Search in sources :

Example 81 with CLIRequest

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

the class SchemaTest method deleteAttributeSchema.

@Parameters({ "subschema" })
@Test(groups = { "schema", "delete-attr", "subschema" }, dependsOnGroups = { "attribute-schema-ops" })
public void deleteAttributeSchema(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("deleteAttributeSchema", params);
    String[] args = (subschema.length() == 0) ? new String[7] : new String[9];
    args[0] = "delete-attr";
    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";
    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);
    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");
        assert (as == null);
        exiting("deleteAttributeSchema");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "deleteAttributeSchema", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "deleteAttributeSchema", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "deleteAttributeSchema", 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 82 with CLIRequest

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

the class SchemaTest method setAttributeDefaults.

@Parameters({ "subschema" })
@Test(groups = { "schema", "set-attr-defs", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "deleteAttributeDefaultValues" })
public void setAttributeDefaults(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("setAttributeDefaults", params);
    SSOToken adminSSOToken = getAdminSSOToken();
    ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, adminSSOToken);
    ServiceSchema serviceSchema = mgr.getGlobalSchema();
    if (subschema.length() > 0) {
        serviceSchema = serviceSchema.getSubSchema(subschema);
    }
    AttributeSchema as = serviceSchema.getAttributeSchema("mock-add");
    as.addChoiceValue("testx", "testx");
    //as.addChoiceValue("testy", "testy");
    String[] args = (subschema.length() == 0) ? new String[7] : new String[9];
    args[0] = "set-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=testx";
    if (subschema.length() > 0) {
        args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
        args[8] = subschema;
    }
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    mgr = new ServiceSchemaManager(TEST_SERVICE, adminSSOToken);
    serviceSchema = mgr.getGlobalSchema();
    if (subschema.length() > 0) {
        serviceSchema = serviceSchema.getSubSchema(subschema);
    }
    as = serviceSchema.getAttributeSchema("mock-add");
    Set defaultValues = as.getDefaultValues();
    assert (defaultValues.size() == 1);
    assert (defaultValues.contains("testx"));
    //assert (defaultValues.contains("testy"));
    exiting("setAttributeDefaults");
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOToken(com.iplanet.sso.SSOToken) 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 83 with CLIRequest

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

the class SchemaTest method deleteAttributeDefaultValues.

@Parameters({ "subschema" })
@Test(groups = { "schema", "add-attribute-default-values", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "showAttributeDefaultValues" })
public void deleteAttributeDefaultValues(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("deleteAttributeDefaultValues", params);
    String[] args = (subschema.length() == 0) ? new String[9] : new String[11];
    args[0] = "delete-attr-def-values";
    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 + IArgument.DEFAULT_VALUES;
    args[8] = "test1";
    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);
    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.contains("test1"));
    exiting("deleteAttributeDefaultValues");
}
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 84 with CLIRequest

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

the class SAML2Test method createMetaTemplate.

@Test(groups = { "samlv2", "samlv2op" }, dependsOnMethods = { "createCircleOfTrust" })
public void createMetaTemplate() throws CLIException {
    entering("createMetaTemplate", null);
    String[] args = { "create-metadata-templ", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_ENTITY_ID, NAME_IDP, CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_METADATA, "meta", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_EXTENDED_DATA, "extended", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_SERVICE_PROVIDER, "/sp", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_IDENTITY_PROVIDER, "/idp", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_PDP, "/pdp", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_PEP, "/pep", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.SPECIFICATION_VERSION, FedCLIConstants.SAML2_SPECIFICATION };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("createMetaTemplate");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 85 with CLIRequest

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

the class SAML2Test method deleteEntity.

@Test(groups = { "samlv2", "samlv2op" }, dependsOnMethods = { "removeProviderFromCircleOfTrust" })
public void deleteEntity() throws CLIException, SAML2MetaException {
    entering("deleteEntity", null);
    String[] args = { "delete-entity", CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.ARGUMENT_ENTITY_ID, NAME_IDP, CLIConstants.PREFIX_ARGUMENT_LONG + FedCLIConstants.SPECIFICATION_VERSION, FedCLIConstants.SAML2_SPECIFICATION };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    SAML2MetaManager mgr = new SAML2MetaManager();
    EntityDescriptorElement entity = mgr.getEntityDescriptor("/", NAME_IDP);
    assert (entity == null);
    exiting("deleteEntity");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) EntityDescriptorElement(com.sun.identity.saml2.jaxb.metadata.EntityDescriptorElement) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

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