Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3315B200BB7 for ; Wed, 9 Nov 2016 14:13:40 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3192D160B16; Wed, 9 Nov 2016 13:13:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2F61A160AEE for ; Wed, 9 Nov 2016 14:13:38 +0100 (CET) Received: (qmail 1709 invoked by uid 500); 9 Nov 2016 13:13:37 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 1699 invoked by uid 99); 9 Nov 2016 13:13:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 13:13:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3D9B0E0999; Wed, 9 Nov 2016 13:13:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: andytaylor@apache.org To: commits@activemq.apache.org Date: Wed, 09 Nov 2016 13:13:37 -0000 Message-Id: <728b4f821123476baf2c3a20fd41694d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/6] activemq-artemis git commit: removal of all JMS control objects archived-at: Wed, 09 Nov 2016 13:13:40 -0000 Repository: activemq-artemis Updated Branches: refs/heads/ARTEMIS-780 dfe95573c -> a6f1167d7 http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java deleted file mode 100644 index 9a71e8d..0000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java +++ /dev/null @@ -1,669 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.tests.integration.jms.server.management; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.JMSContext; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.TopicSubscriber; -import javax.json.JsonArray; -import javax.management.Notification; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.activemq.artemis.api.core.JsonUtil; -import org.apache.activemq.artemis.api.core.client.ActiveMQClient; -import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; -import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; -import org.apache.activemq.artemis.api.jms.management.JMSServerControl; -import org.apache.activemq.artemis.api.jms.management.SubscriptionInfo; -import org.apache.activemq.artemis.api.jms.management.TopicControl; -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.postoffice.Binding; -import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; -import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; -import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; -import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.jms.client.ActiveMQDestination; -import org.apache.activemq.artemis.jms.client.ActiveMQTopic; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; -import org.apache.activemq.artemis.jms.server.management.JMSNotificationType; -import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper; -import org.apache.activemq.artemis.tests.integration.management.ManagementTestBase; -import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext; -import org.apache.activemq.artemis.utils.RandomUtil; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class TopicControlTest extends ManagementTestBase { - - // Constants ----------------------------------------------------- - - // Attributes ---------------------------------------------------- - - private ActiveMQServer server; - - private JMSServerManagerImpl serverManager; - - private String clientID; - - private String subscriptionName; - - protected ActiveMQTopic topic; - - private String topicBinding = "/topic/" + RandomUtil.randomString(); - - // Static -------------------------------------------------------- - - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - @Test - public void testGetAttributes() throws Exception { - TopicControl topicControl = createManagementControl(); - - Assert.assertEquals(topic.getTopicName(), topicControl.getName()); - Assert.assertEquals(topic.getAddress(), topicControl.getAddress()); - Assert.assertEquals(topic.isTemporary(), topicControl.isTemporary()); - Object[] bindings = topicControl.getRegistryBindings(); - Assert.assertEquals(1, bindings.length); - Assert.assertEquals(topicBinding, bindings[0]); - } - - @Test - public void testGetXXXSubscriptionsCount() throws Exception { - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - - // 1 non-durable subscriber, 2 durable subscribers - JMSUtil.createConsumer(connection_1, topic); - - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_2, topic, clientID, subscriptionName); - Connection connection_3 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_3, topic, clientID + "2", subscriptionName + "2"); - - TopicControl topicControl = createManagementControl(); - Assert.assertEquals(3, topicControl.getSubscriptionCount()); - Assert.assertEquals(1, topicControl.getNonDurableSubscriptionCount()); - Assert.assertEquals(2, topicControl.getDurableSubscriptionCount()); - - connection_1.close(); - connection_2.close(); - connection_3.close(); - } - - @Test - public void testGetXXXMessagesCount() throws Exception { - // 1 non-durable subscriber, 2 durable subscribers - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createConsumer(connection_1, topic); - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_2, topic, clientID, subscriptionName); - Connection connection_3 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_3, topic, clientID + "_2", subscriptionName + "2"); - - TopicControl topicControl = createManagementControl(); - - Assert.assertEquals(0, topicControl.getMessageCount()); - Assert.assertEquals(0, topicControl.getNonDurableMessageCount()); - Assert.assertEquals(0, topicControl.getDurableMessageCount()); - - JMSUtil.sendMessages(topic, 2); - - waitForMessageCount(3 * 2, topicControl, 3000); - waitForNonDurableMessageCount(1 * 2, topicControl, 3000); - waitForDurableMessageCount(2 * 2, topicControl, 3000); - - connection_1.close(); - connection_2.close(); - connection_3.close(); - } - - @Test - public void testListXXXSubscriptionsCount() throws Exception { - // 1 non-durable subscriber, 2 durable subscribers - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - MessageConsumer cons = JMSUtil.createConsumer(connection_1, topic); - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - TopicSubscriber subs1 = JMSUtil.createDurableSubscriber(connection_2, topic, clientID, subscriptionName); - Connection connection_3 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - TopicSubscriber subs2 = JMSUtil.createDurableSubscriber(connection_3, topic, clientID + "2", subscriptionName + "2"); - - TopicControl topicControl = createManagementControl(); - Assert.assertEquals(3, topicControl.listAllSubscriptions().length); - Assert.assertEquals(1, topicControl.listNonDurableSubscriptions().length); - Assert.assertEquals(2, topicControl.listDurableSubscriptions().length); - - String json = topicControl.listAllSubscriptionsAsJSON(); - System.out.println("Json: " + json); - JsonArray jsonArray = JsonUtil.readJsonArray(json); - - Assert.assertEquals(3, jsonArray.size()); - - connection_1.close(); - connection_2.close(); - connection_3.close(); - } - - @Test - public void testListXXXSubscriptionsAsJSON() throws Exception { - // 1 non-durable subscriber, 2 durable subscribers - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createConsumer(connection_1, topic); - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_2, topic, clientID, subscriptionName); - Connection connection_3 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_3, topic, clientID + "2", subscriptionName + "2"); - - TopicControl topicControl = createManagementControl(); - String jsonString = topicControl.listDurableSubscriptionsAsJSON(); - SubscriptionInfo[] infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(2, infos.length); - List expectedClientIds = Arrays.asList(clientID, clientID + "2"); - List expectedSubscriptionNames = Arrays.asList(subscriptionName, subscriptionName + "2"); - - Assert.assertTrue(expectedClientIds.contains(infos[0].getClientID())); - Assert.assertTrue(expectedSubscriptionNames.contains(infos[0].getName())); - - Assert.assertTrue(expectedClientIds.contains(infos[1].getClientID())); - Assert.assertTrue(expectedSubscriptionNames.contains(infos[1].getName())); - - jsonString = topicControl.listNonDurableSubscriptionsAsJSON(); - infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(1, infos.length); - Assert.assertNull(infos[0].getClientID()); - Assert.assertNull(infos[0].getName()); - - jsonString = topicControl.listAllSubscriptionsAsJSON(); - infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(3, infos.length); - - connection_1.close(); - connection_2.close(); - connection_3.close(); - } - - @Test - public void testListXXXSubscriptionsAsJSONJMS2() throws Exception { - ConnectionFactory cf = JMSUtil.createFactory(InVMConnectorFactory.class.getName(), ActiveMQClient.DEFAULT_CONNECTION_TTL_INVM, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD_INVM); - JMSContext jmsContext1 = cf.createContext(); - jmsContext1.createSharedDurableConsumer(topic, subscriptionName, null); - JMSContext jmsContext2 = cf.createContext(); - jmsContext2.createSharedDurableConsumer(topic, subscriptionName + "2", null); - JMSContext jmsContext3 = cf.createContext(); - jmsContext3.createConsumer(topic); - - TopicControl topicControl = createManagementControl(); - String jsonString = topicControl.listDurableSubscriptionsAsJSON(); - SubscriptionInfo[] infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(2, infos.length); - - Assert.assertNull(infos[0].getClientID()); - Assert.assertTrue(infos[0].getName().equals(subscriptionName)); - - Assert.assertNull(infos[1].getClientID()); - Assert.assertTrue(infos[1].getName().equals(subscriptionName + "2")); - - jsonString = topicControl.listNonDurableSubscriptionsAsJSON(); - infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(1, infos.length); - Assert.assertNull(infos[0].getClientID()); - Assert.assertNull(infos[0].getName()); - - jsonString = topicControl.listAllSubscriptionsAsJSON(); - infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(3, infos.length); - - jmsContext1.close(); - jmsContext2.close(); - jmsContext3.close(); - } - - @Test - public void testListSubscriptionsAsJSONWithHierarchicalTopics() throws Exception { - // there are no entries in mappings and nameMap in postOffice.addressManager; something isn't creating them as expected - serverManager.createTopic(false, "my.jms.#", "jms/all"); - serverManager.createTopic(false, "my.jms.A", "jms/A"); - ActiveMQTopic myTopic = (ActiveMQTopic) ActiveMQJMSClient.createTopic("my.jms.A"); - - TopicControl topicControl = ManagementControlHelper.createTopicControl(myTopic, mbeanServer); - String jsonString = topicControl.listDurableSubscriptionsAsJSON(); - SubscriptionInfo[] infos = SubscriptionInfo.from(jsonString); - Assert.assertEquals(1, infos.length); - Assert.assertEquals("", infos[0].getClientID()); - Assert.assertEquals("", infos[0].getName()); - } - - @Test - public void testCountMessagesForSubscription() throws Exception { - String key = "key"; - long matchingValue = RandomUtil.randomLong(); - long unmatchingValue = matchingValue + 1; - - Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection, topic, clientID, subscriptionName); - - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - JMSUtil.sendMessageWithProperty(session, topic, key, matchingValue); - JMSUtil.sendMessageWithProperty(session, topic, key, unmatchingValue); - JMSUtil.sendMessageWithProperty(session, topic, key, matchingValue); - - for (Binding binding : server.getPostOffice().getBindingsForAddress(topic.getSimpleAddress()).getBindings()) { - ((LocalQueueBinding) binding).getQueue().flushExecutor(); - } - - TopicControl topicControl = createManagementControl(); - - Assert.assertEquals(3, topicControl.getMessageCount()); - - Assert.assertEquals(2, topicControl.countMessagesForSubscription(clientID, subscriptionName, key + " =" + - matchingValue)); - Assert.assertEquals(1, topicControl.countMessagesForSubscription(clientID, subscriptionName, key + " =" + - unmatchingValue)); - - connection.close(); - } - - @Test - public void testCountMessagesForUnknownSubscription() throws Exception { - String unknownSubscription = RandomUtil.randomString(); - - TopicControl topicControl = createManagementControl(); - - try { - topicControl.countMessagesForSubscription(clientID, unknownSubscription, null); - Assert.fail(); - } catch (Exception e) { - } - } - - @Test - public void testCountMessagesForUnknownClientID() throws Exception { - String unknownClientID = RandomUtil.randomString(); - - TopicControl topicControl = createManagementControl(); - - try { - topicControl.countMessagesForSubscription(unknownClientID, subscriptionName, null); - Assert.fail(); - } catch (Exception e) { - } - } - - @Test - public void testDropDurableSubscriptionWithExistingSubscription() throws Exception { - Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - - JMSUtil.createDurableSubscriber(connection, topic, clientID, subscriptionName); - - TopicControl topicControl = createManagementControl(); - Assert.assertEquals(1, topicControl.getDurableSubscriptionCount()); - - connection.close(); - - topicControl.dropDurableSubscription(clientID, subscriptionName); - - Assert.assertEquals(0, topicControl.getDurableSubscriptionCount()); - } - - @Test - public void testDropDurableSubscriptionWithUnknownSubscription() throws Exception { - Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - - JMSUtil.createDurableSubscriber(connection, topic, clientID, subscriptionName); - - TopicControl topicControl = createManagementControl(); - Assert.assertEquals(1, topicControl.getDurableSubscriptionCount()); - - try { - topicControl.dropDurableSubscription(clientID, "this subscription does not exist"); - Assert.fail("should throw an exception"); - } catch (Exception e) { - - } - - Assert.assertEquals(1, topicControl.getDurableSubscriptionCount()); - - connection.close(); - } - - @Test - public void testDropAllSubscriptions() throws Exception { - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - connection_1.setClientID(clientID); - Session sess1 = connection_1.createSession(false, Session.AUTO_ACKNOWLEDGE); - TopicSubscriber durableSubscriber_1 = sess1.createDurableSubscriber(topic, subscriptionName); - - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - connection_2.setClientID(clientID + "2"); - Session sess2 = connection_1.createSession(false, Session.AUTO_ACKNOWLEDGE); - TopicSubscriber durableSubscriber_2 = sess2.createDurableSubscriber(topic, subscriptionName + "2"); - - connection_1.start(); - connection_2.start(); - - Session sess = connection_1.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer prod = sess.createProducer(topic); - - TextMessage msg1 = sess.createTextMessage("tst1"); - prod.send(msg1); - - Assert.assertNotNull(durableSubscriber_1.receive(5000)); - Assert.assertNotNull(durableSubscriber_2.receive(5000)); - - connection_1.close(); - connection_2.close(); - - TopicControl topicControl = createManagementControl(); - - Assert.assertEquals(2, topicControl.getSubscriptionCount()); - topicControl.dropAllSubscriptions(); - - Assert.assertEquals(0, topicControl.getSubscriptionCount()); - - connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - connection_1.setClientID(clientID); - sess = connection_1.createSession(false, Session.AUTO_ACKNOWLEDGE); - prod = sess.createProducer(topic); - TextMessage msg2 = sess.createTextMessage("tst2"); - prod.send(msg2); - - } - - @Test - public void testRemoveAllMessages() throws Exception { - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_1, topic, clientID, subscriptionName); - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_2, topic, clientID + "2", subscriptionName + "2"); - - JMSUtil.sendMessages(topic, 3); - - TopicControl topicControl = createManagementControl(); - waitForMessageCount(3 * 2, topicControl, 3000); - - int removedCount = topicControl.removeMessages(null); - Assert.assertEquals(3 * 2, removedCount); - Assert.assertEquals(0, topicControl.getMessageCount()); - - connection_1.close(); - connection_2.close(); - } - - @Test - public void testListMessagesForSubscription() throws Exception { - Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - - JMSUtil.createDurableSubscriber(connection, topic, clientID, subscriptionName); - - JMSUtil.sendMessages(topic, 3); - - TopicControl topicControl = createManagementControl(); - Map[] messages = topicControl.listMessagesForSubscription(ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, subscriptionName)); - Assert.assertEquals(3, messages.length); - - connection.close(); - } - - @Test - public void testListMessagesForSubscriptionAsJSON() throws Exception { - Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - - JMSUtil.createDurableSubscriber(connection, topic, clientID, subscriptionName); - - String[] ids = JMSUtil.sendMessages(topic, 3); - - TopicControl topicControl = createManagementControl(); - String jsonString = topicControl.listMessagesForSubscriptionAsJSON(ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, subscriptionName)); - Assert.assertNotNull(jsonString); - JsonArray array = JsonUtil.readJsonArray(jsonString); - Assert.assertEquals(3, array.size()); - for (int i = 0; i < 3; i++) { - Assert.assertEquals(ids[i], array.getJsonObject(i).getString("JMSMessageID")); - } - - connection.close(); - } - - @Test - public void testListMessagesForSubscriptionWithUnknownClientID() throws Exception { - String unknownClientID = RandomUtil.randomString(); - - TopicControl topicControl = createManagementControl(); - - try { - topicControl.listMessagesForSubscription(ActiveMQDestination.createQueueNameForDurableSubscription(true, unknownClientID, subscriptionName)); - Assert.fail(); - } catch (Exception e) { - } - } - - @Test - public void testListMessagesForSubscriptionWithUnknownSubscription() throws Exception { - String unknownSubscription = RandomUtil.randomString(); - - TopicControl topicControl = createManagementControl(); - - try { - topicControl.listMessagesForSubscription(ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, unknownSubscription)); - Assert.fail(); - } catch (Exception e) { - } - } - - @Test - public void testGetMessagesAdded() throws Exception { - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createConsumer(connection_1, topic); - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_2, topic, clientID, subscriptionName); - Connection connection_3 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - JMSUtil.createDurableSubscriber(connection_3, topic, clientID + "2", subscriptionName + "2"); - - TopicControl topicControl = createManagementControl(); - - Assert.assertEquals(0, topicControl.getMessagesAdded()); - - JMSUtil.sendMessages(topic, 2); - - waitForAddedMessageCount(3 * 2, topicControl, 3000); - - connection_1.close(); - connection_2.close(); - connection_3.close(); - } - - @Test - public void testGetMessagesDelivering() throws Exception { - Connection connection_1 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - MessageConsumer cons_1 = JMSUtil.createConsumer(connection_1, topic, Session.CLIENT_ACKNOWLEDGE); - Connection connection_2 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - MessageConsumer cons_2 = JMSUtil.createDurableSubscriber(connection_2, topic, clientID, subscriptionName, Session.CLIENT_ACKNOWLEDGE); - Connection connection_3 = JMSUtil.createConnection(InVMConnectorFactory.class.getName()); - MessageConsumer cons_3 = JMSUtil.createDurableSubscriber(connection_3, topic, clientID + "2", subscriptionName + "2", Session.CLIENT_ACKNOWLEDGE); - - TopicControl topicControl = createManagementControl(); - - Assert.assertEquals(0, topicControl.getDeliveringCount()); - - JMSUtil.sendMessages(topic, 2); - - Assert.assertEquals(0, topicControl.getDeliveringCount()); - - connection_1.start(); - connection_2.start(); - connection_3.start(); - - Message msg_1 = null; - Message msg_2 = null; - Message msg_3 = null; - for (int i = 0; i < 2; i++) { - msg_1 = cons_1.receive(5000); - Assert.assertNotNull(msg_1); - msg_2 = cons_2.receive(5000); - Assert.assertNotNull(msg_2); - msg_3 = cons_3.receive(5000); - Assert.assertNotNull(msg_3); - } - - Assert.assertEquals(3 * 2, topicControl.getDeliveringCount()); - - msg_1.acknowledge(); - Assert.assertEquals(2 * 2, topicControl.getDeliveringCount()); - msg_2.acknowledge(); - Assert.assertEquals(1 * 2, topicControl.getDeliveringCount()); - msg_3.acknowledge(); - Assert.assertEquals(0, topicControl.getDeliveringCount()); - - connection_1.close(); - connection_2.close(); - connection_3.close(); - } - - //make sure notifications are always received no matter whether - //a Topic is created via JMSServerControl or by JMSServerManager directly. - @Test - public void testCreateTopicNotification() throws Exception { - JMSUtil.JMXListener listener = new JMSUtil.JMXListener(); - this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null); - - List connectors = new ArrayList<>(); - connectors.add("invm"); - - String testTopicName = "newTopic"; - serverManager.createTopic(true, testTopicName, testTopicName); - - Notification notif = listener.getNotification(); - - Assert.assertEquals(JMSNotificationType.TOPIC_CREATED.toString(), notif.getType()); - Assert.assertEquals(testTopicName, notif.getMessage()); - - this.serverManager.destroyTopic(testTopicName); - - notif = listener.getNotification(); - Assert.assertEquals(JMSNotificationType.TOPIC_DESTROYED.toString(), notif.getType()); - Assert.assertEquals(testTopicName, notif.getMessage()); - - JMSServerControl control = ManagementControlHelper.createJMSServerControl(mbeanServer); - - control.createTopic(testTopicName); - - notif = listener.getNotification(); - Assert.assertEquals(JMSNotificationType.TOPIC_CREATED.toString(), notif.getType()); - Assert.assertEquals(testTopicName, notif.getMessage()); - - control.destroyTopic(testTopicName); - - notif = listener.getNotification(); - Assert.assertEquals(JMSNotificationType.TOPIC_DESTROYED.toString(), notif.getType()); - Assert.assertEquals(testTopicName, notif.getMessage()); - } - - // Package protected --------------------------------------------- - - // Protected ----------------------------------------------------- - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - Configuration config = createDefaultInVMConfig().setJMXManagementEnabled(true); - server = addServer(ActiveMQServers.newActiveMQServer(config, mbeanServer, false)); - server.start(); - - serverManager = new JMSServerManagerImpl(server); - serverManager.start(); - serverManager.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); - serverManager.activated(); - - clientID = RandomUtil.randomString(); - subscriptionName = RandomUtil.randomString(); - - String topicName = RandomUtil.randomString(); - serverManager.createTopic(false, topicName, topicBinding); - topic = (ActiveMQTopic) ActiveMQJMSClient.createTopic(topicName); - } - - protected TopicControl createManagementControl() throws Exception { - return ManagementControlHelper.createTopicControl(topic, mbeanServer); - } - - // Private ------------------------------------------------------- - - private void waitForMessageCount(long expected, TopicControl topicControl, long timeout) throws Exception { - long timeToWait = System.currentTimeMillis() + timeout; - - while (System.currentTimeMillis() < timeToWait) { - if (expected == topicControl.getMessageCount()) { - return; - } - Thread.sleep(100); - } - assertEquals(expected, topicControl.getMessageCount()); - } - - private void waitForNonDurableMessageCount(long expected, TopicControl topicControl, long timeout) throws Exception { - long timeToWait = System.currentTimeMillis() + timeout; - - while (System.currentTimeMillis() < timeToWait) { - if (expected == topicControl.getNonDurableMessageCount()) { - return; - } - Thread.sleep(100); - } - assertEquals(expected, topicControl.getNonDurableMessageCount()); - } - - private void waitForDurableMessageCount(long expected, TopicControl topicControl, long timeout) throws Exception { - long timeToWait = System.currentTimeMillis() + timeout; - - while (System.currentTimeMillis() < timeToWait) { - if (expected == topicControl.getDurableMessageCount()) { - return; - } - Thread.sleep(100); - } - assertEquals(expected, topicControl.getDurableMessageCount()); - } - - private void waitForAddedMessageCount(long expected, TopicControl topicControl, long timeout) throws Exception { - long timeToWait = System.currentTimeMillis() + timeout; - - while (System.currentTimeMillis() < timeToWait) { - if (expected == topicControl.getMessagesAdded()) { - return; - } - Thread.sleep(100); - } - assertEquals(expected, topicControl.getMessagesAdded()); - } - - // Inner classes ------------------------------------------------- - -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlUsingCoreTest.java index 5907f3f..3aa3ddd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlUsingCoreTest.java @@ -38,7 +38,7 @@ public class AcceptorControlUsingCoreTest extends AcceptorControlTest { protected AcceptorControl createManagementControl(final String name) throws Exception { return new AcceptorControl() { - private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.CORE_ACCEPTOR + name); + private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.ACCEPTOR + name); @Override public String getFactoryClassName() { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java index 52800a8..b606261 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java @@ -66,7 +66,7 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes throw new UnsupportedOperationException(); } - private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.CORE_SERVER); + private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.BROKER); @Override public boolean isSharedStore() { @@ -104,6 +104,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes } @Override + public void deleteAddress(@Parameter(name = "name", desc = "The name of the address") String name) throws Exception { + proxy.invokeOperation("deleteAddress", name); + } + + @Override public void createQueue(final String address, final String name, final String filter, http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java index a845253..1587cef 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java @@ -176,7 +176,7 @@ public class AddressControlUsingCoreTest extends ManagementTestBase { } protected CoreMessagingProxy createProxy(final SimpleString address) throws Exception { - CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.CORE_ADDRESS + address); + CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.ADDRESS + address); return proxy; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java index 208f0ba..e0ff4c8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java @@ -123,7 +123,7 @@ public class BridgeControlUsingCoreTest extends ManagementTestBase { } protected CoreMessagingProxy createProxy(final String name) throws Exception { - CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.CORE_BRIDGE + name); + CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.BRIDGE + name); return proxy; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlUsingCoreTest.java index 6165be4..0533dc5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlUsingCoreTest.java @@ -24,7 +24,7 @@ public class BroadcastGroupControlUsingCoreTest extends BroadcastGroupControlTes @Override protected BroadcastGroupControl createManagementControl(final String name) throws Exception { return new BroadcastGroupControl() { - private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.CORE_BROADCAST_GROUP + name); + private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.BROADCAST_GROUP + name); @Override public long getBroadcastPeriod() { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java index ecf4142..61ecda2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java @@ -34,7 +34,7 @@ public class DivertControlUsingCoreTest extends DivertControlTest { @Override protected DivertControl createDivertManagementControl(final String name, final String address) throws Exception { return new DivertControl() { - private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.CORE_DIVERT + name); + private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()), ResourceNames.DIVERT + name); @Override public String getAddress() { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java index 641d97c..0f82222 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.management; -import javax.jms.Queue; -import javax.jms.Topic; import javax.management.MBeanServer; import javax.management.MBeanServerInvocationHandler; import javax.management.ObjectName; @@ -32,10 +30,6 @@ import org.apache.activemq.artemis.api.core.management.ClusterConnectionControl; import org.apache.activemq.artemis.api.core.management.DivertControl; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; -import org.apache.activemq.artemis.api.jms.management.ConnectionFactoryControl; -import org.apache.activemq.artemis.api.jms.management.JMSQueueControl; -import org.apache.activemq.artemis.api.jms.management.JMSServerControl; -import org.apache.activemq.artemis.api.jms.management.TopicControl; public class ManagementControlHelper { @@ -83,29 +77,6 @@ public class ManagementControlHelper { return (AddressControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getAddressObjectName(address), AddressControl.class, mbeanServer); } - public static JMSQueueControl createJMSQueueControl(final Queue queue, - final MBeanServer mbeanServer) throws Exception { - return ManagementControlHelper.createJMSQueueControl(queue.getQueueName(), mbeanServer); - } - - public static JMSQueueControl createJMSQueueControl(final String name, - final MBeanServer mbeanServer) throws Exception { - return (JMSQueueControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(name), JMSQueueControl.class, mbeanServer); - } - - public static JMSServerControl createJMSServerControl(final MBeanServer mbeanServer) throws Exception { - return (JMSServerControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), JMSServerControl.class, mbeanServer); - } - - public static ConnectionFactoryControl createConnectionFactoryControl(final String name, - final MBeanServer mbeanServer) throws Exception { - return (ConnectionFactoryControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getConnectionFactoryObjectName(name), ConnectionFactoryControl.class, mbeanServer); - } - - public static TopicControl createTopicControl(final Topic topic, final MBeanServer mbeanServer) throws Exception { - return (TopicControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topic.getTopicName()), TopicControl.class, mbeanServer); - } - // Constructors -------------------------------------------------- // Public -------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java index 2004ee8..1afc732 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java @@ -51,7 +51,7 @@ public class ManagementServiceImplTest extends ActiveMQTestBase { // invoke attribute and operation on the server ServerMessage message = new ServerMessageImpl(1, 100); - ManagementHelper.putOperationInvocation(message, ResourceNames.CORE_SERVER, "createQueue", queue, address); + ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "createQueue", queue, address); ServerMessage reply = server.getManagementService().handleMessage(message); @@ -67,7 +67,7 @@ public class ManagementServiceImplTest extends ActiveMQTestBase { // invoke attribute and operation on the server ServerMessage message = new ServerMessageImpl(1, 100); - ManagementHelper.putOperationInvocation(message, ResourceNames.CORE_SERVER, "thereIsNoSuchOperation"); + ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "thereIsNoSuchOperation"); ServerMessage reply = server.getManagementService().handleMessage(message); @@ -102,7 +102,7 @@ public class ManagementServiceImplTest extends ActiveMQTestBase { // invoke attribute and operation on the server ServerMessage message = new ServerMessageImpl(1, 100); - ManagementHelper.putAttribute(message, ResourceNames.CORE_SERVER, "started"); + ManagementHelper.putAttribute(message, ResourceNames.BROKER, "started"); ServerMessage reply = server.getManagementService().handleMessage(message); @@ -120,7 +120,7 @@ public class ManagementServiceImplTest extends ActiveMQTestBase { // invoke attribute and operation on the server ServerMessage message = new ServerMessageImpl(1, 100); - ManagementHelper.putAttribute(message, ResourceNames.CORE_SERVER, "attribute.Does.Not.Exist"); + ManagementHelper.putAttribute(message, ResourceNames.BROKER, "attribute.Does.Not.Exist"); ServerMessage reply = server.getManagementService().handleMessage(message); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java index 8b79e7c..6647c43 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java @@ -25,7 +25,6 @@ import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.management.QueueControl; -import org.apache.activemq.artemis.api.jms.management.JMSQueueControl; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.After; import org.junit.Assert; @@ -105,16 +104,6 @@ public abstract class ManagementTestBase extends ActiveMQTestBase { return queueControl; } - protected long getMessageCount(JMSQueueControl control) throws Exception { - control.flushExecutor(); - return control.getMessageCount(); - } - - protected long getMessagesAdded(JMSQueueControl control) throws Exception { - control.flushExecutor(); - return control.getMessagesAdded(); - } - protected long getMessageCount(QueueControl control) throws Exception { control.flushExecutor(); return control.getMessageCount(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementTestBase.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementTestBase.java index c4e27af..b9d7aa7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementTestBase.java @@ -75,7 +75,7 @@ public abstract class SecurityManagementTestBase extends ActiveMQTestBase { ClientRequestor requestor = new ClientRequestor(session, ActiveMQDefaultConfiguration.getDefaultManagementAddress()); ClientMessage mngmntMessage = session.createMessage(false); - ManagementHelper.putAttribute(mngmntMessage, ResourceNames.CORE_SERVER, "started"); + ManagementHelper.putAttribute(mngmntMessage, ResourceNames.BROKER, "started"); ClientMessage reply = requestor.request(mngmntMessage, 500); if (expectSuccess) { Assert.assertNotNull(reply); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java index 66706ad..52f090d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java @@ -26,7 +26,6 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.api.jms.management.JMSServerControl; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; import org.apache.activemq.artemis.core.security.Role; @@ -36,7 +35,6 @@ import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfigurat import org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl; import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; -import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper; import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.After; @@ -143,10 +141,6 @@ public class OpenWireTestBase extends ActiveMQTestBase { jmsServer.createConnectionFactory(false, configuration, jndiBindings); } - protected JMSServerControl getJMSServerControl() throws Exception { - return ManagementControlHelper.createJMSServerControl(mbeanServer); - } - @Override @After public void tearDown() throws Exception { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java index f02de79..196ea97 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java @@ -36,7 +36,6 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.QueueControl; -import org.apache.activemq.artemis.api.jms.management.JMSQueueControl; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; import org.apache.activemq.artemis.core.server.ActiveMQServer; @@ -101,11 +100,6 @@ public class JMSTestBase extends ActiveMQTestBase { return createTopic(false, topicName); } - protected long getMessageCount(JMSQueueControl control) throws Exception { - control.flushExecutor(); - return control.getMessageCount(); - } - protected long getMessageCount(QueueControl control) throws Exception { control.flushExecutor(); return control.getMessageCount(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java index f309c16..3fae952 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java @@ -228,27 +228,6 @@ public abstract class ActiveMQServerTestCase { queue4 = (Queue) ic.lookup("/queue/Queue4"); } - protected void undeployAdministeredObjects() throws Exception { - removeAllMessages("Topic1", false); - removeAllMessages("Topic2", false); - removeAllMessages("Topic3", false); - removeAllMessages("Queue1", true); - removeAllMessages("Queue2", true); - removeAllMessages("Queue3", true); - removeAllMessages("Queue4", true); - - destroyTopic("Topic1"); - destroyTopic("Topic2"); - destroyTopic("Topic3"); - destroyQueue("Queue1"); - destroyQueue("Queue2"); - destroyQueue("Queue3"); - destroyQueue("Queue4"); - - undeployConnectionFactory("ConnectionFactory"); - undeployConnectionFactory("CF_TOPIC"); - undeployConnectionFactory("CF_XA_TRUE"); - } @AfterClass public static final void tearDownAllServers() { @@ -362,7 +341,7 @@ public abstract class ActiveMQServerTestCase { } protected void removeAllMessages(final String destName, final boolean isQueue) throws Exception { - ActiveMQServerTestCase.servers.get(0).removeAllMessages(destName, isQueue); + ActiveMQServerTestCase.servers.get(0).removeAllMessages(destName); } protected boolean assertRemainingMessages(final int expected) throws Exception { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java index 9f15229..d2bdd19 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java @@ -34,8 +34,8 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.management.AddressControl; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; +import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.api.jms.JMSFactoryType; -import org.apache.activemq.artemis.api.jms.management.TopicControl; import org.apache.activemq.artemis.core.config.FileDeploymentManager; import org.apache.activemq.artemis.core.config.impl.FileConfiguration; import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; @@ -340,14 +340,9 @@ public class LocalTestServer implements Server, Runnable { } @Override - public void removeAllMessages(final String destination, final boolean isQueue) throws Exception { - if (isQueue) { - QueueControl queue = (QueueControl) getActiveMQServer().getManagementService().getResource("queue." + destination); - queue.removeMessages(null); - } else { - TopicControl topic = (TopicControl) getActiveMQServer().getManagementService().getResource(destination); - topic.removeMessages(null); - } + public void removeAllMessages(final String queueName) throws Exception { + QueueControl queue = (QueueControl) getActiveMQServer().getManagementService().getResource(ResourceNames.CORE_QUEUE + queueName); + queue.removeMessages(null); } @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java ---------------------------------------------------------------------- diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java index 1180726..7d21289 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java @@ -174,7 +174,7 @@ public interface Server extends Remote { InitialContext getInitialContext() throws Exception; - void removeAllMessages(String destination, boolean isQueue) throws Exception; + void removeAllMessages(String destination) throws Exception; Long getMessageCountForQueue(String queueName) throws Exception; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java ---------------------------------------------------------------------- diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java index 7d9d24a..f76c5b5 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java @@ -36,7 +36,6 @@ import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; -import org.junit.Assert; import org.objectweb.jtests.jms.admin.Admin; /** @@ -121,7 +120,7 @@ public class AbstractAdmin implements Admin { public void createQueue(final String name) { Boolean result; try { - invokeSyncOperation(ResourceNames.CORE_SERVER, "createQueue", name, name); + invokeSyncOperation(ResourceNames.BROKER, "createQueue", name, name); } catch (Exception e) { throw new IllegalStateException(e); } @@ -131,7 +130,7 @@ public class AbstractAdmin implements Admin { public void deleteQueue(final String name) { Boolean result; try { - invokeSyncOperation(ResourceNames.CORE_SERVER, "destroyQueue", name); + invokeSyncOperation(ResourceNames.BROKER, "destroyQueue", name); } catch (Exception e) { throw new IllegalStateException(e); } @@ -151,7 +150,7 @@ public class AbstractAdmin implements Admin { public void createTopic(final String name) { Boolean result; try { - invokeSyncOperation(ResourceNames.CORE_SERVER, "createAddress", name, (int)AddressInfo.RoutingType.MULTICAST.getType(), false, -1); + invokeSyncOperation(ResourceNames.BROKER, "createAddress", name, (int)AddressInfo.RoutingType.MULTICAST.getType(), false, -1); } catch (Exception e) { throw new IllegalStateException(e); } @@ -161,8 +160,7 @@ public class AbstractAdmin implements Admin { public void deleteTopic(final String name) { Boolean result; try { - result = (Boolean) invokeSyncOperation(ResourceNames.JMS_SERVER, "destroyTopic", name); - Assert.assertEquals(true, result.booleanValue()); + invokeSyncOperation(ResourceNames.BROKER, "deleteAddress", name); } catch (Exception e) { throw new IllegalStateException(e); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java ---------------------------------------------------------------------- diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java index 321bdca..df0c4a2 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java @@ -21,7 +21,6 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.Hashtable; -import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.common.AbstractAdmin; import org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory; @@ -61,15 +60,6 @@ public class ActiveMQCoreAdmin extends AbstractAdmin { } - private void createConnection(final String name, final int cfType) { - try { - invokeSyncOperation(ResourceNames.JMS_SERVER, "createConnectionFactory", name, false, false, cfType, "netty", name); - } catch (Exception e) { - throw new IllegalStateException(e); - } - - } - @Override public Context createContext() throws NamingException { return new InitialContext(jndiProps); @@ -99,12 +89,7 @@ public class ActiveMQCoreAdmin extends AbstractAdmin { @Override public void deleteConnectionFactory(final String name) { - try { - invokeSyncOperation(ResourceNames.JMS_SERVER, "destroyConnectionFactory", name); - jndiProps.remove("connectionFactory." + name); - } catch (Exception e) { - throw new IllegalStateException(e); - } + jndiProps.remove("connectionFactory." + name); } @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java ---------------------------------------------------------------------- diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java index 34bbdb2..6aefd52 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java @@ -44,11 +44,12 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; +import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.JMSFactoryType; -import org.apache.activemq.artemis.api.jms.management.JMSQueueControl; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; @@ -468,8 +469,8 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { } sourceConn.close(); - - JMSQueueControl jmsQueueControl = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(), ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(JMSBridgeImplTest.SOURCE), JMSQueueControl.class, false); + SimpleString add = new SimpleString(JMSBridgeImplTest.SOURCE); + QueueControl jmsQueueControl = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(), ObjectNameBuilder.DEFAULT.getQueueObjectName(add, add), QueueControl.class, false); assertNotEquals(jmsQueueControl.getDeliveringCount(), numMessages); bridge.stop();