@Test
public void testGetPrivilegesByRoleName() throws Exception {

  String roleName1 = "r1";
  String roleName2 = "r2";
  String grantor = "g1";
  PrivilegeObject queryPrivilege = new Builder()
      .setComponent(SEARCH)
      .setAction(SearchConstants.QUERY)
      .setService(SERVICE)
      .setAuthorizables(Arrays.asList(new Collection(COLLECTION_NAME)))
      .build();
  sentryStore.createRole(SEARCH, roleName1, grantor);
  sentryStore.alterRoleGrantPrivilege(SEARCH, roleName1, queryPrivilege,
      ADMIN_USER);
  PrivilegeObject updatePrivilege = new Builder()
      .setComponent(SEARCH)
      .setAction(SearchConstants.QUERY)
      .setService(SERVICE)
      .setAuthorizables(Arrays.asList(new Collection(COLLECTION_NAME)))
      .build();
  sentryStore.createRole(SEARCH, roleName2, grantor);
  sentryStore.alterRoleGrantPrivilege(SEARCH, roleName2, updatePrivilege,
      ADMIN_USER);
  assertEquals(Sets.newHashSet(queryPrivilege,updatePrivilege),
      sentryStore.getPrivilegesByRole(SEARCH, Sets.newHashSet(roleName1,roleName2)));
}