use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class BasicAuthenticationInterceptorIntegrationTest method testHashedPassword.
@Test
public void testHashedPassword() throws Exception {
List<User> users = new ArrayList<User>();
User user = new User("admin", "$6$12345678$jwCsYagMo/KNcTDqnrWL25Dy3AfAT5U94abA5a/iPFO.Cx2zAkMpPxZBNKY/P/xiRrCfCFDxdBp7pvNEMoBcr0");
users.add(user);
BasicAuthenticationInterceptor interceptor = new BasicAuthenticationInterceptor();
StaticUserDataProvider provider = (StaticUserDataProvider) interceptor.getUserDataProvider();
interceptor.setUsers(users);
User postData = new User("admin", "admin");
try {
provider.verify(postData.getAttributes());
} catch (Exception e) {
fail();
}
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class WSDLInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
exc = new Exchange(new FakeHttpHandler(3011));
exc.setRequest(MessageUtil.getGetRequest("/axis2/services/BLZService?wsdl"));
InputStream resourceAsStream = this.getClass().getResourceAsStream("/blz-service.wsdl");
Response okResponse = Response.ok().contentType("text/xml; charset=utf-8").body(resourceAsStream, true).build();
exc.setResponse(okResponse);
exc.setOriginalHostHeader("thomas-bayer.com:80");
interceptor = new WSDLInterceptor();
}
use of com.predic8.membrane.core.interceptor.Interceptor 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.core.interceptor.Interceptor 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.core.interceptor.Interceptor in project service-proxy by membrane.
the class WsaEndpointRewriterInterceptorTest method testRewriterInterceptor.
@Test
public void testRewriterInterceptor() throws Exception {
exc.setRequest(MessageUtil.getPostRequest("http://localhost:9000/SoapContext/SoapPort?wsdl"));
InputStream input = WsaEndpointRewriterTest.class.getResourceAsStream("/interceptor/ws_addressing/body.xml");
exc.getRequest().setBody(new Body(input));
assertEquals(Outcome.CONTINUE, rewriter.handleRequest(exc));
assertEquals(exc.getProperty("messageId"), "urn:uuid:62a0de08-055a-4da7-aefa-730af9dbc6b6");
}
Aggregations