Search in sources :

Example 16 with SCIMResponseHandler

use of org.wso2.identity.integration.test.scim.utils.SCIMResponseHandler in project product-is by wso2.

the class SCIMServiceProviderUserTestCase method listUser.

@Test(alwaysRun = true, description = "list all SCIM users", dependsOnMethods = { "getUserMe" })
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
public void listUser() throws Exception {
    // create SCIM client
    SCIMClient scimClient = new SCIMClient();
    // create a apache wink ClientHandler to intercept and identify response messages
    SCIMResponseHandler responseHandler = new SCIMResponseHandler();
    responseHandler.setSCIMClient(scimClient);
    // set the handler in wink client config
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.handlers(new ClientHandler[] { responseHandler });
    // create a wink rest client with the above config
    RestClient restClient = new RestClient(clientConfig);
    BasicAuthInfo encodedBasicAuthInfo = SCIMUtils.getBasicAuthInfo(provider_userInfo);
    // create resource endpoint to access a known user resource.
    Resource userResource = restClient.resource(scim_url + "Users");
    String response = userResource.header(SCIMConstants.AUTHORIZATION_HEADER, encodedBasicAuthInfo.getAuthorizationHeader()).contentType(SCIMConstants.APPLICATION_JSON).accept(SCIMConstants.APPLICATION_JSON).get(String.class);
    Assert.assertTrue(isAllUsersExists(response));
}
Also used : RestClient(org.apache.wink.client.RestClient) Resource(org.apache.wink.client.Resource) SCIMClient(org.wso2.charon.core.client.SCIMClient) BasicAuthInfo(org.wso2.identity.integration.test.utils.BasicAuthInfo) SCIMResponseHandler(org.wso2.identity.integration.test.scim.utils.SCIMResponseHandler) ClientConfig(org.apache.wink.client.ClientConfig) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) Test(org.testng.annotations.Test)

Aggregations

ClientConfig (org.apache.wink.client.ClientConfig)16 RestClient (org.apache.wink.client.RestClient)16 SCIMResponseHandler (org.wso2.identity.integration.test.scim.utils.SCIMResponseHandler)16 Resource (org.apache.wink.client.Resource)13 BasicAuthInfo (org.wso2.identity.integration.test.utils.BasicAuthInfo)13 Test (org.testng.annotations.Test)12 SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)12 SCIMClient (org.wso2.charon.core.client.SCIMClient)2 Group (org.wso2.charon.core.objects.Group)2 RemoteException (java.rmi.RemoteException)1 JSONObject (org.json.simple.JSONObject)1 User (org.wso2.carbon.automation.engine.context.beans.User)1 UserAdminUserAdminException (org.wso2.carbon.user.mgt.stub.UserAdminUserAdminException)1 FlaggedName (org.wso2.carbon.user.mgt.stub.types.carbon.FlaggedName)1