public void testGetRoles() throws Exception
{
SimpleString address = RandomUtil.randomSimpleString();
SimpleString queue = RandomUtil.randomSimpleString();
Role role = new Role(RandomUtil.randomString(),
RandomUtil.randomBoolean(),
RandomUtil.randomBoolean(),
RandomUtil.randomBoolean(),
RandomUtil.randomBoolean(),
RandomUtil.randomBoolean(),
RandomUtil.randomBoolean(),
RandomUtil.randomBoolean());
session.createQueue(address, queue, true);
CoreMessagingProxy proxy = createProxy(address);
Object[] roles = (Object[])proxy.retrieveAttributeValue("roles");
for (Object role2 : roles)
{
System.out.println(((Object[])role2)[0]);
}
Assert.assertEquals(0, roles.length);
Set<Role> newRoles = new HashSet<Role>();
newRoles.add(role);
server.getSecurityRepository().addMatch(address.toString(), newRoles);
roles = (Object[])proxy.retrieveAttributeValue("roles");
Assert.assertEquals(1, roles.length);
Object[] r = (Object[])roles[0];
Assert.assertEquals(role.getName(), r[0]);
Assert.assertEquals(CheckType.SEND.hasRole(role), r[1]);
Assert.assertEquals(CheckType.CONSUME.hasRole(role), r[2]);
Assert.assertEquals(CheckType.CREATE_DURABLE_QUEUE.hasRole(role), r[3]);
Assert.assertEquals(CheckType.DELETE_DURABLE_QUEUE.hasRole(role), r[4]);
Assert.assertEquals(CheckType.CREATE_NON_DURABLE_QUEUE.hasRole(role), r[5]);