use of com.predic8.membrane.examples.util.SubstringWaitableConsoleEvent in project service-proxy by membrane.
the class CustomInterceptorTest method test.
@Test
public void test() throws IOException, InterruptedException {
File baseDir = getExampleDir("custom-interceptor");
BufferLogger b = new BufferLogger();
Process2 ant = new Process2.Builder().in(baseDir).executable("ant compile").withWatcher(b).start();
try {
int exitCode = ant.waitFor(60000);
if (exitCode != 0)
throw new RuntimeException("Ant exited with code " + exitCode + ": " + b.toString());
} finally {
ant.killScript();
}
FileUtils.copyDirectoryToDirectory(new File(baseDir, "build/classes"), getMembraneHome());
Process2 sl = new Process2.Builder().in(baseDir).script("service-proxy").waitForMembrane().start();
try {
SubstringWaitableConsoleEvent invoked = new SubstringWaitableConsoleEvent(sl, "MyInterceptor invoked");
getAndAssert200("http://localhost:2000/");
assertTrue(invoked.occurred());
} finally {
sl.killScript();
}
}
use of com.predic8.membrane.examples.util.SubstringWaitableConsoleEvent in project service-proxy by membrane.
the class GroovyTest method test.
@Test
public void test() throws IOException, InterruptedException {
Process2 sl = new Process2.Builder().in(getExampleDir("groovy")).script("service-proxy").waitForMembrane().start();
try {
SubstringWaitableConsoleEvent groovyCalled = new SubstringWaitableConsoleEvent(sl, "X-Groovy header added with value :Groovy interceptor");
getAndAssert200("http://localhost:2000/");
assertTrue(groovyCalled.occurred());
} finally {
sl.killScript();
}
}
use of com.predic8.membrane.examples.util.SubstringWaitableConsoleEvent in project service-proxy by membrane.
the class LoggingTest method test.
@Test
public void test() throws IOException, InterruptedException {
Process2 sl = new Process2.Builder().in(getExampleDir("logging")).script("service-proxy").waitForMembrane().start();
try {
SubstringWaitableConsoleEvent logged = new SubstringWaitableConsoleEvent(sl, "HTTP/1.1");
AssertUtils.getAndAssert200("http://localhost:2000/");
assertEquals(true, logged.occurred());
} finally {
sl.killScript();
}
}
use of com.predic8.membrane.examples.util.SubstringWaitableConsoleEvent in project service-proxy by membrane.
the class ProxiesXmlUtil method updateWith.
public void updateWith(String proxiesXmlContent, Process2 sl) throws IOException {
SubstringWaitableConsoleEvent reloaded = new SubstringWaitableConsoleEvent(sl, "Spring Hot Deployment Thread started.");
FileUtils.writeStringToFile(proxiesXml, proxiesXmlContent);
reloaded.waitFor(10000);
}
Aggregations