Search in sources :

Example 31 with NullService

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

the class ServiceUtilTest method testDiscardNull.

@Test
public void testDiscardNull() throws Exception {
    assertEquals(2, discardNulls(new NullService(), new NullService()).length);
    assertEquals(1, discardNulls(new NullService(), null, null).length);
    assertEquals(0, discardNulls().length);
}
Also used : NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 32 with NullService

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

the class LifecycleHelperTest method testLifecycle.

@Test
public void testLifecycle() throws Exception {
    StateManagedComponent stateManaged = new NullService();
    ComponentLifecycle noState = new ChannelList();
    try {
        initAndStart(stateManaged);
        initAndStart(noState);
        initAndStart(null);
        stopAndClose(null);
    } finally {
        stopAndClose(stateManaged);
        stopAndClose(noState);
    }
}
Also used : NullService(com.adaptris.core.NullService) ComponentLifecycle(com.adaptris.core.ComponentLifecycle) StateManagedComponent(com.adaptris.core.StateManagedComponent) ChannelList(com.adaptris.core.ChannelList) Test(org.junit.Test)

Example 33 with NullService

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

the class LifecycleHelperTest method testPrepare.

@Test
public void testPrepare() throws Exception {
    prepare(new NullService());
    prepare((ComponentLifecycle) null);
    prepare(new EmptyIdentityBuilder());
}
Also used : NullService(com.adaptris.core.NullService) EmptyIdentityBuilder(com.adaptris.core.security.access.EmptyIdentityBuilder) Test(org.junit.Test)

Example 34 with NullService

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

the class LifecycleHelperTest method testInterlokLifecycleAnnotation_Exceptions.

@Test
public void testInterlokLifecycleAnnotation_Exceptions() throws Exception {
    NullService nested = new NullService() {

        @Override
        public void start() throws CoreException {
            throw new CoreException();
        }

        // Override close since we never get to started, so we can't override stop.
        @Override
        protected void closeService() {
            throw new RuntimeException();
        }
    };
    WrappingService service = new WrappingService(nested);
    try {
        assertThrows(RuntimeException.class, () -> initAndStart(service, false));
    } finally {
        stopAndClose(service, false);
    }
}
Also used : CoreException(com.adaptris.core.CoreException) NullService(com.adaptris.core.NullService) Test(org.junit.Test)

Example 35 with NullService

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

the class LoggingHelperTest method testFriendlyNameStateManagedComponent.

@Test
public void testFriendlyNameStateManagedComponent() throws Exception {
    assertEquals("", friendlyName((StateManagedComponent) null));
    NullService service = new NullService();
    assertEquals("NullService", friendlyName((StateManagedComponent) service));
    service.setUniqueId("testFriendlyNameService");
    assertEquals("NullService(testFriendlyNameService)", friendlyName((StateManagedComponent) service));
}
Also used : NullService(com.adaptris.core.NullService) StateManagedComponent(com.adaptris.core.StateManagedComponent) 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