privilege.setGrantorPrincipal(grantor);
privilege.setCreateTime(System.currentTimeMillis());
privilege.setPrivilegeName(SentryStore.constructPrivilegeName(privilege));
assertEquals(seqId + 1, sentryStore.alterSentryRoleGrantPrivilege(roleName, privilege)
.getSequenceId());
MSentryRole role = sentryStore.getMSentryRoleByName(roleName);
Set<MSentryPrivilege> privileges = role.getPrivileges();
assertEquals(privileges.toString(), 1, privileges.size());
assertEquals(privilege.getPrivilegeName(), Iterables.get(privileges, 0).getPrivilegeName());
privilege.setAction(AccessConstants.SELECT);
assertEquals(seqId + 2, sentryStore.alterSentryRoleRevokePrivilege(roleName, privilege)
.getSequenceId());
// after having ALL and revoking SELECT, we should have INSERT
role = sentryStore.getMSentryRoleByName(roleName);
privileges = role.getPrivileges();
assertEquals(privileges.toString(), 1, privileges.size());
MSentryPrivilege mPrivilege = Iterables.get(privileges, 0);
assertEquals(server, mPrivilege.getServerName());
assertEquals(db, mPrivilege.getDbName());
assertEquals(table, mPrivilege.getTableName());