public void stopAll(boolean wait) { ArrayList<ProcessHandler> allHandlers = new ArrayList<ProcessHandler>(); synchronized (myProcMap) { for (Info o : myProcMap.values()) { ContainerUtil.addIfNotNull(o.handler, allHandlers); } } for (ProcessHandler handler : allHandlers) { handler.destroyProcess(); } if (wait) { for (ProcessHandler handler : allHandlers) { handler.waitFor(); } } }
protected void assertOutput(String className, String expected, final Module module) throws ExecutionException { final StringBuffer sb = new StringBuffer(); ProcessHandler process = runProcess( className, module, DefaultRunExecutor.class, new ProcessAdapter() { @Override public void onTextAvailable(ProcessEvent event, Key outputType) { if (ProcessOutputTypes.SYSTEM != outputType) { sb.append(event.getText()); } } }, ProgramRunner.PROGRAM_RUNNER_EP.findExtension(DefaultJavaProgramRunner.class)); process.waitFor(); assertEquals(expected.trim(), StringUtil.convertLineSeparators(sb.toString().trim())); }