activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-5644 - fixing the test as many assumptions in it are not correct and were working previously only cause of this bug
Date Fri, 13 Mar 2015 13:17:18 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 6097401c5 -> 10c47d69d


https://issues.apache.org/jira/browse/AMQ-5644 - fixing the test as many assumptions in it
are not correct and were working previously only cause of this bug


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/10c47d69
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/10c47d69
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/10c47d69

Branch: refs/heads/master
Commit: 10c47d69d7545157f79d9b1dff15eabca147754d
Parents: 6097401
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Fri Mar 13 14:16:37 2015 +0100
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Fri Mar 13 14:16:58 2015 +0100

----------------------------------------------------------------------
 .../org/apache/activemq/AuthorizationTest.java  | 67 +++-----------------
 1 file changed, 10 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/10c47d69/activemq-runtime-config/src/test/java/org/apache/activemq/AuthorizationTest.java
----------------------------------------------------------------------
diff --git a/activemq-runtime-config/src/test/java/org/apache/activemq/AuthorizationTest.java
b/activemq-runtime-config/src/test/java/org/apache/activemq/AuthorizationTest.java
index 4cd92ac..b9282a0 100644
--- a/activemq-runtime-config/src/test/java/org/apache/activemq/AuthorizationTest.java
+++ b/activemq-runtime-config/src/test/java/org/apache/activemq/AuthorizationTest.java
@@ -79,8 +79,8 @@ public class AuthorizationTest extends RuntimeConfigTestSupport {
         startBroker(brokerConfig);
         assertTrue("broker alive", brokerService.isStarted());
 
-        final String ALL_USERS = "ALL.USERS";
-        final String ALL_GUESTS = "ALL.GUESTS";
+        final String ALL_USERS = "ALL.USERS.>";
+        final String ALL_GUESTS = "ALL.GUESTS.>";
 
         assertAllowed("user", ALL_USERS);
         assertAllowed("guest", ALL_GUESTS);
@@ -88,65 +88,18 @@ public class AuthorizationTest extends RuntimeConfigTestSupport {
         assertDenied("guest", ALL_GUESTS + "," + ALL_USERS);
 
         final String ALL_PREFIX = "ALL.>";
-        final String ALL_WILDCARD = "ALL.*";
-
-        assertAllowed("user", ALL_PREFIX);
-        assertAllowed("user", ALL_WILDCARD);
-        assertAllowed("guest", ALL_PREFIX);
-        assertAllowed("guest", ALL_WILDCARD);
-
-        assertAllowed("user", "ALL.USERS,ALL.>");
-        assertAllowed("guest", "ALL.GUESTS,ALL.*");
-        assertDenied("user", "ALL.GUESTS,ALL.>");
-        assertDenied("guest", "ALL.USERS,ALL.*");
-
-        assertDenied("user", "ALL.USERS,ALL.GUESTS.>");
-        assertDenied("guest", "ALL.GUESTS,ALL.USERS.*");
-        assertDenied("user", "ALL.USERS.*,ALL.GUESTS.>");
-        assertDenied("guest", "ALL.GUESTS.>,ALL.USERS.*");
-
-        // subscribe to wildcards and check whether messages are actually filtered
-        final ActiveMQConnection userConn = new ActiveMQConnectionFactory("vm://localhost").createActiveMQConnection("user",
"user");
-        final ActiveMQConnection guestConn = new ActiveMQConnectionFactory("vm://localhost").createActiveMQConnection("guest",
"guest");
-        userConn.start();
-        guestConn.start();
-        try {
-            final Session userSession = userConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            final Session guestSession = guestConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            final MessageProducer userProducer = userSession.createProducer(null);
-            final MessageProducer guestProducer = guestSession.createProducer(null);
-
-            // test prefix filter
-            MessageConsumer userConsumer = userSession.createConsumer(userSession.createQueue(ALL_PREFIX));
-            MessageConsumer guestConsumer = guestSession.createConsumer(userSession.createQueue(ALL_PREFIX));
-
-            userProducer.send(userSession.createQueue(ALL_USERS), userSession.createTextMessage(ALL_USERS));
-            assertNotNull(userConsumer.receive(RECEIVE_TIMEOUT));
-            assertNull(guestConsumer.receive(RECEIVE_TIMEOUT));
-
-            guestProducer.send(guestSession.createQueue(ALL_GUESTS), guestSession.createTextMessage(ALL_GUESTS));
-            assertNotNull(guestConsumer.receive(RECEIVE_TIMEOUT));
-            assertNull(userConsumer.receive(RECEIVE_TIMEOUT));
 
-            userConsumer.close();
-            guestConsumer.close();
+        assertDenied("user", ALL_PREFIX);
+        assertDenied("guest", ALL_PREFIX);
 
-            // test wildcard filter
-            userConsumer = userSession.createConsumer(userSession.createQueue(ALL_WILDCARD));
-            guestConsumer = guestSession.createConsumer(userSession.createQueue(ALL_WILDCARD));
+        assertAllowed("user", "ALL.USERS.A");
+        assertAllowed("user", "ALL.USERS.A,ALL.USERS.B");
+        assertAllowed("guest", "ALL.GUESTS.A");
+        assertAllowed("guest", "ALL.GUESTS.A,ALL.GUESTS.B");
 
-            userProducer.send(userSession.createQueue(ALL_USERS), userSession.createTextMessage(ALL_USERS));
-            assertNotNull(userConsumer.receive(RECEIVE_TIMEOUT));
-            assertNull(guestConsumer.receive(RECEIVE_TIMEOUT));
+        assertDenied("user", "USERS.>");
+        assertDenied("guest", "GUESTS.>");
 
-            guestProducer.send(guestSession.createQueue(ALL_GUESTS), guestSession.createTextMessage(ALL_GUESTS));
-            assertNotNull(guestConsumer.receive(RECEIVE_TIMEOUT));
-            assertNull(userConsumer.receive(RECEIVE_TIMEOUT));
-
-        } finally {
-            userConn.close();
-            guestConn.close();
-        }
 
         assertAllowedTemp("guest");
     }


Mime
View raw message