use of com.predic8.membrane.core.transport.http.FakeHttpHandler 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.transport.http.FakeHttpHandler in project service-proxy by membrane.
the class ReverseProxyingInterceptorTest method createExchange.
/**
* Creates a fake exchange which simulates a received redirect by the server.
*/
private Exchange createExchange(String requestHostHeader, String requestDestinationHeader, int port, String requestURI, String redirectionURI) {
Exchange exc = new Exchange(new FakeHttpHandler(port));
Request req = new Request();
req.setUri(requestURI);
Header header = new Header();
if (requestHostHeader != null)
header.setHost(requestHostHeader);
if (requestDestinationHeader != null)
header.add(Header.DESTINATION, requestDestinationHeader);
req.setHeader(header);
exc.setRequest(req);
if (redirectionURI != null) {
Response res = Response.redirect(redirectionURI, false).build();
exc.setResponse(res);
exc.getDestinations().add(requestURI);
}
return exc;
}
use of com.predic8.membrane.core.transport.http.FakeHttpHandler in project service-proxy by membrane.
the class WADLInterceptorTest method getExchange.
private Exchange getExchange() throws IOException {
Exchange exc = new Exchange(new FakeHttpHandler(3011));
exc.setRequest(MessageUtil.getGetRequest("/search?wadl"));
InputStream resourceAsStream = this.getClass().getResourceAsStream("/wadls/search.wadl");
Response okResponse = Response.ok().contentType("text/xml; charset=utf-8").body(resourceAsStream, true).build();
exc.setResponse(okResponse);
exc.setOriginalHostHeader("thomas-bayer.com:80");
return exc;
}
Aggregations