Search in sources :

Example 41 with Parameters

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

the class IdRepoTest method setServiceAttributes.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "set-identity-svc-attrs" }, dependsOnMethods = { "assignServices" })
public void setServiceAttributes(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("setServiceAttributes", param);
    String[] args = { "set-identity-svc-attrs", 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=1" };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity user = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Map attrValues = user.getServiceAttributes("iPlanetAMSessionService");
    Set values = (Set) attrValues.get("iplanet-am-session-quota-limit");
    String val = (String) values.iterator().next();
    assert val.equals("1");
    exiting("setServiceAttributes");
}
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) 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 42 with Parameters

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

the class IdRepoTest method addMember.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "add-members" }, dependsOnMethods = { "createIdentity" })
public void addMember(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("addMember", param);
    createDummyGroup(realm);
    String[] args = { "add-member", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "Group", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, DUMMY_GROUP, CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_MEMBER_IDNAME, uid, CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_MEMBER_IDTYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity group = new AMIdentity(adminSSOToken, DUMMY_GROUP, IdType.GROUP, realm, null);
    AMIdentity user = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Set members = group.getMembers(IdType.USER);
    assert (members.contains(user));
    exiting("addMember");
}
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)

Example 43 with Parameters

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

the class IdRepoTest method setAttributes.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "set-svc-attrs" }, dependsOnMethods = { "assignServices" })
public void setAttributes(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("setAttributes", param);
    String[] args = { "set-identity-attrs", 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.ATTRIBUTE_VALUES, "cn=commonname" };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    AMIdentity user = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
    Map attrValues = user.getServiceAttributes("iPlanetAMUserService");
    Set values = (Set) attrValues.get("cn");
    String val = (String) values.iterator().next();
    assert val.equals("commonname");
    exiting("setAttributes");
}
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) 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 44 with Parameters

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

the class IdRepoTest method getPrivileges.

@Parameters({ "realm", "uid" })
@Test(groups = { "cli-idrepo", "show-privileges" }, dependsOnMethods = { "createIdentity" })
public void getPrivileges(String realm, String uid) throws CLIException, IdRepoException, SSOException {
    String[] param = { realm, uid };
    entering("getPrivileges", param);
    String[] args = { "show-privileges", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "Group", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME, TOP_LEVEL_ADMIN_GROUP, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    SSOToken adminSSOToken = getAdminSSOToken();
    CLIRequest req = new CLIRequest(null, args, adminSSOToken);
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    exiting("getPrivileges");
}
Also used : SSOToken(com.iplanet.sso.SSOToken) 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 45 with Parameters

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

the class ResourceBundleTest method addResourceBundle.

@Parameters({ "bundle-name", "bundle-file-name", "locale" })
@Test(groups = { "cli-resource-bundle", "add-res-bundle" })
public void addResourceBundle(String bundleName, String fileName, String locale) throws CLIException, SSOException {
    entering("addResourceBundle", null);
    String[] args = (locale.length() == 0) ? new String[5] : new String[7];
    args[0] = "add-res-bundle";
    args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.RESOURCE_BUNDLE_NAME;
    args[2] = bundleName;
    args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + AddResourceBundle.ARGUMENT_RESOURCE_BUNDLE_FILE_NAME;
    args[4] = fileName;
    if (locale.length() > 0) {
        args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.RESOURCE_BUNDLE_LOCALE;
        args[6] = locale;
    }
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    ResourceBundle res = (locale.length() == 0) ? ISResourceBundle.getResourceBundle(getAdminSSOToken(), bundleName, (String) null) : ISResourceBundle.getResourceBundle(getAdminSSOToken(), bundleName, locale);
    assert (res != null);
    exiting("addResourceBundle");
}
Also used : ISResourceBundle(com.sun.identity.common.ISResourceBundle) ResourceBundle(java.util.ResourceBundle) Parameters(org.testng.annotations.Parameters) BeforeTest(org.testng.annotations.BeforeTest) Test(org.testng.annotations.Test)

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