Search in sources :

Example 96 with Exchange

use of com.predic8.membrane.core.exchange.Exchange in project service-proxy by membrane.

the class XMLProtectionInterceptorTest method setUp.

@Before
public void setUp() throws Exception {
    exc = new Exchange(null);
    exc.setRequest(MessageUtil.getGetRequest("/axis2/services/BLZService"));
    exc.setOriginalHostHeader("thomas-bayer.com:80");
    interceptor = new XMLProtectionInterceptor();
}
Also used : Exchange(com.predic8.membrane.core.exchange.Exchange) Before(org.junit.Before)

Example 97 with Exchange

use of com.predic8.membrane.core.exchange.Exchange 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");
}
Also used : Exchange(com.predic8.membrane.core.exchange.Exchange) HttpRouter(com.predic8.membrane.core.HttpRouter) Test(org.junit.Test)

Example 98 with Exchange

use of com.predic8.membrane.core.exchange.Exchange in project service-proxy by membrane.

the class SOAPFaultTest method testValidateFaults.

@Test
public void testValidateFaults() throws Exception {
    ValidatorInterceptor i = createValidatorInterceptor(false);
    Exchange exc = createFaultExchange();
    assertEquals(Outcome.ABORT, i.handleResponse(exc));
    assertContainsNot("secret", exc.getResponse().toString());
}
Also used : Exchange(com.predic8.membrane.core.exchange.Exchange) Test(org.junit.Test)

Example 99 with Exchange

use of com.predic8.membrane.core.exchange.Exchange in project service-proxy by membrane.

the class SOAPFaultTest method testSkipFaults.

@Test
public void testSkipFaults() throws Exception {
    ValidatorInterceptor i = createValidatorInterceptor(true);
    Exchange exc = createFaultExchange();
    assertEquals(Outcome.CONTINUE, i.handleResponse(exc));
    assertContains("secret", exc.getResponse().toString());
}
Also used : Exchange(com.predic8.membrane.core.exchange.Exchange) Test(org.junit.Test)

Example 100 with Exchange

use of com.predic8.membrane.core.exchange.Exchange in project service-proxy by membrane.

the class SOAPMessageValidatorInterceptorTest method setUp.

@Before
public void setUp() throws Exception {
    requestTB = MessageUtil.getPostRequest("http://thomas-bayer.com");
    requestXService = MessageUtil.getPostRequest("http://ws.xwebservices.com");
    exc = new Exchange(null);
}
Also used : Exchange(com.predic8.membrane.core.exchange.Exchange) Before(org.junit.Before)

Aggregations

Exchange (com.predic8.membrane.core.exchange.Exchange)107 Test (org.junit.Test)39 IOException (java.io.IOException)32 Request (com.predic8.membrane.core.http.Request)25 Outcome (com.predic8.membrane.core.interceptor.Outcome)24 Response (com.predic8.membrane.core.http.Response)16 AbstractInterceptor (com.predic8.membrane.core.interceptor.AbstractInterceptor)16 ServiceProxy (com.predic8.membrane.core.rules.ServiceProxy)16 HttpRouter (com.predic8.membrane.core.HttpRouter)14 Before (org.junit.Before)13 ServiceProxyKey (com.predic8.membrane.core.rules.ServiceProxyKey)12 AbstractExchange (com.predic8.membrane.core.exchange.AbstractExchange)11 Header (com.predic8.membrane.core.http.Header)10 HttpClient (com.predic8.membrane.core.transport.http.HttpClient)10 CacheBuilder (com.google.common.cache.CacheBuilder)9 Rule (com.predic8.membrane.core.rules.Rule)6 URISyntaxException (java.net.URISyntaxException)6 UnknownHostException (java.net.UnknownHostException)6 ArrayList (java.util.ArrayList)6 Session (com.predic8.membrane.core.interceptor.authentication.session.SessionManager.Session)5