This closes #1092
This commit is contained in:
commit
b58381f20e
|
@ -24,24 +24,23 @@ import org.apache.activemq.artemis.api.core.SimpleString;
|
|||
import org.apache.activemq.artemis.api.core.management.AddressControl;
|
||||
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
|
||||
import org.apache.activemq.artemis.tests.util.JMSClusteredTestBase;
|
||||
import org.apache.activemq.artemis.tests.util.Wait;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TopicControlClusterTest extends JMSClusteredTestBase {
|
||||
|
||||
@Test
|
||||
public void testClusteredSubscriptionCount() throws Exception {
|
||||
Connection conn1 = cf1.createConnection();
|
||||
final String topicName = "t1";
|
||||
final SimpleString simpleTopicName = SimpleString.toSimpleString(topicName);
|
||||
|
||||
try (Connection conn1 = cf1.createConnection(); Connection conn2 = cf2.createConnection()) {
|
||||
conn1.setClientID("someClient1");
|
||||
|
||||
Connection conn2 = cf2.createConnection();
|
||||
|
||||
conn2.setClientID("someClient2");
|
||||
|
||||
try {
|
||||
Topic topic1 = createTopic("t1");
|
||||
Topic topic1 = createTopic(topicName);
|
||||
|
||||
Topic topic2 = (Topic) context2.lookup("/topic/t1");
|
||||
Topic topic2 = (Topic) context2.lookup("/topic/" + topicName);
|
||||
|
||||
Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
session1.createDurableSubscriber(topic1, "sub1_1");
|
||||
|
@ -50,16 +49,14 @@ public class TopicControlClusterTest extends JMSClusteredTestBase {
|
|||
Session session2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
session2.createDurableSubscriber(topic2, "sub2");
|
||||
|
||||
SimpleString add1 = new SimpleString(topic1.getTopicName());
|
||||
SimpleString add2 = new SimpleString(topic2.getTopicName());
|
||||
AddressControl topicControl1 = ManagementControlHelper.createAddressControl(add1, mBeanServer1);
|
||||
AddressControl topicControl2 = ManagementControlHelper.createAddressControl(add2, mBeanServer2);
|
||||
AddressControl topicControl1 = ManagementControlHelper.createAddressControl(simpleTopicName, mBeanServer1);
|
||||
AddressControl topicControl2 = ManagementControlHelper.createAddressControl(simpleTopicName, mBeanServer2);
|
||||
|
||||
assertEquals(2, topicControl1.getQueueNames().length);
|
||||
assertEquals(1, topicControl2.getQueueNames().length);
|
||||
} finally {
|
||||
conn1.close();
|
||||
conn2.close();
|
||||
assertTrue("There should be 3 subscriptions on the topic, 2 local and 1 remote.",
|
||||
Wait.waitFor(() -> topicControl1.getQueueNames().length == 3, 2000));
|
||||
|
||||
assertTrue("There should be 3 subscriptions on the topic, 1 local and 2 remote.",
|
||||
Wait.waitFor(() -> topicControl2.getQueueNames().length == 3, 2000));
|
||||
}
|
||||
|
||||
jmsServer1.destroyTopic("t1");
|
||||
|
|
Loading…
Reference in New Issue