server.getReceivedData());
}
public void testExecuteLogging() throws Exception {
Project project = new Project();
LineBuffer buffer = new LineBuffer();
ProcessTester server = new ProcessTester();
XhExecTask task = new XhExecTask();
task.setProject(project);
task.setExecutable(JVM);
task.createArg().setValue("-cp");
task.createArg().setPath(new Path(project, getClassPath()));
task.createArg().setLine(ProcessTester.class.getName());
task.createArg().setLine("-p " + server.getPort());
task.createArg().setLine("-s user.dir");
task.enableLogging(buffer, 0, 1);
task.execute();
assertEquals("Wrong return value", 0, task.getReturnValue());
assertTrue("Client did not run", server.passed());
assertEquals("Wrong user dir", System.getProperty("user.dir"), server.getReceivedData());
assertEquals("Wrong stderr", "Welcome stderr!", buffer.toString(1));
String stdout = buffer.toString(0);
assertTrue("Wrong stdout", stdout.startsWith("Welcome stdout!"));
assertTrue("Wrong stdout", stdout.endsWith("...done. Exiting."));
}