Search in sources :

Example 1 with NullService

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

the class RetryFromJettyTest method testExecuteQuietly.

@Test
public void testExecuteQuietly() throws Exception {
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    NullService s1 = new NullService();
    ThrowExceptionService s2 = new ThrowExceptionService(new ConfiguredException("failure"));
    try {
        start(s1, s2);
        RetryFromJetty.executeQuietly(s1, msg);
        RetryFromJetty.executeQuietly(s2, msg);
    } finally {
        stop(s1, s2);
    }
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) ThrowExceptionService(com.adaptris.core.services.exception.ThrowExceptionService) NullService(com.adaptris.core.NullService) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException) Test(org.junit.Test)

Example 2 with NullService

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

the class SharedServiceConfigurationCheckerTest method testServiceExist.

@Test
public void testServiceExist() throws Exception {
    BootstrapProperties mockBootProperties = new MockBootProperties(createAdapterConfig(new NullService("SharedNullService"), new SharedService("SharedNullService")));
    ConfigurationCheckReport report = checker.performConfigCheck(mockBootProperties);
    assertTrue(report.isCheckPassed());
    assertNotNull(report.toString());
}
Also used : SharedService(com.adaptris.core.SharedService) BootstrapProperties(com.adaptris.core.management.BootstrapProperties) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 3 with NullService

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

the class SharedServiceConfigurationCheckerTest method testServiceInServiceCollectionExist.

@Test
public void testServiceInServiceCollectionExist() throws Exception {
    BootstrapProperties mockBootProperties = new MockBootProperties(createAdapterConfig(new NullService("SharedNullService"), new ServiceList(new SharedService("SharedNullService"))));
    ConfigurationCheckReport report = checker.performConfigCheck(mockBootProperties);
    assertTrue(report.isCheckPassed());
    assertNotNull(report.toString());
}
Also used : SharedService(com.adaptris.core.SharedService) BootstrapProperties(com.adaptris.core.management.BootstrapProperties) ServiceList(com.adaptris.core.ServiceList) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 4 with NullService

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

the class AdapterManagerTest method testMBean_RemoveSharedComponent.

@Test
public void testMBean_RemoveSharedComponent() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    adapter.getSharedComponents().addService(new NullService(NullService.class.getCanonicalName()));
    adapter.getSharedComponents().addConnection(new NullConnection(NullConnection.class.getCanonicalName()));
    AdapterManager adapterManager = new AdapterManager(adapter);
    ObjectName adapterObj = adapterManager.createObjectName();
    AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
    try {
        adapterManager.registerMBean();
        AdapterManagerMBean amp = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
        assertTrue(amp.removeSharedComponent(NullService.class.getCanonicalName()));
        assertFalse(amp.removeSharedComponent("HelloWorld"));
        Adapter marshalledAdapter = (Adapter) m.unmarshal(amp.getConfiguration());
        assertEquals(0, marshalledAdapter.getSharedComponents().getServices().size());
        assertTrue(amp.removeSharedComponent(NullConnection.class.getCanonicalName()));
        marshalledAdapter = (Adapter) m.unmarshal(amp.getConfiguration());
        assertEquals(0, marshalledAdapter.getSharedComponents().getConnections().size());
    } finally {
    }
}
Also used : AdaptrisMarshaller(com.adaptris.core.AdaptrisMarshaller) NullService(com.adaptris.core.NullService) Adapter(com.adaptris.core.Adapter) NullConnection(com.adaptris.core.NullConnection) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 5 with NullService

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

the class AdapterManagerTest method testMBean_RemoveSharedService.

@Test
public void testMBean_RemoveSharedService() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    adapter.getSharedComponents().addService(new NullService(getName()));
    AdapterManager adapterManager = new AdapterManager(adapter);
    ObjectName adapterObj = adapterManager.createObjectName();
    AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
    try {
        adapterManager.registerMBean();
        AdapterManagerMBean amp = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
        assertTrue(amp.removeSharedService(getName()));
        assertFalse(amp.removeSharedService("HelloWorld"));
        Adapter marshalledAdapter = (Adapter) m.unmarshal(amp.getConfiguration());
        assertEquals(0, marshalledAdapter.getSharedComponents().getServices().size());
    } 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)

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