You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/01/15 22:13:52 UTC
[activemq-artemis] branch 2.6.x updated (0bfba42 -> 29abe0d)
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a change to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git.
from 0bfba42 ARTEMIS-2229 Qpid jms consumer cannot receive from multicast queue using FQQN
new b872763 Revert "ARTEMIS-2190 Fixing Test"
new 29abe0d ARTEMIS-2190 move tests
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../jms/client/TemporaryDestinationTest.java | 207 +++++++++++++++++++++
.../activemq/artemis/tests/util/JMSTestBase.java | 20 ++
.../jms/tests/TemporaryDestinationTest.java | 48 -----
3 files changed, 227 insertions(+), 48 deletions(-)
create mode 100644 tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
[activemq-artemis] 01/02: Revert "ARTEMIS-2190 Fixing Test"
Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit b8727637a4afe3eef06158e132651f2a261170cf
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Jan 15 17:11:57 2019 -0500
Revert "ARTEMIS-2190 Fixing Test"
This reverts commit 877e16ccc5a325b542e9e8189a39a4b8d66c125c.
---
.../jms/tests/TemporaryDestinationTest.java | 121 +++++++++++++++++++++
1 file changed, 121 insertions(+)
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
index af4077a..6b29aea 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
@@ -27,6 +27,7 @@ import javax.jms.TemporaryTopic;
import javax.jms.TextMessage;
import javax.naming.NamingException;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport;
@@ -313,6 +314,126 @@ public class TemporaryDestinationTest extends JMSTestCase {
}
@Test
+ public void testTemporaryQueueDeletedAfterSessionClosed() throws Exception {
+ servers.get(0).getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
+
+ Connection conn = null;
+
+ try {
+ conn = createConnection();
+
+ Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Make sure temporary queue cannot be used after it has been deleted
+
+ TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
+
+ MessageProducer producer = producerSession.createProducer(tempQueue);
+
+ MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
+
+ conn.start();
+
+ final String messageText = "This is a message";
+
+ Message m = producerSession.createTextMessage(messageText);
+
+ producer.send(m);
+
+ TextMessage m2 = (TextMessage) consumer.receive(2000);
+
+ ProxyAssertSupport.assertNotNull(m2);
+
+ ProxyAssertSupport.assertEquals(messageText, m2.getText());
+
+ consumer.close();
+
+ consumerSession.close();
+
+ producer.close();
+
+ producerSession.close();
+
+ tempQueue.delete();
+
+ producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ try {
+ producer = producerSession.createProducer(tempQueue);
+ producer.send(m);
+ ProxyAssertSupport.fail();
+ } catch (JMSException e) {
+ }
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testTemporaryTopicDeletedAfterSessionClosed() throws Exception {
+ servers.get(0).getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
+
+ Connection conn = null;
+
+ try {
+ conn = createConnection();
+
+ Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Make sure temporary topic cannot be used after it has been deleted
+
+ TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
+
+ MessageProducer producer = producerSession.createProducer(tempTopic);
+
+ MessageConsumer consumer = consumerSession.createConsumer(tempTopic);
+
+ conn.start();
+
+ final String messageText = "This is a message";
+
+ Message m = producerSession.createTextMessage(messageText);
+
+ producer.send(m);
+
+ TextMessage m2 = (TextMessage) consumer.receive(2000);
+
+ ProxyAssertSupport.assertNotNull(m2);
+
+ ProxyAssertSupport.assertEquals(messageText, m2.getText());
+
+ consumer.close();
+
+ consumerSession.close();
+
+ producer.close();
+
+ producerSession.close();
+
+ tempTopic.delete();
+
+ producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ try {
+ producer = producerSession.createProducer(tempTopic);
+ producer.send(m);
+ ProxyAssertSupport.fail();
+ } catch (JMSException e) {
+ }
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
public void testTemporaryTopicBasic() throws Exception {
Connection conn = null;
[activemq-artemis] 02/02: ARTEMIS-2190 move tests
Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 29abe0d8c17cd5cdf927474f6ef488c47f17a3e2
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Fri Dec 21 09:15:45 2018 -0600
ARTEMIS-2190 move tests
The "jms-tests" module is deprecated and these tests should have never
gone in there. Moving them to the "integration-tests" module.
(cherry picked from commit d7eb076d4bbde61a68617dfcee0f790ef873b05c)
---
.../jms/client/TemporaryDestinationTest.java | 207 +++++++++++++++++++++
.../activemq/artemis/tests/util/JMSTestBase.java | 20 ++
.../jms/tests/TemporaryDestinationTest.java | 169 -----------------
3 files changed, 227 insertions(+), 169 deletions(-)
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
new file mode 100644
index 0000000..6f87d52
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
@@ -0,0 +1,207 @@
+/*
+ * 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.client;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
+import org.apache.activemq.artemis.tests.util.JMSTestBase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TemporaryDestinationTest extends JMSTestBase {
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void testTemporaryQueueLeak() throws Exception {
+ ActiveMQConnection conn = null;
+
+ try {
+ conn = (ActiveMQConnection) createConnection();
+
+ Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
+
+ MessageProducer producer = producerSession.createProducer(tempQueue);
+
+ MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
+
+ conn.start();
+
+ final String messageText = "This is a message";
+
+ javax.jms.Message m = producerSession.createTextMessage(messageText);
+
+ producer.send(m);
+
+ TextMessage m2 = (TextMessage) consumer.receive(2000);
+
+ assertNotNull(m2);
+
+ assertEquals(messageText, m2.getText());
+
+ consumer.close();
+
+ tempQueue.delete();
+
+ assertFalse(conn.containsKnownDestination(SimpleString.toSimpleString(tempQueue.getQueueName())));
+
+ assertFalse(conn.containsTemporaryQueue(SimpleString.toSimpleString(tempQueue.getQueueName())));
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ }
+ @Test
+ public void testTemporaryQueueDeletedAfterSessionClosed() throws Exception {
+ server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
+
+ Connection conn = null;
+
+ try {
+ conn = createConnection();
+
+ Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Make sure temporary queue cannot be used after it has been deleted
+
+ TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
+
+ MessageProducer producer = producerSession.createProducer(tempQueue);
+
+ MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
+
+ conn.start();
+
+ final String messageText = "This is a message";
+
+ javax.jms.Message m = producerSession.createTextMessage(messageText);
+
+ producer.send(m);
+
+ TextMessage m2 = (TextMessage) consumer.receive(2000);
+
+ assertNotNull(m2);
+
+ assertEquals(messageText, m2.getText());
+
+ consumer.close();
+
+ consumerSession.close();
+
+ producer.close();
+
+ producerSession.close();
+
+ tempQueue.delete();
+
+ producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ try {
+ producer = producerSession.createProducer(tempQueue);
+ producer.send(m);
+ fail();
+ } catch (JMSException e) {
+ }
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testTemporaryTopicDeletedAfterSessionClosed() throws Exception {
+ server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
+
+ Connection conn = null;
+
+ try {
+ conn = createConnection();
+
+ Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Make sure temporary topic cannot be used after it has been deleted
+
+ TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
+
+ MessageProducer producer = producerSession.createProducer(tempTopic);
+
+ MessageConsumer consumer = consumerSession.createConsumer(tempTopic);
+
+ conn.start();
+
+ final String messageText = "This is a message";
+
+ javax.jms.Message m = producerSession.createTextMessage(messageText);
+
+ producer.send(m);
+
+ TextMessage m2 = (TextMessage) consumer.receive(2000);
+
+ assertNotNull(m2);
+
+ assertEquals(messageText, m2.getText());
+
+ consumer.close();
+
+ consumerSession.close();
+
+ producer.close();
+
+ producerSession.close();
+
+ tempTopic.delete();
+
+ producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ try {
+ producer = producerSession.createProducer(tempTopic);
+ producer.send(m);
+ fail();
+ } catch (JMSException e) {
+ }
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ }
+
+}
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 44ab399..50074e9 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
@@ -64,6 +64,7 @@ public class JMSTestBase extends ActiveMQTestBase {
private final Set<JMSContext> contextSet = new HashSet<>();
private final Random random = new Random();
protected InVMNamingContext namingContext;
+ private final Set<Connection> connectionsSet = new HashSet<>();
protected boolean useSecurity() {
return false;
@@ -176,6 +177,15 @@ public class JMSTestBase extends ActiveMQTestBase {
} catch (Exception e) {
// no-op
}
+ try {
+ for (Connection localConn : connectionsSet) {
+ localConn.close();
+ }
+ } catch (Exception ignored) {
+ // no-op
+ } finally {
+ connectionsSet.clear();
+ }
namingContext.close();
jmsServer.stop();
@@ -275,4 +285,14 @@ public class JMSTestBase extends ActiveMQTestBase {
}
}
+ protected final Connection createConnection() throws JMSException {
+ Connection c = cf.createConnection();
+ return addConnection(c);
+ }
+
+ protected final Connection addConnection(Connection conn) {
+ connectionsSet.add(conn);
+ return conn;
+ }
+
}
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
index 6b29aea..f43dd4e 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
@@ -27,9 +27,6 @@ import javax.jms.TemporaryTopic;
import javax.jms.TextMessage;
import javax.naming.NamingException;
-import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport;
import org.junit.Test;
@@ -128,52 +125,6 @@ public class TemporaryDestinationTest extends JMSTestCase {
}
}
}
-
- @Test
- public void testTemporaryQueueLeak() throws Exception {
- ActiveMQConnection conn = null;
-
- try {
- conn = (ActiveMQConnection) createConnection();
-
- Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
-
- MessageProducer producer = producerSession.createProducer(tempQueue);
-
- MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
-
- conn.start();
-
- final String messageText = "This is a message";
-
- Message m = producerSession.createTextMessage(messageText);
-
- producer.send(m);
-
- TextMessage m2 = (TextMessage) consumer.receive(2000);
-
- ProxyAssertSupport.assertNotNull(m2);
-
- ProxyAssertSupport.assertEquals(messageText, m2.getText());
-
- consumer.close();
-
- tempQueue.delete();
-
- ProxyAssertSupport.assertFalse(conn.containsKnownDestination(SimpleString.toSimpleString(tempQueue.getQueueName())));
-
- ProxyAssertSupport.assertFalse(conn.containsTemporaryQueue(SimpleString.toSimpleString(tempQueue.getQueueName())));
- } finally {
- if (conn != null) {
- conn.close();
- }
- }
- }
-
/**
* http://jira.jboss.com/jira/browse/JBMESSAGING-93
*/
@@ -314,126 +265,6 @@ public class TemporaryDestinationTest extends JMSTestCase {
}
@Test
- public void testTemporaryQueueDeletedAfterSessionClosed() throws Exception {
- servers.get(0).getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
-
- Connection conn = null;
-
- try {
- conn = createConnection();
-
- Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Make sure temporary queue cannot be used after it has been deleted
-
- TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
-
- MessageProducer producer = producerSession.createProducer(tempQueue);
-
- MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
-
- conn.start();
-
- final String messageText = "This is a message";
-
- Message m = producerSession.createTextMessage(messageText);
-
- producer.send(m);
-
- TextMessage m2 = (TextMessage) consumer.receive(2000);
-
- ProxyAssertSupport.assertNotNull(m2);
-
- ProxyAssertSupport.assertEquals(messageText, m2.getText());
-
- consumer.close();
-
- consumerSession.close();
-
- producer.close();
-
- producerSession.close();
-
- tempQueue.delete();
-
- producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- try {
- producer = producerSession.createProducer(tempQueue);
- producer.send(m);
- ProxyAssertSupport.fail();
- } catch (JMSException e) {
- }
- } finally {
- if (conn != null) {
- conn.close();
- }
- }
- }
-
- @Test
- public void testTemporaryTopicDeletedAfterSessionClosed() throws Exception {
- servers.get(0).getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
-
- Connection conn = null;
-
- try {
- conn = createConnection();
-
- Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Make sure temporary topic cannot be used after it has been deleted
-
- TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
-
- MessageProducer producer = producerSession.createProducer(tempTopic);
-
- MessageConsumer consumer = consumerSession.createConsumer(tempTopic);
-
- conn.start();
-
- final String messageText = "This is a message";
-
- Message m = producerSession.createTextMessage(messageText);
-
- producer.send(m);
-
- TextMessage m2 = (TextMessage) consumer.receive(2000);
-
- ProxyAssertSupport.assertNotNull(m2);
-
- ProxyAssertSupport.assertEquals(messageText, m2.getText());
-
- consumer.close();
-
- consumerSession.close();
-
- producer.close();
-
- producerSession.close();
-
- tempTopic.delete();
-
- producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- try {
- producer = producerSession.createProducer(tempTopic);
- producer.send(m);
- ProxyAssertSupport.fail();
- } catch (JMSException e) {
- }
- } finally {
- if (conn != null) {
- conn.close();
- }
- }
- }
-
- @Test
public void testTemporaryTopicBasic() throws Exception {
Connection conn = null;