Closedown
This commit is contained in:
@@ -78,7 +78,8 @@ public class TestingList extends Panel {
|
||||
public TestingList() throws Exception {
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="types enum">
|
||||
/**
|
||||
* enumeration of table column indexes
|
||||
*/
|
||||
@@ -280,14 +281,15 @@ public class TestingList extends Panel {
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
Logger logger = Logger.getLogger("TestsLog");
|
||||
//these paths are converted to unix or win path according to host OS
|
||||
public static Path TESTS_DEVICES_DEFAULT_DIR = Paths.get(".", "home", "script", "tests", "devices");
|
||||
public static Path TESTS_TESTS_DEFAULT_DIR = Paths.get(".", "home", "script", "tests", "tests");
|
||||
public static Path TESTS_CONFIG_DEFAULT_DIR = Paths.get(".", "home", "script", "tests", "config");
|
||||
public static Path TESTS_PROPERTIES_DEFAULT_DIR = Paths.get(".", "home", "script", "tests", "tests.properties");
|
||||
public final Path TESTS_LOG_DEFAULT_DIR = Paths.get(".", "home", "script", "tests", "log", "TestsLog" + getnow() + ".txt");
|
||||
public final Path TESTS_LOG_DEFAULT_DIR = Paths.get(".", "home", "script", "tests", "log", "TestsLog" + getnow() + ".txt");
|
||||
public static String TESTS_CONFIG_FILENAME = ".config";
|
||||
public static String TESTS_HELP_FILENAME = "help.html";
|
||||
|
||||
@@ -298,9 +300,9 @@ public class TestingList extends Panel {
|
||||
private void initialise(){
|
||||
initComponents();
|
||||
initLogger();
|
||||
loadProperties();
|
||||
buildTable();
|
||||
closeCustomPanel();
|
||||
loadProperties();
|
||||
try {
|
||||
loadTests();
|
||||
//if not administrator, then show only enabled tests
|
||||
@@ -309,16 +311,20 @@ public class TestingList extends Panel {
|
||||
jCheckBoxMenuShowSelectedTests1.setState(bShow);
|
||||
if(bShow){
|
||||
//if tests are not shown, then show the load tests dialog
|
||||
loadSettings();
|
||||
loadListFilter();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
getLogger().severe(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* load general properties
|
||||
*/
|
||||
private void loadProperties(){
|
||||
System.out.print("Properties loading ");
|
||||
File configFile = TESTS_PROPERTIES_DEFAULT_DIR.toFile();
|
||||
System.out.print("Properties file: " + configFile.toString());
|
||||
if (!configFile.isFile()) return;
|
||||
|
||||
try {
|
||||
@@ -332,8 +338,10 @@ public class TestingList extends Panel {
|
||||
reader.close();
|
||||
} catch (FileNotFoundException ex) {
|
||||
// file does not exist
|
||||
System.out.print(ex.toString());
|
||||
} catch (IOException ex) {
|
||||
// I/O error
|
||||
System.out.print(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,12 +364,14 @@ public class TestingList extends Panel {
|
||||
Path pluginsPath = Paths.get(".", "home", "config", "plugins.properties");
|
||||
List<String> stringBuffer =new ArrayList<String>() ;
|
||||
try {
|
||||
//get list of java classes from plugins list file
|
||||
File file = pluginsPath.toFile();
|
||||
FileReader fileReader = new FileReader(file);
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
String line, fileName;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
if(line.contains("=enabled")){
|
||||
//extract java class name from file path
|
||||
fileName = line.replace(".java=enabled", "");
|
||||
fileName = (Paths.get(fileName)).getFileName().toString();
|
||||
if( !(fileName.contains("TestingListDetails") ||
|
||||
@@ -949,7 +959,7 @@ public class TestingList extends Panel {
|
||||
}//GEN-LAST:event_jButtonMoveUpActionPerformed
|
||||
|
||||
private void jButtonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOpenActionPerformed
|
||||
this.loadSettings();
|
||||
this.loadListFilter();
|
||||
//this below is a test that can be useful to check that multithreading does work fine with passing variables
|
||||
/* new Thread(() -> {
|
||||
try {
|
||||
@@ -1951,7 +1961,7 @@ public class TestingList extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SwingUtils.showMessage(this, "loadSettings()", ex.toString());
|
||||
SwingUtils.showMessage(this, "loadListFilter()", ex.toString());
|
||||
}
|
||||
updateStatus();
|
||||
}
|
||||
@@ -2254,13 +2264,13 @@ public class TestingList extends Panel {
|
||||
* Save current setup in a file. The current position of table rows is also
|
||||
* saved.
|
||||
*/
|
||||
public void loadSettings() {
|
||||
public void loadListFilter() {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
fc.setCurrentDirectory(TESTS_CONFIG_DEFAULT_DIR.toFile());
|
||||
int returnVal = fc.showOpenDialog(this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
loadSettings(file);
|
||||
loadListFilter(file);
|
||||
jCheckBoxMenuShowSelectedTests.setSelected(true);
|
||||
this.showSelectedTestsOnly(true);
|
||||
}
|
||||
@@ -2272,7 +2282,7 @@ public class TestingList extends Panel {
|
||||
*
|
||||
* @param file file containing the settings
|
||||
*/
|
||||
private void loadSettings(File file) {
|
||||
private void loadListFilter(File file) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel();
|
||||
try {
|
||||
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
|
||||
@@ -2289,7 +2299,7 @@ public class TestingList extends Panel {
|
||||
loadTests();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SwingUtils.showMessage(this, "loadSettings()", ex.toString());
|
||||
SwingUtils.showMessage(this, "loadListFilter()", ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user