Search in sources :

Example 86 with CLIRequest

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

the class SAML2Test method deleteCircleOfTrust.

@Test(groups = { "samlv2" }, dependsOnMethods = { "removeProviderFromCircleOfTrust" }, expectedExceptions = { COTException.class })
public void deleteCircleOfTrust() throws CLIException, COTException, SAML2MetaException {
    entering("deleteCircleOfTrust", null);
    String[] args = { "delete-cot", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_COT, NAME_COT };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    try {
        cmdManager.serviceRequestQueue();
        CircleOfTrustManager cotManager = new CircleOfTrustManager();
        CircleOfTrustDescriptor objCircleOfTrust = cotManager.getCircleOfTrust("/", NAME_COT);
    } finally {
        exiting("deleteCircleOfTrust");
    }
}
Also used : CircleOfTrustManager(com.sun.identity.cot.CircleOfTrustManager) CLIRequest(com.sun.identity.cli.CLIRequest) CircleOfTrustDescriptor(com.sun.identity.cot.CircleOfTrustDescriptor) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 87 with CLIRequest

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

the class SchemaTest method setServiceViewBeanURL.

@Test(groups = { "schema", "set-svc-view-bean-url" })
public void setServiceViewBeanURL() throws CLIException, SMSException, SSOException {
    entering("setServiceViewBeanURL", null);
    String[] args = { "set-svc-view-bean-url", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, TEST_SERVICE, CLIConstants.PREFIX_ARGUMENT_LONG + SetServiceSchemaPropertiesViewBeanURL.ARGUMENT_URL, "mockviewbeanURL" };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    try {
        cmdManager.serviceRequestQueue();
        ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
        assert mgr.getPropertiesViewBeanURL().equals("mockviewbeanURL");
        exiting("setServiceViewBeanURL");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "setServiceViewBeanURL", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "setServiceViewBeanURL", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "setServiceViewBeanURL", e.getMessage());
        throw e;
    }
}
Also used : 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 88 with CLIRequest

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

the class SchemaTest method setAttributeSchemaStartRange.

@Parameters({ "subschema" })
@Test(groups = { "schema", "set-attr-start-range", "subschema" })
public void setAttributeSchemaStartRange(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("setAttributeSchemaStartRange", params);
    String[] args = (subschema.length() == 0) ? new String[9] : new String[11];
    args[0] = "set-attr-start-range";
    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-number";
    args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + SetAttributeSchemaStartRange.ARGUMENT_RANGE;
    args[8] = "10";
    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-number");
        assert as.getStartRange().equals("10");
        exiting("setAttributeSchemaStartRange");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "setAttributeSchemaStartRange", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "setAttributeSchemaStartRange", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "setAttributeSchemaStartRange", 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 89 with CLIRequest

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

the class SchemaTest method addAttributeDefaultValues.

@Parameters({ "subschema" })
@Test(groups = { "schema", "add-attr-defs", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "addAttributeSchema" })
public void addAttributeDefaultValues(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("addAttributeDefaultValues", params);
    String[] args = (subschema.length() == 0) ? new String[7] : new String[9];
    args[0] = "add-attr-defs";
    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_VALUES;
    args[6] = "mock-add=test1";
    if (subschema.length() > 0) {
        args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
        args[8] = subschema;
    }
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    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");
    Set values = as.getDefaultValues();
    assert (values.size() == 1);
    assert (values.contains("test1"));
    exiting("addAttributeDefaultValues");
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) AttributeSchema(com.sun.identity.sm.AttributeSchema) CLIRequest(com.sun.identity.cli.CLIRequest) 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 90 with CLIRequest

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

the class SchemaTest method setServiceI18nKey.

@Test(groups = { "schema", "set-svc-i18n-key" })
public void setServiceI18nKey() throws CLIException, SMSException, SSOException {
    entering("setServiceI18nKey", null);
    String[] args = { "set-svc-i18n-key", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, TEST_SERVICE, CLIConstants.PREFIX_ARGUMENT_LONG + SetServiceSchemaI18nKey.ARGUMENT_I18N_KEY, "service-18nKey" };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    try {
        cmdManager.serviceRequestQueue();
        ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
        assert mgr.getI18NKey().equals("service-18nKey");
        exiting("setServiceI18nKey");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "setServiceI18nKey", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "setServiceI18nKey", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "setServiceI18nKey", e.getMessage());
        throw e;
    }
}
Also used : 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)

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