improvements
This commit is contained in:
@@ -353,7 +353,7 @@ public class TestingList extends Panel {
|
||||
jTable1 = new javax.swing.JTable();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jButtonRun = new javax.swing.JButton();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanelButtons = new javax.swing.JPanel();
|
||||
jButtonOptions = new javax.swing.JButton();
|
||||
jButtonSave = new javax.swing.JButton();
|
||||
jButtonOpen = new javax.swing.JButton();
|
||||
@@ -532,9 +532,9 @@ public class TestingList extends Panel {
|
||||
});
|
||||
jPanel1.add(jButtonRun, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setMinimumSize(new java.awt.Dimension(0, 80));
|
||||
jPanel3.setPreferredSize(new java.awt.Dimension(100, 80));
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
jPanelButtons.setMinimumSize(new java.awt.Dimension(0, 80));
|
||||
jPanelButtons.setPreferredSize(new java.awt.Dimension(100, 80));
|
||||
jPanelButtons.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jButtonOptions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/settings-32px.png"))); // NOI18N
|
||||
jButtonOptions.setMaximumSize(new java.awt.Dimension(60, 40));
|
||||
@@ -545,7 +545,7 @@ public class TestingList extends Panel {
|
||||
jButtonOptionsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(jButtonOptions, java.awt.BorderLayout.LINE_START);
|
||||
jPanelButtons.add(jButtonOptions, java.awt.BorderLayout.LINE_START);
|
||||
|
||||
jButtonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/android-save-24-000000.png"))); // NOI18N
|
||||
jButtonSave.setToolTipText("Save current configuration");
|
||||
@@ -557,7 +557,7 @@ public class TestingList extends Panel {
|
||||
jButtonSaveActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(jButtonSave, java.awt.BorderLayout.LINE_END);
|
||||
jPanelButtons.add(jButtonSave, java.awt.BorderLayout.LINE_END);
|
||||
|
||||
jButtonOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/folder-open-24-000000.png"))); // NOI18N
|
||||
jButtonOpen.setToolTipText("Open configuration");
|
||||
@@ -568,9 +568,9 @@ public class TestingList extends Panel {
|
||||
jButtonOpenActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(jButtonOpen, java.awt.BorderLayout.PAGE_END);
|
||||
jPanelButtons.add(jButtonOpen, java.awt.BorderLayout.PAGE_END);
|
||||
|
||||
jPanel1.add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
jPanel1.add(jPanelButtons, java.awt.BorderLayout.EAST);
|
||||
|
||||
jPanel2.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
@@ -614,7 +614,7 @@ public class TestingList extends Panel {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jButtonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRunActionPerformed
|
||||
if (this.jButtonRun.getToolTipText().equals("Run selected tests")) {
|
||||
if (this.jButtonRun.getToolTipText().equals("Run enabled tests")) {
|
||||
setButtonToStart();
|
||||
updateStatus();
|
||||
executeTests();
|
||||
@@ -623,9 +623,12 @@ public class TestingList extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_jButtonRunActionPerformed
|
||||
|
||||
/**
|
||||
* reaction to Stop
|
||||
*/
|
||||
private void setButtonToStop() {
|
||||
abort();
|
||||
this.jButtonRun.setToolTipText("Run selected tests");
|
||||
this.jButtonRun.setToolTipText("Run enabled tests");
|
||||
jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/play-circled-64-000000.png")));
|
||||
this.jTable1.setEnabled(true);
|
||||
this.jButtonOpen.setEnabled(true);
|
||||
@@ -633,6 +636,9 @@ public class TestingList extends Panel {
|
||||
this.jButtonSave.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* reaction to Start
|
||||
*/
|
||||
private void setButtonToStart() {
|
||||
this.jButtonRun.setToolTipText("Stop tests");
|
||||
jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stop-circled-64-000000.png")));
|
||||
@@ -863,7 +869,7 @@ public class TestingList extends Panel {
|
||||
private javax.swing.JMenu jMenuSelect;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanelButtons;
|
||||
private javax.swing.JPopupMenu jPopupMenuConfigs;
|
||||
private javax.swing.JPopupMenu jPopupMenuOptions;
|
||||
private javax.swing.JPopupMenu jPopupMenuTable;
|
||||
@@ -903,15 +909,11 @@ public class TestingList extends Panel {
|
||||
|
||||
public void openNewTestEditor(String type){
|
||||
try {
|
||||
// NewTest nt = new NewTest();
|
||||
// nt.setVisible(true);
|
||||
JDialog dlg = new JDialog(getView(), "New Test", true);
|
||||
//create a class to visualise the details panel
|
||||
Class testingListDetailsClass = getController().getClassByName("NewTest");
|
||||
JPanel detailsPanel = (JPanel) testingListDetailsClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{type});
|
||||
|
||||
JPanel detailsPanel = (JPanel) testingListDetailsClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{type});
|
||||
dlg.getContentPane().add(detailsPanel);
|
||||
//dlg.add(new TestingListDetails());
|
||||
dlg.pack();
|
||||
dlg.setVisible(true);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
@@ -929,7 +931,6 @@ public class TestingList extends Panel {
|
||||
} catch (InvocationTargetException ex) {
|
||||
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1659,12 +1660,12 @@ public class TestingList extends Panel {
|
||||
int iCounter = 0;
|
||||
//search devices and their tests
|
||||
//Scan the list of devices
|
||||
File[] listOfFiles = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles();
|
||||
for (File listOfFile : listOfFiles) {
|
||||
File[] listOfDevices = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles();
|
||||
for (File deviceInList : listOfDevices) {
|
||||
propDevice.clear();
|
||||
if (listOfFile.isFile()) {
|
||||
} else if (listOfFile.isDirectory()) {
|
||||
File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME));
|
||||
if (deviceInList.isFile()) {
|
||||
} else if (deviceInList.isDirectory()) {
|
||||
File configFile = new File(deviceInList.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream is = new FileInputStream(configFile);
|
||||
propDevice.load(is);
|
||||
@@ -1673,10 +1674,10 @@ public class TestingList extends Panel {
|
||||
testsFolder = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), propDevice.getProperty("tests")).toFile();
|
||||
if (testsFolder.exists() && testsFolder.isDirectory()) {
|
||||
File[] listOfTests = testsFolder.listFiles();
|
||||
for (File listOfTest : listOfTests) {
|
||||
for (File testinList : listOfTests) {
|
||||
propTest.clear();
|
||||
if (listOfTest.isDirectory()) {
|
||||
configFile = new File(listOfTest.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME));
|
||||
if (testinList.isDirectory()) {
|
||||
configFile = new File(testinList.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream ist = new FileInputStream(configFile);
|
||||
propTest.load(ist);
|
||||
@@ -1700,7 +1701,7 @@ public class TestingList extends Panel {
|
||||
}
|
||||
|
||||
/**
|
||||
* scan tests table and see if tests in the table still exist in directory.
|
||||
* scan tests table and see if tests/devices in the table still exist in directory.
|
||||
* Remove from table the tests whose files do not exist in directories.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
@@ -1716,15 +1717,14 @@ public class TestingList extends Panel {
|
||||
int iCounter = 0;
|
||||
//search devices and their tests
|
||||
//Scan the list of devices
|
||||
File[] listOfFiles = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles();
|
||||
//first, collect all tests from files
|
||||
File[] listOfDevices = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles();
|
||||
//collect all tests from files
|
||||
List<List> testsInDir = new ArrayList<List>();
|
||||
List<String> testDetails = new ArrayList<String>();
|
||||
for (File listOfFile : listOfFiles) {
|
||||
for (File deviceInList : listOfDevices) {
|
||||
propDevice.clear();
|
||||
if (listOfFile.isFile()) {
|
||||
} else if (listOfFile.isDirectory()) {
|
||||
File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME));
|
||||
if (deviceInList.isDirectory()) {
|
||||
File configFile = new File(deviceInList.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream is = new FileInputStream(configFile);
|
||||
propDevice.load(is);
|
||||
@@ -1733,10 +1733,10 @@ public class TestingList extends Panel {
|
||||
testsFolder = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), propDevice.getProperty("tests")).toFile();
|
||||
if (testsFolder.exists() && testsFolder.isDirectory()) {
|
||||
File[] listOfTests = testsFolder.listFiles();
|
||||
for (File listOfTest : listOfTests) {
|
||||
for (File testinList : listOfTests) {
|
||||
propTest.clear();
|
||||
if (listOfTest.isDirectory()) {
|
||||
configFile = new File(listOfTest.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME));
|
||||
if (testinList.isDirectory()) {
|
||||
configFile = new File(testinList.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME));
|
||||
if (configFile.exists() && !configFile.isDirectory()) {
|
||||
InputStream ist = new FileInputStream(configFile);
|
||||
propTest.load(ist);
|
||||
@@ -1766,26 +1766,30 @@ public class TestingList extends Panel {
|
||||
//loop among the tests in the table
|
||||
for (row = 0; row < totalRows; row++) {
|
||||
bTestAlreadyInTable = false;
|
||||
//deviceNameTable = model.getValueAt(row, COL.DEVICENAME.ordinal()).toString();
|
||||
deviceNameTable = model.getValueAt(row, COL.DEVICENAME.ordinal()).toString();
|
||||
//testSuiteTable = model.getValueAt(row, COL.TESTSUITE.ordinal()).toString();
|
||||
//testNameTable = model.getValueAt(row, COL.TESTNAME.ordinal()).toString();
|
||||
testPathTable = model.getValueAt(row, COL.TESTPATH.ordinal()).toString();
|
||||
//loop to compare current test in table with all tests in directory
|
||||
for (int i = 0; i < testsInDir.size(); i++) {
|
||||
deviceNameDir = testsInDir.get(i).get(0).toString();
|
||||
testSuiteDir = testsInDir.get(i).get(1).toString();
|
||||
testNameDir = testsInDir.get(i).get(2).toString();
|
||||
testPathDir = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), testSuiteDir, testNameDir, testNameDir + ".py").toString();
|
||||
bTestAlreadyInTable = (testPathDir.equals(testPathTable));
|
||||
testSuiteDir = testsInDir.get(i).get(1).toString();
|
||||
testNameDir = testsInDir.get(i).get(2).toString();
|
||||
testPathDir = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(),
|
||||
testSuiteDir, testNameDir, testNameDir + ".py").toString();
|
||||
//check if the test files and device files corresponding to the current test row exist
|
||||
bTestAlreadyInTable = (testPathDir.equals(testPathTable) && deviceNameDir.equals(deviceNameTable));
|
||||
if (bTestAlreadyInTable) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bTestAlreadyInTable) {
|
||||
//this test in table does not exist any more in the tests directory: remove
|
||||
//this test in table does not exist any more in the tests directory or in the device directory: remove
|
||||
model.removeRow(row);
|
||||
totalRows = model.getRowCount();
|
||||
row=0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user