use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class SimpleAnonymousPluginTest method initCombosForTestAnonymousSendFails.
/**
* @see {@link CombinationTestSupport}
*/
public void initCombosForTestAnonymousSendFails() {
addCombinationValues("userName", new Object[] { null });
addCombinationValues("password", new Object[] { null });
addCombinationValues("destination", new Object[] { 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 SimpleAuthenticationPluginTest method testSecurityContextClearedOnPurge.
public void testSecurityContextClearedOnPurge() throws Exception {
connection.close();
ActiveMQConnectionFactory tcpFactory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getPublishableConnectString());
ActiveMQConnection conn = (ActiveMQConnection) tcpFactory.createConnection("user", "password");
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
final int numDests = broker.getRegionBroker().getDestinations().length;
for (int i = 0; i < 10; i++) {
MessageProducer p = sess.createProducer(new ActiveMQQueue("USERS.PURGE." + i));
p.close();
}
assertTrue("dests are purged", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
LOG.info("dests, orig: " + numDests + ", now: " + broker.getRegionBroker().getDestinations().length);
return (numDests + 1) == broker.getRegionBroker().getDestinations().length;
}
}));
// verify removed from connection security context
TransportConnection brokerConnection = broker.getTransportConnectors().get(0).getConnections().get(0);
TransportConnectionState transportConnectionState = brokerConnection.lookupConnectionState(conn.getConnectionInfo().getConnectionId());
assertEquals("no destinations", 0, transportConnectionState.getContext().getSecurityContext().getAuthorizedWriteDests().size());
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class SimpleSecurityBrokerSystemTest method testPopulateJMSXUserID.
/**
* @throws javax.jms.JMSException
*/
public void testPopulateJMSXUserID() throws Exception {
destination = new ActiveMQQueue("TEST");
Connection connection = factory.createConnection("system", "manager");
connections.add(connection);
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
sendMessages(session, destination, 1);
// make sure that the JMSXUserID is exposed over JMX
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
CompositeData[] browse = (CompositeData[]) mbs.invoke(new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=TEST"), "browse", null, null);
assertEquals("system", browse[0].get("JMSXUserID"));
// And also via JMS.
MessageConsumer consumer = session.createConsumer(destination);
Message m = consumer.receive(1000);
assertTrue(m.propertyExists("JMSXUserID"));
assertEquals("system", m.getStringProperty("JMSXUserID"));
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class SimpleSecurityBrokerSystemTest method createAuthorizationMap.
public static AuthorizationMap createAuthorizationMap() {
DestinationMap readAccess = new DefaultAuthorizationMap();
readAccess.put(new ActiveMQQueue(">"), ADMINS);
readAccess.put(new ActiveMQQueue("USERS.>"), USERS);
readAccess.put(new ActiveMQQueue("GUEST.>"), GUESTS);
readAccess.put(new ActiveMQTopic(">"), ADMINS);
readAccess.put(new ActiveMQTopic("USERS.>"), USERS);
readAccess.put(new ActiveMQTopic("GUEST.>"), GUESTS);
DestinationMap writeAccess = new DefaultAuthorizationMap();
writeAccess.put(new ActiveMQQueue(">"), ADMINS);
writeAccess.put(new ActiveMQQueue("USERS.>"), USERS);
writeAccess.put(new ActiveMQQueue("GUEST.>"), USERS);
writeAccess.put(new ActiveMQQueue("GUEST.>"), GUESTS);
writeAccess.put(new ActiveMQTopic(">"), ADMINS);
writeAccess.put(new ActiveMQTopic("USERS.>"), USERS);
writeAccess.put(new ActiveMQTopic("GUEST.>"), USERS);
writeAccess.put(new ActiveMQTopic("GUEST.>"), GUESTS);
readAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), WILDCARD);
writeAccess.put(new ActiveMQTopic("ActiveMQ.Advisory.>"), WILDCARD);
DestinationMap adminAccess = new DefaultAuthorizationMap();
adminAccess.put(new ActiveMQTopic(">"), ADMINS);
adminAccess.put(new ActiveMQTopic(">"), USERS);
adminAccess.put(new ActiveMQTopic(">"), GUESTS);
adminAccess.put(new ActiveMQQueue(">"), ADMINS);
adminAccess.put(new ActiveMQQueue(">"), USERS);
adminAccess.put(new ActiveMQQueue(">"), GUESTS);
return new SimpleAuthorizationMap(writeAccess, readAccess, adminAccess);
}
use of org.apache.activemq.command.ActiveMQQueue in project activemq-artemis by apache.
the class XBeanSecurityWithGuestTest method initCombosForTestUserSendGoodPassword.
/**
* @see {@link CombinationTestSupport}
*/
public void initCombosForTestUserSendGoodPassword() {
addCombinationValues("userName", new Object[] { "system" });
addCombinationValues("password", new Object[] { "manager" });
addCombinationValues("destination", new Object[] { new ActiveMQQueue("test"), new ActiveMQTopic("test") });
}
Aggregations