securityManager.addRole("guest", "guest");
securityManager.setDefaultUser("guest");
Assert.assertTrue(securityManager.validateUser(null, null));
Assert.assertTrue(securityManager.validateUser("guest", "guest"));
HashSet<Role> roles = new HashSet<Role>();
roles.add(new Role("guest", true, true, true, true, true, true, true));
Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE));
Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND));
Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME));
roles = new HashSet<Role>();
roles.add(new Role("guest", true, true, false, true, true, true, true));
Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE));
Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND));
Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME));
roles = new HashSet<Role>();
roles.add(new Role("guest", true, false, false, true, true, true, true));
Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE));
Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND));
Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME));
roles = new HashSet<Role>();
roles.add(new Role("guest", false, false, false, true, true, true, true));
Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE));
Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND));
Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME));
}