@Override @Before public void setUp() throws Exception { super.setUp(); Configuration config = createDefaultInVMConfig().setSecurityEnabled(true); server = addServer(ActiveMQServers.newActiveMQServer(config, false)); server.start(); notifQueue = RandomUtil.randomSimpleString(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("admin", "admin"); securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); Role role = new Role("notif", true, true, true, true, true, true, true, true, true, true); Set<Role> roles = new HashSet<>(); roles.add(role); server .getSecurityRepository() .addMatch( ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress().toString(), roles); securityManager.getConfiguration().addRole("admin", "notif"); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); adminSession = sf.createSession("admin", "admin", false, true, true, false, 1); adminSession.start(); adminSession.createTemporaryQueue( ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), notifQueue); notifConsumer = adminSession.createConsumer(notifQueue); }