Search in sources :

Example 71 with Channel

use of com.adaptris.core.Channel in project interlok by adaptris.

the class WorkflowLifecycleStrategyCase method testStopNoStrategy.

@Test
public void testStopNoStrategy() throws Exception {
    WorkflowList wfl = new WorkflowList();
    wfl.add(createWorkflow(idGenerator.create(wfl)));
    Channel c = createChannel(wfl);
    c.requestStart();
    c.requestStop();
}
Also used : WorkflowList(com.adaptris.core.WorkflowList) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 72 with Channel

use of com.adaptris.core.Channel in project interlok by adaptris.

the class WorkflowLifecycleStrategyCase method createChannel.

protected Channel createChannel(WorkflowList wfl) throws Exception {
    Channel channel = new MockChannel();
    channel.setWorkflowList(wfl);
    channel.prepare();
    return channel;
}
Also used : MockChannel(com.adaptris.core.stubs.MockChannel) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel)

Example 73 with Channel

use of com.adaptris.core.Channel in project interlok by adaptris.

the class WorkflowLifecycleStrategyCase method testCloseNoStrategy.

@Test
public void testCloseNoStrategy() throws Exception {
    WorkflowList wfl = new WorkflowList();
    wfl.add(createWorkflow(idGenerator.create(wfl)));
    Channel c = createChannel(wfl);
    c.requestStart();
    c.requestClose();
}
Also used : WorkflowList(com.adaptris.core.WorkflowList) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 74 with Channel

use of com.adaptris.core.Channel in project interlok by adaptris.

the class WorkflowLifecycleStrategyCase method testClose.

@Test
public void testClose() throws Exception {
    WorkflowList wfl = new WorkflowList();
    wfl.add(createWorkflow(idGenerator.create(wfl)));
    wfl.setLifecycleStrategy(createStrategy());
    Channel c = createChannel(wfl);
    c.requestStart();
    c.requestClose();
}
Also used : WorkflowList(com.adaptris.core.WorkflowList) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 75 with Channel

use of com.adaptris.core.Channel in project interlok by adaptris.

the class WorkflowRetryAndFailTest method testFailedStart_ExceedsMax.

@Override
@Test
public void testFailedStart_ExceedsMax() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndFail strategy = new WorkflowRetryAndFail(2, new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailStart workflow = new FailStart(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestInit();
    try {
        c.requestStart();
    } catch (CoreException expected) {
    }
    // That's right 1 + 2 retries.
    assertEquals(3, workflow.getAttempts());
    assertEquals(InitialisedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) CoreException(com.adaptris.core.CoreException) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Aggregations

Channel (com.adaptris.core.Channel)322 Test (org.junit.Test)276 Adapter (com.adaptris.core.Adapter)136 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)125 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)122 StandardWorkflow (com.adaptris.core.StandardWorkflow)111 ObjectName (javax.management.ObjectName)97 ArrayList (java.util.ArrayList)74 StandaloneProducer (com.adaptris.core.StandaloneProducer)64 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)57 JettyHelper.createChannel (com.adaptris.core.http.jetty.JettyHelper.createChannel)52 Workflow (com.adaptris.core.Workflow)44 MockChannel (com.adaptris.core.stubs.MockChannel)43 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)37 TimeInterval (com.adaptris.util.TimeInterval)36 HttpConsumerTest (com.adaptris.core.http.jetty.HttpConsumerTest)35 StaticMockMessageProducer (com.adaptris.core.stubs.StaticMockMessageProducer)35 ServiceList (com.adaptris.core.ServiceList)31 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)30 CoreException (com.adaptris.core.CoreException)29