Search in sources :

Example 21 with NullService

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

Example 22 with NullService

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

the class ServiceCollectionCase method testAdd.

@Test
public void testAdd() throws Exception {
    ServiceCollectionImp sc = createServiceCollection();
    assertTrue(sc.add(new NullService(UUID.randomUUID().toString())));
    try {
        sc.add(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 23 with NullService

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

the class ServiceCollectionCase method testAddAtPosition.

@Test
public void testAddAtPosition() throws Exception {
    ServiceCollectionImp sc = createServiceCollection();
    sc.addService(new NullService(UUID.randomUUID().toString()));
    sc.addService(new NullService(UUID.randomUUID().toString()));
    sc.add(1, new WaitService(UUID.randomUUID().toString()));
    assertEquals(3, sc.size());
    assertEquals(WaitService.class, sc.get(1).getClass());
}
Also used : WaitService(com.adaptris.core.services.WaitService) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 24 with NullService

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

the class ServiceCollectionCase method testAddAllAtPosition.

@Test
public void testAddAllAtPosition() throws Exception {
    ServiceCollectionImp sc = createServiceCollection();
    sc.addService(new NullService(UUID.randomUUID().toString()));
    sc.addService(new NullService(UUID.randomUUID().toString()));
    ServiceCollectionImp sc2 = createServiceCollection();
    sc2.addService(new WaitService(UUID.randomUUID().toString()));
    sc2.addService(new WaitService(UUID.randomUUID().toString()));
    sc.addAll(1, sc2);
    assertEquals(4, sc.size());
    assertEquals(WaitService.class, sc.get(1).getClass());
    assertEquals(WaitService.class, sc.get(2).getClass());
}
Also used : WaitService(com.adaptris.core.services.WaitService) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 25 with NullService

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

the class BranchingHttpRequestServiceTest method retrieveObjectForSampleConfig.

@Override
protected BranchingServiceCollection retrieveObjectForSampleConfig() {
    BranchingHttpRequestService service = createForExamples();
    BranchingServiceCollection sl = new BranchingServiceCollection();
    sl.addService(service);
    sl.setFirstServiceId(service.getUniqueId());
    sl.addService(new ThrowExceptionService("5XX Server Error", new ConfiguredException("Got 5XX error from server")));
    sl.addService(new ThrowExceptionService("4XX Client Error", new ConfiguredException("Got 4XX error from server")));
    sl.addService(new NullService("Not Found"));
    sl.addService(new LogMessageService("2XX OK"));
    sl.addService(new ThrowExceptionService("DefaultServiceId", new ConfiguredException("Unmatched Response")));
    return sl;
}
Also used : BranchingServiceCollection(com.adaptris.core.BranchingServiceCollection) ThrowExceptionService(com.adaptris.core.services.exception.ThrowExceptionService) NullService(com.adaptris.core.NullService) LogMessageService(com.adaptris.core.services.LogMessageService) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException)

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