id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
d13a52bb-8e99-4f6d-be0d-878926b71c6e | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CMD frame = new CMD();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
7eb5b2f2-c752-493f-83f7-9f3e2917a561 | public void run() {
try {
CMD frame = new CMD();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
} |
1b6eadbc-e582-43e2-a667-5078211881b4 | public CMD() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JScrollPane scrollPane = new JScrollPane();
textField = new JTextField();
textField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
textArea.append(arg0.getActionCommand() + "\n");
textField.setText("");
}
});
textField.setColumns(10);
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(textField, GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
);
textArea = new JTextArea();
textArea.setEditable(false);
textArea.setForeground(Color.WHITE);
textArea.setBackground(Color.BLACK);
textArea.setLineWrap(true);
scrollPane.setViewportView(textArea);
contentPane.setLayout(gl_contentPane);
textArea.append("Type \"help\" for help.\n");
} |
4446b34d-5464-4ad2-a3cb-0f1f0ce8dab5 | public void actionPerformed(ActionEvent arg0) {
textArea.append(arg0.getActionCommand() + "\n");
textField.setText("");
} |
86f7cb23-4327-4b76-8dba-2485060db47a | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Builder.readConfig();
changeLookAndFeel();
Main frame = new Main();
frame.setVisible(true);
}catch(Exception e) {
e.printStackTrace();
}
}
});
} |
675a12d1-4146-4531-8f66-793c84668264 | public void run() {
try {
Builder.readConfig();
changeLookAndFeel();
Main frame = new Main();
frame.setVisible(true);
}catch(Exception e) {
e.printStackTrace();
}
} |
98e99c85-a9d6-4a94-a93c-fb050b651283 | public Main() {
setIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/net/lotusdev/medusa/client/res/keyboard.png")));
setTitle("Medusa Logger (v" + getVersion() + ")");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 488, 317);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnMain = new JMenu("Client");
menuBar.add(mnMain);
JMenuItem mntmSettings = new JMenuItem("Settings");
mntmSettings.setIcon(new ImageIcon(Main.class.getResource("/net/lotusdev/medusa/client/res/cog.png")));
mnMain.add(mntmSettings);
JSeparator separator = new JSeparator();
mnMain.add(separator);
JMenuItem mntmExit = new JMenuItem("Exit");
mntmExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
mntmExit.setIcon(new ImageIcon(Main.class.getResource("/net/lotusdev/medusa/client/res/door_open.png")));
mnMain.add(mntmExit);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 462, Short.MAX_VALUE)
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(tabbedPane)
);
JPanel panel = new JPanel();
tabbedPane.addTab("Email Setup", new ImageIcon(Main.class.getResource("res/page_white_text.png")), panel, null);
JPanel panel_3 = new JPanel();
panel_3.setBorder(new TitledBorder(null, "Email Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GroupLayout gl_panel = new GroupLayout(panel);
gl_panel.setHorizontalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 306, Short.MAX_VALUE)
);
gl_panel.setVerticalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
);
final JSpinner spinner_1 = new JSpinner();
JLabel lblTimeoutminutes = new JLabel("Timeout(minutes):");
final JSpinner spinner = new JSpinner();
JLabel lblSmtpPort = new JLabel("SMTP Port:");
JLabel lblSmtpHost = new JLabel("SMTP Host:");
final JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"smtp.gmail.com"}));
comboBox.setEditable(true);
passwordField = new JPasswordField();
JLabel lblPassword = new JLabel("Password:");
JLabel lblEmail = new JLabel("Email:");
textField = new JTextField();
textField.setColumns(10);
JButton btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Builder.setEmailUser(textField.getText());
Builder.setEmailPass(passwordField.getText());
Builder.setEmailHost(String.valueOf(comboBox.getSelectedItem()));
Builder.setEmailPort(String.valueOf(spinner.getValue()));
Builder.setTimeout((Integer)spinner_1.getValue());
Builder.writeConfig();
}
});
btnSave.setIcon(new ImageIcon(Main.class.getResource("/net/lotusdev/medusa/client/res/accept.png")));
GroupLayout gl_panel_3 = new GroupLayout(panel_3);
gl_panel_3.setHorizontalGroup(
gl_panel_3.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_3.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
.addComponent(btnSave, Alignment.TRAILING)
.addGroup(gl_panel_3.createSequentialGroup()
.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_3.createSequentialGroup()
.addComponent(lblSmtpPort, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
.addGap(10)
.addComponent(spinner, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(lblTimeoutminutes)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(spinner_1, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_3.createSequentialGroup()
.addComponent(lblSmtpHost)
.addGap(10)
.addComponent(comboBox, 0, 209, Short.MAX_VALUE))
.addGroup(gl_panel_3.createSequentialGroup()
.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
.addComponent(lblPassword)
.addComponent(lblEmail))
.addGap(15)
.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
.addComponent(passwordField, GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE))))
.addContainerGap())))
);
gl_panel_3.setVerticalGroup(
gl_panel_3.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_panel_3.createSequentialGroup()
.addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblEmail))
.addGap(6)
.addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
.addComponent(lblPassword)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_3.createSequentialGroup()
.addGap(9)
.addComponent(lblSmtpHost))
.addGroup(gl_panel_3.createSequentialGroup()
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_3.createSequentialGroup()
.addGap(3)
.addComponent(lblSmtpPort))
.addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
.addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(spinner_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblTimeoutminutes)))
.addPreferredGap(ComponentPlacement.RELATED, 72, Short.MAX_VALUE)
.addComponent(btnSave))
);
panel_3.setLayout(gl_panel_3);
panel.setLayout(gl_panel);
JPanel panel_1 = new JPanel();
tabbedPane.addTab("Build Stub", new ImageIcon(Main.class.getResource("res/application_edit.png")), panel_1, null);
JPanel panel_2 = new JPanel();
panel_2.setBorder(new TitledBorder(null, "Output", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GroupLayout gl_panel_1 = new GroupLayout(panel_1);
gl_panel_1.setHorizontalGroup(
gl_panel_1.createParallelGroup(Alignment.LEADING)
.addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 306, Short.MAX_VALUE)
);
gl_panel_1.setVerticalGroup(
gl_panel_1.createParallelGroup(Alignment.LEADING)
.addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
);
JLabel lblLocation = new JLabel("Location:");
JLabel lblName = new JLabel("Name:");
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_3 = new JTextField();
textField_3.setColumns(10);
JButton button = new JButton("...");
JButton btnBuild = new JButton("Build");
btnBuild.setIcon(new ImageIcon(Main.class.getResource("/net/lotusdev/medusa/client/res/application_go.png")));
JButton btnFiles = new JButton("Files");
btnFiles.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
EstimateClasses estClasses = new EstimateClasses();
estClasses.setVisible(true);
}
});
btnFiles.setIcon(new ImageIcon(Main.class.getResource("/net/lotusdev/medusa/client/res/page_white_stack.png")));
GroupLayout gl_panel_2 = new GroupLayout(panel_2);
gl_panel_2.setHorizontalGroup(
gl_panel_2.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_2.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_2.createSequentialGroup()
.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
.addComponent(lblName)
.addComponent(lblLocation))
.addGap(21)
.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_2.createSequentialGroup()
.addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(button))
.addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE))
.addContainerGap())
.addGroup(Alignment.TRAILING, gl_panel_2.createSequentialGroup()
.addComponent(btnFiles)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(btnBuild))))
);
gl_panel_2.setVerticalGroup(
gl_panel_2.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_2.createSequentialGroup()
.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_2.createSequentialGroup()
.addGap(3)
.addComponent(lblName)
.addGap(9)
.addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
.addComponent(lblLocation)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(button)))
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 112, Short.MAX_VALUE)
.addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
.addComponent(btnBuild)
.addComponent(btnFiles)))
);
panel_2.setLayout(gl_panel_2);
panel_1.setLayout(gl_panel_1);
contentPane.setLayout(gl_contentPane);
/**
* Set text of fields after being read drom config file.
*/
textField.setText(Builder.getEmailUser());
passwordField.setText(Builder.getEmailPass());
comboBox.setSelectedItem(String.valueOf(Builder.getEmailHost()));
//spinner.setValue(Integer.parseInt(Builder.getEmailPort()));
spinner_1.setValue((Integer)Builder.getTimeout());
JPanel panel_4 = new JPanel();
tabbedPane.addTab("Stub Settings", null, panel_4, null);
JScrollPane scrollPane = new JScrollPane();
final JPanel panel_5 = new JPanel(new CardLayout());
panel_5.setBorder(new TitledBorder(null, curTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null));
GroupLayout gl_panel_4 = new GroupLayout(panel_4);
gl_panel_4.setHorizontalGroup(
gl_panel_4.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_4.createSequentialGroup()
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 136, GroupLayout.PREFERRED_SIZE)
.addGap(2)
.addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE))
);
gl_panel_4.setVerticalGroup(
gl_panel_4.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 218, GroupLayout.PREFERRED_SIZE)
.addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE))
);
CustomTreeCellNodes.makeTreeIcons();
tree = new JTree();
tree.setShowsRootHandles(false);
tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Settings")));
for (int i = 0; i < CustomTreeCellNodes.getTreeIcons().size(); i++) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)getTreeModel().getRoot();
node.add(new DefaultMutableTreeNode(CustomTreeCellNodes.getTreeIcons().get(i)));
}
expand();
final PanelEmail p_email = new PanelEmail();
final PanelTimeout p_timeout = new PanelTimeout();
tree.setCellRenderer(new CustomTreeCellRenderer());
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent arg0) {
try {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)arg0.getNewLeadSelectionPath().getLastPathComponent();
if (node != null) {
curTitle = node.toString();
panel_5.setBorder(new TitledBorder(null, curTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null));
if(node.toString().equals("Email")) {
panel_5.add(p_email);
panel_5.remove(p_timeout);
}else if(node.toString().equals("Timeout")) {
panel_5.add(p_timeout);
panel_5.remove(p_email);
}
System.out.println(node.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
scrollPane.setViewportView(tree);
panel_4.setLayout(gl_panel_4);
} |
422f717e-8000-4404-a02b-1e796a4a2225 | public void actionPerformed(ActionEvent arg0) {
System.exit(0);
} |
a76592de-e15c-4c5d-b967-396a009f1e9b | public void actionPerformed(ActionEvent arg0) {
Builder.setEmailUser(textField.getText());
Builder.setEmailPass(passwordField.getText());
Builder.setEmailHost(String.valueOf(comboBox.getSelectedItem()));
Builder.setEmailPort(String.valueOf(spinner.getValue()));
Builder.setTimeout((Integer)spinner_1.getValue());
Builder.writeConfig();
} |
a53b0f47-ceff-4bba-9bc8-742d35738d77 | public void actionPerformed(ActionEvent arg0) {
EstimateClasses estClasses = new EstimateClasses();
estClasses.setVisible(true);
} |
0ae3cfe4-1aab-4043-bca4-6ca338242c9d | public void valueChanged(TreeSelectionEvent arg0) {
try {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)arg0.getNewLeadSelectionPath().getLastPathComponent();
if (node != null) {
curTitle = node.toString();
panel_5.setBorder(new TitledBorder(null, curTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null));
if(node.toString().equals("Email")) {
panel_5.add(p_email);
panel_5.remove(p_timeout);
}else if(node.toString().equals("Timeout")) {
panel_5.add(p_timeout);
panel_5.remove(p_email);
}
System.out.println(node.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
}
} |
d405aece-9698-4a8b-9aed-a8481fbc1707 | public static void changeLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception e) {
}
} |
1d0cd3a2-a3d9-475f-ac72-a4e34d3d6587 | public void expand() {
tree.expandRow(0);
} |
8cda2562-5a07-4750-bfa2-7e67388ec80f | public static String getVersion() {
return "0.8_5";
} |
a62f0c6d-6715-4db2-b7d8-e0619e5655a2 | public DefaultTreeModel getTreeModel() {
return (DefaultTreeModel)tree.getModel();
} |
949fe2dc-91be-4e01-a822-d55bf1c5e562 | public static void makeConfig() {
try {
if(!curDir.exists()) {
curDir.createNewFile();
}else {
}
}catch(IOException e) {
e.printStackTrace();
}
} |
705fde73-1d01-4199-8402-e715264efc49 | public static File getConfig() {
return curDir;
} |
0b5bdf75-f265-4cce-aa07-4aba7e6d7197 | public static void writeConfig() {
try {
/**
* Writes user set data to config file.
*/
if(curDir.exists()) {
BufferedWriter out = new BufferedWriter(new FileWriter(curDir));
out.write("#DO NOT MODIFY THIS FILE.");
out.write("\r\neUser:" + getEmailUser());
out.write("\r\nePass:" + getEmailPass());
out.write("\r\neHost:" + getEmailHost());
out.write("\r\nePort:" + getEmailPort());
out.write("\r\ntimeout:" + getTimeout());
out.close();
System.out.println(getEmailUser() + " | " + getEmailPass() + " | " + getEmailHost() + " | " + getEmailPort() + " | " + getTimeout());
}else {
curDir.createNewFile();
}
}catch(Exception e) {
}
} |
ae1e082b-b1a0-4f38-9974-16a081cc87ba | public static void readConfig() {
try {
if(curDir.exists()) {
BufferedReader in = new BufferedReader(new FileReader(curDir));
String inLine;
for(; (inLine = in.readLine()) != null;) {
String[] parseVar = inLine.split(":");
if(parseVar[0].startsWith("eUser"))
setEmailUser(parseVar[1]);
else if(parseVar[0].startsWith("ePass"))
setEmailPass(parseVar[1]);
else if(parseVar[0].startsWith("eHost"))
setEmailHost(parseVar[1]);
else if(parseVar[0].startsWith("ePort"))
setEmailPort(parseVar[1]);
else if(parseVar[0].startsWith("timeout"))
setTimeout(Integer.parseInt(parseVar[1]));
System.out.println(getEmailUser() + " | " + getEmailPass() + " | " + getEmailHost() + " | " + getEmailPort() + " | " + getTimeout());
}
in.close();
}else {
curDir.createNewFile();
}
}catch(Exception e) {
}
} |
84017f22-4a0e-4d22-b298-1114534ff098 | public static void build() {
try {
File temp = File.createTempFile("l_stb_tmp", ".jar");
JarFile jarFile = new JarFile("stub.jar");
Enumeration j = jarFile.entries();
while(j.hasMoreElements())
process(j.nextElement());
JarEntry entry = jarFile.getJarEntry("config.dat");
InputStream input = jarFile.getInputStream(entry);
process1(input);
System.out.println(curDir);
}catch(Exception e) {
}
} |
953ed2e0-5a7b-4e0d-bc20-6a63e41bd5af | public static void getEstimateClasses() {
try {
JarFile jarFile = new JarFile("stub.jar");
Enumeration j = jarFile.entries();
while(j.hasMoreElements())
process(j.nextElement());
JarEntry entry = jarFile.getJarEntry("config.dat");
InputStream input = jarFile.getInputStream(entry);
process1(input);
}catch(Exception e) {
}
} |
e22bea76-755c-492c-bd57-fc4b9009675e | public static void process(Object obj) {
JarEntry entry = (JarEntry)obj;
String name = entry.getName();
long size = entry.getSize();
long compressedSize = entry.getCompressedSize();
System.out.println(name + "\t" + size + "\t" + compressedSize);
getClasses.add(name);
} |
3b562636-e89c-4f2c-9b97-228c6c792bc5 | private static void process1(InputStream input) {
try {
InputStreamReader isr = new InputStreamReader(input);
BufferedReader reader = new BufferedReader(isr);
String line;
while ((line = reader.readLine()) != null)
System.out.println(line);
reader.close();
}catch(Exception e) {
}
} |
90760446-ab2f-46f0-a5c0-0d035ad3b646 | public static void setEmailUser(String eUser) {
Builder.eUser = eUser;
} |
09197437-f6c6-49e3-899f-63a0db7bb08c | public static void setEmailPass(String ePass) {
Builder.ePass = ePass;
} |
98e1676f-9755-4436-b5ab-14c538173b92 | public static void setEmailHost(String eHost) {
Builder.eHost = eHost;
} |
5b19811c-8e64-4eaa-b4ab-d101a384da04 | public static void setEmailPort(String ePort) {
Builder.ePort = ePort;
} |
956f8af9-f516-4651-b38d-c106408e2a2c | public static void setTimeout(int timeout) {
/**
* Set the timeout to a int and multiply by 60 to get minute value.
*/
Builder.timeout = timeout;
} |
2684cd43-3e4a-4190-8270-f76ed5f34dc9 | public static String getEmailUser() {
return eUser;
} |
20493ae4-a2f2-4c59-8ccc-3d28e2c54620 | public static String getEmailPass() {
return ePass;
} |
b01295d4-9536-4b79-9070-06004e88a161 | public static String getEmailHost() {
return eHost;
} |
7ab50bfe-5d50-471f-a64a-4907f139bb87 | public static String getEmailPort() {
return ePort;
} |
bb5589d9-7067-4011-ab15-25ac5b773e37 | public static int getTimeout() {
return timeout;
} |
d9dc290c-d493-4044-9c96-21869b804ee1 | public static ImageIcon getIcon(String name) {
return new ImageIcon(Main.class.getResource("/net/lotusdev/medusa/client/res/" + name + ".png"));
} |
84d61044-1623-4111-93e1-f78d0d8cf615 | public PanelEmail() {
JLabel lblHello = new JLabel("Email:");
textField = new JTextField();
textField.setColumns(10);
JLabel lblPassword = new JLabel("Password:");
textField_1 = new JTextField();
textField_1.setColumns(10);
JLabel lblSmtpHost = new JLabel("SMTP Host:");
lblSmtpHost.setToolTipText("You can find out what your SMTP host address is from your email provider.");
JComboBox comboBox = new JComboBox();
comboBox.setEditable(true);
comboBox.setModel(new DefaultComboBoxModel(new String[] {"smtp.gmail.com"}));
JLabel lblPort = new JLabel("Port:");
lblPort.setToolTipText("You can find out what your SMTP port is from your email provider.");
JSpinner spinner = new JSpinner();
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(lblHello)
.addComponent(lblPassword))
.addGap(23)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(textField, GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addComponent(textField_1, GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(lblSmtpHost)
.addGap(18)
.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(lblPort)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(spinner, GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)))
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblHello)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblPassword)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblSmtpHost)
.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblPort))
.addContainerGap(121, Short.MAX_VALUE))
);
setLayout(groupLayout);
} |
8eff3c9d-086a-4a1f-b011-dbfa976f6fd5 | public PanelTimeout() {
final JLabel lblTimeout = new JLabel("Timeout:");
final JSpinner spinner = new JSpinner();
final JLabel lblminutes = new JLabel("(minutes)");
final JLabel lblTime = new JLabel("Hour:");
final JSpinner spinner_1 = new JSpinner();
final JComboBox comboBox = new JComboBox();
final JLabel lblsystemThatStub = new JLabel("(system time that server is on)");
lblTime.setEnabled(false);
spinner_1.setEnabled(false);
comboBox.setEnabled(false);
JRadioButton rdbtnMinuteDelay = new JRadioButton("Minute schedule");
rdbtnMinuteDelay.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
lblTime.setEnabled(false);
spinner_1.setEnabled(false);
comboBox.setEnabled(false);
lblsystemThatStub.setEnabled(false);
lblTimeout.setEnabled(true);
lblminutes.setEnabled(true);
spinner.setEnabled(true);
}
});
rdbtnMinuteDelay.setSelected(true);
JRadioButton rdbtnTimelySchedule = new JRadioButton("Time schedule");
rdbtnTimelySchedule.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
lblTimeout.setEnabled(false);
lblminutes.setEnabled(false);
spinner.setEnabled(false);
lblTime.setEnabled(true);
spinner_1.setEnabled(true);
comboBox.setEnabled(true);
lblsystemThatStub.setEnabled(true);
}
});
ButtonGroup group = new ButtonGroup();
group.add(rdbtnMinuteDelay);
group.add(rdbtnTimelySchedule);
JSeparator separator = new JSeparator();
separator.setOrientation(SwingConstants.VERTICAL);
comboBox.setModel(new DefaultComboBoxModel(new String[] {"AM", "PM"}));
lblsystemThatStub.setEnabled(false);
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(rdbtnMinuteDelay)
.addComponent(rdbtnTimelySchedule, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
.addComponent(separator, GroupLayout.PREFERRED_SIZE, 2, GroupLayout.PREFERRED_SIZE)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(lblTimeout)
.addComponent(lblTime))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(spinner_1)
.addComponent(spinner, GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblminutes, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(groupLayout.createSequentialGroup()
.addGap(18)
.addComponent(lblsystemThatStub)))
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblminutes)
.addComponent(lblTimeout)
.addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(rdbtnMinuteDelay))
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(48)
.addComponent(rdbtnTimelySchedule))
.addGroup(groupLayout.createSequentialGroup()
.addGap(51)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblTime)
.addComponent(spinner_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(lblsystemThatStub))
.addComponent(separator, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE))
.addContainerGap())
);
setLayout(groupLayout);
} |
a75200ea-c189-413f-b544-54879cc3d4da | public void actionPerformed(ActionEvent e) {
lblTime.setEnabled(false);
spinner_1.setEnabled(false);
comboBox.setEnabled(false);
lblsystemThatStub.setEnabled(false);
lblTimeout.setEnabled(true);
lblminutes.setEnabled(true);
spinner.setEnabled(true);
} |
77d78186-1c89-4f06-bb66-ffed6a3e19dc | public void actionPerformed(ActionEvent arg0) {
lblTimeout.setEnabled(false);
lblminutes.setEnabled(false);
spinner.setEnabled(false);
lblTime.setEnabled(true);
spinner_1.setEnabled(true);
comboBox.setEnabled(true);
lblsystemThatStub.setEnabled(true);
} |
75dc973a-6574-4d2b-ae62-66f3f4b53272 | public SubElementIterator(List list, Method getMethod){
this.list = list;
this.getMethod = getMethod;
} |
7d1dcace-7e9c-432d-9c2e-30fa6ae7ad15 | @Override
public boolean hasNext() {
return index < (list.size() - 1);
} |
9b6dc155-f5ab-4fd8-96d7-7a06c2bb12e5 | @Override
public E next() {
if (!hasNext()) {
throw new IndexOutOfBoundsException();
}
Object o = list.get(++index);
try {
return (E) getMethod.invoke(o);
} catch (IllegalAccessException e) {
LOGGER.error(ERROR_CANNOT_ACCESS_INVOKE + getMethod.getName(), e);
} catch (InvocationTargetException e) {
LOGGER.error(ERROR_CANNOT_CALL_INVOKE + getMethod.getName(), e);
}
return null;
} |
ab9b9c84-008b-4913-92f7-5fdcd2e91770 | @Override
public void remove() {
list.remove(index);
} |
4158ec84-8032-4a76-8354-95460ab18f4c | public SubElementList(List list, Method getMethod){
this.list = list;
this.getMethod = getMethod;
} |
aae9750f-ba37-4fa7-ae64-ca61f4f113a8 | @Override
public int size() {
return list.size();
} |
7d89eb33-3b7f-456e-9882-231b0263660f | @Override
public boolean isEmpty() {
return list.isEmpty();
} |
46156a6a-8aff-4f86-90cc-c9e2aa90cf8d | @Override
public boolean contains(Object o) {
return indexOf(o) >= 0;
} |
993f456e-3e12-494c-ab77-cc4e89742417 | @Override
public Iterator<E> iterator() {
return new SubElementIterator<E>(list, getMethod);
} |
e09fafad-d57b-40c7-9b10-eb1c906d35f5 | @Override
public Object[] toArray() {
throw new UnsupportedOperationException("Use toArray(T[] a) instead!");
} |
b0041c25-a069-4e05-946f-a4613bb4af89 | @Override
public <T> T[] toArray(T[] a) {
for(int i = 0; i < list.size(); i++){
a[i] = (T) get(i);
}
return a;
} |
2b30fb56-84d8-4651-8ecb-54a3226a671b | @Override
public boolean add(E e) {
throw new UnsupportedOperationException(ONLY_READ_AND_DELETE);
} |
24960d9e-69e7-4341-97a0-587594624f31 | @Override
public boolean remove(Object o) {
int i = indexOf(o);
if(i != -1) {
return list.remove(i) != null;
} else {
return false;
}
} |
a23bd494-99c2-41be-b07c-bc6232741ffb | @Override
public boolean containsAll(Collection<?> c) {
boolean hasContainedAll = true;
for(Object o : c){
if(!contains(o)){
hasContainedAll = false;
}
}
return hasContainedAll;
} |
964707b3-eba9-418e-a1b0-6f4ba56d80cc | @Override
public boolean addAll(Collection<? extends E> c) {
throw new UnsupportedOperationException(ONLY_READ_AND_DELETE);
} |
62f3748e-d438-467b-8952-b02be8ae201f | @Override
public boolean addAll(int index, Collection<? extends E> c) {
throw new UnsupportedOperationException(ONLY_READ_AND_DELETE);
} |
ae21209e-f5cb-4c62-a4e4-789270081b64 | @Override
public boolean removeAll(Collection<?> c) {
boolean hasRemovedAll = true;
for(Object o : c){
if(!remove(o)){
hasRemovedAll = false;
}
}
return hasRemovedAll;
} |
0de2d899-86f4-4423-9d1b-314f7347ffeb | @Override
public boolean retainAll(Collection<?> c) {
boolean hasChanged = false;
for(Object o : c){
if(contains(o)){
remove(o);
hasChanged = true;
}
}
return hasChanged;
} |
d04c78fa-64af-4dbc-90da-11dd1ae0d028 | @Override
public void clear() {
list.clear();
} |
196a4705-fdd3-4e4a-aced-59e9d5bb7f1e | @Generated("method")
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof List))
return false;
Iterator<E> e1 = iterator();
Iterator e2 = ((List) o).iterator();
while(e1.hasNext() && e2.hasNext()) {
E o1 = e1.next();
Object o2 = e2.next();
if (!(o1==null ? o2==null : o1.equals(o2)))
return false;
}
return !(e1.hasNext() || e2.hasNext());
} |
02f185cf-e1c3-47cd-b1f2-d102cf08a5ec | @Generated("method")
@Override
public int hashCode() {
int hashCode = 1;
Iterator<E> i = iterator();
while (i.hasNext()) {
E obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
return hashCode;
} |
02849f2c-a720-4bc8-803f-6a77e12ee582 | @Override
public E get(int index) {
Object o = list.get(index);
return getInvoke(o);
} |
b818ac3b-f859-4aaa-a0bc-581386316a7b | @Override
public E set(int index, E element) {
throw new UnsupportedOperationException(ONLY_READ_AND_DELETE);
} |
2036b9e6-b6f5-47a5-a8a4-21573ba75f72 | @Override
public void add(int index, E element) {
throw new UnsupportedOperationException(ONLY_READ_AND_DELETE);
} |
4becb176-7757-4fbb-97b3-ff8823d1bdb3 | @Override
public E remove(int index) {
Object o = list.get(index);
E element = getInvoke(o);
list.remove(index);
return element;
} |
1fca4e17-4ac5-440f-a118-fa60a1368a01 | private E getInvoke(Object o) {
try {
return (E) getMethod.invoke(o);
} catch (IllegalAccessException e) {
LOGGER.error(ERROR_CANNOT_ACCESS_INVOKE + getMethod.getName(), e);
} catch (InvocationTargetException e) {
LOGGER.error(ERROR_CANNOT_CALL_INVOKE + getMethod.getName(), e);
}
return null;
} |
c3407707-077b-44ea-9c48-4349b2955f7c | @Override
public int indexOf(Object o) {
if (o == null) {
for (int i = 0; i < list.size(); i++) {
Object current = list.get(i);
if (getInvoke(current) == null){
return i;
}
}
} else {
for (int i = 0; i < list.size(); i++) {
Object current = list.get(i);
if (o.equals(getInvoke(current))){
return i;
}
}
}
return -1;
} |
673e9cee-76e0-471b-ae8a-ef65986ef684 | @Override
public int lastIndexOf(Object o) {
if (o == null) {
for (int i = list.size()-1; i >= 0; i--){
Object current = list.get(i);
if (getInvoke(current)==null){
return i;
}
}
} else {
for (int i = list.size()-1; i >= 0; i--){
Object current = list.get(i);
if (o.equals(getInvoke(current))){
return i;
}
}
}
return -1;
} |
2e39c585-f9b2-4ff7-bf88-de244a55dfd9 | @Override
public ListIterator<E> listIterator() {
throw new UnsupportedOperationException(ONLY_ITERATOR);
} |
8e59933d-576b-411d-ab88-8a9d9425c4d1 | @Override
public ListIterator<E> listIterator(int index) {
throw new UnsupportedOperationException(ONLY_ITERATOR);
} |
b41c14e1-142b-432a-b5aa-6f4b351abca8 | @Override
public List<E> subList(int fromIndex, int toIndex) {
return new SubElementList<E>(list.subList(fromIndex, toIndex), getMethod);
} |
a7503cc9-81f1-45df-abb8-088058238b7a | public <T> List<T> getParentList(){
return (ArrayList<T>) new ArrayList<T>(list);
} |
ae76669a-fcc5-4fb7-90c9-1dbceaea8954 | @Override
public SubElementList<E> clone(){
try {
super.clone();
} catch (CloneNotSupportedException e) {
LOGGER.error(COULDN_T_CLONE_SUB_ELEMENT_LIST, e);
}
return new SubElementList<E>((ArrayList) new ArrayList(list).clone(), getMethod);
} |
7364e3ca-6e61-4d15-a0e6-2568f8dc2688 | @Test
public void testTitleIteration() throws Exception {
SubElementIterator<String> subElementIterator = getTitleSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT; i++) {
Assert.assertTrue(subElementIterator.hasNext());
String title = subElementIterator.next();
Assert.assertEquals(title, getTitle(i));
}
} |
4423b3e2-6a9c-472f-805d-197e14cdefd9 | @Test
public void testAuthorIteration() throws Exception {
SubElementIterator<String> subElementIterator = getAuthorSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT; i++) {
Assert.assertTrue(subElementIterator.hasNext());
String author = subElementIterator.next();
Assert.assertEquals(author, getAuthor(i));
}
} |
677bdf01-b3ab-40cf-b6d1-b76e8807abb4 | @Test
public void testContentIteration() throws Exception {
SubElementIterator<String> subElementIterator = getContentSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT; i++) {
Assert.assertTrue(subElementIterator.hasNext());
String content = subElementIterator.next();
Assert.assertEquals(content, getContent(i));
}
} |
8aace33f-5994-4325-8dd7-345dc619de32 | @Test
public void testPagesIteration() throws Exception {
SubElementIterator<Integer> subElementIterator = getPagesSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT; i++) {
Assert.assertTrue(subElementIterator.hasNext());
int pages = subElementIterator.next();
Assert.assertEquals(pages, getPages(i));
}
} |
d2f62f1b-c98f-4c4e-9656-ecf95c88adae | @Test
public void testDateIteration() throws Exception {
SubElementIterator<Date> subElementIterator = getPublicationSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT; i++) {
Assert.assertTrue(subElementIterator.hasNext());
Date publication = subElementIterator.next();
Assert.assertEquals(publication, getPublication(i));
}
} |
60a35a06-2a01-402c-a712-f2a73153629f | @Test
public void testTitleRemove() throws Exception {
SubElementIterator<String> subElementIterator = getTitleSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 2; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
subElementIterator.remove();
}
} |
e3b43d2d-492b-4ec7-8d6e-61b421e4a91f | @Test
public void testAuthorRemove() throws Exception {
SubElementIterator<String> subElementIterator = getAuthorSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 2; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
subElementIterator.remove();
}
Assert.assertFalse(subElementIterator.hasNext());
} |
091d65e6-09cc-462d-b946-0d90fecd601b | @Test
public void testContentRemove() throws Exception {
SubElementIterator<String> subElementIterator = getContentSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 2; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
subElementIterator.remove();
}
Assert.assertFalse(subElementIterator.hasNext());
} |
358029de-4017-4ed8-8b97-b5ca20aa4474 | @Test
public void testPagesRemove() throws Exception {
SubElementIterator<Integer> subElementIterator = getPagesSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 2; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
subElementIterator.remove();
}
Assert.assertFalse(subElementIterator.hasNext());
} |
5a941fc2-8563-4220-b517-c307291788a5 | @Test
public void testDateRemove() throws Exception {
SubElementIterator<Date> subElementIterator = getPublicationSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 2; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
subElementIterator.remove();
}
Assert.assertFalse(subElementIterator.hasNext());
} |
5da31eed-e2a0-4fed-905e-95c78f63a101 | @Test
public void testTitleRemoveEverySecond() throws Exception {
SubElementIterator<String> subElementIterator = getTitleSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 3; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.remove();
}
Assert.assertTrue(subElementIterator.hasNext());
} |
62ecb62c-ff4b-4072-90c1-4939a1a43b92 | @Test
public void testAuthorRemoveEverySecond() throws Exception {
SubElementIterator<String> subElementIterator = getAuthorSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 3; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.remove();
}
Assert.assertTrue(subElementIterator.hasNext());
} |
afa195f5-47ec-4bca-b49e-ed5c54d064a3 | @Test
public void testContentRemoveEverySecond() throws Exception {
SubElementIterator<String> subElementIterator = getContentSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 3; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.remove();
}
Assert.assertTrue(subElementIterator.hasNext());
} |
2492e64a-7330-4e62-975a-43c20ad80af2 | @Test
public void testDateRemoveEverySecond() throws Exception {
SubElementIterator<Date> subElementIterator = getPublicationSubElementIterator();
for (int i = 0; i < TESTBOOK_COUNT / 3; i++) {
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.next();
Assert.assertTrue(subElementIterator.hasNext());
subElementIterator.remove();
}
Assert.assertTrue(subElementIterator.hasNext());
} |
2e677af5-017d-4223-ad5c-9a1538c2a747 | @Test(expectedExceptions = IndexOutOfBoundsException.class)
public void testTitleNoNextException() throws Exception {
testNextException(getTitleSubElementIterator());
} |
6bb815e9-8a5d-40ce-8421-4b3676aaf1bc | @Test(expectedExceptions = IndexOutOfBoundsException.class)
public void testAuthorNoNextException() throws Exception {
testNextException(getAuthorSubElementIterator());
} |
103ec574-1bbb-42e5-9365-dce05adc54b8 | @Test(expectedExceptions = IndexOutOfBoundsException.class)
public void testContentNoNextException() throws Exception {
testNextException(getContentSubElementIterator());
} |
3bca8fe2-a0b5-4640-b57e-19403a3394ec | @Test(expectedExceptions = IndexOutOfBoundsException.class)
public void testPagesNoNextException() throws Exception {
testNextException(getPagesSubElementIterator());
} |
2a216968-9317-482b-92e7-918f2056a7bf | @Test(expectedExceptions = IndexOutOfBoundsException.class)
public void testPublicationNoNextException() throws Exception {
testNextException(getPublicationSubElementIterator());
} |
faf11850-0023-47c0-a4b1-0fc5e8f939e1 | private void testNextException(SubElementIterator subElementIterator) throws IndexOutOfBoundsException {
for (int i = 0; i < TESTBOOK_COUNT; i++) {
subElementIterator.next();
}
subElementIterator.next();
} |
be040866-fa2d-44f7-ad3f-6717dd89efe0 | private SubElementIterator<String> getTitleSubElementIterator() throws NoSuchMethodException {
return new SubElementIterator<String>(testBooks, TestBook.class.getMethod("getTitle"));
} |
0752febb-62af-48bf-9cd4-9ca6c9e59f95 | private SubElementIterator<String> getAuthorSubElementIterator() throws NoSuchMethodException {
return new SubElementIterator<String>(testBooks, TestBook.class.getMethod("getAuthor"));
} |
531e42a8-b4f2-4d1b-809f-75f454f84284 | private SubElementIterator<String> getContentSubElementIterator() throws NoSuchMethodException {
return new SubElementIterator<String>(testBooks, TestBook.class.getMethod("getContent"));
} |
a51a3715-fc7c-4e63-8d78-b1aa4d8ceb03 | private SubElementIterator<Integer> getPagesSubElementIterator() throws NoSuchMethodException {
return new SubElementIterator<Integer>(testBooks, TestBook.class.getMethod("getPages"));
} |
b3e908d9-ca87-4c01-8606-4f759af9d440 | private SubElementIterator<Date> getPublicationSubElementIterator() throws NoSuchMethodException {
return new SubElementIterator<Date>(testBooks, TestBook.class.getMethod("getPublication"));
} |
c2d14aa2-44c0-40e4-9758-8c8a4415de6f | @BeforeMethod
public void generateTestData() throws ParseException {
testBooks = new ArrayList<TestBook>();
dates = new ArrayList<Date>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd");
for (int i = 0; i < TESTBOOK_COUNT; i++) {
dates.add(simpleDateFormat.parse("2013-" + i % 13 + "-" + i % 29));
TestBook testBook = new TestBook(getTitle(i), getAuthor(i), getContent(i), getPages(i), getPublication(i));
testBooks.add(testBook);
}
} |
52e92190-99c3-4f71-a4f8-d80b41f4e240 | protected String getTitle(int i) {
return "Title" + i;
} |
d3382f49-0ed3-44cf-8432-a9c0d069e508 | protected String getAuthor(int i) {
return "Author" + i;
} |
7b75e881-18c6-43b5-92f3-f7a410094551 | protected String getContent(int i) {
return "Content" + i;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.