use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class LDAPAuthorizationMapTest method testGetAdminACLs.
/*
* Test method for 'org.apache.activemq.security.LDAPAuthorizationMap.getAdminACLs(ActiveMQDestination)'
*/
@Test
public void testGetAdminACLs() {
ActiveMQDestination q1 = new ActiveMQQueue("queue1");
Set<GroupPrincipal> aclsq1 = authMap.getAdminACLs(q1);
assertEquals(1, aclsq1.size());
assertTrue(aclsq1.contains(new GroupPrincipal("role1")));
ActiveMQDestination t1 = new ActiveMQTopic("topic1");
Set<GroupPrincipal> aclst1 = authMap.getAdminACLs(t1);
assertEquals(1, aclst1.size());
assertTrue(aclst1.contains(new GroupPrincipal("role1")));
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class LDAPAuthorizationMapTest method testGetReadACLs.
/*
* Test method for 'org.apache.activemq.security.LDAPAuthorizationMap.getReadACLs(ActiveMQDestination)'
*/
@Test
public void testGetReadACLs() {
ActiveMQDestination q1 = new ActiveMQQueue("queue1");
Set<GroupPrincipal> aclsq1 = authMap.getReadACLs(q1);
assertEquals(1, aclsq1.size());
assertTrue(aclsq1.contains(new GroupPrincipal("role1")));
ActiveMQDestination t1 = new ActiveMQTopic("topic1");
Set<GroupPrincipal> aclst1 = authMap.getReadACLs(t1);
assertEquals(1, aclst1.size());
assertTrue(aclst1.contains(new GroupPrincipal("role2")));
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class SecurityJMXTest method testBrowseExpiredMessages.
public void testBrowseExpiredMessages() throws Exception {
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1199/jmxrmi");
JMXConnector connector = JMXConnectorFactory.connect(url, null);
connector.connect();
MBeanServerConnection connection = connector.getMBeanServerConnection();
ObjectName name = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost," + "destinationType=Queue,destinationName=TEST.Q");
QueueViewMBean queueMbean = MBeanServerInvocationHandler.newProxyInstance(connection, name, QueueViewMBean.class, true);
HashMap<String, String> headers = new HashMap<>();
headers.put("timeToLive", Long.toString(2000));
headers.put("JMSDeliveryMode", Integer.toString(DeliveryMode.PERSISTENT));
queueMbean.sendTextMessage(headers, "test", "system", "manager");
// allow message to expire on the queue
TimeUnit.SECONDS.sleep(4);
Connection c = new ActiveMQConnectionFactory("vm://localhost").createConnection("system", "manager");
c.start();
// browser consumer will force expiration check on addConsumer
QueueBrowser browser = c.createSession(false, Session.AUTO_ACKNOWLEDGE).createBrowser(new ActiveMQQueue("TEST.Q"));
assertTrue("no message in the q", !browser.getEnumeration().hasMoreElements());
// verify dlq got the message, no security exception as brokers context is now used
browser = c.createSession(false, Session.AUTO_ACKNOWLEDGE).createBrowser(new ActiveMQQueue("ActiveMQ.DLQ"));
assertTrue("one message in the dlq", browser.getEnumeration().hasMoreElements());
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class SecurityTestSupport method initCombosForTestGuestSendFails.
/**
* @see {@link CombinationTestSupport}
*/
public void initCombosForTestGuestSendFails() {
addCombinationValues("userName", new Object[] { "guest" });
addCombinationValues("password", new Object[] { "password" });
addCombinationValues("destination", new Object[] { new ActiveMQQueue("GUESTS.BY_PASS,TEST"), new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), new ActiveMQQueue("USERS.FOO"), new ActiveMQTopic("USERS.FOO") });
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class SecurityTestSupport method initCombosForTestUserReceiveFails.
/**
* @see {@link CombinationTestSupport}
*/
public void initCombosForTestUserReceiveFails() {
addCombinationValues("userName", new Object[] { "user" });
addCombinationValues("password", new Object[] { "password" });
addCombinationValues("destination", new Object[] { new ActiveMQQueue("USERS.BY_PASS, TEST"), new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR") });
}
Aggregations