Search in sources :

Example 11 with WorkflowList

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

the class WorkflowRetryAndContinueTest method testFailedStart_Retries_Infinite.

@Test
public void testFailedStart_Retries_Infinite() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndContinue strategy = createStrategy();
    strategy.setMaxRetries(-1);
    strategy.setWaitBetweenRetries(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailStart workflow = new FailStart(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestStart();
    assertEquals(4, workflow.getAttempts());
    assertEquals(StartedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 12 with WorkflowList

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

the class WorkflowRetryAndContinueTest method testFailedInitialise_ExceedsMax.

@Test
public void testFailedInitialise_ExceedsMax() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndContinue strategy = createStrategy();
    strategy.setMaxRetries(2);
    strategy.setWaitBetweenRetries(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailInit workflow = new FailInit(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestInit();
    assertEquals(ClosedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 13 with WorkflowList

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

the class WorkflowRetryAndContinueTest method testFailedInitialise_Retries_Infinite.

@Test
public void testFailedInitialise_Retries_Infinite() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndContinue strategy = createStrategy();
    strategy.setMaxRetries(-1);
    strategy.setWaitBetweenRetries(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailInit workflow = new FailInit(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestInit();
    assertEquals(4, workflow.getAttempts());
    assertEquals(InitialisedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 14 with WorkflowList

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

the class WorkflowRetryAndContinueTest method testFailedStart_ExceedsMax.

@Test
public void testFailedStart_ExceedsMax() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndContinue strategy = createStrategy();
    strategy.setMaxRetries(2);
    strategy.setWaitBetweenRetries(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailStart workflow = new FailStart(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestStart();
    assertEquals(InitialisedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 15 with WorkflowList

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

the class WorkflowRetryAndContinueTest method testFailedStart_Retries.

@Test
public void testFailedStart_Retries() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndContinue strategy = createStrategy();
    strategy.setMaxRetries(10);
    strategy.setWaitBetweenRetries(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailStart workflow = new FailStart(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestStart();
    assertEquals(4, workflow.getAttempts());
    assertEquals(StartedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Aggregations

WorkflowList (com.adaptris.core.WorkflowList)16 Test (org.junit.Test)16 Channel (com.adaptris.core.Channel)12 TimeInterval (com.adaptris.util.TimeInterval)8 MockChannel (com.adaptris.core.stubs.MockChannel)4 CoreException (com.adaptris.core.CoreException)2