Search in sources :

Example 6 with IForwardTarget

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

the class MessageStreamCapTest method testStringCap.

@Test
public void testStringCap() throws Exception {
    INamedObject owner = new Owner();
    IForwardTarget forward = null;
    String responseMessage = "fakeResponseMessage";
    StringWriter captureWriter = null;
    try (MessageOutputStreamCap cap = new MessageOutputStreamCap(owner, forward)) {
        captureWriter = cap.captureCharacterStream();
        try (Writer capWriter = cap.asWriter()) {
            Object capNative = cap.asNative();
            assertEquals(capWriter.getClass(), capNative.getClass());
            assertEquals(capWriter, capNative);
            capWriter.write(responseMessage);
        }
        PipeRunResult result = cap.getPipeRunResult();
        assertEquals(responseMessage, result.getResult().asString());
    }
    assertEquals(responseMessage, captureWriter.toString());
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) StringWriter(java.io.StringWriter) INamedObject(nl.nn.adapterframework.core.INamedObject) IForwardTarget(nl.nn.adapterframework.core.IForwardTarget) INamedObject(nl.nn.adapterframework.core.INamedObject) StringWriter(java.io.StringWriter) Writer(java.io.Writer) Test(org.junit.Test)

Aggregations

IForwardTarget (nl.nn.adapterframework.core.IForwardTarget)6 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)6 StringWriter (java.io.StringWriter)4 INamedObject (nl.nn.adapterframework.core.INamedObject)4 Test (org.junit.Test)4 Writer (java.io.Writer)3 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)2 PipeForward (nl.nn.adapterframework.core.PipeForward)2 PipeRunException (nl.nn.adapterframework.core.PipeRunException)2 Message (nl.nn.adapterframework.stream.Message)2 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 TransformerException (javax.xml.transform.TransformerException)1 IbisManager (nl.nn.adapterframework.configuration.IbisManager)1 IAdapter (nl.nn.adapterframework.core.IAdapter)1 IPipe (nl.nn.adapterframework.core.IPipe)1 IPipeLineExitHandler (nl.nn.adapterframework.core.IPipeLineExitHandler)1 IValidator (nl.nn.adapterframework.core.IValidator)1 ExitState (nl.nn.adapterframework.core.PipeLine.ExitState)1 PipeLineExit (nl.nn.adapterframework.core.PipeLineExit)1