Search in sources :

Example 21 with ServiceResult

use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.

the class TestFileService method testGetRoom.

@Test
public void testGetRoom() {
    ServiceResult r = login();
    FileExplorerObject fo = getClient(getFileUrl()).path("/room/5").query("sid", r.getMessage()).get(FileExplorerObject.class);
    assertNotNull(fo);
}
Also used : ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) FileExplorerObject(org.apache.openmeetings.db.dto.file.FileExplorerObject) Test(org.junit.Test)

Example 22 with ServiceResult

use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.

the class TestGroupService method addRoomTest.

@Test
public void addRoomTest() {
    // create new group
    ServiceResult sr = login();
    Long groupId = createGroup(sr.getMessage(), "Group WS");
    RoomDTO rdto = new RoomDTO();
    rdto.setName("Group WS Room");
    CallResult<RoomDTO> room = createAndValidate(sr.getMessage(), rdto);
    Response resp = getClient(getGroupUrl()).path(String.format("/%s/rooms/add/%s", groupId, room.getObj().getId())).query("sid", sr.getMessage()).query("name", "Test Group").post("");
    assertNotNull("Valid ServiceResult should be returned", resp);
    assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
    ServiceResult sr1 = resp.readEntity(ServiceResult.class);
    assertEquals("OM Call should be successful", sr1.getType(), Type.SUCCESS.name());
}
Also used : Response(javax.ws.rs.core.Response) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) RoomDTO(org.apache.openmeetings.db.dto.room.RoomDTO) Test(org.junit.Test)

Example 23 with ServiceResult

use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.

the class TestGroupService method addRemoveTest.

@Test
public void addRemoveTest() {
    ServiceResult r = login();
    Long groupId = createGroup(r.getMessage(), "Test Group");
    // delete group created
    {
        Response resp = getClient(getGroupUrl()).path("/" + groupId).query("sid", r.getMessage()).delete();
        assertNotNull("Valid ServiceResult should be returned", resp);
        assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
        ServiceResult r1 = resp.readEntity(ServiceResult.class);
        assertEquals("OM Call should be successful", r1.getType(), Type.SUCCESS.name());
    }
}
Also used : Response(javax.ws.rs.core.Response) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Test(org.junit.Test)

Example 24 with ServiceResult

use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.

the class TestGroupService method createGroup.

private static Long createGroup(String sid, String name) {
    Response resp = getClient(getGroupUrl()).path("/").query("sid", sid).query("name", name).post("");
    assertNotNull("Valid ServiceResult should be returned", resp);
    assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
    ServiceResult r1 = resp.readEntity(ServiceResult.class);
    assertEquals("OM Call should be successful", r1.getType(), Type.SUCCESS.name());
    return Long.valueOf(r1.getMessage());
}
Also used : Response(javax.ws.rs.core.Response) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult)

Example 25 with ServiceResult

use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.

the class TestRecordingService method testExternal.

@Test
public void testExternal() throws Exception {
    User u = getExternalUser();
    Recording r = new Recording();
    r.setInsertedBy(u.getId());
    r.setComment("Created by Unit Tests");
    r.setRoomId(5L);
    r = getBean(RecordingDao.class).update(r);
    ServiceResult sr = login();
    Collection<? extends RecordingDTO> recs = getClient(getRecordUrl()).path("/" + UNIT_TEST_EXT_TYPE).query("sid", sr.getMessage()).getCollection(RecordingDTO.class);
    assertNotNull("Valid collection should be returned", recs);
    assertFalse("Collection of the recordings should not be empty", recs.isEmpty());
    boolean found = false;
    for (RecordingDTO rdo : recs) {
        if (r.getId().equals(rdo.getId())) {
            // TODO check room, user
            found = true;
            break;
        }
    }
    assertTrue("Just created recording was not found by the service", found);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) AbstractJUnitDefaults.getUser(org.apache.openmeetings.AbstractJUnitDefaults.getUser) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) RecordingDTO(org.apache.openmeetings.db.dto.record.RecordingDTO) Recording(org.apache.openmeetings.db.entity.record.Recording) Test(org.junit.Test)

Aggregations

ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)37 Test (org.junit.Test)18 Path (javax.ws.rs.Path)12 User (org.apache.openmeetings.db.entity.user.User)8 Response (javax.ws.rs.core.Response)7 WebMethod (javax.jws.WebMethod)5 POST (javax.ws.rs.POST)5 Room (org.apache.openmeetings.db.entity.room.Room)5 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)5 DELETE (javax.ws.rs.DELETE)4 Form (javax.ws.rs.core.Form)4 AbstractJUnitDefaults.getUser (org.apache.openmeetings.AbstractJUnitDefaults.getUser)4 GET (javax.ws.rs.GET)3 AbstractJUnitDefaults.createUser (org.apache.openmeetings.AbstractJUnitDefaults.createUser)3 GroupDao (org.apache.openmeetings.db.dao.user.GroupDao)3 RoomDTO (org.apache.openmeetings.db.dto.room.RoomDTO)3 Locale (java.util.Locale)2 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)2 UserDTO (org.apache.openmeetings.db.dto.user.UserDTO)2 FileItem (org.apache.openmeetings.db.entity.file.FileItem)2