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 91d1559620..3642e0b3fc 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); @@ -84,6 +85,22 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { assertNotNull(msg); } + @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"); 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 563818eab6..e9d1e42dc7 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 +