use of org.apache.schema_validation.SchemaValidation in project cxf by apache.
the class ValidationClientServerTest method assertFailedRequestValidation.
private void assertFailedRequestValidation(Object validationConfig) throws Exception {
SchemaValidation service = createService(validationConfig);
SomeResponse response = execute(service, "1111111111");
assertEquals(response.getTransactionId(), "aaaaaaaaaa");
try {
execute(service, "1234567890aaa");
fail("should catch marshall exception as the invalid outgoing message per schema");
} catch (Exception e) {
assertTrue(e.getMessage().contains("Marshalling Error"));
assertTrue(e.getMessage().contains("is not facet-valid with respect to pattern"));
}
((java.io.Closeable) service).close();
}
use of org.apache.schema_validation.SchemaValidation in project cxf by apache.
the class ValidationClientServerTest method testSchemaValidationClient.
@Test
public void testSchemaValidationClient() throws Exception {
SchemaValidation validation = createService(Boolean.TRUE, "SoapPort");
runSchemaValidationTest(validation);
((java.io.Closeable) validation).close();
}
use of org.apache.schema_validation.SchemaValidation in project cxf by apache.
the class ValidationClientServerTest method createService.
private SchemaValidation createService(Object validationConfig, String postfix) throws Exception {
URL wsdl = getClass().getResource("/wsdl/schema_validation.wsdl");
assertNotNull(wsdl);
SchemaValidationService service = new SchemaValidationService(wsdl, serviceName);
assertNotNull(service);
SchemaValidation validation = service.getPort(portName, SchemaValidation.class);
setAddress(validation, "http://localhost:" + PORT + "/SoapContext/" + postfix);
((BindingProvider) validation).getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED, validationConfig);
((BindingProvider) validation).getResponseContext().put(Message.SCHEMA_VALIDATION_ENABLED, validationConfig);
new LoggingFeature().initialize((Client) validation, getBus());
return validation;
}
use of org.apache.schema_validation.SchemaValidation in project cxf by apache.
the class ValidationClientServerTest method testSchemaValidationServer.
@Test
public void testSchemaValidationServer() throws Exception {
SchemaValidation validation = createService(Boolean.FALSE, "SoapPortValidate");
runSchemaValidationTest(validation);
((java.io.Closeable) validation).close();
}
Aggregations