Search in sources :

Example 1 with EchoPipe

use of nl.nn.adapterframework.pipes.EchoPipe in project iaf by ibissource.

the class PipeLineTest method testDirectWrapperPipeSuccessForward.

// Should add tests to assertThat(configuration.getConfigWarning(0), StringEndsWith.endsWith("] has no pipe forwards defined"));
@Test
public void testDirectWrapperPipeSuccessForward() throws ConfigurationException, PipeRunException {
    TestConfiguration configuration = new TestConfiguration();
    PipeLine pipeline = configuration.createBean(PipeLine.class);
    PipeForward pf = configuration.createBean(PipeForward.class);
    pf.setName("success");
    pf.setPath("nextPipe");
    PipeForward toExit = configuration.createBean(PipeForward.class);
    toExit.setName("success");
    toExit.setPath("EXIT");
    DirectWrapperPipe pipe = configuration.createBean(DirectWrapperPipe.class);
    pipe.setName("DirectWrapperPipe");
    pipe.registerForward(pf);
    pipeline.addPipe(pipe);
    EchoPipe echoPipe = configuration.createBean(EchoPipe.class);
    echoPipe.setName("nextPipe");
    echoPipe.setPipeLine(pipeline);
    echoPipe.registerForward(toExit);
    pipeline.addPipe(echoPipe);
    PipeLineExit exit = configuration.createBean(PipeLineExit.class);
    exit.setPath("exit");
    exit.setState(ExitState.SUCCESS);
    pipeline.registerPipeLineExit(exit);
    pipeline.setOwner(pipe);
    pipeline.configure();
    CorePipeProcessor cpp = configuration.createBean(CorePipeProcessor.class);
    PipeLineSession ps = configuration.createBean(PipeLineSession.class);
    PipeRunResult pipeRunResult = cpp.processPipe(pipeline, pipe, new Message("<dummy/>"), ps);
    PipeForward pipeForward = pipeRunResult.getPipeForward();
    IForwardTarget target = pipeline.resolveForward(pipe, pipeForward);
    assertNotNull(target);
    configuration.close();
    configuration = null;
}
Also used : Message(nl.nn.adapterframework.stream.Message) EchoPipe(nl.nn.adapterframework.pipes.EchoPipe) CorePipeProcessor(nl.nn.adapterframework.processors.CorePipeProcessor) TestConfiguration(nl.nn.adapterframework.testutil.TestConfiguration) DirectWrapperPipe(nl.nn.adapterframework.extensions.esb.DirectWrapperPipe) Test(org.junit.Test)

Example 2 with EchoPipe

use of nl.nn.adapterframework.pipes.EchoPipe in project iaf by ibissource.

the class ReceiverTest method setupAdapter.

public Adapter setupAdapter(Receiver<String> receiver) throws Exception {
    Adapter adapter = configuration.createBean(Adapter.class);
    adapter.setName("ReceiverTestAdapterName");
    PipeLine pl = new PipeLine();
    pl.setFirstPipe("dummy");
    EchoPipe pipe = new EchoPipe();
    pipe.setName("dummy");
    pl.addPipe(pipe);
    PipeLineExit ple = new PipeLineExit();
    ple.setPath("success");
    ple.setState(ExitState.SUCCESS);
    pl.registerPipeLineExit(ple);
    adapter.setPipeLine(pl);
    adapter.registerReceiver(receiver);
    configuration.registerAdapter(adapter);
    return adapter;
}
Also used : EchoPipe(nl.nn.adapterframework.pipes.EchoPipe) Adapter(nl.nn.adapterframework.core.Adapter) PipeLine(nl.nn.adapterframework.core.PipeLine) PipeLineExit(nl.nn.adapterframework.core.PipeLineExit)

Example 3 with EchoPipe

use of nl.nn.adapterframework.pipes.EchoPipe in project iaf by ibissource.

the class WsdlGeneratorTest method createPipeline.

private PipeLine createPipeline() throws Exception {
    EchoPipe pipe = new EchoPipe();
    pipe.registerForward(new PipeForward("success", null));
    pipe.setName(pipe.getClass().getSimpleName().concat("4WsdlGeneratorTest"));
    PipeLine pipeline = new PipeLine();
    pipeline.addPipe(pipe);
    PipeLineExit exit = new PipeLineExit();
    exit.setPath("exit");
    exit.setState(ExitState.SUCCESS);
    pipeline.registerPipeLineExit(exit);
    Adapter adapter = new Adapter();
    adapter.setName(pipe.getClass().getSimpleName().concat("4WsdlGeneratorTest"));
    adapter.setPipeLine(pipeline);
    pipeline.setAdapter(adapter);
    return pipeline;
}
Also used : EchoPipe(nl.nn.adapterframework.pipes.EchoPipe) Adapter(nl.nn.adapterframework.core.Adapter) PipeLine(nl.nn.adapterframework.core.PipeLine) PipeForward(nl.nn.adapterframework.core.PipeForward) PipeLineExit(nl.nn.adapterframework.core.PipeLineExit)

Example 4 with EchoPipe

use of nl.nn.adapterframework.pipes.EchoPipe in project iaf by ibissource.

the class PipeLineTest method testFixedForwardPipesWithNoForwardShouldDefaultToNextPipe.

