use of org.apache.openejb.config.ValidationFailure in project tomee by apache.
the class LightWeightMappingValidator method visit.
@Override
protected void visit(BindingFault bindingFault) {
SOAPBody body = getSOAPBody(bindingFault.getExtensibilityElements());
String encoding = body.getUse();
if (encoding == null || !encoding.equals("encoded")) {
context.addFailure(new ValidationFailure("The use attribute of the binding fault operation must be 'encoded': " + bindingFault.getName()));
}
}
use of org.apache.openejb.config.ValidationFailure in project tomee by apache.
the class InvokeMethod method evaluate.
@Override
public void evaluate() throws Throwable {
final Map<Integer, List<String>> expectedKeys = validateKeys();
setUp();
final Object obj = testMethod.invokeExplosively(target);
final String outputDescriptors = SystemInstance.get().getProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, "false");
try {
SystemInstance.get().setProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, "false");
ValidationContext vc = null;
if (obj instanceof EjbJar) {
final EjbJar ejbJar = (EjbJar) obj;
final EjbModule ejbModule = new EjbModule(ejbJar);
vc = ejbModule.getValidation();
assembler.createApplication(config.configureApplication(ejbModule));
} else if (obj instanceof EjbModule) {
final EjbModule ejbModule = (EjbModule) obj;
vc = ejbModule.getValidation();
assembler.createApplication(config.configureApplication(ejbModule));
} else if (obj instanceof AppModule) {
final AppModule appModule = (AppModule) obj;
vc = appModule.getValidation();
assembler.createApplication(config.configureApplication(appModule));
}
if (!isEmpty(expectedKeys)) {
if (vc != null && expectedKeys.get(KeyType.FAILURE).isEmpty() && expectedKeys.get(KeyType.ERROR).isEmpty()) {
if (!expectedKeys.get(KeyType.WARNING).isEmpty()) {
assertWarnings(expectedKeys.get(KeyType.WARNING), new ValidationFailedException("", vc));
}
} else {
fail("A ValidationFailedException should have been thrown");
}
}
} catch (final ValidationFailedException vfe) {
if (!isEmpty(expectedKeys)) {
if (!expectedKeys.get(KeyType.FAILURE).isEmpty()) {
assertFailures(expectedKeys.get(KeyType.FAILURE), vfe);
}
if (!expectedKeys.get(KeyType.WARNING).isEmpty()) {
assertWarnings(expectedKeys.get(KeyType.WARNING), vfe);
}
if (!expectedKeys.get(KeyType.ERROR).isEmpty()) {
assertErrors(expectedKeys.get(KeyType.ERROR), vfe);
}
} else {
for (final ValidationFailure failure : vfe.getFailures()) {
System.out.println("failure = " + failure.getMessageKey());
}
fail("There should be no validation failures");
}
} finally {
SystemInstance.get().setProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, outputDescriptors);
}
tearDown();
}
use of org.apache.openejb.config.ValidationFailure in project tomee by apache.
the class LightWeightMappingValidator method visit.
@Override
protected void visit(BindingOutput bindingOutput) {
SOAPBody body = getSOAPBody(bindingOutput.getExtensibilityElements());
String encoding = body.getUse();
if (encoding == null || !encoding.equals("encoded")) {
context.addFailure(new ValidationFailure("The use attribute of the binding output operation must be 'encoded': " + bindingOutput.getName()));
}
}
use of org.apache.openejb.config.ValidationFailure in project tomee by apache.
the class LightWeightMappingValidator method visit.
@Override
protected void visit(BindingInput bindingInput) {
SOAPBody body = getSOAPBody(bindingInput.getExtensibilityElements());
String encoding = body.getUse();
if (encoding == null || !encoding.equals("encoded")) {
context.addFailure(new ValidationFailure("The use attribute of the binding input operation must be 'encoded': " + bindingInput.getName()));
}
}
Aggregations