Search in sources :

Example 1 with ValidatorInterceptor

use of com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor in project service-proxy by membrane.

the class ValidatorInterceptorTest method createSchemaValidatorInterceptor.

private ValidatorInterceptor createSchemaValidatorInterceptor(String schema) throws Exception {
    ValidatorInterceptor interceptor = new ValidatorInterceptor();
    interceptor.setResourceResolver(new ResolverMap());
    interceptor.setSchema(schema);
    interceptor.init();
    return interceptor;
}
Also used : ResolverMap(com.predic8.membrane.core.resolver.ResolverMap)

Example 2 with ValidatorInterceptor

use of com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor in project service-proxy by membrane.

the class SOAPFaultTest method testSkipFault2.

@Test
public void testSkipFault2() throws Exception {
    ValidatorInterceptor i = createValidatorInterceptor(true);
    Exchange exc = getExchangeCP("wsdlValidator/soapFaultCustom.xml");
    assertEquals(Outcome.CONTINUE, i.handleResponse(exc));
}
Also used : Exchange(com.predic8.membrane.core.exchange.Exchange) Test(org.junit.Test)

Example 3 with ValidatorInterceptor

use of com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor in project service-proxy by membrane.

the class UnavailableSoapProxyTest method setup.

@Before
public void setup() {
    r = new Router();
    HttpClientConfiguration httpClientConfig = new HttpClientConfiguration();
    httpClientConfig.setMaxRetries(1);
    r.setHttpClientConfig(httpClientConfig);
    r.setHotDeploy(false);
    r.setRetryInit(true);
    sp = new SOAPProxy();
    sp.setPort(2000);
    sp.setWsdl("http://localhost:2001/axis2/services/BLZService?wsdl");
    sp3 = new ServiceProxy();
    sp3.setPort(2000);
    sp3.setTarget(new AbstractServiceProxy.Target("localhost", 2001));
    ValidatorInterceptor v = new ValidatorInterceptor();
    v.setWsdl("http://localhost:2001/axis2/services/BLZService?wsdl");
    sp3.getInterceptors().add(v);
    SOAPProxy sp2 = new SOAPProxy();
    sp2.setPort(2001);
    sp2.setWsdl("http://www.thomas-bayer.com/axis2/services/BLZService?wsdl");
    r2 = new Router();
    r2.setHotDeploy(false);
    r2.getRules().add(sp2);
// r2 will be started during the test
}
Also used : ValidatorInterceptor(com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor) Router(com.predic8.membrane.core.Router) HttpClientConfiguration(com.predic8.membrane.core.transport.http.client.HttpClientConfiguration) Before(org.junit.Before)

Example 4 with ValidatorInterceptor

use of com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor in project service-proxy by membrane.

the class UnavailableSoapProxyTest method checkWSDLDownloadFailureInSoapProxyAndValidator.

@Test
public void checkWSDLDownloadFailureInSoapProxyAndValidator() {
    sp.getInterceptors().add(new ValidatorInterceptor());
    r.getRules().add(sp);
    test();
}
Also used : ValidatorInterceptor(com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor) Test(org.junit.Test)

Example 5 with ValidatorInterceptor

use of com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor 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)

Aggregations

Test (org.junit.Test)4 Exchange (com.predic8.membrane.core.exchange.Exchange)3 ResolverMap (com.predic8.membrane.core.resolver.ResolverMap)3 ValidatorInterceptor (com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor)2 Router (com.predic8.membrane.core.Router)1 HttpClientConfiguration (com.predic8.membrane.core.transport.http.client.HttpClientConfiguration)1 Before (org.junit.Before)1