@Test
public void testFixedForwardPipesWithNoForwardShouldDefaultToNextPipe() throws ConfigurationException {
    TestConfiguration configuration = new TestConfiguration();
    PipeLine pipeline = configuration.createBean(PipeLine.class);
    String pipeForwardName = "EchoPipe next pipe";
    EchoPipe pipe = configuration.createBean(EchoPipe.class);
    pipe.setName(pipe.getClass().getSimpleName() + " under test");
    pipe.setPipeLine(pipeline);
    pipeline.addPipe(pipe);
    EchoPipe pipe2 = configuration.createBean(EchoPipe.class);
    pipe2.setName(pipeForwardName);
    pipe2.setPipeLine(pipeline);
    pipeline.addPipe(pipe2);
    PipeLineExit exit = new PipeLineExit();
    exit.setPath("exit");
    exit.setState(ExitState.SUCCESS);
    pipeline.registerPipeLineExit(exit);
    pipeline.configure();
    assertTrue("pipe should not cause any configuration warnings", configuration.getConfigurationWarnings().getWarnings().isEmpty());
    assertEquals("pipe1 should only have 1 pipe-forward", 1, pipe.getForwards().size());
    assertEquals("pipe1 forward should default to next pipe", pipeForwardName, pipe.getForwards().get(PipeForward.SUCCESS_FORWARD_NAME).getPath());
    assertEquals("pipe2 should only have 1 pipe-forward", 1, pipe2.getForwards().size());
    assertEquals("pipe2 forward should default to pipeline-exit", "exit", pipe2.getForwards().get(PipeForward.SUCCESS_FORWARD_NAME).getPath());
    configuration.close();
    configuration = null;
}
Also used : EchoPipe(nl.nn.adapterframework.pipes.EchoPipe) TestConfiguration(nl.nn.adapterframework.testutil.TestConfiguration) Test(org.junit.Test)

Example 5 with EchoPipe

use of nl.nn.adapterframework.pipes.EchoPipe in project iaf by ibissource.

the class PipeLineTest method giveWarningWhenForwardToNonExistingPipe.

@Test
public void giveWarningWhenForwardToNonExistingPipe() throws ConfigurationException {
    TestConfiguration configuration = new TestConfiguration();
    PipeLine pipeline = configuration.createBean(PipeLine.class);
    String pipeForwardName = "EchoPipe next pipe";
    EchoPipe pipe = configuration.createBean(EchoPipe.class);
    pipe.setName(pipe.getClass().getSimpleName() + " under test");
    pipe.registerForward(new PipeForward("success", "the next pipe"));
    pipe.setPipeLine(pipeline);
    pipeline.addPipe(pipe);
    EchoPipe pipe2 = configuration.createBean(EchoPipe.class);
    pipe2.setName(pipeForwardName);
    pipe2.setPipeLine(pipeline);
    pipeline.addPipe(pipe2);
    PipeLineExit exit = new PipeLineExit();
    exit.setPath("special exit name");
    exit.setState(ExitState.SUCCESS);
    pipeline.registerPipeLineExit(exit);
    pipeline.configure();
    assertEquals("pipes should cause a configuration warning", 1, configuration.getConfigurationWarnings().getWarnings().size());
    assertThat(configuration.getConfigWarning(0), StringEndsWith.endsWith("] has a forward of which the pipe to execute [the next pipe] is not defined"));
    assertEquals("pipe1 should only have 1 pipe-forward", 1, pipe.getForwards().size());
    assertEquals("pipe1 forward should exist even though next pipe doesn't exist", "the next pipe", pipe.getForwards().get(PipeForward.SUCCESS_FORWARD_NAME).getPath());
    assertEquals("pipe2 should only have 1 pipe-forward", 1, pipe2.getForwards().size());
    assertEquals("pipe2 forward should default to pipeline-exit", "special exit name", pipe2.getForwards().get(PipeForward.SUCCESS_FORWARD_NAME).getPath());
    configuration.close();
    configuration = null;
}
Also used : EchoPipe(nl.nn.adapterframework.pipes.EchoPipe) TestConfiguration(nl.nn.adapterframework.testutil.TestConfiguration) Test(org.junit.Test)

Aggregations

EchoPipe (nl.nn.adapterframework.pipes.EchoPipe)8 TestConfiguration (nl.nn.adapterframework.testutil.TestConfiguration)5 Adapter (nl.nn.adapterframework.core.Adapter)4 PipeLine (nl.nn.adapterframework.core.PipeLine)4 PipeLineExit (nl.nn.adapterframework.core.PipeLineExit)4 Test (org.junit.Test)4 Message (nl.nn.adapterframework.stream.Message)2 URL (java.net.URL)1 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)1 PipeForward (nl.nn.adapterframework.core.PipeForward)1 PipeLineResult (nl.nn.adapterframework.core.PipeLineResult)1 PipeLineSession (nl.nn.adapterframework.core.PipeLineSession)1 DirectWrapperPipe (nl.nn.adapterframework.extensions.esb.DirectWrapperPipe)1 CorePipeProcessor (nl.nn.adapterframework.processors.CorePipeProcessor)1 DefaultIbisManager (nl.nn.adapterframework.unmanaged.DefaultIbisManager)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1