Search in sources :

Example 1 with CLIRequest

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

the class IdRepoTest method getAssignableServices.

//    Duplicate of getIdentityServices?
//    @Parameters ({"realm", "uid"})
//    @Test(groups = {"cli-idrepo", "get-identity-svcs"},
//        dependsOnMethods = {"createIdentity"})
//    public void getServices(String realm, String uid)
//        throws CLIException {
//        String[] param = {realm, uid};
//        entering("getServices", param);
//        String[] args = {
//            "get-identity-svcs",
//            CLIConstants.PREFIX_ARGUMENT_LONG +
//                IdentityCommand.ARGUMENT_ID_TYPE,
//            "User",
//            CLIConstants.PREFIX_ARGUMENT_LONG +
//                IdentityCommand.ARGUMENT_ID_NAME,
//            uid,
//            CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME,
//            realm};
//
//        CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
//        cmdManager.addToRequestQueue(req);
//        cmdManager.serviceRequestQueue();
//        exiting("getServices");
//    }
@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "list-identity-assignable-svcs" }, dependsOnMethods = { "createIdentity" })
public void getAssignableServices(String realm, String uid) throws CLIException {
    String[] param = { realm, uid };
    entering("getAssignableServices", param);
    String[] args = { "list-identity-assignable-svcs", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("getAssignableServices");
}
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 2 with CLIRequest

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

the class IdRepoTest method assignServices.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "add-svc-identity" }, dependsOnMethods = { "createIdentity" })
public void assignServices(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("assignServices", param);
    String[] args = { "add-svc-identity", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, "iPlanetAMSessionService", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, "iplanet-am-session-quota-limit=10" };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity amid = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Set services = amid.getAssignedServices();
    assert services.contains("iPlanetAMSessionService");
    exiting("assignServices");
}
Also used : SSOToken(com.iplanet.sso.SSOToken) HashSet(java.util.HashSet) Set(java.util.Set) AMIdentity(com.sun.identity.idm.AMIdentity) 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 3 with CLIRequest

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

the class IdRepoTest method setServiceAttributes.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "set-identity-svc-attrs" }, dependsOnMethods = { "assignServices" })
public void setServiceAttributes(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("setServiceAttributes", param);
    String[] args = { "set-identity-svc-attrs", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, "iPlanetAMSessionService", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, "iplanet-am-session-quota-limit=1" };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity user = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Map attrValues = user.getServiceAttributes("iPlanetAMSessionService");
    Set values = (Set) attrValues.get("iplanet-am-session-quota-limit");
    String val = (String) values.iterator().next();
    assert val.equals("1");
    exiting("setServiceAttributes");
}
Also used : SSOToken(com.iplanet.sso.SSOToken) HashSet(java.util.HashSet) Set(java.util.Set) AMIdentity(com.sun.identity.idm.AMIdentity) CLIRequest(com.sun.identity.cli.CLIRequest) HashMap(java.util.HashMap) Map(java.util.Map) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 4 with CLIRequest

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

the class IdRepoTest method addMember.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "add-members" }, dependsOnMethods = { "createIdentity" })
public void addMember(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("addMember", param);
    createDummyGroup(realm);
    String[] args = { "add-member", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "Group", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, DUMMY_GROUP, CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_MEMBER_IDNAME, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_MEMBER_IDTYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity group = new AMIdentity(adminSSOToken, DUMMY_GROUP, IdType.GROUP, realm, null);
    AMIdentity user = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Set members = group.getMembers(IdType.USER);
    assert (members.contains(user));
    exiting("addMember");
}
Also used : SSOToken(com.iplanet.sso.SSOToken) HashSet(java.util.HashSet) Set(java.util.Set) AMIdentity(com.sun.identity.idm.AMIdentity) 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 5 with CLIRequest

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

the class IdRepoTest method setAttributes.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "set-svc-attrs" }, dependsOnMethods = { "assignServices" })
public void setAttributes(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("setAttributes", param);
    String[] args = { "set-identity-attrs", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, "cn=commonname" };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity user = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Map attrValues = user.getServiceAttributes("iPlanetAMUserService");
    Set values = (Set) attrValues.get("cn");
    String val = (String) values.iterator().next();
    assert val.equals("commonname");
    exiting("setAttributes");
}
Also used : SSOToken(com.iplanet.sso.SSOToken) HashSet(java.util.HashSet) Set(java.util.Set) AMIdentity(com.sun.identity.idm.AMIdentity) CLIRequest(com.sun.identity.cli.CLIRequest) HashMap(java.util.HashMap) Map(java.util.Map) 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