Closedown

This commit is contained in:
boccioli_m
2015-06-26 14:17:41 +02:00
parent 0ccfd9cda7
commit e762a1aa99
2 changed files with 49 additions and 26 deletions

View File

@@ -540,6 +540,7 @@ public class TestingList extends Panel {
}//GEN-LAST:event_jButtonMoveUpActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
new Thread(() -> {
try {
Object ret = eval("parallelize((run,('Motor Test 3 100ms',)), (run,('Motor Test 3 200ms',)))");
@@ -777,7 +778,7 @@ public class TestingList extends Panel {
String sTestName;
String sTestCaseName;
String sTestPath;
HashMap args = new HashMap();
HashMap<String,Object> args = new HashMap<>();
HashMap mParameters = new HashMap();
//scan through the table starting from 'position' and execute the first selected test found
int row = position;
@@ -900,23 +901,27 @@ public class TestingList extends Panel {
logger.log(Level.INFO, "Running Test '" + sTestName + "'. No parameters found.");
System.out.println("Running test '" + sTestName + "'. No parameters found.");
}
// runTest = new RunTest(sDeviceName, sTestPath, mParameters);
// Thread t = new Thread(runTest);
// t.start();
args = new HashMap();
args.put("ret", "");
args.put("parameters", mParameters);
args.put("device", sDeviceName);
args.put("status", false);
Object ret = eval("parallelize((run,(" + sTestPath + "," + ")))");
Object ret1 = ((ArrayList) ret).get(0);
//Object ret2 = ((ArrayList) ret).get(1);
System.out.println(String.valueOf(ret1));
System.out.println("A");
runTest = new RunTest(sTestPath, args);
System.out.println("b");
Thread t = new Thread(runTest);
System.out.println("c");
t.start();
System.out.println("d");
// //Object ret = eval("parallelize((run,(" + sTestPath + "," + ")))");
// Object ret = eval("parallelize((run,('Motor Test 3 100ms',)), (run,('Motor Test 3 200ms',)))");
// Object ret1 = ((ArrayList) ret).get(0);
// //Object ret2 = ((ArrayList) ret).get(1);
// System.out.println(String.valueOf(ret1));
//runAsync(sTestPath, args);
iRet = 0;
} catch (Exception ex) {
SwingUtils.showMessage(this, "executeTest()", ex.toString());
@@ -933,28 +938,43 @@ public class TestingList extends Panel {
private String sDeviceName, sTestPath;
private HashMap mParameters;
private HashMap<String,Object> args;
public RunTest(String sDeviceName, String sTestPath, HashMap mParameters) {
this.sDeviceName = sDeviceName;
public RunTest(String sTestPath, HashMap<String,Object> args) {
System.out.println("A1");
this.sDeviceName = args.get("device").toString();
System.out.println("A2");
this.sTestPath = sTestPath;
this.mParameters = mParameters;
System.out.println("A3");
this.mParameters = (HashMap) args.get("parameters");
this.args = args;
}
public RunTest(String sTestPath) {
this.sDeviceName = sTestPath;
this.sTestPath = sTestPath;
this.mParameters.put("a", 1);
}
public void run() {
// code in the other thread, can reference "var" variable
HashMap args = new HashMap();
try {
Thread.sleep(1000);
args.put("parameters", mParameters);
args.put("device", sDeviceName);
args.put("ret", "");
args.put("status", false);
System.out.println("Parameters passed: " + String.valueOf(mParameters));
runAsync(sTestPath, args);
} catch (Controller.ControllerStateException ex) {
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
System.out.println("A4");
for (String key:args.keySet()){
getController().getScriptManager().setVar(key,args.get(key));
}
System.out.println("A5");
//runAsync(sTestPath, args);
Object ret = eval("parallelize((run,('Motor Test 3 100ms'), (run,('Motor Test 3 200ms')))");
System.out.println("A6");
Object ret1 = ((ArrayList) ret).get(0);
//Object ret2 = ((ArrayList) ret).get(1);
System.out.println(String.valueOf(ret1));
} catch (Exception ex) {
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
SwingUtils.showMessage(TestingList.this.getComponent(), "runTest()", ex.toString());
}
}
}