Search in sources :

Example 1 with OutOfStateHandler

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

the class ExampleServiceCase method assertDefaults.

protected void assertDefaults(Service s, boolean assertBranching) throws Exception {
    if (assertBranching) {
        if (s instanceof BranchingServiceImp) {
            assertTrue(s.getClass().getName(), s.isBranching());
        } else {
            assertFalse(s.getClass().getName(), s.isBranching());
        }
    }
    assertFalse(s.getClass().getName(), s.isTrackingEndpoint());
    assertFalse(s.getClass().getName(), s.continueOnFailure());
    if (s instanceof ServiceImp) {
        ((ServiceImp) s).setIsTrackingEndpoint(true);
        assertEquals(Boolean.TRUE, ((ServiceImp) s).getIsTrackingEndpoint());
        ((ServiceImp) s).setContinueOnFail(true);
        assertEquals(Boolean.TRUE, ((ServiceImp) s).getContinueOnFail());
    }
    if (s instanceof ServiceCollectionImp) {
        ((ServiceCollectionImp) s).setContinueOnFail(true);
        assertEquals(Boolean.TRUE, ((ServiceCollectionImp) s).getContinueOnFail());
        ((ServiceCollectionImp) s).setIsTrackingEndpoint(true);
        assertEquals(Boolean.TRUE, ((ServiceCollectionImp) s).getIsTrackingEndpoint());
        ((ServiceCollectionImp) s).setRestartAffectedServiceOnException(Boolean.TRUE);
        assertEquals(Boolean.TRUE, ((ServiceCollectionImp) s).getRestartAffectedServiceOnException());
        OutOfStateHandler handler = new RaiseExceptionOutOfStateHandler();
        ((ServiceCollectionImp) s).setOutOfStateHandler(handler);
        assertEquals(handler, ((ServiceCollectionImp) s).getOutOfStateHandler());
    }
}
Also used : RaiseExceptionOutOfStateHandler(com.adaptris.core.RaiseExceptionOutOfStateHandler) BranchingServiceImp(com.adaptris.core.BranchingServiceImp) ServiceImp(com.adaptris.core.ServiceImp) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) BranchingServiceImp(com.adaptris.core.BranchingServiceImp) RaiseExceptionOutOfStateHandler(com.adaptris.core.RaiseExceptionOutOfStateHandler) OutOfStateHandler(com.adaptris.core.OutOfStateHandler)

Aggregations

BranchingServiceImp (com.adaptris.core.BranchingServiceImp)1 OutOfStateHandler (com.adaptris.core.OutOfStateHandler)1 RaiseExceptionOutOfStateHandler (com.adaptris.core.RaiseExceptionOutOfStateHandler)1 ServiceCollectionImp (com.adaptris.core.ServiceCollectionImp)1 ServiceImp (com.adaptris.core.ServiceImp)1