use of org.apache.schema_validation.types.SomeResponse in project cxf by apache.
the class ValidationClientServerTest method assertIgnoredResponseValidation.
private void assertIgnoredResponseValidation(Object validationConfig) throws Exception {
SchemaValidation service = createService(validationConfig);
// the request will result in invalid response but validation is turned off
SomeResponse response = execute(service, "1234567890");
assertEquals(response.getTransactionId(), "aaaaaaaaaaxxx");
((java.io.Closeable) service).close();
}
use of org.apache.schema_validation.types.SomeResponse in project cxf by apache.
the class ValidationClientServerTest method assertIgnoredRequestValidation.
private void assertIgnoredRequestValidation(Object validationConfig) throws Exception {
SchemaValidation service = createService(validationConfig);
// this is an invalid request but validation is turned off.
SomeResponse response = execute(service, "1234567890aaaa");
assertEquals(response.getTransactionId(), "aaaaaaaaaa");
((java.io.Closeable) service).close();
}
use of org.apache.schema_validation.types.SomeResponse in project cxf by apache.
the class ValidationClientServerTest method assertFailureResponseValidation.
private void assertFailureResponseValidation(Object validationConfig) throws Exception {
SchemaValidation service = createService(validationConfig);
// valid request
SomeResponse response = execute(service, "1111111111");
assertEquals(response.getTransactionId(), "aaaaaaaaaa");
try {
// valid request, but will result in invalid response
execute(service, "1234567890");
fail("should catch marshall exception as the invalid incoming message per schema");
} catch (Exception e) {
assertTrue(e.getMessage().contains("Unmarshalling Error"));
assertTrue(e.getMessage().contains("is not facet-valid with respect to pattern"));
}
((java.io.Closeable) service).close();
}
use of org.apache.schema_validation.types.SomeResponse 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.types.SomeResponse in project cxf by apache.
the class SchemaValidationImpl method doSomething.
@Override
public SomeResponse doSomething(SomeRequest in) throws DoSomethingFault {
SomeResponse response = new SomeResponse();
if (in.getId().equals("1234567890")) {
// invalid transaction id
response.setTransactionId("aaaaaaaaaaxxx");
} else if (in.getId().equals("9999999999")) {
SomeFault someFault = new SomeFault();
someFault.setErrorCode("1234");
throw new DoSomethingFault("Fault", someFault);
} else if (in.getId().equals("8888888888")) {
SomeFault someFault = new SomeFault();
someFault.setErrorCode("1");
throw new DoSomethingFault("Fault", someFault);
} else {
response.setTransactionId("aaaaaaaaaa");
}
return response;
}
Aggregations