Search in sources :

Example 91 with CLIRequest

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

the class SchemaTest method setAttributeSchemaValidator.

@Parameters({ "subschema" })
@Test(groups = { "schema", "set-attr-validator", "attribute-schema-ops", "subschema" })
public void setAttributeSchemaValidator(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("setAttributeSchemaValidator", params);
    String[] args = (subschema.length() == 0) ? new String[9] : new String[11];
    args[0] = "set-attr-validator";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME;
    args[2] = TEST_SERVICE;
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SCHEMA_TYPE;
    args[4] = "global";
    args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_SCHEMA;
    args[6] = "mock-add";
    args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + SetAttributeSchemaValidator.ARGUMENT_VALIDATOR;
    args[8] = "com.dummy.Dummy";
    if (subschema.length() > 0) {
        args[9] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
        args[10] = subschema;
    }
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    try {
        cmdManager.serviceRequestQueue();
        ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
        ServiceSchema serviceSchema = mgr.getGlobalSchema();
        if (subschema.length() > 0) {
            serviceSchema = serviceSchema.getSubSchema(subschema);
        }
        AttributeSchema as = serviceSchema.getAttributeSchema("mock-add");
        /*
             * unable to verify because AttributeSchema does not have 
             * getValidator method. Hence pass if there are no exceptions.
             */
        exiting("setAttributeSchemaValidator");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "setAttributeSchemaValidator", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "setAttributeSchemaValidator", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "setAttributeSchemaValidator", e.getMessage());
        throw e;
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) AttributeSchema(com.sun.identity.sm.AttributeSchema) CLIRequest(com.sun.identity.cli.CLIRequest) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 92 with CLIRequest

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

the class ListPolicyNamesTest method listPolicyNames.

@Test
public void listPolicyNames() throws CLIException {
    String[] args = new String[6];
    args[0] = "list-policies";
    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 93 with CLIRequest

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

the class RealmTest method getAssignedServicesInRealm.

@Parameters({ "realm" })
@Test(groups = { "cli-realm", "show-realm-svcs" })
public void getAssignedServicesInRealm(String realm) throws CLIException, SMSException {
    String[] param = { realm };
    entering("getAssignedServicesInRealm", param);
    String[] args = { "show-realm-svcs", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("getAssignedServicesInRealm");
}
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 94 with CLIRequest

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

the class RealmTest method getPolicy.

@Test(groups = { "cli-realm", "list-policies" }, dependsOnMethods = { "createPolicy" })
public void getPolicy() throws CLIException, PolicyException, SSOException {
    entering("getPolicy", null);
    String[] args = { "list-policies", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, "/" };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("getPolicy");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 95 with CLIRequest

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

the class RealmTest method setRealmAttributeValues.

@Parameters({ "realm" })
@Test(groups = { "cli-realm", "set-realm-attrs" }, dependsOnMethods = { "removeRealmAttribute" })
public void setRealmAttributeValues(String realm) throws CLIException, SMSException, SSOException {
    String[] param = { realm };
    entering("setRealmAttributeValues", param);
    String[] args = { "set-realm-attrs", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, "sunIdentityRepositoryService", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, "sunOrganizationStatus=Active" };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    OrganizationConfigManager ocm = new OrganizationConfigManager(getAdminSSOToken(), realm);
    Map values = ocm.getAttributes("sunIdentityRepositoryService");
    Set attrValues = (Set) values.get("sunOrganizationStatus");
    assert attrValues.contains("Active");
    exiting("setRealmAttributeValues");
}
Also used : Set(java.util.Set) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) 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