Search in sources :

Example 1 with ServiceCollectionImp

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

the class ServiceCollectionCase method testLastIndexOf.

@Test
public void testLastIndexOf() throws Exception {
    ServiceCollectionImp sc = createServiceCollection();
    sc.addService(new NullService(UUID.randomUUID().toString()));
    WaitService s = new WaitService(UUID.randomUUID().toString());
    sc.addService(new NullService(UUID.randomUUID().toString()));
    sc.addService(s);
    assertEquals(2, sc.lastIndexOf(s));
}
Also used : WaitService(com.adaptris.core.services.WaitService) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 2 with ServiceCollectionImp

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

the class ServiceCollectionCase method testCreateName.

@Test
public void testCreateName() {
    ServiceCollectionImp sc = createServiceCollection();
    assertEquals(sc.getClass().getName(), sc.createName());
}
Also used : ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) Test(org.junit.Test)

Example 3 with ServiceCollectionImp

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

the class ServiceCollectionCase method testContinueOnFail.

@Test
public void testContinueOnFail() throws Exception {
    ServiceCollectionImp sc = createServiceCollection();
    assertNull(sc.getContinueOnFail());
    assertEquals(false, sc.continueOnFailure());
    sc.setContinueOnFail(Boolean.TRUE);
    assertEquals(Boolean.TRUE, sc.getContinueOnFail());
    assertEquals(true, sc.continueOnFailure());
    sc.setContinueOnFail(Boolean.FALSE);
    assertEquals(false, sc.continueOnFailure());
    assertEquals(Boolean.FALSE, sc.getContinueOnFail());
}
Also used : ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) Test(org.junit.Test)

Example 4 with ServiceCollectionImp

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

the class ServiceCollectionCase method testAddService.

@Test
public void testAddService() throws Exception {
    ServiceCollectionImp sc = createServiceCollection();
    sc.addService(new NullService(UUID.randomUUID().toString()));
    assertEquals(1, sc.size());
    try {
        sc.addService(null);
        fail();
    } catch (IllegalArgumentException e) {
    }
    assertEquals(1, sc.size());
}
Also used : ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 5 with ServiceCollectionImp

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

the class ServiceCollectionCase method testInitWithEventHandlerAware.

@Test
public void testInitWithEventHandlerAware() throws Exception {
    EventHandlerAwareService s = new EventHandlerAwareService(UUID.randomUUID().toString());
    ServiceCollectionImp sc = createServiceCollection();
    DefaultEventHandler eh = new DefaultEventHandler();
    sc.registerEventHandler(eh);
    sc.addService(new NullService(UUID.randomUUID().toString()));
    sc.addService(s);
    LifecycleHelper.init(sc);
    assertNotNull(s.retrieveEventHandler());
    assertEquals(eh, s.retrieveEventHandler());
}
Also used : DefaultEventHandler(com.adaptris.core.DefaultEventHandler) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) EventHandlerAwareService(com.adaptris.core.stubs.EventHandlerAwareService) Test(org.junit.Test)

Aggregations

ServiceCollectionImp (com.adaptris.core.ServiceCollectionImp)19 Test (org.junit.Test)18 NullService (com.adaptris.core.NullService)16 WaitService (com.adaptris.core.services.WaitService)9 EventHandlerAwareService (com.adaptris.core.stubs.EventHandlerAwareService)5 Service (com.adaptris.core.Service)4 BranchingServiceImp (com.adaptris.core.BranchingServiceImp)1 DefaultEventHandler (com.adaptris.core.DefaultEventHandler)1 OutOfStateHandler (com.adaptris.core.OutOfStateHandler)1 RaiseExceptionOutOfStateHandler (com.adaptris.core.RaiseExceptionOutOfStateHandler)1 ServiceImp (com.adaptris.core.ServiceImp)1