Search in sources :

Example 1 with WorkflowImp

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

the class ExampleWorkflowCase method testRegisterObjects.

@Test
public void testRegisterObjects() throws Exception {
    WorkflowImp wf = createWorkflowForGenericTests();
    wf.registerChannel(new Channel());
    try {
        wf.registerChannel(null);
        fail();
    } catch (IllegalArgumentException e) {
        ;
    }
    wf.registerActiveMsgErrorHandler(new NullProcessingExceptionHandler());
    try {
        wf.registerActiveMsgErrorHandler(null);
        fail();
    } catch (IllegalArgumentException e) {
        ;
    }
    wf.registerActiveMsgErrorHandler(new NullProcessingExceptionHandler());
    try {
        wf.registerActiveMsgErrorHandler(null);
        fail();
    } catch (IllegalArgumentException e) {
        ;
    }
    wf.registerEventHandler(new DefaultEventHandler());
    try {
        wf.registerEventHandler(null);
        fail();
    } catch (IllegalArgumentException e) {
        ;
    }
}
Also used : DefaultEventHandler(com.adaptris.core.DefaultEventHandler) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) WorkflowImp(com.adaptris.core.WorkflowImp) NullProcessingExceptionHandler(com.adaptris.core.NullProcessingExceptionHandler) Test(org.junit.Test)

Example 2 with WorkflowImp

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

the class ExampleWorkflowCase method testSetProduceExceptionHandler.

@Test
public void testSetProduceExceptionHandler() throws Exception {
    WorkflowImp wf = createWorkflowForGenericTests();
    assertNull(wf.getProduceExceptionHandler());
    ProduceExceptionHandler obj = new NullProduceExceptionHandler();
    wf.setProduceExceptionHandler(obj);
    assertEquals(obj, wf.getProduceExceptionHandler());
}
Also used : NullProduceExceptionHandler(com.adaptris.core.NullProduceExceptionHandler) NullProduceExceptionHandler(com.adaptris.core.NullProduceExceptionHandler) ProduceExceptionHandler(com.adaptris.core.ProduceExceptionHandler) WorkflowImp(com.adaptris.core.WorkflowImp) Test(org.junit.Test)

Example 3 with WorkflowImp

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

the class ExampleWorkflowCase method testSetInterceptors.

@Test
public void testSetInterceptors() throws Exception {
    WorkflowImp wf = createWorkflowForGenericTests();
    wf.setInterceptors(new ArrayList(Arrays.asList(new WorkflowInterceptor[] { new MockWorkflowInterceptor() })));
    assertEquals(1, wf.getInterceptors().size());
    try {
        wf.addInterceptor(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    assertEquals(1, wf.getInterceptors().size());
    wf.addInterceptor(new MockWorkflowInterceptor());
    assertEquals(2, wf.getInterceptors().size());
    try {
        wf.setInterceptors(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    assertEquals(2, wf.getInterceptors().size());
}
Also used : ArrayList(java.util.ArrayList) MockWorkflowInterceptor(com.adaptris.core.stubs.MockWorkflowInterceptor) WorkflowImp(com.adaptris.core.WorkflowImp) Test(org.junit.Test)

Example 4 with WorkflowImp

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

the class BasicJettyConsumer method submitToWorkflow.

private boolean submitToWorkflow(AdaptrisMessage msg) {
    boolean waitForCompletion = false;
    if (retrieveAdaptrisMessageListener() instanceof WorkflowImp) {
        List<WorkflowInterceptor> interceptors = ((WorkflowImp) retrieveAdaptrisMessageListener()).getInterceptors();
        for (WorkflowInterceptor i : interceptors) {
            if (JettyWorkflowInterceptorImpl.class.isAssignableFrom(i.getClass())) {
                waitForCompletion = true;
                break;
            }
        }
    }
    retrieveAdaptrisMessageListener().onAdaptrisMessage(msg);
    return waitForCompletion;
}
Also used : WorkflowInterceptor(com.adaptris.core.WorkflowInterceptor) WorkflowImp(com.adaptris.core.WorkflowImp)

Example 5 with WorkflowImp

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

the class ExampleWorkflowCase method testSetSendEvents.

@Test
public void testSetSendEvents() throws Exception {
    WorkflowImp wf = createWorkflowForGenericTests();
    assertNull(wf.getSendEvents());
    assertTrue(wf.sendEvents());
    wf.setSendEvents(Boolean.FALSE);
    assertNotNull(wf.getSendEvents());
    assertEquals(Boolean.FALSE, wf.getSendEvents());
    assertEquals(false, wf.sendEvents());
    wf.setSendEvents(null);
    assertNull(wf.getSendEvents());
    assertTrue(wf.sendEvents());
}
Also used : WorkflowImp(com.adaptris.core.WorkflowImp) Test(org.junit.Test)

Aggregations

WorkflowImp (com.adaptris.core.WorkflowImp)10 Test (org.junit.Test)9 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 AdaptrisMessageConsumer (com.adaptris.core.AdaptrisMessageConsumer)1 AdaptrisMessageProducer (com.adaptris.core.AdaptrisMessageProducer)1 Channel (com.adaptris.core.Channel)1 DefaultEventHandler (com.adaptris.core.DefaultEventHandler)1 NullProcessingExceptionHandler (com.adaptris.core.NullProcessingExceptionHandler)1 NullProduceExceptionHandler (com.adaptris.core.NullProduceExceptionHandler)1 ProduceExceptionHandler (com.adaptris.core.ProduceExceptionHandler)1 ServiceCollection (com.adaptris.core.ServiceCollection)1 WorkflowInterceptor (com.adaptris.core.WorkflowInterceptor)1 MockChannel (com.adaptris.core.stubs.MockChannel)1 MockWorkflowInterceptor (com.adaptris.core.stubs.MockWorkflowInterceptor)1 PayloadMessageLogger (com.adaptris.core.util.PayloadMessageLogger)1 TimeInterval (com.adaptris.util.TimeInterval)1 ArrayList (java.util.ArrayList)1