Search in sources :

Example 41 with NullService

use of com.adaptris.core.NullService in project interlok by adaptris.

the class MimeAggregatorTest method testService_MimeSplitter.

@Test
public void testService_MimeSplitter() throws Exception {
    // This is a 3 part message, so that should generate 3 split messages; which should generate 4 parts at the end.
    AdaptrisMessage msg = MimeJunitHelper.create();
    PooledSplitJoinService service = new PooledSplitJoinService();
    // The service doesn't actually matter right now.
    service.setService(new NullService());
    service.setTimeout(new TimeInterval(10L, TimeUnit.SECONDS));
    service.setSplitter(new MimePartSplitter());
    MimeAggregator aggr = createAggregatorForTests();
    aggr.setEncoding("base64");
    service.setAggregator(aggr);
    execute(service, msg);
    BodyPartIterator input = MimeHelper.createBodyPartIterator(msg);
    assertEquals(4, input.size());
}
Also used : PooledSplitJoinService(com.adaptris.core.services.splitter.PooledSplitJoinService) TimeInterval(com.adaptris.util.TimeInterval) BodyPartIterator(com.adaptris.util.text.mime.BodyPartIterator) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) NullService(com.adaptris.core.NullService) MimePartSplitter(com.adaptris.core.services.splitter.MimePartSplitter) Test(org.junit.Test)

Example 42 with NullService

use of com.adaptris.core.NullService in project interlok by adaptris.

the class AdapterManagerTest method testMBean_AddSharedService.

@Test
public void testMBean_AddSharedService() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    AdapterManager adapterManager = new AdapterManager(adapter);
    ObjectName adapterObj = adapterManager.createObjectName();
    AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
    try {
        adapterManager.registerMBean();
        AdapterManagerMBean amp = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
        amp.addSharedService(m.marshal(new NullService(getName())));
        Adapter marshalledAdapter = (Adapter) m.unmarshal(amp.getConfiguration());
        assertEquals(1, marshalledAdapter.getSharedComponents().getServices().size());
        assertEquals(getName(), marshalledAdapter.getSharedComponents().getServices().get(0).getUniqueId());
        assertTrue(marshalledAdapter.getSharedComponents().getServiceIds().contains(getName()));
    } finally {
    }
}
Also used : AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) NullService(com.adaptris.core.NullService) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 43 with NullService

use of com.adaptris.core.NullService in project interlok by adaptris.

the class AdapterManagerTest method testMBean_AddAndBindSharedService.

@Test
public void testMBean_AddAndBindSharedService() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    AdapterManager adapterManager = new AdapterManager(adapter);
    ObjectName adapterObj = adapterManager.createObjectName();
    AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
    List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
    mBeans.add(adapterManager);
    mBeans.addAll(adapterManager.getAllDescendants());
    try {
        register(mBeans);
        adapterManager.requestStart();
        AdapterManagerMBean amp = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
        amp.addAndBindSharedService(m.marshal(new NullService(getName())));
        Adapter marshalledAdapter = (Adapter) m.unmarshal(amp.getConfiguration());
        assertEquals(1, marshalledAdapter.getSharedComponents().getServices().size());
        assertEquals(getName(), marshalledAdapter.getSharedComponents().getServices().get(0).getUniqueId());
        assertTrue(amp.getSharedServiceIds().contains(getName()));
        assertTrue(amp.containsSharedService(getName()));
    } finally {
        adapterManager.requestClose();
    }
}
Also used : AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) NullService(com.adaptris.core.NullService) ArrayList(java.util.ArrayList) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 44 with NullService

use of com.adaptris.core.NullService in project interlok by adaptris.

the class BranchingServiceEnablerTest method testIsBranching.

@Test
public void testIsBranching() throws Exception {
    BranchingServiceEnabler s = wrap(new NullService());
    assertTrue(s.isBranching());
}
Also used : NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 45 with NullService

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