Search in sources :

Example 1 with ExternalUserDTO

use of org.apache.openmeetings.db.dto.user.ExternalUserDTO in project openmeetings by apache.

the class TestUserService method getHash.

private static ServiceResult getHash(String sid, boolean expectError) {
    ExternalUserDTO user = new ExternalUserDTO().setExternalId("1").setExternalType(UNIT_TEST_EXT_TYPE).setEmail("user1@junit.openmeetings.apache.org").setFirstname("First Name 1").setLastname("Last Name 1").setLogin("login1");
    RoomOptionsDTO options = new RoomOptionsDTO().setRoomId(5L).setModerator(true);
    try (Response resp = getClient(getUserUrl()).path("/hash").query("sid", sid).form(new Form().param("user", user.toString()).param("options", options.toString()))) {
        assertNotNull("Valid ServiceResult should be returned", resp);
        if (expectError) {
            assertEquals("Call should NOT be successful", Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), resp.getStatus());
            return null;
        } else {
            assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
            return resp.readEntity(ServiceResult.class);
        }
    }
}
Also used : Response(javax.ws.rs.core.Response) RoomOptionsDTO(org.apache.openmeetings.db.dto.room.RoomOptionsDTO) Form(javax.ws.rs.core.Form) ExternalUserDTO(org.apache.openmeetings.db.dto.user.ExternalUserDTO)

Aggregations

Form (javax.ws.rs.core.Form)1 Response (javax.ws.rs.core.Response)1 RoomOptionsDTO (org.apache.openmeetings.db.dto.room.RoomOptionsDTO)1 ExternalUserDTO (org.apache.openmeetings.db.dto.user.ExternalUserDTO)1