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());
}
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());
}
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());
}
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());
}
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;
}
Aggregations