Search in sources :

Example 36 with Parameters

use of org.testng.annotations.Parameters in project OpenAM by OpenRock.

the class RealmTest method getServiceAttribute.

@Parameters({ "realm", "service-name" })
@Test(groups = { "cli-realm", "services", "show-realm-svc-attrs" }, dependsOnMethods = { "assignedServiceToRealm" })
public void getServiceAttribute(String realm, String serviceName) throws CLIException {
    String[] param = { realm };
    entering("getServiceAttribute", param);
    String[] args = { "get-realm-svc-attrs", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, serviceName };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("getServiceAttribute");
}
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 37 with Parameters

use of org.testng.annotations.Parameters in project OpenAM by OpenRock.

the class RealmTest method unassignServiceFromRealm.

@Parameters({ "realm", "service-name", "attribute-value" })
@Test(groups = { "cli-realm", "remove-svc-realm" }, dependsOnGroups = { "services" })
public void unassignServiceFromRealm(String realm, String serviceName, String attributeValue) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm };
    entering("unassignServiceFromRealm", param);
    String[] args = { "remove-svc-realm", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, serviceName };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentityRepository amir = new AMIdentityRepository(getAdminSSOToken(), realm);
    AMIdentity ai = amir.getRealmIdentity();
    Map map = ai.getServiceAttributes(serviceName);
    Map orig = CollectionUtils.parseStringToMap(attributeValue);
    assert !map.equals(orig);
    exiting("unassignServiceFromRealm");
}
Also used : AMIdentity(com.sun.identity.idm.AMIdentity) AMIdentityRepository(com.sun.identity.idm.AMIdentityRepository) 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 38 with Parameters

use of org.testng.annotations.Parameters in project OpenAM by OpenRock.

the class SchemaTest method removeAttributeDefaultValues.

@Parameters({ "subschema" })
@Test(groups = { "schema", "remove-attr-defs", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "showAttributeDefaultValues" })
public void removeAttributeDefaultValues(String subschema) throws CLIException, SMSException, SSOException {
    Object[] params = { subschema };
    entering("removeAttributeDefaultValues", params);
    String[] args = (subschema.length() == 0) ? new String[7] : new String[9];
    args[0] = "remove-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_NAMES;
    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");
        Set values = as.getDefaultValues();
        assert values.isEmpty();
        exiting("removeAttributeDefaultValues");
    } catch (CLIException e) {
        this.log(Level.SEVERE, "removeAttributeDefaultValues", e.getMessage());
        throw e;
    } catch (SMSException e) {
        this.log(Level.SEVERE, "removeAttributeDefaultValues", e.getMessage());
        throw e;
    } catch (SSOException e) {
        this.log(Level.SEVERE, "removeAttributeDefaultValues", e.getMessage());
        throw e;
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) 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 39 with Parameters

use of org.testng.annotations.Parameters 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 40 with Parameters

use of org.testng.annotations.Parameters 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)

Aggregations

Parameters (org.testng.annotations.Parameters)630 Test (org.testng.annotations.Test)608 BaseTest (org.xdi.oxauth.BaseTest)511 Response (javax.ws.rs.core.Response)271 Builder (javax.ws.rs.client.Invocation.Builder)270 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)270 ResponseType (org.xdi.oxauth.model.common.ResponseType)259 JSONException (org.codehaus.jettison.json.JSONException)238 OxAuthCryptoProvider (org.xdi.oxauth.model.crypto.OxAuthCryptoProvider)196 JSONObject (org.codehaus.jettison.json.JSONObject)191 URISyntaxException (java.net.URISyntaxException)119 RegisterResponse (org.xdi.oxauth.client.RegisterResponse)110 RegisterRequest (org.xdi.oxauth.client.RegisterRequest)96 JwtAuthorizationRequest (org.xdi.oxauth.client.model.authorize.JwtAuthorizationRequest)92 AuthorizationRequest (org.xdi.oxauth.client.AuthorizationRequest)86 URI (java.net.URI)85 Jwt (org.xdi.oxauth.model.jwt.Jwt)81 Claim (org.xdi.oxauth.client.model.authorize.Claim)80 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)73 REGISTRATION_CLIENT_URI (org.xdi.oxauth.model.register.RegisterResponseParam.REGISTRATION_CLIENT_URI)73