use of com.predic8.membrane.examples.Process2 in project service-proxy by membrane.
the class SOAPProxyValidationTest method test.
@Test
public void test() throws IOException, InterruptedException {
File baseDir = getExampleDir("validation" + File.separator + "soap-Proxy");
Process2 sl = new Process2.Builder().in(baseDir).script("service-proxy").waitForMembrane().start();
try {
String url = "http://localhost:2000/axis2/services/BLZService/getBankResponse";
String[] headers = new String[] { "Content-Type", "application/soap+xml" };
postAndAssert(200, url, headers, readFileToString(new File(baseDir, "blz-soap.xml")));
postAndAssert(400, url, headers, readFileToString(new File(baseDir, "invalid-blz-soap.xml")));
} finally {
sl.killScript();
}
}
use of com.predic8.membrane.examples.Process2 in project service-proxy by membrane.
the class XMLValidationTest method test.
@Test
public void test() throws IOException, InterruptedException {
File baseDir = getExampleDir("validation" + File.separator + "xml");
Process2 sl = new Process2.Builder().in(baseDir).script("service-proxy").waitForMembrane().start();
try {
String url = "http://localhost:2000/";
postAndAssert(200, url, readFileToString(new File(baseDir, "year.xml")));
postAndAssert(400, url, readFileToString(new File(baseDir, "invalid-year.xml")));
} finally {
sl.killScript();
}
}
use of com.predic8.membrane.examples.Process2 in project service-proxy by membrane.
the class AntInPath method checkThatAntExecutableIsAvailable.
/**
* Please make sure that the Apache Ant executable can be found in the PATH.
*/
@Test
public void checkThatAntExecutableIsAvailable() throws IOException, InterruptedException {
BufferLogger antOutput = new BufferLogger();
Process2 ant = new Process2.Builder().in(new File(".")).executable("ant -version").withWatcher(antOutput).start();
Assert.assertEquals(0, ant.waitFor(20000));
AssertUtils.assertContains("Apache Ant", antOutput.toString());
}
use of com.predic8.membrane.examples.Process2 in project service-proxy by membrane.
the class DefaultConfigTest method test.
@Test
public void test() throws IOException, InterruptedException {
File baseDir = getMembraneHome();
File proxies = new File(baseDir, "conf/proxies.xml");
File proxiesFull = new File(baseDir, "conf/proxies-full-sample.xml");
replaceInFile(proxies, "9000", "2003");
replaceInFile(proxiesFull, "9000", "2003");
Process2 sl = new Process2.Builder().in(baseDir).script("service-proxy").waitForMembrane().start();
try {
setupHTTPAuthentication("localhost", 2003, "admin", "membrane");
assertContains("Membrane Service Proxy Administration", getAndAssert200("http://localhost:2003/admin/"));
ProxiesXmlUtil pxu = new ProxiesXmlUtil(proxies);
pxu.updateWith(FileUtils.readFileToString(proxiesFull), sl);
setupHTTPAuthentication("localhost", 2001, "admin", "membrane");
assertContains("Routing Configuration", getAndAssert200("http://localhost:2001/static/proxies.xml"));
} finally {
sl.killScript();
}
}
use of com.predic8.membrane.examples.Process2 in project service-proxy by membrane.
the class CBRTest method test.
@Test
public void test() throws IOException, InterruptedException {
File baseDir = getExampleDir("cbr");
Process2 sl = new Process2.Builder().in(baseDir).script("service-proxy").waitForMembrane().start();
try {
String result = postAndAssert200("http://localhost:2000/shop", FileUtils.readFileToString(new File(baseDir, "order.xml")));
assertContains("Normal order received.", result);
result = postAndAssert200("http://localhost:2000/shop", FileUtils.readFileToString(new File(baseDir, "express.xml")));
assertContains("Express order received.", result);
result = postAndAssert200("http://localhost:2000/shop", FileUtils.readFileToString(new File(baseDir, "import.xml")));
assertContains("Order contains import items.", result);
} finally {
sl.killScript();
}
}
Aggregations