Search in sources :

Example 6 with WorkflowList

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

the class WorkflowLifecycleStrategyCase method testStartNoStrategy.

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

Example 7 with WorkflowList

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

the class WorkflowLifecycleStrategyCase method testInit.

@Test
public void testInit() throws Exception {
    WorkflowList wfl = new WorkflowList();
    wfl.add(createWorkflow(idGenerator.create(wfl)));
    wfl.setLifecycleStrategy(createStrategy());
    createChannel(wfl).requestInit();
}
Also used : WorkflowList(com.adaptris.core.WorkflowList) Test(org.junit.Test)

Example 8 with WorkflowList

use of com.adaptris.core.WorkflowList 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)

Example 9 with WorkflowList

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

the class WorkflowRetryAndFailTest method testFailedInitialise_ExceedsMax.

@Override
@Test
public void testFailedInitialise_ExceedsMax() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndFail strategy = new WorkflowRetryAndFail(2, new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailInit workflow = new FailInit(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    try {
        c.requestInit();
    } catch (CoreException expected) {
    }
    // That's right 1 + 2 retries.
    assertEquals(3, workflow.getAttempts());
    assertEquals(ClosedState.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)

Example 10 with WorkflowList

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

the class WorkflowRetryAndContinueTest method testFailedInitialise_Retries.

@Test
public void testFailedInitialise_Retries() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndContinue strategy = createStrategy();
    strategy.setMaxRetries(10);
    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)

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