Startup
This commit is contained in:
@@ -88,17 +88,16 @@ public class TestingList extends Panel {
|
||||
STARTSEQUENCE(1),
|
||||
TIME(2),
|
||||
DEVICENAME(3),
|
||||
DEVICEPATH(4),
|
||||
DEVICEDESCR(5),
|
||||
TESTSUITE(6),
|
||||
TESTNAME(7),
|
||||
TESTPATH(8),
|
||||
TESTPARAMS(9),
|
||||
TESTDESCR(10),
|
||||
TESTHELP(11),
|
||||
RESULT(12),
|
||||
STATUS(13),
|
||||
ICON(14);
|
||||
DEVICEDESCR(4),
|
||||
TESTSUITE(5),
|
||||
TESTNAME(6),
|
||||
TESTPATH(7),
|
||||
TESTPARAMS(8),
|
||||
TESTDESCR(9),
|
||||
TESTHELP(10),
|
||||
RESULT(11),
|
||||
STATUS(12),
|
||||
ICON(13);
|
||||
private int value;
|
||||
|
||||
private COL(int value) {
|
||||
@@ -298,36 +297,6 @@ public class TestingList extends Panel {
|
||||
* initialise panel
|
||||
*/
|
||||
private void initialise(){
|
||||
System.out.println("msg:");
|
||||
int PORT1 = 0x8899; // this port
|
||||
String mode = "2,IQCOM,$BMA1,1,DIA";
|
||||
int i = 0;
|
||||
byte[] msg = new byte[128];
|
||||
msg[0] = 50; //bytecount
|
||||
msg[2] = 105; // transfer function
|
||||
msg[4] = (byte) PORT1;
|
||||
msg[5] = (byte) (PORT1 >>> 8);
|
||||
msg[6] = 1; // message id
|
||||
msg[16] = 1; //io-func reset=2 read mode=0 write mode=1
|
||||
byte[] buffer = mode.getBytes();
|
||||
while (i < buffer.length) {
|
||||
msg[28 + i] = buffer[i];
|
||||
i++;
|
||||
}
|
||||
for (i=0 ; i < msg.length; i++) {
|
||||
System.out.print(String.format("%02X ", msg[i]));
|
||||
}
|
||||
System.out.println("");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
initComponents();
|
||||
initLogger();
|
||||
buildTable();
|
||||
@@ -410,7 +379,7 @@ public class TestingList extends Panel {
|
||||
try {
|
||||
if (!configFile.isFile()) configFile.createNewFile();
|
||||
FileReader reader = new FileReader(configFile);
|
||||
System.out.println("save property: "+ key + " = " + val);
|
||||
//System.out.println("save property: "+ key + " = " + val);
|
||||
properties.setProperty(key, val);
|
||||
Properties props = properties;
|
||||
|
||||
@@ -1004,14 +973,14 @@ public class TestingList extends Panel {
|
||||
|
||||
},
|
||||
new String [] {
|
||||
"Enable", "Start Mode", "Time", "Device Name", "Device Path", "Device Description", "Test Suite", "Test Name", "Test Peth", "Test Parameters", "Test Description", "Test Help", "Last Test Result", "Status", ""
|
||||
"Enable", "Start Mode", "Time", "Device Name", "Device Description", "Test Suite", "Test Name", "Test Peth", "Test Parameters", "Test Description", "Test Help", "Last Test Result", "Status", ""
|
||||
}
|
||||
) {
|
||||
Class[] types = new Class [] {
|
||||
java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, javax.swing.Icon.class
|
||||
java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, javax.swing.Icon.class
|
||||
};
|
||||
boolean[] canEdit = new boolean [] {
|
||||
true, true, false, false, false, false, false, false, false, false, false, false, false, false, false
|
||||
true, true, false, false, false, false, false, false, false, false, false, false, false, false
|
||||
};
|
||||
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
@@ -1619,12 +1588,11 @@ public class TestingList extends Panel {
|
||||
String sTestPath = String.valueOf(jTable1.getValueAt(row, COL.TESTPATH.ordinal())).replace("\\", File.separator);
|
||||
String sTestCaseName = jTable1.getValueAt(row, COL.TESTSUITE.ordinal()).toString();
|
||||
String sTestDescription = getTestDescription(sTestPath);
|
||||
String sDevicePath = jTable1.getValueAt(row, COL.DEVICEPATH.ordinal()).toString();
|
||||
String sDeviceDescription = jTable1.getValueAt(row, COL.DEVICEDESCR.ordinal()).toString();
|
||||
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 = getParameters(sTestPath, sDevicePath);
|
||||
HashMap mParameters = getTestParameters(sTestPath);
|
||||
//create map for passing details to Details Panel
|
||||
HashMap details = new HashMap();
|
||||
details.put("deviceName", sDeviceName);
|
||||
@@ -1979,14 +1947,13 @@ public class TestingList extends Panel {
|
||||
*/
|
||||
private HashMap buildMapFromTableRow(int row) {
|
||||
String sDeviceName = jTable1.getValueAt(row, COL.DEVICENAME.ordinal()).toString();
|
||||
String sDevicePath = jTable1.getValueAt(row, COL.DEVICEPATH.ordinal()).toString().replace("\\", File.separator);
|
||||
String sTestName = jTable1.getValueAt(row, COL.TESTNAME.ordinal()).toString();
|
||||
String sTestCaseName = jTable1.getValueAt(row, COL.TESTSUITE.ordinal()).toString();
|
||||
String sTestPath = jTable1.getValueAt(row, COL.TESTPATH.ordinal()).toString().replace("\\", File.separator);
|
||||
// HashMap mParameters = buildParametersMap(String.valueOf(jTable1.getValueAt(row, COL.TESTPARAMS.ordinal())));
|
||||
//get the parameters directly frm he config file
|
||||
// System.out.println("sTestPath: " + sTestPath);
|
||||
HashMap mParameters = getParameters(sTestPath, sDevicePath);
|
||||
HashMap mParameters = getTestParameters(sTestPath);
|
||||
HashMap testArgs = new HashMap();
|
||||
//args.put("ret", "");
|
||||
testArgs.put(testArgNames.PARAMETERS.toString(), mParameters);
|
||||
@@ -2214,13 +2181,13 @@ public class TestingList extends Panel {
|
||||
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
|
||||
renderer.setToolTipText("Click for options");
|
||||
jTable1.getColumnModel().getColumn(COL.STARTSEQUENCE.ordinal()).setCellRenderer(renderer);
|
||||
|
||||
jTable1.getColumnModel().getColumn(COL.STARTSEQUENCE.ordinal()).setPreferredWidth(30);
|
||||
jTable1.getColumnModel().getColumn(COL.ICON.ordinal()).setMaxWidth(27);
|
||||
jTable1.getColumnModel().getColumn(COL.CHECK.ordinal()).setMaxWidth(27);
|
||||
jTable1.getColumnModel().getColumn(COL.DEVICENAME.ordinal()).setPreferredWidth(30);
|
||||
jTable1.getColumnModel().getColumn(COL.STATUS.ordinal()).setPreferredWidth(20);
|
||||
hideColumn(COL.DEVICEDESCR);
|
||||
hideColumn(COL.DEVICEPATH);
|
||||
hideColumn(COL.TESTPATH);
|
||||
hideColumn(COL.TESTDESCR);
|
||||
hideColumn(COL.TESTPARAMS);
|
||||
@@ -2267,9 +2234,8 @@ public class TestingList extends Panel {
|
||||
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
|
||||
//String testPath = FilenameUtils.separatorsToSystem(TESTS_TESTS_DEFAULT_DIR + testSuite + "/" + testName + "/" + testName + ".py");
|
||||
String testPath = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), testSuite, testName, testName + ".py").toString();
|
||||
String devicePath = Paths.get(TESTS_DEVICES_DEFAULT_DIR.toString(), deviceName, deviceName + ".config").toString();
|
||||
System.out.println("Path = " + testPath);
|
||||
Object rowData[] = new Object[]{false, "", sDate, deviceName, devicePath, deviceDescription, testSuite, testName, testPath, testParams, testDescription, testHelp, "", "Pending", icon};
|
||||
Object rowData[] = new Object[]{false, "", sDate, deviceName, deviceDescription, testSuite, testName, testPath, testParams, testDescription, testHelp, "", "Pending", icon};
|
||||
//vedify that this test is not already in the table
|
||||
int totalRows = model.getRowCount();
|
||||
boolean bTestAlreadyInTable = false;
|
||||
@@ -2504,43 +2470,6 @@ public class TestingList extends Panel {
|
||||
return buildParametersMap(testParams);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the parameters from the test and device config file.
|
||||
* the test config params are default params. if the same param name
|
||||
* is also in the device config, it will override the test param.
|
||||
*
|
||||
* @param sTestPath directory where the test files are (directory with the
|
||||
* test name)
|
||||
* @param sdevicePath device config file path
|
||||
* @return HashMap of the test parameters. See buildParametersMap() for
|
||||
* details.
|
||||
*/
|
||||
private HashMap getParameters(String sTestPath, String sDevicePath) {
|
||||
HashMap deviceParams = buildParametersMap(getConfigItem("parameters", sDevicePath));
|
||||
HashMap testParams = buildParametersMap(getConfigItem("parameters", sTestPath));
|
||||
HashMap params = new HashMap();
|
||||
if(deviceParams.isEmpty()){
|
||||
return testParams;
|
||||
}
|
||||
Iterator itD = deviceParams.entrySet().iterator();
|
||||
System.out.println("deviceParams: " + deviceParams.size());
|
||||
while (itD.hasNext()) {
|
||||
Map.Entry pairD = (Map.Entry)itD.next();
|
||||
System.out.println(pairD.getKey() + " = " + pairD.getValue());
|
||||
params.putIfAbsent(pairD.getKey(), pairD.getValue());
|
||||
}
|
||||
Iterator it = testParams.entrySet().iterator();
|
||||
System.out.println("testParams: " + testParams.size());
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry)it.next();
|
||||
System.out.println(pair.getKey() + " = " + pair.getValue());
|
||||
// add parameter only if not already on device parameters
|
||||
params.putIfAbsent(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the description of the test.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user