use of com.adaptris.core.ServiceCollectionImp in project interlok by adaptris.
the class ServiceCollectionCase method testSetAtPosition.
@Test
public void testSetAtPosition() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.addService(new NullService(UUID.randomUUID().toString()));
WaitService wait = new WaitService(UUID.randomUUID().toString());
sc.addService(wait);
sc.addService(new NullService(UUID.randomUUID().toString()));
Service s = sc.set(1, new NullService(UUID.randomUUID().toString()));
assertEquals(WaitService.class, s.getClass());
assertEquals(wait, s);
assertEquals(3, sc.size());
assertFalse(sc.contains(wait));
}
use of com.adaptris.core.ServiceCollectionImp in project interlok by adaptris.
the class ServiceCollectionCase method testClear.
@Test
public void testClear() {
ServiceCollectionImp list = createServiceCollection();
list.add(new NullService(UUID.randomUUID().toString()));
list.add(new NullService(UUID.randomUUID().toString()));
list.add(new NullService(UUID.randomUUID().toString()));
list.add(new NullService(UUID.randomUUID().toString()));
assertEquals(4, list.size());
list.clear();
assertEquals(0, list.size());
}
use of com.adaptris.core.ServiceCollectionImp in project interlok by adaptris.
the class ServiceCollectionCase method testSetServices.
@Test
public void testSetServices() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
List<Service> services = Arrays.asList(new Service[] { new NullService(UUID.randomUUID().toString()), new NullService(UUID.randomUUID().toString()) });
sc.setServices(services);
assertEquals(2, sc.size());
assertEquals(services, sc.getServices());
try {
sc.setServices(null);
fail();
} catch (IllegalArgumentException e) {
}
assertEquals(2, sc.size());
assertEquals(services, sc.getServices());
}
use of com.adaptris.core.ServiceCollectionImp in project interlok by adaptris.
the class ServiceCollectionCase method testSubList.
@Test
public void testSubList() {
ServiceCollectionImp list = createServiceCollection();
list.add(new NullService(UUID.randomUUID().toString()));
list.add(new NullService(UUID.randomUUID().toString()));
list.add(new NullService(UUID.randomUUID().toString()));
list.add(new NullService(UUID.randomUUID().toString()));
assertNotNull(list.subList(0, 2));
assertEquals(2, list.subList(0, 2).size());
}
Aggregations