mirror of https://github.com/apache/activemq.git
Add ldap auth unit test
This commit is contained in:
parent
b1bc593931
commit
bf5305e2ee
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
#######################
|
||||
|
@ -209,3 +238,4 @@ member: cn=admins
|
|||
member: cn=users
|
||||
objectClass: groupOfNames
|
||||
objectClass: top
|
||||
|
||||
|
|
Loading…
Reference in New Issue