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 2017/06/06 14:58:15 UTC
[1/2] activemq-artemis git commit: This closes #1317
Repository: activemq-artemis
Updated Branches:
refs/heads/master 3090a6f31 -> 34362e980
This closes #1317
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/34362e98
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/34362e98
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/34362e98
Branch: refs/heads/master
Commit: 34362e98039059a66bdcedf05dd4bf955b492a4e
Parents: 3090a6f 754e9db
Author: Clebert Suconic <cl...@apache.org>
Authored: Tue Jun 6 10:57:44 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Jun 6 10:57:44 2017 -0400
----------------------------------------------------------------------
.../artemis/jms/client/ActiveMQConnection.java | 3 --
.../jms/connection/ExceptionListenerTest.java | 27 ++++++++++++++
.../artemis/jms/tests/ConnectionTest.java | 39 +++++++++++---------
3 files changed, 48 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
[2/2] activemq-artemis git commit: ARTEMIS-1207: [Core JMS Client]
Align order of when setClientId can be called with AcitveMQ5 and QPID
Posted by cl...@apache.org.
ARTEMIS-1207: [Core JMS Client] Align order of when setClientId can be called with AcitveMQ5 and QPID
Update ActiveMQConnection to change behaviour
Add test to avoid regression.
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/754e9db5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/754e9db5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/754e9db5
Branch: refs/heads/master
Commit: 754e9db5fdee3807758a4c2da14bc61e715d616f
Parents: 3090a6f
Author: Michael Andre Pearce <Mi...@me.com>
Authored: Tue Jun 6 09:54:02 2017 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Jun 6 10:57:44 2017 -0400
----------------------------------------------------------------------
.../artemis/jms/client/ActiveMQConnection.java | 3 --
.../jms/connection/ExceptionListenerTest.java | 27 ++++++++++++++
.../artemis/jms/tests/ConnectionTest.java | 39 +++++++++++---------
3 files changed, 48 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/754e9db5/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
index 90ab952..51a89e3 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
@@ -280,8 +280,6 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
public ExceptionListener getExceptionListener() throws JMSException {
checkClosed();
- justCreated = false;
-
return exceptionListener;
}
@@ -290,7 +288,6 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
checkClosed();
exceptionListener = listener;
- justCreated = false;
}
@Override
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/754e9db5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ExceptionListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ExceptionListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ExceptionListenerTest.java
index feaa7a3..9b91308 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ExceptionListenerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ExceptionListenerTest.java
@@ -143,4 +143,31 @@ public class ExceptionListenerTest extends ActiveMQTestBase {
conn.close();
}
+
+ /**
+ * The JMS Spec isn't specific about if ClientId can be set after Exception Listener or not,
+ * simply it states that clientId must be set before any operation (read as remote)
+ *
+ * QpidJMS and ActiveMQ5 both interpret that therefor you can set the exception lister first.
+ * As such we align with those, allowing the exception listener to be set prior to the clientId,
+ * This to avoid causing implementation nuance's, when switching code from one client to another.
+ *
+ * This test is to test this and to ensure it doesn't get accidentally regressed.
+ */
+ @Test
+ public void testSetClientIdAfterSetExceptionListener() throws Exception {
+ Connection conn = cf.createConnection();
+ conn.setExceptionListener((e) -> { });
+ conn.setClientID("clientId");
+ conn.close();
+ }
+
+ @Test
+ public void testSetClientIdAfterGetExceptionListener() throws Exception {
+ Connection conn = cf.createConnection();
+ conn.getExceptionListener();
+ conn.setClientID("clientId");
+ conn.close();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/754e9db5/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionTest.java
index eab72f0..2d89713 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionTest.java
@@ -153,24 +153,6 @@ public class ConnectionTest extends JMSTestCase {
// {
// }
// connection.close();
-
- connection = createConnection();
- ExceptionListener listener = connection.getExceptionListener();
- try {
- connection.setClientID(clientID);
- ProxyAssertSupport.fail();
- } catch (javax.jms.IllegalStateException e) {
- }
- connection.close();
-
- connection = createConnection();
- connection.setExceptionListener(listener);
- try {
- connection.setClientID(clientID);
- ProxyAssertSupport.fail();
- } catch (javax.jms.IllegalStateException e) {
- }
- connection.close();
}
@Test
@@ -233,6 +215,27 @@ public class ConnectionTest extends JMSTestCase {
conn.close();
+ // Ensure setting / getting exception listener can occur before setting clientid.
+ final String clientID = "my-test-client-id";
+
+ Connection connection = createConnection();
+ ExceptionListener listener = connection.getExceptionListener();
+ try {
+ connection.setClientID(clientID);
+ } catch (javax.jms.IllegalStateException e) {
+ ProxyAssertSupport.fail();
+ }
+ connection.close();
+
+ connection = createConnection();
+ connection.setExceptionListener(listener);
+ try {
+ connection.setClientID(clientID);
+ } catch (javax.jms.IllegalStateException e) {
+ ProxyAssertSupport.fail();
+ }
+ connection.close();
+
}
// This test is to check netty issue in https://jira.jboss.org/jira/browse/JBMESSAGING-1618