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:
Bosanac Dejan 2013-03-07 13:55:39 +00:00
parent 931ca1882e
commit 5bc37afb3b
1 changed files with 23 additions and 13 deletions

View File

@ -24,19 +24,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.jms.BytesMessage;
import javax.jms.Connection;
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.jms.*;
import javax.management.*;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.TabularData;
import junit.textui.TestRunner;
@ -1266,4 +1255,25 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
consumer.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);
}
}