コード例 #1
0
    public void start() {
      WorkerProcessBuilder builder = workerFactory.create();
      builder.applicationClasspath(classPathRegistry.getClassPath("ANT").getAsFiles());
      builder.sharedPackages("org.apache.tools.ant");
      builder.getJavaCommand().systemProperty("test.system.property", "value");
      builder.getJavaCommand().environment("TEST_ENV_VAR", "value");
      builder.worker(action);

      if (mainClass != null) {
        builder.getJavaCommand().setMain(mainClass);
      }

      proc = builder.build();
      try {
        proc.start();
        assertFalse(startFails);
      } catch (ExecException e) {
        assertTrue(startFails);
        return;
      }
      proc.getConnection().addIncoming(TestListenerInterface.class, exceptionListener);
      if (serverAction != null) {
        serverAction.execute(proc.getConnection());
      }
    }
コード例 #2
0
 public void waitForStop() {
   if (startFails) {
     return;
   }
   try {
     proc.waitForStop();
     assertFalse("Expected process to fail", stopFails);
   } catch (ExecException e) {
     assertTrue("Unexpected failure in worker process", stopFails);
   }
 }