Search in sources :

Example 6 with IValidator

use of nl.nn.adapterframework.core.IValidator in project iaf by ibissource.

the class WsdlGeneratorUtils method canProvideWSDL.

// Check if the adapter has WebServiceListener with an InputValidator OR
// InputValidator==SoapValidator OR
// IXmlValidator.getSchema()!=NULL && webServiceListenerNamespace!=NULL
public static boolean canProvideWSDL(Adapter adapter) {
    boolean hasWebServiceListener = false;
    String webServiceListenerNamespace = null;
    for (IListener<?> listener : WsdlGeneratorUtils.getListeners(adapter)) {
        if (listener instanceof WebServiceListener) {
            hasWebServiceListener = true;
            webServiceListenerNamespace = ((WebServiceListener) listener).getServiceNamespaceURI();
        }
    }
    IValidator inputValidator = adapter.getPipeLine().getInputValidator();
    if (inputValidator instanceof SoapValidator) {
        // We have to check this first as the SoapValidator cannot use getSchema()
        return true;
    } else if (inputValidator instanceof IXmlValidator) {
        IXmlValidator xmlValidator = (IXmlValidator) inputValidator;
        if (xmlValidator.getSchema() != null) {
            return StringUtils.isNotEmpty(webServiceListenerNamespace);
        }
    }
    // If not an IXmlValidator, return false
    return hasWebServiceListener;
}
Also used : IXmlValidator(nl.nn.adapterframework.core.IXmlValidator) IValidator(nl.nn.adapterframework.core.IValidator) WebServiceListener(nl.nn.adapterframework.http.WebServiceListener)

Example 7 with IValidator

use of nl.nn.adapterframework.core.IValidator in project iaf by ibissource.

the class WsdlTest method wubCalculateQuoteAndPolicyValuesLifeRetailMixed.

@Test
public void wubCalculateQuoteAndPolicyValuesLifeRetailMixed() throws XMLStreamException, IOException, SAXException, ParserConfigurationException, URISyntaxException, ConfigurationException, NamingException {
    XmlValidator inputValidator = getXmlValidatorInstance("CalculationRequest", "CalculationResponse", null, "http://wub2nn.nn.nl/CalculateQuoteAndPolicyValuesLifeRetail WsdlTest/CalculateQuoteAndPolicyValuesLifeRetail/xsd/CalculationRequestv2.1.xsd " + "http://wub2nn.nn.nl/CalculateQuoteAndPolicyValuesLifeRetail_response  WsdlTest/CalculateQuoteAndPolicyValuesLifeRetail/xsd/CalculationRespons.xsd");
    IValidator outputValidator = inputValidator.getResponseValidator();
    PipeLine pipe = mockPipeLine(inputValidator, outputValidator, "http://wub2nn.nn.nl/CalculateQuoteAndPolicyValuesLifeRetail", "WsdlTest/CalculateQuoteAndPolicyValuesLifeRetail");
    WsdlGenerator wsdl = new WsdlGenerator(pipe);
    wsdl.init();
    wsdl.setUseIncludes(true);
    test(wsdl, "WsdlTest/CalculateQuoteAndPolicyValuesLifeRetail.test.wsdl");
}
Also used : XmlValidator(nl.nn.adapterframework.pipes.XmlValidator) AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) IValidator(nl.nn.adapterframework.core.IValidator) PipeLine(nl.nn.adapterframework.core.PipeLine) XmlValidatorTest(nl.nn.adapterframework.pipes.XmlValidatorTest) Test(org.junit.Test)

Example 8 with IValidator

use of nl.nn.adapterframework.core.IValidator in project iaf by ibissource.

the class WsdlTest method wubFindIntermediaryMixed.

@Test
public void wubFindIntermediaryMixed() throws XMLStreamException, IOException, SAXException, ParserConfigurationException, URISyntaxException, ConfigurationException, NamingException {
    XmlValidator inputValidator = getXmlValidatorInstance("FindIntermediaryREQ", "FindIntermediaryRLY", null, "http://wub2nn.nn.nl/FindIntermediary WsdlTest/FindIntermediary/xsd/XSD_FindIntermediary_v1.1_r1.0.xsd");
    IValidator outputValidator = inputValidator.getResponseValidator();
    PipeLine pipe = mockPipeLine(inputValidator, outputValidator, "http://wub2nn.nn.nl/FindIntermediary", "WsdlTest/FindIntermediary");
    WsdlGenerator wsdl = new WsdlGenerator(pipe);
    wsdl.setUseIncludes(true);
    wsdl.init();
    assertTrue(wsdl.isUseIncludes());
    test(wsdl, "WsdlTest/FindIntermediary.test.wsdl");
    zip(wsdl);
// assertEquals(2, wsdl.getXSDs(true).size()); TODO?
}
Also used : XmlValidator(nl.nn.adapterframework.pipes.XmlValidator) AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) IValidator(nl.nn.adapterframework.core.IValidator) PipeLine(nl.nn.adapterframework.core.PipeLine) XmlValidatorTest(nl.nn.adapterframework.pipes.XmlValidatorTest) Test(org.junit.Test)

