use of com.adaptris.core.NullService in project interlok by adaptris.
the class ServiceCollectionCase method testCollectionConstructor.
@Test
public void testCollectionConstructor() {
ServiceCollectionImp sc = createServiceCollection();
sc.addService(new NullService(UUID.randomUUID().toString()));
sc.addService(new NullService(UUID.randomUUID().toString()));
ServiceCollectionImp sc2 = createServiceCollection(sc);
assertEquals(sc.size(), sc2.size());
}
use of com.adaptris.core.NullService in project interlok by adaptris.
the class ServiceCollectionCase method testIterator.
@Test
public void testIterator() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.addAll(Arrays.asList(new Service[] { new NullService(UUID.randomUUID().toString()), new NullService(UUID.randomUUID().toString()) }));
assertEquals(2, sc.size());
assertNotNull(sc.iterator());
int count = 0;
for (Iterator<Service> i = sc.iterator(); i.hasNext(); ) {
assertNotNull(i.next());
count++;
}
assertEquals(2, count);
assertNotNull(sc.listIterator(0));
count = 0;
for (ListIterator<Service> i = sc.listIterator(0); i.hasNext(); ) {
assertNotNull(i.next());
count++;
}
assertEquals(2, count);
assertNotNull(sc.listIterator());
count = 0;
for (ListIterator<Service> i = sc.listIterator(); i.hasNext(); ) {
assertNotNull(i.next());
count++;
}
assertEquals(2, count);
}
use of com.adaptris.core.NullService in project interlok by adaptris.
the class ServiceCollectionCase method testIndexOf.
@Test
public void testIndexOf() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.addService(new NullService(UUID.randomUUID().toString()));
WaitService s = new WaitService(UUID.randomUUID().toString());
sc.addService(s);
sc.addService(new NullService(UUID.randomUUID().toString()));
assertEquals(1, sc.indexOf(s));
}
use of com.adaptris.core.NullService in project interlok by adaptris.
the class ServiceCollectionCase method testGet.
@Test
public void testGet() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.addService(new NullService(UUID.randomUUID().toString()));
sc.addService(new WaitService(UUID.randomUUID().toString()));
sc.addService(new NullService(UUID.randomUUID().toString()));
assertEquals(WaitService.class, sc.get(1).getClass());
}
use of com.adaptris.core.NullService in project interlok by adaptris.
the class ServiceCollectionCase method testRemove.
@Test
public void testRemove() 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.remove(1);
assertEquals(WaitService.class, s.getClass());
assertEquals(wait, s);
assertEquals(2, sc.size());
assertFalse(sc.contains(wait));
}
Aggregations