Test parameters read deirectly from file upon:

- Opening Details
- Running test
This commit is contained in:
boccioli_m
2015-08-17 14:39:58 +02:00
parent 42347db171
commit 2f09cc1d12

View File

@@ -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.