Search in sources :

Example 11 with PipeLine

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

the class IbisDebuggerAdvice method debugProvideOutputStream.

/**
 * Provides advice for {@link IOutputStreamingSupport#provideOutputStream(PipeLineSession session, IForwardTarget next)}
 */
public MessageOutputStream debugProvideOutputStream(ProceedingJoinPoint proceedingJoinPoint, PipeLineSession session) throws Throwable {
    if (!isEnabled()) {
        return (MessageOutputStream) proceedingJoinPoint.proceed();
    }
    String correlationId = session == null ? null : session.getMessageId();
    if (log.isDebugEnabled())
        log.debug("debugProvideOutputStream thread id [" + Thread.currentThread().getId() + "] thread name [" + Thread.currentThread().getName() + "] correlationId [" + correlationId + "]");
    if (proceedingJoinPoint.getTarget() instanceof ISender) {
        ISender sender = (ISender) proceedingJoinPoint.getTarget();
        // Use WriterPlaceHolder to make the contents that is later written to the MessageOutputStream appear as input of the Sender
        WriterPlaceHolder writerPlaceHolder = ibisDebugger.senderInput(sender, correlationId, new WriterPlaceHolder());
        MessageOutputStream resultStream = (MessageOutputStream) proceedingJoinPoint.proceed();
        String resultMessage = handleMessageOutputStream(writerPlaceHolder, resultStream);
        ibisDebugger.senderOutput(sender, correlationId, resultMessage);
        return resultStream;
    }
    if (proceedingJoinPoint.getTarget() instanceof IPipe) {
        IPipe pipe = (IPipe) proceedingJoinPoint.getTarget();
        PipeLine pipeLine = pipe instanceof AbstractPipe ? ((AbstractPipe) pipe).getPipeLine() : new PipeLine();
        // Use WriterPlaceHolder to make the contents that is later written to the MessageOutputStream appear as input of the Pipe
        WriterPlaceHolder writerPlaceHolder = ibisDebugger.pipeInput(pipeLine, pipe, correlationId, new WriterPlaceHolder());
        MessageOutputStream resultStream = (MessageOutputStream) proceedingJoinPoint.proceed();
        String resultMessage = handleMessageOutputStream(writerPlaceHolder, resultStream);
        ibisDebugger.pipeOutput(pipeLine, pipe, correlationId, resultMessage);
        return resultStream;
    }
    log.warn("Could not identify outputstream provider [" + proceedingJoinPoint.getTarget().getClass().getName() + "] as pipe or sender");
    return (MessageOutputStream) proceedingJoinPoint.proceed();
}
Also used : MessageOutputStream(nl.nn.adapterframework.stream.MessageOutputStream) AbstractPipe(nl.nn.adapterframework.pipes.AbstractPipe) ISender(nl.nn.adapterframework.core.ISender) PipeLine(nl.nn.adapterframework.core.PipeLine) IPipe(nl.nn.adapterframework.core.IPipe)

Example 12 with PipeLine

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

the class WsdlTest method includeXsdInWsdl.

@Test
public void includeXsdInWsdl() throws XMLStreamException, IOException, ParserConfigurationException, SAXException, ConfigurationException, URISyntaxException, NamingException {
    PipeLine simple = mockPipeLine(getXmlValidatorInstance("a", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), getXmlValidatorInstance("b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), "urn:webservice1", "IncludeXsds");
    WsdlGenerator wsdl = new WsdlGenerator(simple);
    wsdl.setUseIncludes(true);
    wsdl.init();
    test(wsdl, "WsdlTest/includexsds.test.wsdl");
}
Also used : PipeLine(nl.nn.adapterframework.core.PipeLine) XmlValidatorTest(nl.nn.adapterframework.pipes.XmlValidatorTest) Test(org.junit.Test)

Example 13 with PipeLine

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

the class WsdlTest method noroottagMixed.

@Test
public void noroottagMixed() throws XMLStreamException, IOException, SAXException, ParserConfigurationException, URISyntaxException, ConfigurationException, NamingException {
    XmlValidator inputValidator = getXmlValidatorInstance(null, "b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd");
    IValidator outputValidator = inputValidator.getResponseValidator();
    PipeLine simple = mockPipeLine(inputValidator, outputValidator, "urn:webservice1", "TestRootTag");
    WsdlGenerator wsdl = new WsdlGenerator(simple);
    wsdl.init();
    test(wsdl, "WsdlTest/noroottag.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 14 with PipeLine

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

the class WsdlTest method wubCalculateQuoteAndPolicyValuesLifeRetail.

@Test
public void wubCalculateQuoteAndPolicyValuesLifeRetail() throws XMLStreamException, IOException, SAXException, ParserConfigurationException, URISyntaxException, ConfigurationException, NamingException {
    PipeLine pipe = mockPipeLine(getXmlValidatorInstance("CalculationRequest", null, null, "http://wub2nn.nn.nl/CalculateQuoteAndPolicyValuesLifeRetail " + "WsdlTest/CalculateQuoteAndPolicyValuesLifeRetail/xsd/CalculationRequestv2.1.xsd"), getXmlValidatorInstance("CalculationResponse", null, null, "http://wub2nn.nn.nl/CalculateQuoteAndPolicyValuesLifeRetail_response " + "WsdlTest/CalculateQuoteAndPolicyValuesLifeRetail/xsd/CalculationRespons.xsd"), "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 : PipeLine(nl.nn.adapterframework.core.PipeLine) XmlValidatorTest(nl.nn.adapterframework.pipes.XmlValidatorTest) Test(org.junit.Test)

Example 15 with PipeLine

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

the class WsdlTest method basicMultipleRootTagsAllowed.

@Test
public void basicMultipleRootTagsAllowed() throws XMLStreamException, IOException, ParserConfigurationException, SAXException, ConfigurationException, URISyntaxException, NamingException {
    PipeLine simple = mockPipeLine(getXmlValidatorInstance("a,x,y", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), getXmlValidatorInstance("b,p,q", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), "urn:webservice1", "Test1");
    WsdlGenerator wsdl = new WsdlGenerator(simple);
    wsdl.init();
    test(wsdl, "WsdlTest/webservice1.test.wsdl");
}
Also used : PipeLine(nl.nn.adapterframework.core.PipeLine) XmlValidatorTest(nl.nn.adapterframework.pipes.XmlValidatorTest) Test(org.junit.Test)

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