@Test
public void testGetRoleAccess() {

    SignedDomain signedDomain = createSignedDomain("roleaccess", "tenantrole", "storage", true);
    store.processDomain(signedDomain, false);
    
    Principal principal = SimplePrincipal.create("user_domain", "user", "v=U1;d=user_domain;n=user;s=sig", 0, null);
    ResourceContext context = createResourceContext(principal);
    
    RoleAccess roleAccess = zts.getRoleAccess(context, "roleaccess", "user_domain.user");
    assertEquals(roleAccess.getRoles().size(), 1);
    assertTrue(roleAccess.getRoles().contains("writers"));
    
    Principal principal1 = SimplePrincipal.create("user_domain", "user1", "v=U1;d=user_domain;n=user1;s=sig", 0, null);
    ResourceContext context1 = createResourceContext(principal1);
    
    roleAccess = zts.getRoleAccess(context1, "roleaccess", "user_domain.user1");
    assertEquals(roleAccess.getRoles().size(), 2);
    assertTrue(roleAccess.getRoles().contains("readers"));
    assertTrue(roleAccess.getRoles().contains("writers"));
    
    Principal principal4 = SimplePrincipal.create("user_domain", "user4", "v=U1;d=user_domain;n=user1;s=sig", 0, null);
    ResourceContext context4 = createResourceContext(principal4);
    
    roleAccess = zts.getRoleAccess(context4, "roleaccess", "user_domain.user4");
    assertEquals(roleAccess.getRoles().size(), 1);
    assertTrue(roleAccess.getRoles().contains("readers"));
    
    // invalid domain
    
    try {
        zts.getRoleAccess(context4, "unknowndomain", "user_domain.user4");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 404);
    }
}