Search in sources :

Example 76 with ActiveMQQueue

use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.

the class AbstractCachedLDAPAuthorizationMapLegacyTest method testWildcards.

@Test
public void testWildcards() throws Exception {
    map.query();
    Set<?> fooACLs = map.getReadACLs(new ActiveMQQueue("FOO.1"));
    assertEquals("set size: " + fooACLs, 2, fooACLs.size());
    assertTrue("Contains admin group", fooACLs.contains(ADMINS));
    assertTrue("Contains users group", fooACLs.contains(USERS));
    Set<?> barACLs = map.getReadACLs(new ActiveMQQueue("BAR.2"));
    assertEquals("set size: " + barACLs, 2, barACLs.size());
    assertTrue("Contains admin group", barACLs.contains(ADMINS));
    assertTrue("Contains users group", barACLs.contains(USERS));
}
Also used : ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) Test(org.junit.Test)

Example 77 with ActiveMQQueue

use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.

the class AuthorizationMapTest method testWildcards.

public void testWildcards() {
    AuthorizationMap map = createWildcardAuthorizationMap();
    Set<?> readACLs = map.getReadACLs(new ActiveMQQueue("USERS.FOO.BAR"));
    assertEquals("set size: " + readACLs, 1, readACLs.size());
    assertTrue("Contains users group", readACLs.contains(ADMINS));
    assertTrue("Contains users group", readACLs.contains(USERS));
    Set<?> writeAcls = map.getWriteACLs(new ActiveMQQueue("USERS.FOO.BAR"));
    assertEquals("set size: " + writeAcls, 1, writeAcls.size());
    assertTrue("Contains users group", writeAcls.contains(ADMINS));
    assertTrue("Contains users group", writeAcls.contains(USERS));
    Set<?> adminAcls = map.getAdminACLs(new ActiveMQQueue("USERS.FOO.BAR"));
    assertEquals("set size: " + adminAcls, 1, adminAcls.size());
    assertTrue("Contains users group", adminAcls.contains(ADMINS));
    assertFalse("Contains users group", adminAcls.contains(USERS));
    Set<?> tempAdminACLs = map.getTempDestinationAdminACLs();
    assertEquals("set size: " + tempAdminACLs, 1, tempAdminACLs.size());
    assertTrue("Contains users group", tempAdminACLs.contains(TEMP_DESTINATION_ADMINS));
}
Also used : ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue)

Example 78 with ActiveMQQueue

use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.

the class AuthorizationMapTest method testAuthorizationMapWithTempDest.

public void testAuthorizationMapWithTempDest() {
    AuthorizationMap map = createAuthorizationMapWithTempDest();
    Set<?> readACLs = map.getReadACLs(new ActiveMQQueue("USERS.FOO.BAR"));
    assertEquals("set size: " + readACLs, 2, readACLs.size());
    assertTrue("Contains users group", readACLs.contains(ADMINS));
    assertTrue("Contains users group", readACLs.contains(USERS));
    Set<?> tempAdminACLs = map.getTempDestinationAdminACLs();
    assertEquals("set size: " + tempAdminACLs, 1, tempAdminACLs.size());
    assertTrue("Contains users group", tempAdminACLs.contains(TEMP_DESTINATION_ADMINS));
}
Also used : ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue)

Example 79 with ActiveMQQueue

use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.

the class JaasNetworkTest method testNetwork.

public void testNetwork() throws Exception {
    System.setProperty("javax.net.ssl.trustStore", "src/test/resources/org/apache/activemq/security/client.ts");
    System.setProperty("javax.net.ssl.trustStorePassword", "password");
    System.setProperty("javax.net.ssl.trustStoreType", "jks");
    System.setProperty("javax.net.ssl.keyStore", "src/test/resources/org/apache/activemq/security/client.ks");
    System.setProperty("javax.net.ssl.keyStorePassword", "password");
    System.setProperty("javax.net.ssl.keyStoreType", "jks");
    ActiveMQConnectionFactory producerFactory = new ActiveMQConnectionFactory("ssl://localhost:61617");
    Connection producerConn = producerFactory.createConnection();
    Session producerSess = producerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = producerSess.createProducer(new ActiveMQQueue("test"));
    producerConn.start();
    TextMessage sentMessage = producerSess.createTextMessage("test");
    producer.send(sentMessage);
    ActiveMQConnectionFactory consumerFactory = new ActiveMQConnectionFactory("ssl://localhost:61618");
    Connection consumerConn = consumerFactory.createConnection();
    Session consumerSess = consumerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    consumerConn.start();
    MessageConsumer consumer = consumerSess.createConsumer(new ActiveMQQueue("test"));
    TextMessage receivedMessage = (TextMessage) consumer.receive(100);
    assertEquals(sentMessage, receivedMessage);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) MessageConsumer(javax.jms.MessageConsumer) Connection(javax.jms.Connection) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) MessageProducer(javax.jms.MessageProducer) TextMessage(javax.jms.TextMessage) Session(javax.jms.Session)

Example 80 with ActiveMQQueue

use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.

the class LDAPAuthorizationMapTest method testComposite.

@Test
public void testComposite() {
    ActiveMQDestination q1 = new ActiveMQQueue("queue1,topic://topic1");
    Set<GroupPrincipal> aclsq1 = authMap.getWriteACLs(q1);
    assertEquals(0, aclsq1.size());
}
Also used : GroupPrincipal(org.apache.activemq.jaas.GroupPrincipal) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination) Test(org.junit.Test)

Aggregations

ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)239 Session (javax.jms.Session)81 MessageProducer (javax.jms.MessageProducer)78 MessageConsumer (javax.jms.MessageConsumer)76 TextMessage (javax.jms.TextMessage)73 Test (org.junit.Test)66 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)54 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)44 Message (javax.jms.Message)36 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)33 Connection (javax.jms.Connection)32 Destination (javax.jms.Destination)27 CountDownLatch (java.util.concurrent.CountDownLatch)20 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)18 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)18 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)18 SessionInfo (org.apache.activemq.command.SessionInfo)18 Message (org.apache.activemq.command.Message)17 BasicOpenWireTest (org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest)16 ProducerInfo (org.apache.activemq.command.ProducerInfo)16