Search in sources :

Example 41 with PipeLine

use of nl.nn.adapterframework.core.PipeLine 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 42 with PipeLine

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

the class WsdlTest method mockPipeLine.

protected PipeLine mockPipeLine(IValidator inputValidator, IValidator outputValidator, String targetNamespace, String adapterName) {
    PipeLine simple = mock(PipeLine.class);
    when(simple.getInputValidator()).thenReturn(inputValidator);
    when(simple.getOutputValidator()).thenReturn(outputValidator);
    Adapter adp = mock(Adapter.class);
    when(simple.getAdapter()).thenReturn(adp);
    Configuration cfg = mock(Configuration.class);
    when(simple.getAdapter().getConfiguration()).thenReturn(cfg);
    final Receiver receiverBase = mock(Receiver.class);
    WebServiceListener listener = new WebServiceListener();
    listener.setServiceNamespaceURI(targetNamespace);
    when(receiverBase.getListener()).thenReturn(listener);
    when(adp.getReceivers()).thenAnswer(new Answer<Iterable<Receiver>>() {

        public Iterable<Receiver> answer(InvocationOnMock invocation) throws Throwable {
            return Arrays.asList(receiverBase);
        }
    });
    when(adp.getName()).thenReturn(adapterName);
    when(cfg.getClassLoader()).thenReturn(this.getClass().getClassLoader());
    when(adp.getConfigurationClassLoader()).thenReturn(this.getClass().getClassLoader());
    when(simple.getConfigurationClassLoader()).thenReturn(this.getClass().getClassLoader());
    return simple;
}
Also used : Configuration(nl.nn.adapterframework.configuration.Configuration) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Receiver(nl.nn.adapterframework.receivers.Receiver) Adapter(nl.nn.adapterframework.core.Adapter) PipeLine(nl.nn.adapterframework.core.PipeLine) WebServiceListener(nl.nn.adapterframework.http.WebServiceListener)

Example 43 with PipeLine

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

the class ApiServiceDispatcher method mapRequest.

private void mapRequest(IAdapter adapter, MediaTypes consumes, JsonObjectBuilder methodBuilder) {
    PipeLine pipeline = adapter.getPipeLine();
    Json2XmlValidator inputValidator = getJsonValidator(pipeline, false);
    if (inputValidator != null && StringUtils.isNotEmpty(inputValidator.getRoot())) {
        JsonObjectBuilder requestBodyContent = Json.createObjectBuilder();
        JsonObjectBuilder schemaBuilder = Json.createObjectBuilder().add("schema", Json.createObjectBuilder().add("$ref", SCHEMA_DEFINITION_PATH + inputValidator.getRoot()));
        requestBodyContent.add("content", Json.createObjectBuilder().add(consumes.getContentType(), schemaBuilder));
        methodBuilder.add("requestBody", requestBodyContent);
    }
}
Also used : Json2XmlValidator(nl.nn.adapterframework.pipes.Json2XmlValidator) PipeLine(nl.nn.adapterframework.core.PipeLine) JsonObjectBuilder(javax.json.JsonObjectBuilder)

Aggregations

PipeLine (nl.nn.adapterframework.core.PipeLine)43 Adapter (nl.nn.adapterframework.core.Adapter)19 Test (org.junit.Test)17 XmlValidatorTest (nl.nn.adapterframework.pipes.XmlValidatorTest)12 IPipe (nl.nn.adapterframework.core.IPipe)10 PipeLineExit (nl.nn.adapterframework.core.PipeLineExit)8 MessageSendingPipe (nl.nn.adapterframework.pipes.MessageSendingPipe)8 IOException (java.io.IOException)6 IValidator (nl.nn.adapterframework.core.IValidator)6 XmlValidator (nl.nn.adapterframework.pipes.XmlValidator)6 Configuration (nl.nn.adapterframework.configuration.Configuration)5 PipeForward (nl.nn.adapterframework.core.PipeForward)5 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)5 Message (nl.nn.adapterframework.stream.Message)5 AbstractXmlValidator (nl.nn.adapterframework.validation.AbstractXmlValidator)5 JavaxXmlValidator (nl.nn.adapterframework.validation.JavaxXmlValidator)5 XercesXmlValidator (nl.nn.adapterframework.validation.XercesXmlValidator)5 ArrayList (java.util.ArrayList)4 Iterator (java.util.Iterator)4 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)4