Example 9 with IValidator

use of nl.nn.adapterframework.core.IValidator in project iaf by ibissource.

the class WsdlTest method basicMixed.

@Test
public void basicMixed() throws XMLStreamException, IOException, ParserConfigurationException, SAXException, ConfigurationException, URISyntaxException, NamingException {
    XmlValidator inputValidator = getXmlValidatorInstance("a", "b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd");
    IValidator outputValidator = inputValidator.getResponseValidator();
    PipeLine simple = mockPipeLine(inputValidator, outputValidator, "urn:webservice1", "Test1");
    WsdlGenerator wsdl = new WsdlGenerator(simple);
    wsdl.init();
    test(wsdl, "WsdlTest/webservice1.test.wsdl");
}
Also used : XmlValidator(nl.nn.adapterframework.pipes.XmlValidator) AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) IValidator(nl.nn.adapterframework.core.IValidator) PipeLine(nl.nn.adapterframework.core.PipeLine) XmlValidatorTest(nl.nn.adapterframework.pipes.XmlValidatorTest) Test(org.junit.Test)

Example 10 with IValidator

use of nl.nn.adapterframework.core.IValidator in project iaf by ibissource.

the class InputOutputPipeProcessorTest method setUp.

@Before
public void setUp() {
    processor = new InputOutputPipeProcessor();
    PipeProcessor chain = new PipeProcessor() {

        @Override
        public PipeRunResult processPipe(PipeLine pipeLine, IPipe pipe, Message message, PipeLineSession pipeLineSession) throws PipeRunException {
            return pipe.doPipe(message, pipeLineSession);
        }

        @Override
        public PipeRunResult validate(PipeLine pipeLine, IValidator validator, Message message, PipeLineSession pipeLineSession, String messageRoot) throws PipeRunException {
            return validator.validate(message, pipeLineSession, messageRoot);
        }
    };
    processor.setPipeProcessor(chain);
    pipeLine = new PipeLine();
    Adapter owner = new Adapter();
    owner.setName("PipeLine owner");
    pipeLine.setOwner(owner);
    session = new PipeLineSession();
}
Also used : Message(nl.nn.adapterframework.stream.Message) IValidator(nl.nn.adapterframework.core.IValidator) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) Adapter(nl.nn.adapterframework.core.Adapter) PipeLine(nl.nn.adapterframework.core.PipeLine) IPipe(nl.nn.adapterframework.core.IPipe) Before(org.junit.Before)

Aggregations

IValidator (nl.nn.adapterframework.core.IValidator)10 PipeLine (nl.nn.adapterframework.core.PipeLine)6 XmlValidator (nl.nn.adapterframework.pipes.XmlValidator)5 XmlValidatorTest (nl.nn.adapterframework.pipes.XmlValidatorTest)5 AbstractXmlValidator (nl.nn.adapterframework.validation.AbstractXmlValidator)5 JavaxXmlValidator (nl.nn.adapterframework.validation.JavaxXmlValidator)5 XercesXmlValidator (nl.nn.adapterframework.validation.XercesXmlValidator)5 Test (org.junit.Test)5 Message (nl.nn.adapterframework.stream.Message)3 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)2 IPipe (nl.nn.adapterframework.core.IPipe)2 PipeForward (nl.nn.adapterframework.core.PipeForward)2 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)2 IOException (java.io.IOException)1 URL (java.net.URL)1 TransformerException (javax.xml.transform.TransformerException)1 IbisManager (nl.nn.adapterframework.configuration.IbisManager)1 Adapter (nl.nn.adapterframework.core.Adapter)1 HasPhysicalDestination (nl.nn.adapterframework.core.HasPhysicalDestination)1 IAdapter (nl.nn.adapterframework.core.IAdapter)1