use of org.apache.cxf.bus.managers.CXFBusLifeCycleManager in project cxf by apache.
the class CXFBusLifeCycleManagerTest method testSingleListenerRegistration.
@Test
public void testSingleListenerRegistration() {
BusLifeCycleListener listener1 = EasyMock.createMock(BusLifeCycleListener.class);
CXFBusLifeCycleManager mgr = new CXFBusLifeCycleManager();
mgr.registerLifeCycleListener(listener1);
EasyMock.reset(listener1);
listener1.initComplete();
EasyMock.replay(listener1);
mgr.initComplete();
EasyMock.verify(listener1);
EasyMock.reset(listener1);
listener1.preShutdown();
EasyMock.replay(listener1);
mgr.preShutdown();
EasyMock.verify(listener1);
EasyMock.reset(listener1);
listener1.postShutdown();
EasyMock.replay(listener1);
mgr.postShutdown();
EasyMock.verify(listener1);
}
use of org.apache.cxf.bus.managers.CXFBusLifeCycleManager in project cxf by apache.
the class CXFBusLifeCycleManagerTest method testMultipleListeners.
@Test
public void testMultipleListeners() {
IMocksControl ctrl = EasyMock.createStrictControl();
BusLifeCycleListener listener1 = ctrl.createMock(BusLifeCycleListener.class);
BusLifeCycleListener listener2 = ctrl.createMock(BusLifeCycleListener.class);
CXFBusLifeCycleManager mgr = new CXFBusLifeCycleManager();
mgr.registerLifeCycleListener(listener1);
mgr.registerLifeCycleListener(listener2);
ctrl.reset();
listener1.initComplete();
listener2.initComplete();
ctrl.replay();
mgr.initComplete();
ctrl.verify();
ctrl.reset();
listener2.preShutdown();
listener1.preShutdown();
ctrl.replay();
mgr.preShutdown();
ctrl.verify();
ctrl.reset();
listener2.postShutdown();
listener1.postShutdown();
ctrl.replay();
mgr.postShutdown();
ctrl.verify();
}
use of org.apache.cxf.bus.managers.CXFBusLifeCycleManager in project cxf by apache.
the class BusApplicationListenerTest method testParentApplicationEvent.
@Test
public void testParentApplicationEvent() {
AbstractRefreshableApplicationContext parent = new ClassPathXmlApplicationContext();
parent.refresh();
SpringBusFactory factory = new SpringBusFactory(parent);
Bus bus = factory.createBus();
CXFBusLifeCycleManager manager = bus.getExtension(CXFBusLifeCycleManager.class);
BusLifeCycleListener listener = EasyMock.createMock(BusLifeCycleListener.class);
manager.registerLifeCycleListener(listener);
EasyMock.reset(listener);
listener.preShutdown();
EasyMock.expectLastCall().times(1);
listener.postShutdown();
EasyMock.expectLastCall().times(1);
EasyMock.replay(listener);
parent.close();
EasyMock.verify(listener);
}
use of org.apache.cxf.bus.managers.CXFBusLifeCycleManager in project cxf by apache.
the class CXFBusLifeCycleManagerTest method testDeregistration.
@Test
public void testDeregistration() {
IMocksControl ctrl = EasyMock.createStrictControl();
BusLifeCycleListener listener1 = ctrl.createMock(BusLifeCycleListener.class);
BusLifeCycleListener listener2 = ctrl.createMock(BusLifeCycleListener.class);
CXFBusLifeCycleManager mgr = new CXFBusLifeCycleManager();
mgr.registerLifeCycleListener(listener2);
mgr.registerLifeCycleListener(listener1);
mgr.unregisterLifeCycleListener(listener2);
ctrl.reset();
listener1.initComplete();
ctrl.replay();
mgr.initComplete();
ctrl.verify();
ctrl.reset();
listener1.preShutdown();
ctrl.replay();
mgr.preShutdown();
ctrl.verify();
ctrl.reset();
listener1.postShutdown();
ctrl.replay();
mgr.postShutdown();
ctrl.verify();
}
use of org.apache.cxf.bus.managers.CXFBusLifeCycleManager in project cxf by apache.
the class CXFBusLifeCycleManagerTest method testListenerNotRegistered.
@Test
public void testListenerNotRegistered() {
BusLifeCycleListener listener1 = EasyMock.createMock(BusLifeCycleListener.class);
CXFBusLifeCycleManager mgr = new CXFBusLifeCycleManager();
EasyMock.reset(listener1);
EasyMock.replay(listener1);
mgr.initComplete();
EasyMock.verify(listener1);
EasyMock.reset(listener1);
EasyMock.replay(listener1);
mgr.preShutdown();
EasyMock.verify(listener1);
EasyMock.reset(listener1);
EasyMock.replay(listener1);
mgr.postShutdown();
EasyMock.verify(listener1);
}
Aggregations