use of com.adaptris.core.ServiceCollectionImp 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.ServiceCollectionImp 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.ServiceCollectionImp 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.ServiceCollectionImp 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());
}
}
use of com.adaptris.core.ServiceCollectionImp in project interlok by adaptris.
the class ServiceCollectionCase method testSize.
@Test
public void testSize() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.add(new NullService(UUID.randomUUID().toString()));
assertEquals(1, sc.size());
}
Aggregations