Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 8cac3e0bb -> 319edfe69


QPID-7994: [Broker-J] [JMS2.0 support] Add a system test for unsubscibe of 
global shared durable subscription


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/319edfe6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/319edfe6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/319edfe6

Branch: refs/heads/master
Commit: 319edfe69c42d468fe47e10bc247a34f06f68de3
Parents: 8cac3e0
Author: Alex Rudyy <oru...@apache.org>
Authored: Mon Oct 30 11:38:12 2017 +0000
Committer: Alex Rudyy <oru...@apache.org>
Committed: Mon Oct 30 11:41:51 2017 +0000

----------------------------------------------------------------------
 .../subscription/SharedSubscriptionTest.java      | 18 +++++++++++++++---
 .../utils/QpidJmsClientConnectionBuilder.java     |  9 ++++++++-
 test-profiles/Java10Excludes                      |  2 ++
 3 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/319edfe6/systests/qpid-systests-jms_2.0/src/test/java/org/apache/qpid/systests/jms_2_0/subscription/SharedSubscriptionTest.java
----------------------------------------------------------------------
diff --git 
a/systests/qpid-systests-jms_2.0/src/test/java/org/apache/qpid/systests/jms_2_0/subscription/SharedSubscriptionTest.java
 
b/systests/qpid-systests-jms_2.0/src/test/java/org/apache/qpid/systests/jms_2_0/subscription/SharedSubscriptionTest.java
index 78ee5fc..ae252f2 100644
--- 
a/systests/qpid-systests-jms_2.0/src/test/java/org/apache/qpid/systests/jms_2_0/subscription/SharedSubscriptionTest.java
+++ 
b/systests/qpid-systests-jms_2.0/src/test/java/org/apache/qpid/systests/jms_2_0/subscription/SharedSubscriptionTest.java
@@ -146,7 +146,18 @@ public class SharedSubscriptionTest extends 
QpidBrokerTestCase
 
     public void testUnsubscribe() throws Exception
     {
-        Connection connection = 
getConnectionBuilder().setPrefetch(0).setClientId("myClientId").build();
+        sharedDurableSubscriptionUnsubscribeTest("myClientId");
+    }
+
+
+    public void testUnsubscribeForGlobalSharedDurableSubscription() throws 
Exception
+    {
+        sharedDurableSubscriptionUnsubscribeTest(null);
+    }
+
+    private void sharedDurableSubscriptionUnsubscribeTest(final String 
clientId) throws Exception
+    {
+        Connection connection = 
getConnectionBuilder().setPrefetch(0).setClientId(clientId).build();
         Session session = connection.createSession();
 
         connection.start();
@@ -156,7 +167,8 @@ public class SharedSubscriptionTest extends 
QpidBrokerTestCase
         String subscriptionName = "testSharedSubscription";
         MessageConsumer consumer = session.createSharedDurableConsumer(topic, 
subscriptionName);
 
-        Map<String, Object> statistics = 
_restTestHelper.getJsonAsMap("virtualhost/test/test/getStatistics?statistics=[\"queueCount\"]");
+        Map<String, Object>
+                statistics = 
_restTestHelper.getJsonAsMap("virtualhost/test/test/getStatistics?statistics=[\"queueCount\"]");
         int numberOfQueuesBeforeUnsubscribe = (int) 
statistics.get("queueCount");
         assertEquals("Unexpected number of Queues", 1, 
numberOfQueuesBeforeUnsubscribe);
 
@@ -169,7 +181,7 @@ public class SharedSubscriptionTest extends 
QpidBrokerTestCase
             restartDefaultBroker();
         }
 
-        connection = 
getConnectionBuilder().setPrefetch(0).setClientId("myClientId").build();
+        connection = 
getConnectionBuilder().setPrefetch(0).setClientId(clientId).build();
         session = connection.createSession();
         session.unsubscribe(subscriptionName);
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/319edfe6/systests/src/main/java/org/apache/qpid/test/utils/QpidJmsClientConnectionBuilder.java
----------------------------------------------------------------------
diff --git 
a/systests/src/main/java/org/apache/qpid/test/utils/QpidJmsClientConnectionBuilder.java
 
b/systests/src/main/java/org/apache/qpid/test/utils/QpidJmsClientConnectionBuilder.java
index 7420a14..fe0761c 100644
--- 
a/systests/src/main/java/org/apache/qpid/test/utils/QpidJmsClientConnectionBuilder.java
+++ 
b/systests/src/main/java/org/apache/qpid/test/utils/QpidJmsClientConnectionBuilder.java
@@ -62,7 +62,14 @@ public class QpidJmsClientConnectionBuilder implements 
ConnectionBuilder
     @Override
     public ConnectionBuilder setClientId(final String clientId)
     {
-        _options.put("jms.clientID", clientId);
+        if (clientId == null)
+        {
+            _options.remove("jms.clientID");
+        }
+        else
+        {
+            _options.put("jms.clientID", clientId);
+        }
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/319edfe6/test-profiles/Java10Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes
index 1e732c8..d94c72c 100644
--- a/test-profiles/Java10Excludes
+++ b/test-profiles/Java10Excludes
@@ -220,3 +220,5 @@ org.apache.qpid.server.security.acl.Amqp0xMessagingACLTest#*
 
org.apache.qpid.server.security.acl.MessagingACLTest#testCreateTemporaryQueueFailed
 
 
+// QPID-7994 : Temporary excluded due to a bug
+org.apache.qpid.systests.jms_2_0.subscription.SharedSubscriptionTest#testUnsubscribeForGlobalSharedDurableSubscription


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to