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);
}
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);
}
}
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());
}
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);
}
}
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));
}
Aggregations