diff --git a/plugins/TestingList.java b/plugins/TestingList.java index df5c99f..673fcd5 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -300,7 +300,7 @@ public class TestingList extends Panel { */ private void initialise(){ initComponents(); - closeCustomPanel(); + //closeCustomPanel(); initLogger(); buildTable(); @@ -308,12 +308,7 @@ public class TestingList extends Panel { loadTests(); //if not administrator, then show only enabled tests boolean bShow = Controller.getInstance().getLevel()==AccessLevel.administrator; - //showEnabledTestsOnly(bShow); jCheckBoxMenuShowSelectedTests1.setEnabled(bShow); - if(bShow){ - //if tests are not shown, then show the load tests dialog - //loadListFilter(); - } } catch (Exception ex) { getLogger().severe(ex.getMessage()); } @@ -332,45 +327,56 @@ public class TestingList extends Panel { FileReader reader = new FileReader(configFile); Properties props = new Properties(); props.load(reader); - - String property = null; + reader.close(); + String property; + properties = props; //list filter property = props.getProperty("listFilter"); - property = property.replace("\"",""); - loadListFilter(Paths.get(TESTS_CONFIG_DEFAULT_DIR.toString(), property).toFile()); - + //System.out.println("load listFilter: " + property); + if(property==null || property==""){ + loadListFilter(); + } else{ + property = property.replace("\"",""); + loadListFilter(Paths.get(TESTS_CONFIG_DEFAULT_DIR.toString(), property).toFile()); + } //custom panel property = props.getProperty("customPanel"); + //System.out.println("load customPanel: " + property); property = property.replace("\"",""); loadCustomPanel(property); //show Enabled Tests Only property = props.getProperty("showEnabledTestsOnly"); + //System.out.println("load showEnabledTestsOnly: " + property); property = property.replace("\"",""); showEnabledTestsOnly("true".equals(property)); - properties = props; - reader.close(); + } catch (FileNotFoundException ex) { // file does not exist System.out.println(ex.toString()); } catch (IOException ex) { // I/O error System.out.println(ex.toString()); - } + } catch (Exception ex){ + // Any other exception + System.out.println(ex.toString()); + } } /** * save general properties */ - private void saveProperties(){ - File configFile = TESTS_PROPERTIES_DEFAULT_DIR.toFile(); - /* + private void saveProperties(String key, String val){ + File configFile = TESTS_PROPERTIES_DEFAULT_DIR.toFile(); + try { if (!configFile.isFile()) configFile.createNewFile(); FileReader reader = new FileReader(configFile); + //System.out.println("save property: "+ key + " = " + val); + properties.setProperty(key, val); Properties props = properties; OutputStream out = new FileOutputStream( configFile ); @@ -384,7 +390,7 @@ public class TestingList extends Panel { // I/O error System.out.println(ex.toString()); } - */ + } @@ -396,8 +402,7 @@ public class TestingList extends Panel { jPanelCustom.setVisible(false); repaint(); //store custom panel in the properties - //properties.setProperty("customPanel", ""); - saveProperties(); + saveProperties("customPanel", ""); } @@ -460,8 +465,7 @@ public class TestingList extends Panel { repaint(); revalidate(); //store custom panel in the properties - //properties.setProperty("customPanel", sPanelClassName); - saveProperties(); + saveProperties("customPanel", sPanelClassName); jPanelCustom.setVisible(true); } catch (ClassNotFoundException ex) { Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); @@ -1261,12 +1265,13 @@ public class TestingList extends Panel { filter =""; } filterTests(filter); - //store filter in the properties - //properties.setProperty("showEnabledTestsOnly", filter); - saveProperties(); + //store filter in the properties + saveProperties("showEnabledTestsOnly", filter); //if only enabled tests are visible, disable the move buttons this.jButtonMoveUp.setEnabled(!show); this.jButtonMoveDown.setEnabled(!show); + jCheckBoxMenuShowSelectedTests.setSelected(show); + jCheckBoxMenuShowSelectedTests1.setSelected(show); } /** @@ -2114,7 +2119,7 @@ public class TestingList extends Panel { } } } - showEnabledTestsOnly(jCheckBoxMenuShowSelectedTests1.getState()); + //showEnabledTestsOnly(jCheckBoxMenuShowSelectedTests1.getState()); logger.log(Level.INFO, iCounter + " tests loaded."); } @@ -2343,7 +2348,6 @@ public class TestingList extends Panel { if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); loadListFilter(file); - jCheckBoxMenuShowSelectedTests.setSelected(true); this.showEnabledTestsOnly(true); } } @@ -2357,6 +2361,8 @@ public class TestingList extends Panel { private void loadListFilter(File file) { if (file == null || !file.isFile()){ loadListFilter(); + //store current file in the properties + saveProperties("listFilter", ""); return; } DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel(); @@ -2374,8 +2380,7 @@ public class TestingList extends Panel { in.close(); loadTests(); //store current file in the properties - //properties.setProperty("listFilter", file.toString()); - saveProperties(); + saveProperties("listFilter", file.getName()); } catch (Exception ex) { ex.printStackTrace(); SwingUtils.showMessage(this, "loadListFilter()", ex.toString()); diff --git a/script/tests/tests.properties b/script/tests/tests.properties index 3a3eea4..bd03cac 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,4 +1,5 @@ #TestingList for pshell: configuration properties -#Thu Oct 15 10:53:38 CEST 2015 +#Thu Oct 15 11:45:11 CEST 2015 customPanel= -showEnabledTestsOnly= +showEnabledTestsOnly=true +listFilter=parallelizeOneTest