Search in sources :

Example 1 with InstantMessagingAddress

use of io.jans.scim.model.scim2.user.InstantMessagingAddress in project jans by JanssenProject.

the class PatchReplaceUserTest method objectPatch.

@Test(dependsOnMethods = "jsonPathPatch2")
public void objectPatch() {
    // Create a patch request by supplying a singleton list with one IMS object
    InstantMessagingAddress ims = new InstantMessagingAddress();
    ims.setDisplay("barbas");
    ims.setPrimary(true);
    ims.setType("escape");
    ims.setValue("bjensen");
    PatchOperation op = new PatchOperation();
    op.setOperation("replace");
    op.setPath("ims");
    op.setValue(Collections.singleton(ims));
    PatchRequest pr = new PatchRequest();
    pr.setOperations(Collections.singletonList(op));
    Response response = client.patchUser(pr, user.getId(), null, null);
    assertEquals(response.getStatus(), OK.getStatusCode());
    UserResource other = response.readEntity(usrClass);
    for (int i = 0; i < 2; i++) {
        // Verify different info appeared
        InstantMessagingAddress newIms = other.getIms().get(0);
        assertEquals(newIms.getDisplay(), ims.getDisplay());
        assertEquals(newIms.getValue(), ims.getValue());
        assertEquals(newIms.getType(), ims.getType());
        assertEquals(newIms.getPrimary(), ims.getPrimary());
        // Double check
        response = client.getUserById(user.getId(), "ims", null);
        other = response.readEntity(usrClass);
    }
}
Also used : Response(javax.ws.rs.core.Response) PatchOperation(io.jans.scim.model.scim2.patch.PatchOperation) UserResource(io.jans.scim.model.scim2.user.UserResource) PatchRequest(io.jans.scim.model.scim2.patch.PatchRequest) InstantMessagingAddress(io.jans.scim.model.scim2.user.InstantMessagingAddress) UserBaseTest(io.jans.scim2.client.UserBaseTest) Test(org.testng.annotations.Test)

Aggregations

PatchOperation (io.jans.scim.model.scim2.patch.PatchOperation)1 PatchRequest (io.jans.scim.model.scim2.patch.PatchRequest)1 InstantMessagingAddress (io.jans.scim.model.scim2.user.InstantMessagingAddress)1 UserResource (io.jans.scim.model.scim2.user.UserResource)1 UserBaseTest (io.jans.scim2.client.UserBaseTest)1 Response (javax.ws.rs.core.Response)1 Test (org.testng.annotations.Test)1