protected boolean runProgram(ApplicationWithPrograms app, Class<?> programClass, Arguments args) throws Exception { return waitForCompletion(AppFabricTestHelper.submit(app, programClass.getName(), args, TEMP_FOLDER_SUPPLIER)); }
private ProgramController startProgram(ApplicationWithPrograms app, Class<?> programClass) throws Throwable { final AtomicReference<Throwable> errorCause = new AtomicReference<>(); final ProgramController controller = AppFabricTestHelper.submit(app, programClass.getName(), new BasicArguments(), TEMP_FOLDER_SUPPLIER); runningPrograms.add(controller); controller.addListener(new AbstractListener() { @Override public void error(Throwable cause) { errorCause.set(cause); } @Override public void killed() { errorCause.set(new RuntimeException("Killed")); } }, Threads.SAME_THREAD_EXECUTOR); Tasks.waitFor(ProgramController.State.ALIVE, new Callable<ProgramController.State>() { @Override public ProgramController.State call() throws Exception { Throwable t = errorCause.get(); if (t != null) { Throwables.propagateIfInstanceOf(t, Exception.class); throw Throwables.propagate(t); } return controller.getState(); } }, 30, TimeUnit.SECONDS); return controller; }
controllers.add(AppFabricTestHelper.submit(app, programDescriptor.getSpecification().getClassName(), new BasicArguments(args), TEMP_FOLDER_SUPPLIER)); for (ProgramDescriptor programDescriptor : app.getPrograms()) { if (programDescriptor.getProgramId().getType().equals(ProgramType.MAPREDUCE)) { controller = AppFabricTestHelper.submit(app, programDescriptor.getSpecification().getClassName(), new BasicArguments(), TEMP_FOLDER_SUPPLIER);