use of javax.servlet.ServletContextEvent in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextInitialized_excDuringStart_ExcThrown.
@Test(expected = BrokerLifecycleException.class)
public void contextInitialized_excDuringStart_ExcThrown() throws Exception {
ServletContext sc = mock(ServletContext.class);
BrokerService broker = mock(BrokerService.class);
doThrow(new BrokerLifecycleException()).when(broker).start();
WebBrokerInitializer i = spy(WebBrokerInitializer.class);
doReturn(broker).when(i).createBroker(sc);
i.contextInitialized(new ServletContextEvent(sc));
}
use of javax.servlet.ServletContextEvent in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextDestroyed.
@Test
public void contextDestroyed() throws Exception {
ServletContext sc = mock(ServletContext.class);
BrokerService broker = mock(BrokerService.class);
doReturn(true).when(broker).isStarted();
doReturn(true).when(broker).waitUntilStarted();
WebBrokerInitializer i = spy(WebBrokerInitializer.class);
doReturn(broker).when(i).createBroker(sc);
i.contextInitialized(new ServletContextEvent(sc));
i.contextDestroyed(new ServletContextEvent(sc));
}
use of javax.servlet.ServletContextEvent in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextDestroyed_excDuringStop_ExcThrown.
@Test(expected = BrokerLifecycleException.class)
public void contextDestroyed_excDuringStop_ExcThrown() throws Exception {
ServletContext sc = mock(ServletContext.class);
BrokerService broker = mock(BrokerService.class);
doReturn(true).when(broker).isStarted();
doReturn(true).when(broker).waitUntilStarted();
doThrow(new BrokerLifecycleException()).when(broker).stop();
WebBrokerInitializer i = spy(WebBrokerInitializer.class);
doReturn(broker).when(i).createBroker(sc);
i.contextInitialized(new ServletContextEvent(sc));
i.contextDestroyed(new ServletContextEvent(sc));
}
use of javax.servlet.ServletContextEvent in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextInitialized_waitUntilStartedReturnsFalse_ExcThrown.
@Test(expected = BrokerLifecycleException.class)
public void contextInitialized_waitUntilStartedReturnsFalse_ExcThrown() throws Exception {
ServletContext sc = mock(ServletContext.class);
BrokerService broker = mock(BrokerService.class);
doReturn(false).when(broker).waitUntilStarted();
WebBrokerInitializer i = spy(WebBrokerInitializer.class);
doReturn(broker).when(i).createBroker(sc);
i.contextInitialized(new ServletContextEvent(sc));
}
use of javax.servlet.ServletContextEvent in project hevelian-activemq by Hevelian.
the class ServletContextHolderInitializerTest method contextDestroyed.
@Test
public void contextDestroyed() {
ServletContextHolderInitializer i = new ServletContextHolderInitializer();
ServletContext sc = Mockito.mock(ServletContext.class);
ServletContextHolder.setServletContext(sc);
i.contextDestroyed(new ServletContextEvent(sc));
assertFalse(ServletContextHolder.isServletContextSet());
}
Aggregations