Search in sources :

Example 41 with CLIRequest

use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.

the class ApplicationPrivilegeCLITest method changeAction.

@Test(dependsOnMethods = "changeDescription")
public void changeAction() throws Exception {
    String[] args = new String[7];
    args[0] = "update-app-priv";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_NAME;
    args[4] = PRIVILEGE_NAME;
    args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_ACTIONS;
    args[6] = ApplicationPrivilegeBase.PARAM_ACTION_DELEGATE;
    CLIRequest req = new CLIRequest(null, args, adminToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
    ApplicationPrivilege ap = apm.getPrivilege(PRIVILEGE_NAME);
    if (!ap.getActionValues().equals(ApplicationPrivilege.PossibleAction.READ_DELEGATE)) {
        throw new Exception("ApplicationPrivilegeCLITest.changeAction: " + "action is incorrect.");
    }
}
Also used : ApplicationPrivilege(com.sun.identity.entitlement.ApplicationPrivilege) CLIRequest(com.sun.identity.cli.CLIRequest) ApplicationPrivilegeManager(com.sun.identity.entitlement.ApplicationPrivilegeManager) IdRepoException(com.sun.identity.idm.IdRepoException) EntitlementException(com.sun.identity.entitlement.EntitlementException) SSOException(com.iplanet.sso.SSOException) Test(org.testng.annotations.Test)

Example 42 with CLIRequest

use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.

the class ApplicationPrivilegeCLITest method listApplicationPrivileges.

@Test(dependsOnMethods = "createApplicationPrivilege")
public void listApplicationPrivileges() throws Exception {
    String[] args = new String[3];
    args[0] = "list-app-privs";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    CLIRequest req = new CLIRequest(null, args, adminToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Test(org.testng.annotations.Test)

Example 43 with CLIRequest

use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.

the class ApplicationPrivilegeCLITest method changeDescription.

@Test(dependsOnMethods = "listApplicationPrivileges")
public void changeDescription() throws Exception {
    String[] args = new String[7];
    args[0] = "update-app-priv";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_NAME;
    args[4] = PRIVILEGE_NAME;
    args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_DESCRIPTION;
    args[6] = "descChanged";
    CLIRequest req = new CLIRequest(null, args, adminToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
    ApplicationPrivilege ap = apm.getPrivilege(PRIVILEGE_NAME);
    if (!ap.getDescription().equals("descChanged")) {
        throw new Exception("ApplicationPrivilegeCLITest.changeDescription: " + "description is incorrect.");
    }
}
Also used : ApplicationPrivilege(com.sun.identity.entitlement.ApplicationPrivilege) CLIRequest(com.sun.identity.cli.CLIRequest) ApplicationPrivilegeManager(com.sun.identity.entitlement.ApplicationPrivilegeManager) IdRepoException(com.sun.identity.idm.IdRepoException) EntitlementException(com.sun.identity.entitlement.EntitlementException) SSOException(com.iplanet.sso.SSOException) Test(org.testng.annotations.Test)

Example 44 with CLIRequest

use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.

the class ApplicationPrivilegeCLITest method setResources.

@Test(dependsOnMethods = "removeSubjects")
public void setResources() throws Exception {
    String[] args = new String[10];
    args[0] = "update-app-priv-resources";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_NAME;
    args[4] = PRIVILEGE_NAME;
    args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_APPL_NAME;
    args[6] = ApplicationTypeManager.URL_APPLICATION_TYPE_NAME;
    args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + ApplicationPrivilegeBase.PARAM_RESOURCES;
    args[8] = "http://www.example1.com";
    args[9] = "http://www.example2.com";
    CLIRequest req = new CLIRequest(null, args, adminToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
    ApplicationPrivilege ap = apm.getPrivilege(PRIVILEGE_NAME);
    Set<String> resources = new HashSet<String>();
    resources.add("http://www.example1.com");
    resources.add("http://www.example2.com");
    validateResources(ap, resources, "setResources");
}
Also used : ApplicationPrivilege(com.sun.identity.entitlement.ApplicationPrivilege) CLIRequest(com.sun.identity.cli.CLIRequest) ApplicationPrivilegeManager(com.sun.identity.entitlement.ApplicationPrivilegeManager) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 45 with CLIRequest

use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.

the class ListPolicyNamesTest method listXACMLPolicyNames.

@Test
public void listXACMLPolicyNames() throws CLIException {
    String[] args = new String[6];
    args[0] = "list-xacml";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + RealmGetPolicy.ARGUMENT_POLICY_NAMES;
    args[4] = "*";
    args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.NAMES_ONLY;
    CLIRequest req = new CLIRequest(null, args, adminToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Test(org.testng.annotations.Test)

Aggregations

CLIRequest (com.sun.identity.cli.CLIRequest)102 Test (org.testng.annotations.Test)95 BeforeTest (org.testng.annotations.BeforeTest)77 AfterTest (org.testng.annotations.AfterTest)66 Parameters (org.testng.annotations.Parameters)57 SSOException (com.iplanet.sso.SSOException)28 CLIException (com.sun.identity.cli.CLIException)27 SMSException (com.sun.identity.sm.SMSException)25 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)25 ServiceSchema (com.sun.identity.sm.ServiceSchema)21 AttributeSchema (com.sun.identity.sm.AttributeSchema)18 Set (java.util.Set)18 AMIdentity (com.sun.identity.idm.AMIdentity)14 HashSet (java.util.HashSet)14 SSOToken (com.iplanet.sso.SSOToken)13 ApplicationPrivilegeManager (com.sun.identity.entitlement.ApplicationPrivilegeManager)10 ApplicationPrivilege (com.sun.identity.entitlement.ApplicationPrivilege)9 HashMap (java.util.HashMap)8 Map (java.util.Map)8 OrganizationConfigManager (com.sun.identity.sm.OrganizationConfigManager)5