use of com.predic8.membrane.core.interceptor.xslt.XSLTInterceptor in project service-proxy by membrane.
the class XSLTInterceptorTest method testRequest.
@Test
public void testRequest() throws Exception {
exc = new Exchange(null);
exc.setResponse(Response.ok().body(getClass().getResourceAsStream("/customer.xml"), true).build());
XSLTInterceptor i = new XSLTInterceptor();
i.setXslt("classpath:/customer2person.xsl");
i.init(new HttpRouter());
i.handleResponse(exc);
// printBodyContent();
assertXPath("/person/name/first", "Rick");
assertXPath("/person/name/last", "Cort\u00e9s Ribotta");
assertXPath("/person/address/street", "Calle P\u00fablica \"B\" 5240 Casa 121");
assertXPath("/person/address/city", "Omaha");
}
use of com.predic8.membrane.core.interceptor.xslt.XSLTInterceptor in project service-proxy by membrane.
the class RESTBLZServiceIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 3005), "thomas-bayer.com", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
HTTP2XMLInterceptor http2xml = new HTTP2XMLInterceptor();
router.getTransport().getInterceptors().add(http2xml);
RewriteInterceptor urlRewriter = new RewriteInterceptor();
List<Mapping> mappings = new ArrayList<Mapping>();
mappings.add(new Mapping("/bank/.*", "/axis2/services/BLZService", null));
urlRewriter.setMappings(mappings);
router.getTransport().getInterceptors().add(urlRewriter);
XSLTInterceptor xslt = new XSLTInterceptor();
xslt.setXslt("classpath:/blz-httpget2soap-request.xsl");
xslt.setFlow(Flow.Set.REQUEST);
xslt.setXslt("classpath:/strip-soap-envelope.xsl");
xslt.setFlow(Flow.Set.RESPONSE);
router.getTransport().getInterceptors().add(xslt);
}
use of com.predic8.membrane.core.interceptor.xslt.XSLTInterceptor in project service-proxy by membrane.
the class XSLTInterceptorTest method testXSLTParameter.
@Test
public void testXSLTParameter() throws Exception {
exc = new Exchange(null);
exc.setResponse(Response.ok().body(getClass().getResourceAsStream("/customer.xml"), true).build());
exc.setProperty("XSLT_COMPANY", "predic8");
XSLTInterceptor i = new XSLTInterceptor();
i.setXslt("classpath:/customer2personAddCompany.xsl");
i.init(new HttpRouter());
i.handleResponse(exc);
// printBodyContent();
assertXPath("/person/name/first", "Rick");
assertXPath("/person/name/last", "Cort\u00e9s Ribotta");
assertXPath("/person/address/street", "Calle P\u00fablica \"B\" 5240 Casa 121");
assertXPath("/person/address/city", "Omaha");
assertXPath("/person/company", "predic8");
}
Aggregations