Search in sources :

Example 26 with ApplicationPrivilegeManager

use of com.sun.identity.entitlement.ApplicationPrivilegeManager in project OpenAM by OpenRock.

the class ApplicationPrivilegeCLITest method removedApplicationPrivilege.

@Test(dependsOnMethods = "removeResources")
public void removedApplicationPrivilege() throws Exception {
    String[] args = new String[5];
    args[0] = "remove-app-privs";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + DeleteApplicationPrivilege.PARAM_NAMES;
    args[4] = PRIVILEGE_NAME;
    CLIRequest req = new CLIRequest(null, args, adminToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
    try {
        apm.getPrivilege(PRIVILEGE_NAME);
    } catch (EntitlementException ex) {
        if (ex.getErrorCode() != 325) {
            throw ex;
        }
    }
}
Also used : EntitlementException(com.sun.identity.entitlement.EntitlementException) CLIRequest(com.sun.identity.cli.CLIRequest) ApplicationPrivilegeManager(com.sun.identity.entitlement.ApplicationPrivilegeManager) Test(org.testng.annotations.Test)

Aggregations

ApplicationPrivilegeManager (com.sun.identity.entitlement.ApplicationPrivilegeManager)26 ApplicationPrivilege (com.sun.identity.entitlement.ApplicationPrivilege)18 EntitlementException (com.sun.identity.entitlement.EntitlementException)18 Test (org.testng.annotations.Test)11 CLIRequest (com.sun.identity.cli.CLIRequest)10 HashSet (java.util.HashSet)10 Subject (javax.security.auth.Subject)9 SSOException (com.iplanet.sso.SSOException)8 CLIException (com.sun.identity.cli.CLIException)8 Set (java.util.Set)6 PrivilegeIndexStore (com.sun.identity.entitlement.PrivilegeIndexStore)5 SubjectImplementation (com.sun.identity.entitlement.SubjectImplementation)4 AMIdentity (com.sun.identity.idm.AMIdentity)4 SMSEntry (com.sun.identity.sm.SMSEntry)4 SMSException (com.sun.identity.sm.SMSException)4 SSOToken (com.iplanet.sso.SSOToken)3 IPrivilege (com.sun.identity.entitlement.IPrivilege)3 IdRepoException (com.sun.identity.idm.IdRepoException)3 Policy (com.sun.identity.policy.Policy)3 PolicyException (com.sun.identity.policy.PolicyException)3