activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [10/17] activemq git commit: Add ldap auth unit test
Date Thu, 18 Dec 2014 02:41:40 GMT
Add ldap auth unit test


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

Branch: refs/heads/activemq-5.10.x
Commit: ccae55e3676870910df36c86e32a1cf41beebd01
Parents: 3f67862
Author: Hadrian Zbarcea <hadrian@apache.org>
Authored: Sun Aug 17 11:15:56 2014 -0400
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Wed Dec 17 19:39:57 2014 -0500

----------------------------------------------------------------------
 .../activemq/security/LDAPSecurityTest.java     | 19 +++++++++++-
 .../org/apache/activemq/security/activemq.ldif  | 32 +++++++++++++++++++-
 2 files changed, 49 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/ccae55e3/activemq-unit-tests/src/test/java/org/apache/activemq/security/LDAPSecurityTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/security/LDAPSecurityTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/security/LDAPSecurityTest.java
index 91d1559..3642e0b 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/security/LDAPSecurityTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/security/LDAPSecurityTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 import javax.jms.Connection;
+import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
@@ -74,7 +75,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit {
         Connection conn = factory.createQueueConnection("jdoe", "sunflower");
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         conn.start();
-        Queue queue = sess.createQueue("TEST.FOO");
+        Destination queue = sess.createQueue("TEST.FOO");
 
         MessageProducer producer = sess.createProducer(queue);
         MessageConsumer consumer = sess.createConsumer(queue);
@@ -85,6 +86,22 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit {
     }
 
     @Test
+    public void testSendTopic() throws Exception {
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
+        Connection conn = factory.createQueueConnection("jdoe", "sunflower");
+        Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        conn.start();
+        Destination topic = sess.createTopic("TEST.BAR");
+
+        MessageProducer producer = sess.createProducer(topic);
+        MessageConsumer consumer = sess.createConsumer(topic);
+
+        producer.send(sess.createTextMessage("test"));
+        Message msg = consumer.receive(1000);
+        assertNotNull(msg);
+    }
+
+    @Test
     public void testSendDenied() throws Exception {
         ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
         Connection conn = factory.createQueueConnection("jdoe", "sunflower");

http://git-wip-us.apache.org/repos/asf/activemq/blob/ccae55e3/activemq-unit-tests/src/test/resources/org/apache/activemq/security/activemq.ldif
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/resources/org/apache/activemq/security/activemq.ldif
b/activemq-unit-tests/src/test/resources/org/apache/activemq/security/activemq.ldif
index 563818e..e9d1e42 100644
--- a/activemq-unit-tests/src/test/resources/org/apache/activemq/security/activemq.ldif
+++ b/activemq-unit-tests/src/test/resources/org/apache/activemq/security/activemq.ldif
@@ -146,6 +146,35 @@ objectClass: top
 member: cn=users
 member: cn=admins
 
+## TEST.BAR
+
+dn: cn=TEST.BAR,ou=Topic,ou=Destination,ou=ActiveMQ,ou=system
+cn: TEST.BAR
+description: A topic
+objectClass: applicationProcess
+objectClass: top
+
+dn: cn=admin,cn=TEST.BAR,ou=Topic,ou=Destination,ou=ActiveMQ,ou=system
+cn: admin
+description: Admin privilege group, members are roles
+member: cn=admins
+member: cn=users
+objectClass: groupOfNames
+objectClass: top
+
+dn: cn=read,cn=TEST.BAR,ou=Topic,ou=Destination,ou=ActiveMQ,ou=system
+cn: read
+member: cn=users
+member: cn=admins
+objectClass: groupOfNames
+objectClass: top
+
+dn: cn=write,cn=TEST.BAR,ou=Topic,ou=Destination,ou=ActiveMQ,ou=system
+cn: write
+objectClass: groupOfNames
+objectClass: top
+member: cn=users
+member: cn=admins
 
 
 #######################
@@ -208,4 +237,5 @@ cn: admin
 member: cn=admins
 member: cn=users
 objectClass: groupOfNames
-objectClass: top
\ No newline at end of file
+objectClass: top
+


Mime
View raw message