use of org.apache.activemq.broker.BrokerService in project camel by apache.
the class AMQPRouteTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
broker = new BrokerService();
broker.setPersistent(false);
broker.addConnector("amqp://0.0.0.0:" + amqpPort);
broker.start();
System.setProperty(AMQP_PORT, amqpPort + "");
}
use of org.apache.activemq.broker.BrokerService in project spring-framework by spring-projects.
the class ReactorNettyTcpStompClientTests method setUp.
@Before
public void setUp() throws Exception {
logger.debug("Setting up before '" + this.testName.getMethodName() + "'");
int port = SocketUtils.findAvailableTcpPort(61613);
this.activeMQBroker = new BrokerService();
this.activeMQBroker.addConnector("stomp://127.0.0.1:" + port);
this.activeMQBroker.setStartAsync(false);
this.activeMQBroker.setPersistent(false);
this.activeMQBroker.setUseJmx(false);
this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5);
this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5);
this.activeMQBroker.start();
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.afterPropertiesSet();
this.client = new ReactorNettyTcpStompClient("127.0.0.1", port);
this.client.setMessageConverter(new StringMessageConverter());
this.client.setTaskScheduler(taskScheduler);
}
use of org.apache.activemq.broker.BrokerService in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextDestroyed_excDuringWaitUntilStopped_ExcThrown.
@Test(expected = BrokerLifecycleException.class)
public void contextDestroyed_excDuringWaitUntilStopped_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).waitUntilStopped();
WebBrokerInitializer i = spy(WebBrokerInitializer.class);
doReturn(broker).when(i).createBroker(sc);
i.contextInitialized(new ServletContextEvent(sc));
i.contextDestroyed(new ServletContextEvent(sc));
}
use of org.apache.activemq.broker.BrokerService in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextInitialized.
@Test
public void contextInitialized() throws Exception {
ServletContext sc = mock(ServletContext.class);
BrokerService broker = mock(BrokerService.class);
doReturn(true).when(broker).waitUntilStarted();
WebBrokerInitializer i = spy(WebBrokerInitializer.class);
doReturn(broker).when(i).createBroker(sc);
i.contextInitialized(new ServletContextEvent(sc));
}
use of org.apache.activemq.broker.BrokerService in project hevelian-activemq by Hevelian.
the class WebBrokerInitializerTest method contextDestroyed_brokerNotStarted_doNothing.
@Test
public void contextDestroyed_brokerNotStarted_doNothing() throws Exception {
ServletContext sc = mock(ServletContext.class);
BrokerService broker = mock(BrokerService.class);
doReturn(false).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));
verify(broker, never()).stop();
}
Aggregations