use of org.apache.cxf.buslifecycle.BusLifeCycleListener in project cxf by apache.
the class BusDefinitionParserTest method testBusConfigureCreateBus.
@Test
public void testBusConfigureCreateBus() {
ClassPathXmlApplicationContext context = null;
final AtomicBoolean b = new AtomicBoolean();
try {
context = new ClassPathXmlApplicationContext("org/apache/cxf/bus/spring/customerBus2.xml");
Bus cxf1 = (Bus) context.getBean("cxf1");
assertTrue(cxf1.getOutInterceptors().size() == 1);
assertTrue(cxf1.getInInterceptors().isEmpty());
Bus cxf2 = (Bus) context.getBean("cxf2");
assertTrue(cxf2.getInInterceptors().size() == 1);
assertTrue(cxf2.getOutInterceptors().isEmpty());
cxf2.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(new BusLifeCycleListener() {
public void initComplete() {
}
public void preShutdown() {
}
public void postShutdown() {
b.set(true);
}
});
} finally {
if (context != null) {
context.close();
}
}
assertTrue("postShutdown not called", b.get());
}
Aggregations