Search in sources :

Example 46 with NullService

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());
}
Also used : ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 47 with NullService

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);
}
Also used : ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) NullService(com.adaptris.core.NullService) Service(com.adaptris.core.Service) EventHandlerAwareService(com.adaptris.core.stubs.EventHandlerAwareService) WaitService(com.adaptris.core.services.WaitService) Test(org.junit.Test)

Example 48 with NullService

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));
}
Also used : WaitService(com.adaptris.core.services.WaitService) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 49 with NullService

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());
}
Also used : WaitService(com.adaptris.core.services.WaitService) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 50 with NullService

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));
}
Also used : WaitService(com.adaptris.core.services.WaitService) ServiceCollectionImp(com.adaptris.core.ServiceCollectionImp) NullService(com.adaptris.core.NullService) NullService(com.adaptris.core.NullService) Service(com.adaptris.core.Service) EventHandlerAwareService(com.adaptris.core.stubs.EventHandlerAwareService) WaitService(com.adaptris.core.services.WaitService) Test(org.junit.Test)

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