Search in sources :

Example 16 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 17 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)

Example 18 with CLIRequest

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

the class SetApplicationTest method modifyApp.

@Test
public void modifyApp() throws CLIException {
    String[] args = new String[16];
    args[0] = "set-appl";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME;
    args[2] = "/";
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + CreateApplication.PARAM_APPL_NAME;
    args[4] = APPL_NAME;
    args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES;
    args[6] = CreateApplication.ATTR_ACTIONS + "=GET=true";
    args[7] = CreateApplication.ATTR_ACTIONS + "=POST=true";
    args[8] = CreateApplication.ATTR_CONDITIONS + "=com.sun.identity.admin.model.DateRangeCondition";
    args[9] = CreateApplication.ATTR_SUBJECTS + "=com.sun.identity.admin.model.IdRepoGroupViewSubject";
    args[10] = CreateApplication.ATTR_RESOURCES + "=https://";
    args[11] = CreateApplication.ATTR_SUBJECT_ATTRIBUTE_NAMES + "=uid";
    args[12] = CreateApplication.ATTR_ENTITLEMENT_COMBINER + "=com.sun.identity.entitlement.DenyOverride";
    args[13] = CreateApplication.ATTR_RESOURCE_COMPARATOR + "=com.sun.identity.entitlement.URLResourceName";
    args[14] = CreateApplication.ATTR_SAVE_INDEX + "=com.sun.identity.entitlement.util.ResourceNameIndexGenerator";
    args[15] = CreateApplication.ATTR_SEARCH_INDEX + "=com.sun.identity.entitlement.util.ResourceNameSplitter";
    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 19 with CLIRequest

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

the class IdRepoTest method listIdentities.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "list-identities" }, dependsOnMethods = { "createIdentity" })
public void listIdentities(String realm, String uid) throws CLIException {
    String[] param = { realm, uid };
    entering("listIdentities", param);
    String[] args = { "list-identities", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.FILTER, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("listIdentities");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 20 with CLIRequest

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

the class IdRepoTest method getIdentityTypes.

@Parameters({ "realm" })
@Test(groups = { "cli-idrepo", "show-identity-types" })
public void getIdentityTypes(String realm) throws CLIException {
    String[] param = { realm };
    entering("getIdentityTypes", param);
    String[] args = { "show-identity-types", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("getIdentityTypes");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

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