assertNotNull(admin);
Group global = ss.getGroupByName("global");
assertNotNull(global);
Role app = ss.getRoleByName("User");
assertNotNull(app);
AccessControlList acl = ss.getACL(admin);
assertFalse(acl.hasRole(app, global));
ss.grant(admin, global, app);
AccessControlList acl2 = ss.getACL(admin);
assertTrue(acl2.hasRole(app, global));
// Get existing ACL modified?
assertFalse(acl.hasRole(app, global));
try
{
ss.grant(admin, global, app);
fail("Role could be granted twice!");
}
catch (Exception e)
{
//
// Ugh. DataBackendError? This means that our query actually hit the database and only the "unique key"
// prevented us from a double entry. This seems to be a bug
//
assertEquals("Wrong Exception thrown: " + e.getClass().getName(), DataBackendException.class, e.getClass());
}
try
{
Role unknown = ss.getRoleInstance("unknown");
ss.grant(admin, global, unknown);
fail("Nonexisting Role could be granted!");
}
catch (Exception e)