mirror of
https://github.com/apache/activemq.git
synced 2025-02-28 05:09:07 +00:00
Disable the JMX bits on some additional tests that don't use it.
This commit is contained in:
parent
b5ef92814e
commit
5667e4ddcc
@ -49,6 +49,7 @@ public class AMQ5035Test {
|
|||||||
brokerService = BrokerFactory.createBroker(xbean + confBase + "/activemq.xml");
|
brokerService = BrokerFactory.createBroker(xbean + confBase + "/activemq.xml");
|
||||||
connectionUri = brokerService.getTransportConnectorByScheme("tcp").getPublishableConnectString();
|
connectionUri = brokerService.getTransportConnectorByScheme("tcp").getPublishableConnectString();
|
||||||
brokerService.setDeleteAllMessagesOnStartup(true);
|
brokerService.setDeleteAllMessagesOnStartup(true);
|
||||||
|
brokerService.getManagementContext().setCreateConnector(false);
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
brokerService.waitUntilStarted();
|
brokerService.waitUntilStarted();
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import javax.jms.JMSException;
|
|||||||
import javax.jms.MessageProducer;
|
import javax.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
import javax.jms.Topic;
|
import javax.jms.Topic;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.broker.BrokerRegistry;
|
import org.apache.activemq.broker.BrokerRegistry;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
@ -37,6 +38,7 @@ public class AMQ5136Test {
|
|||||||
public void startBroker() throws Exception {
|
public void startBroker() throws Exception {
|
||||||
brokerService = new BrokerService();
|
brokerService = new BrokerService();
|
||||||
brokerService.setPersistent(false);
|
brokerService.setPersistent(false);
|
||||||
|
brokerService.setUseJmx(false);
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,14 +17,19 @@
|
|||||||
|
|
||||||
package org.apache.activemq.bugs;
|
package org.apache.activemq.bugs;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javax.jms.Message;
|
import javax.jms.Message;
|
||||||
import javax.jms.MessageConsumer;
|
import javax.jms.MessageConsumer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnection;
|
import org.apache.activemq.ActiveMQConnection;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.ActiveMQMessageProducer;
|
import org.apache.activemq.ActiveMQMessageProducer;
|
||||||
@ -40,10 +45,6 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
@RunWith(value = Parameterized.class)
|
@RunWith(value = Parameterized.class)
|
||||||
public class AMQ5212Test {
|
public class AMQ5212Test {
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ public class AMQ5212Test {
|
|||||||
((KahaDBPersistenceAdapter)brokerService.getPersistenceAdapter()).setConcurrentStoreAndDispatchQueues(concurrentStoreAndDispatchQ);
|
((KahaDBPersistenceAdapter)brokerService.getPersistenceAdapter()).setConcurrentStoreAndDispatchQueues(concurrentStoreAndDispatchQ);
|
||||||
brokerService.addConnector("tcp://localhost:0");
|
brokerService.addConnector("tcp://localhost:0");
|
||||||
brokerService.setAdvisorySupport(false);
|
brokerService.setAdvisorySupport(false);
|
||||||
|
brokerService.getManagementContext().setCreateConnector(false);
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,13 +16,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.activemq.bugs;
|
package org.apache.activemq.bugs;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
import javax.jms.JMSException;
|
import javax.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import javax.jms.Message;
|
||||||
import javax.jms.MessageConsumer;
|
import javax.jms.MessageConsumer;
|
||||||
import javax.jms.MessageProducer;
|
import javax.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnection;
|
import org.apache.activemq.ActiveMQConnection;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.RedeliveryPolicy;
|
import org.apache.activemq.RedeliveryPolicy;
|
||||||
@ -38,21 +43,18 @@ import org.junit.Test;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
public class AMQ5274Test {
|
public class AMQ5274Test {
|
||||||
static Logger LOG = LoggerFactory.getLogger(AMQ5274Test.class);
|
private static Logger LOG = LoggerFactory.getLogger(AMQ5274Test.class);
|
||||||
String activemqURL;
|
|
||||||
BrokerService brokerService;
|
|
||||||
ActiveMQQueue dest = new ActiveMQQueue("TestQ");
|
|
||||||
|
|
||||||
|
private String activemqURL;
|
||||||
|
private BrokerService brokerService;
|
||||||
|
private final ActiveMQQueue dest = new ActiveMQQueue("TestQ");
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void startBroker() throws Exception {
|
public void startBroker() throws Exception {
|
||||||
brokerService = new BrokerService();
|
brokerService = new BrokerService();
|
||||||
brokerService.setPersistent(false);
|
brokerService.setPersistent(false);
|
||||||
|
brokerService.getManagementContext().setCreateConnector(false);
|
||||||
PolicyMap policyMap = new PolicyMap();
|
PolicyMap policyMap = new PolicyMap();
|
||||||
PolicyEntry defaultPolicy = new PolicyEntry();
|
PolicyEntry defaultPolicy = new PolicyEntry();
|
||||||
defaultPolicy.setExpireMessagesPeriod(1000);
|
defaultPolicy.setExpireMessagesPeriod(1000);
|
||||||
@ -91,7 +93,7 @@ public class AMQ5274Test {
|
|||||||
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
|
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
|
||||||
MessageConsumer consumer = session.createConsumer(dest);
|
MessageConsumer consumer = session.createConsumer(dest);
|
||||||
Message m;
|
Message m;
|
||||||
while ( (m = consumer.receive(4000)) != null) {
|
while ((m = consumer.receive(4000)) != null) {
|
||||||
LOG.info("Got:" + m);
|
LOG.info("Got:" + m);
|
||||||
TimeUnit.SECONDS.sleep(1);
|
TimeUnit.SECONDS.sleep(1);
|
||||||
session.rollback();
|
session.rollback();
|
||||||
@ -106,8 +108,8 @@ public class AMQ5274Test {
|
|||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
MessageProducer producer = session.createProducer(dest);
|
MessageProducer producer = session.createProducer(dest);
|
||||||
producer.setTimeToLive(10000);
|
producer.setTimeToLive(10000);
|
||||||
for (int i=0;i<20;i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
producer.send(session.createTextMessage("i="+i));
|
producer.send(session.createTextMessage("i=" + i));
|
||||||
}
|
}
|
||||||
connection.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
@ -116,11 +118,11 @@ public class AMQ5274Test {
|
|||||||
return (ActiveMQConnection) new ActiveMQConnectionFactory(activemqURL).createConnection();
|
return (ActiveMQConnection) new ActiveMQConnectionFactory(activemqURL).createConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public long getQueueSize() throws Exception {
|
public long getQueueSize() throws Exception {
|
||||||
long queueSize = 0;
|
long queueSize = 0;
|
||||||
try {
|
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();
|
queueSize = queueViewMBean.getQueueSize();
|
||||||
LOG.info("QueueSize for destination {} is {}", dest, queueSize);
|
LOG.info("QueueSize for destination {} is {}", dest, queueSize);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -75,6 +75,7 @@ public class AMQ5421Test {
|
|||||||
policy.setTopicPrefetch(10);
|
policy.setTopicPrefetch(10);
|
||||||
PolicyMap pMap = new PolicyMap();
|
PolicyMap pMap = new PolicyMap();
|
||||||
pMap.setDefaultEntry(policy);
|
pMap.setDefaultEntry(policy);
|
||||||
|
brokerService.setUseJmx(false);
|
||||||
brokerService.setDestinationPolicy(pMap);
|
brokerService.setDestinationPolicy(pMap);
|
||||||
brokerService.addConnector("tcp://0.0.0.0:0");
|
brokerService.addConnector("tcp://0.0.0.0:0");
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user