Search in sources :

Example 61 with CLIRequest

use of com.sun.identity.cli.CLIRequest 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)

Example 62 with CLIRequest

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

the class ListApplicationsTest method listApps.

@Test
public void listApps() throws CLIException {
    String[] args = new String[3];
    args[0] = "list-appls";
    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 63 with CLIRequest

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

the class SchemaTest method deleteSubConfiguration.

@Test(groups = { "schema", "delete-sub-cfg" }, dependsOnMethods = { "setSubConfiguration" })
public void deleteSubConfiguration() throws CLIException, SMSException, SSOException {
    entering("deleteSubConfiguration", null);
    String[] args = { "delete-sub-cfg", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, TEST_SERVICE, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUB_CONFIGURATION_NAME, "/testConfig" };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    try {
        cmdManager.serviceRequestQueue();
        ServiceConfigManager scm = new ServiceConfigManager(TEST_SERVICE, getAdminSSOToken());
        ServiceConfig sc = scm.getGlobalConfig(null);
        sc = sc.getSubConfig("testConfig");
        assert (sc == null);
        exiting("deleteSubConfiguration");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "deleteSubConfiguration", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "deleteSubConfiguration", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "deleteSubConfiguration", e.getMessage());
        throw e;
    }
}
Also used : ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) CLIRequest(com.sun.identity.cli.CLIRequest) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 64 with CLIRequest

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

the class SchemaTest method setInheritance.

@Test(groups = { "schema", "set-inheritance" })
public void setInheritance() throws CLIException, SMSException, SSOException {
    entering("setInheritance", null);
    String[] args = { "set-inheritance", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, TEST_SERVICE, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SCHEMA_TYPE, "global", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME, "subschema-inheritance", CLIConstants.PREFIX_ARGUMENT_LONG + ModifyInheritance.ARGUMENT_INHERITANCE, "multiple" };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    try {
        cmdManager.serviceRequestQueue();
        ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
        ServiceSchema globalSchema = mgr.getSchema(SchemaType.GLOBAL);
        ServiceSchema ss = globalSchema.getSubSchema("subschema-inheritance");
        assert ss.supportsMultipleConfigurations();
        exiting("setInheritance");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "setInheritance", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "setInheritance", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "setInheritance", e.getMessage());
        throw e;
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) CLIRequest(com.sun.identity.cli.CLIRequest) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 65 with CLIRequest

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

the class SchemaTest method removeAttributeSchemaChoiceValues.

@Parameters({ "subschema" })
@Test(groups = { "schema", "remove-attr-choicevals", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "setAttributeSchemaChoiceValues" })
public void removeAttributeSchemaChoiceValues(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("removeAttributeSchemaChoiceValues", params);
    String[] args = (subschema.length() == 0) ? new String[9] : new String[11];
    args[0] = "remove-attr-choicevals";
    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_NAME;
    args[6] = "mock-single-choice";
    args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.CHOICE_VALUES;
    args[8] = "choice1";
    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-single-choice");
        String[] choiceValues = as.getChoiceValues();
        assert (choiceValues.length == 0);
        exiting("removeAttributeSchemaChoiceValues");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "removeAttributeSchemaChoiceValues", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "removeAttributeSchemaChoiceValues", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "removeAttributeSchemaChoiceValues", 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)

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