From 2f09cc1d128379f2ef8a1203055b812aa00b747e Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Mon, 17 Aug 2015 14:39:58 +0200 Subject: [PATCH] Test parameters read deirectly from file upon: - Opening Details - Running test --- plugins/TestingList.java | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 2461bbd..48c7fad 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -659,7 +659,7 @@ public class TestingList extends Panel { String sLastResult = jTable1.getValueAt(row, COL.RESULT.ordinal()).toString(); String sResultTime = jTable1.getValueAt(row, COL.TIME.ordinal()).toString(); String sTestHelp = String.valueOf(jTable1.getValueAt(row, COL.TESTHELP.ordinal())); - HashMap mParameters = buildParametersMap(String.valueOf(jTable1.getValueAt(row, COL.TESTPARAMS.ordinal()))); + HashMap mParameters = getTestParameters(sTestPath); //create map for passing details to Details Panel HashMap details = new HashMap(); details.put("deviceName", sDeviceName); @@ -965,7 +965,8 @@ public class TestingList extends Panel { String sTestCaseName = jTable1.getValueAt(row, COL.TESTSUITE.ordinal()).toString(); String sTestPath = jTable1.getValueAt(row, COL.TESTPATH.ordinal()).toString(); // HashMap mParameters = buildParametersMap(String.valueOf(jTable1.getValueAt(row, COL.TESTPARAMS.ordinal()))); - HashMap mParameters = buildParametersMap(String.valueOf(jTable1.getValueAt(row, COL.TESTPARAMS.ordinal()))); + //get the parameters directly frm he config file + HashMap mParameters = getTestParameters(sTestPath); HashMap testArgs = new HashMap(); //args.put("ret", ""); testArgs.put(testArgNames.PARAMETERS.toString(), mParameters); @@ -973,29 +974,8 @@ public class TestingList extends Panel { testArgs.put(testArgNames.DEVICE.toString(), sDeviceName); testArgs.put(testArgNames.TEST_PATH.toString(), sTestPath); testArgs.put(testArgNames.STATUS.toString(), false); - String testParams = getTestParameters(sTestPath); - System.out.println("sTestPath: " + sTestPath); - System.out.println("testParams: " + testParams); - return testArgs; - } - private String getTestParameters(String sTestPath){ - Properties propTest = new Properties(); - File fileTest = new File(sTestPath); - String testParams = ""; - if (fileTest.isDirectory()) { - File configFile = new File(fileTest.getPath() + FilenameUtils.separatorsToSystem("/.config")); - if (configFile.exists() && !configFile.isDirectory()) { - try { - InputStream ist = new FileInputStream(configFile); - propTest.load(ist); - testParams = propTest.getProperty("parameters"); - } catch (IOException ex) { - Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - return testParams; + return testArgs; } /** @@ -1349,6 +1329,26 @@ public class TestingList extends Panel { return mParameters; } + private HashMap getTestParameters(String sTestPath){ + Properties propTest = new Properties(); + File fileTest = new File(sTestPath); + File dirTest = fileTest.getParentFile(); + String testParams = ""; + if (dirTest.isDirectory()) { + File configFile = new File(dirTest.getPath() + FilenameUtils.separatorsToSystem("/.config")); + if (configFile.exists() && !configFile.isDirectory()) { + try { + InputStream ist = new FileInputStream(configFile); + propTest.load(ist); + testParams = propTest.getProperty("parameters"); + } catch (IOException ex) { + Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + return buildParametersMap(testParams); + } + /** * Save current setup in a file. The current position of table rows is also * saved.