mirror of https://github.com/apache/activemq.git
test for some mbean queries
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1453871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
931ca1882e
commit
5bc37afb3b
|
@ -24,19 +24,8 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.jms.BytesMessage;
|
import javax.jms.*;
|
||||||
import javax.jms.Connection;
|
import javax.management.*;
|
||||||
import javax.jms.ConnectionFactory;
|
|
||||||
import javax.jms.Destination;
|
|
||||||
import javax.jms.Message;
|
|
||||||
import javax.jms.MessageConsumer;
|
|
||||||
import javax.jms.MessageProducer;
|
|
||||||
import javax.jms.Session;
|
|
||||||
import javax.jms.Topic;
|
|
||||||
import javax.management.MBeanServer;
|
|
||||||
import javax.management.MBeanServerInvocationHandler;
|
|
||||||
import javax.management.MalformedObjectNameException;
|
|
||||||
import javax.management.ObjectName;
|
|
||||||
import javax.management.openmbean.CompositeData;
|
import javax.management.openmbean.CompositeData;
|
||||||
import javax.management.openmbean.TabularData;
|
import javax.management.openmbean.TabularData;
|
||||||
import junit.textui.TestRunner;
|
import junit.textui.TestRunner;
|
||||||
|
@ -1266,4 +1255,25 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
|
||||||
consumer.close();
|
consumer.close();
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testDynamicProducers() throws Exception {
|
||||||
|
connection = connectionFactory.createConnection();
|
||||||
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
MessageProducer producer = session.createProducer(null);
|
||||||
|
|
||||||
|
ObjectName query = new ObjectName(domain + ":type=Broker,brokerName=localhost,endpoint=dynamicProducer,*");
|
||||||
|
Set<ObjectInstance> mbeans = mbeanServer.queryMBeans(query, null);
|
||||||
|
assertEquals(mbeans.size(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDurableSubQuery() throws Exception {
|
||||||
|
connection = connectionFactory.createConnection();
|
||||||
|
connection.setClientID("test");
|
||||||
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
TopicSubscriber sub = session.createDurableSubscriber(session.createTopic("test.topic"), "test.consumer");
|
||||||
|
|
||||||
|
ObjectName query = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=test.topic,endpoint=Consumer,consumerId=Durable(*),*");
|
||||||
|
Set<ObjectInstance> mbeans = mbeanServer.queryMBeans(query, null);
|
||||||
|
assertEquals(mbeans.size(), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue