use of org.apache.geode.test.process.ProcessWrapper in project geode by apache.
the class GoldenTestCase method createProcessWrapper.
protected final ProcessWrapper createProcessWrapper(final ProcessWrapper.Builder processWrapperBuilder, final Class<?> main) {
final ProcessWrapper processWrapper = processWrapperBuilder.jvmArguments(JVM_ARGS).mainClass(main).build();
this.processes.add(processWrapper);
return processWrapper;
}
use of org.apache.geode.test.process.ProcessWrapper in project geode by apache.
the class GoldenTestCase method tearDownGoldenTest.
@After
public final void tearDownGoldenTest() throws Exception {
try {
for (ProcessWrapper process : this.processes) {
process.destroy();
printProcessOutput(process, true);
}
} finally {
this.processes.clear();
}
subTearDown();
}
use of org.apache.geode.test.process.ProcessWrapper in project geode by apache.
the class PassJUnitTest method testPass.
/**
* Process output has no problems and should pass
*/
@Test
public void testPass() throws Exception {
final String goldenString = "Begin " + name() + ".main" + "\n" + "Press Enter to continue." + "\n" + "End " + name() + ".main" + "\n";
final ProcessWrapper process = createProcessWrapper(new ProcessWrapper.Builder(), getClass());
process.execute(createProperties());
assertTrue(process.isAlive());
process.waitForOutputToMatch("Begin " + name() + "\\.main");
process.waitForOutputToMatch("Press Enter to continue\\.");
process.sendInput();
process.waitForOutputToMatch("End " + name() + "\\.main");
process.waitFor();
assertOutputMatchesGoldenFile(process, goldenString);
assertFalse(process.isAlive());
assertFalse(process.getStandardOutReader().isAlive());
assertFalse(process.getStandardErrorReader().isAlive());
}
use of org.apache.geode.test.process.ProcessWrapper in project geode by apache.
the class FailWithExtraLineInOutputJUnitTest method testFailWithExtraLineInOutput.
/**
* Process output has an extra line and should fail
*/
@Test
public void testFailWithExtraLineInOutput() throws Exception {
final String goldenString = "Begin " + name() + ".main" + "\n" + "Press Enter to continue." + "\n" + "End " + name() + ".main" + "\n";
debug(goldenString, "GOLDEN");
final ProcessWrapper process = createProcessWrapper(new ProcessWrapper.Builder(), getClass());
process.execute(createProperties());
process.waitForOutputToMatch("Begin " + name() + "\\.main");
process.waitForOutputToMatch("Press Enter to continue\\.");
process.sendInput();
process.waitForOutputToMatch("End " + name() + "\\.main");
process.waitFor();
try {
assertOutputMatchesGoldenFile(process.getOutput(), goldenString);
fail("assertOutputMatchesGoldenFile should have failed due to " + problem());
} catch (AssertionError expected) {
assertTrue(expected.getMessage().contains(problem()));
}
}
Aggregations