Search in sources :

Example 16 with NullService

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

the class LifecycleHelperTest method testRegisterEventHandler.

@Test
public void testRegisterEventHandler() throws Exception {
    registerEventHandler(new NullService(), new DefaultEventHandler());
    registerEventHandler(null, new DefaultEventHandler());
    registerEventHandler(new Channel(), new DefaultEventHandler());
}
Also used : DefaultEventHandler(com.adaptris.core.DefaultEventHandler) NullService(com.adaptris.core.NullService) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 17 with NullService

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

the class LifecycleHelperTest method testInterlokLifecycleAnnotation.

@Test
public void testInterlokLifecycleAnnotation() throws Exception {
    NullService nested = new NullService();
    // Turtles all the way down for a bit of recursive fun.
    WrappingService service = new WrappingService(new WrappingService(new WrappingService(nested)));
    try {
        initAndStart(service, false);
        assertSame(StartedState.getInstance(), nested.retrieveComponentState());
    } finally {
        stopAndClose(service, false);
    }
    assertSame(ClosedState.getInstance(), nested.retrieveComponentState());
}
Also used : NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 18 with NullService

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

the class LoggingHelperTest method testFriendlyNameService.

@Test
public void testFriendlyNameService() throws Exception {
    assertEquals("", friendlyName((Service) null));
    NullService service = new NullService();
    assertEquals("NullService", friendlyName(service));
    service.setUniqueId("");
    assertEquals("NullService", friendlyName(service));
    service.setUniqueId("testFriendlyNameService");
    assertEquals("NullService(testFriendlyNameService)", friendlyName(service));
}
Also used : NullService(com.adaptris.core.NullService) NullService(com.adaptris.core.NullService) Service(com.adaptris.core.Service) Test(org.junit.Test)

Example 19 with NullService

use of com.adaptris.core.NullService 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 20 with NullService

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

Aggregations

NullService (com.adaptris.core.NullService)54 Test (org.junit.Test)53 ServiceCollectionImp (com.adaptris.core.ServiceCollectionImp)16 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)15 WaitService (com.adaptris.core.services.WaitService)9 PooledSplitJoinService (com.adaptris.core.services.splitter.PooledSplitJoinService)9 TimeInterval (com.adaptris.util.TimeInterval)9 Service (com.adaptris.core.Service)5 XpathMessageSplitter (com.adaptris.core.services.splitter.XpathMessageSplitter)5 EventHandlerAwareService (com.adaptris.core.stubs.EventHandlerAwareService)5 InsertNode (com.adaptris.util.text.xml.InsertNode)5 XPath (com.adaptris.util.text.xml.XPath)5 Adapter (com.adaptris.core.Adapter)4 AdaptrisMarshaller (com.adaptris.core.AdaptrisMarshaller)4 ServiceException (com.adaptris.core.ServiceException)4 BootstrapProperties (com.adaptris.core.management.BootstrapProperties)4 BodyPartIterator (com.adaptris.util.text.mime.BodyPartIterator)4 ObjectName (javax.management.ObjectName)4 SharedService (com.adaptris.core.SharedService)3 ComponentLifecycle (com.adaptris.core.ComponentLifecycle)2