Disable the JMX bits on some additional tests that don't use it.
This commit is contained in:
Timothy Bish 2015-02-26 19:26:41 -05:00
parent b5ef92814e
commit 5667e4ddcc
5 changed files with 28 additions and 20 deletions

View File

@ -49,6 +49,7 @@ public class AMQ5035Test {
brokerService = BrokerFactory.createBroker(xbean + confBase + "/activemq.xml");
connectionUri = brokerService.getTransportConnectorByScheme("tcp").getPublishableConnectString();
brokerService.setDeleteAllMessagesOnStartup(true);
brokerService.getManagementContext().setCreateConnector(false);
brokerService.start();
brokerService.waitUntilStarted();
}

View File

@ -23,6 +23,7 @@ import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.Topic;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerRegistry;
import org.apache.activemq.broker.BrokerService;
@ -37,6 +38,7 @@ public class AMQ5136Test {
public void startBroker() throws Exception {
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(false);
brokerService.start();
}

View File

@ -17,14 +17,19 @@
package org.apache.activemq.bugs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQMessageProducer;
@ -40,10 +45,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(value = Parameterized.class)
public class AMQ5212Test {
@ -70,6 +71,7 @@ public class AMQ5212Test {
((KahaDBPersistenceAdapter)brokerService.getPersistenceAdapter()).setConcurrentStoreAndDispatchQueues(concurrentStoreAndDispatchQ);
brokerService.addConnector("tcp://localhost:0");
brokerService.setAdvisorySupport(false);
brokerService.getManagementContext().setCreateConnector(false);
brokerService.start();
}

View File

@ -16,13 +16,18 @@
*/
package org.apache.activemq.bugs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.RedeliveryPolicy;
@ -38,21 +43,18 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class AMQ5274Test {
static Logger LOG = LoggerFactory.getLogger(AMQ5274Test.class);
String activemqURL;
BrokerService brokerService;
ActiveMQQueue dest = new ActiveMQQueue("TestQ");
private static Logger LOG = LoggerFactory.getLogger(AMQ5274Test.class);
private String activemqURL;
private BrokerService brokerService;
private final ActiveMQQueue dest = new ActiveMQQueue("TestQ");
@Before
public void startBroker() throws Exception {
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.getManagementContext().setCreateConnector(false);
PolicyMap policyMap = new PolicyMap();
PolicyEntry defaultPolicy = new PolicyEntry();
defaultPolicy.setExpireMessagesPeriod(1000);
@ -91,7 +93,7 @@ public class AMQ5274Test {
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer consumer = session.createConsumer(dest);
Message m;
while ( (m = consumer.receive(4000)) != null) {
while ((m = consumer.receive(4000)) != null) {
LOG.info("Got:" + m);
TimeUnit.SECONDS.sleep(1);
session.rollback();
@ -106,26 +108,26 @@ public class AMQ5274Test {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(dest);
producer.setTimeToLive(10000);
for (int i=0;i<20;i++) {
producer.send(session.createTextMessage("i="+i));
for (int i = 0; i < 20; i++) {
producer.send(session.createTextMessage("i=" + i));
}
connection.close();
connection.close();
}
private ActiveMQConnection createConnection() throws JMSException {
return (ActiveMQConnection) new ActiveMQConnectionFactory(activemqURL).createConnection();
}
public long getQueueSize() throws Exception {
long queueSize = 0;
try {
QueueViewMBean queueViewMBean = (QueueViewMBean) brokerService.getManagementContext().newProxyInstance(BrokerMBeanSupport.createDestinationName(brokerService.getBrokerObjectName(), dest), QueueViewMBean.class, false);
QueueViewMBean queueViewMBean = (QueueViewMBean) brokerService.getManagementContext().newProxyInstance(
BrokerMBeanSupport.createDestinationName(brokerService.getBrokerObjectName(), dest), QueueViewMBean.class, false);
queueSize = queueViewMBean.getQueueSize();
LOG.info("QueueSize for destination {} is {}", dest, queueSize);
} catch (Exception ex) {
LOG.error("Error retrieving QueueSize from JMX ", ex);
throw ex;
LOG.error("Error retrieving QueueSize from JMX ", ex);
throw ex;
}
return queueSize;
}

View File

@ -75,6 +75,7 @@ public class AMQ5421Test {
policy.setTopicPrefetch(10);
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
brokerService.setUseJmx(false);
brokerService.setDestinationPolicy(pMap);
brokerService.addConnector("tcp://0.0.0.0:0");
brokerService.start();