mirror of https://github.com/apache/activemq.git
Allow for broker stats to be viewed in tests by enabling JMX but disabling the creation of a management connector.
This commit is contained in:
parent
36689beff7
commit
44a318bd3f
|
@ -16,10 +16,13 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.junit;
|
package org.apache.activemq.junit;
|
||||||
|
|
||||||
|
import static org.apache.activemq.command.ActiveMQDestination.QUEUE_TYPE;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.jms.BytesMessage;
|
import javax.jms.BytesMessage;
|
||||||
import javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
import javax.jms.JMSException;
|
import javax.jms.JMSException;
|
||||||
|
@ -45,8 +48,6 @@ import org.junit.rules.ExternalResource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import static org.apache.activemq.command.ActiveMQDestination.QUEUE_TYPE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A JUnit Rule that embeds an ActiveMQ broker into a test.
|
* A JUnit Rule that embeds an ActiveMQ broker into a test.
|
||||||
*/
|
*/
|
||||||
|
@ -61,12 +62,13 @@ public class EmbeddedActiveMQBroker extends ExternalResource {
|
||||||
* <p>
|
* <p>
|
||||||
* The defaults are:
|
* The defaults are:
|
||||||
* - the broker name is 'embedded-broker'
|
* - the broker name is 'embedded-broker'
|
||||||
* - JMX is disabled
|
* - JMX is enable but no management connector is created.
|
||||||
* - Persistence is disabled
|
* - Persistence is disabled
|
||||||
*/
|
*/
|
||||||
public EmbeddedActiveMQBroker() {
|
public EmbeddedActiveMQBroker() {
|
||||||
brokerService = new BrokerService();
|
brokerService = new BrokerService();
|
||||||
brokerService.setUseJmx(false);
|
brokerService.setUseJmx(true);
|
||||||
|
brokerService.getManagementContext().setCreateConnector(false);
|
||||||
brokerService.setUseShutdownHook(false);
|
brokerService.setUseShutdownHook(false);
|
||||||
brokerService.setPersistent(false);
|
brokerService.setPersistent(false);
|
||||||
brokerService.setBrokerName("embedded-broker");
|
brokerService.setBrokerName("embedded-broker");
|
||||||
|
|
Loading…
Reference in New Issue