Search in sources :

Example 1 with ValidationFailure

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()));
    }
}
Also used : SOAPBody(javax.wsdl.extensions.soap.SOAPBody) ValidationFailure(org.apache.openejb.config.ValidationFailure)

Example 2 with ValidationFailure

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();
}
Also used : AppModule(org.apache.openejb.config.AppModule) ValidationFailedException(org.apache.openejb.config.ValidationFailedException) EjbModule(org.apache.openejb.config.EjbModule) ArrayList(java.util.ArrayList) List(java.util.List) ValidationContext(org.apache.openejb.config.ValidationContext) EjbJar(org.apache.openejb.jee.EjbJar) ValidationFailure(org.apache.openejb.config.ValidationFailure)

Example 3 with ValidationFailure

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()));
    }
}
Also used : SOAPBody(javax.wsdl.extensions.soap.SOAPBody) ValidationFailure(org.apache.openejb.config.ValidationFailure)

Example 4 with ValidationFailure

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()));
    }
}
Also used : SOAPBody(javax.wsdl.extensions.soap.SOAPBody) ValidationFailure(org.apache.openejb.config.ValidationFailure)

Aggregations

ValidationFailure (org.apache.openejb.config.ValidationFailure)4 SOAPBody (javax.wsdl.extensions.soap.SOAPBody)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AppModule (org.apache.openejb.config.AppModule)1 EjbModule (org.apache.openejb.config.EjbModule)1 ValidationContext (org.apache.openejb.config.ValidationContext)1 ValidationFailedException (org.apache.openejb.config.ValidationFailedException)1 EjbJar (org.apache.openejb.jee.EjbJar)1