Search in sources :

Example 1 with AbstractRefreshableApplicationContext

use of org.springframework.context.support.AbstractRefreshableApplicationContext 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);
}
Also used : Bus(org.apache.cxf.Bus) AbstractRefreshableApplicationContext(org.springframework.context.support.AbstractRefreshableApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) BusLifeCycleListener(org.apache.cxf.buslifecycle.BusLifeCycleListener) CXFBusLifeCycleManager(org.apache.cxf.bus.managers.CXFBusLifeCycleManager) Test(org.junit.Test)

Aggregations

Bus (org.apache.cxf.Bus)1 CXFBusLifeCycleManager (org.apache.cxf.bus.managers.CXFBusLifeCycleManager)1 BusLifeCycleListener (org.apache.cxf.buslifecycle.BusLifeCycleListener)1 Test (org.junit.Test)1 AbstractRefreshableApplicationContext (org.springframework.context.support.AbstractRefreshableApplicationContext)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1