Search in sources :

Example 6 with RoomDTO

use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.

the class TestRoomService method testExternal.

@Test
public void testExternal() {
    ServiceResult sr = login();
    String extId = UUID.randomUUID().toString();
    Room.Type type = Room.Type.presentation;
    String name = "Unit Test Ext Room";
    String comment = "Unit Test Ext Room Comments";
    RoomDTO r = new RoomDTO();
    r.setType(type);
    r.setName(name);
    r.setComment(comment);
    r.setCapacity(CAPACITY);
    RoomDTO room = getClient(getRoomUrl()).path(String.format("/%s/%s/%s", type, UNIT_TEST_EXT_TYPE, extId)).query("sid", sr.getMessage()).query("room", r.toString()).get(RoomDTO.class);
    assertNotNull("Valid room should be returned", room);
    assertNotNull("Room ID should be not empty", room.getId());
    RoomDTO room1 = getClient(getRoomUrl()).path(String.format("/%s/%s/%s", Room.Type.presentation, UNIT_TEST_EXT_TYPE, extId)).query("sid", sr.getMessage()).get(RoomDTO.class);
    assertNotNull("Valid room should be returned", room1);
    assertEquals("Same Room should be returned", room.getId(), room1.getId());
}
Also used : ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) RoomDTO(org.apache.openmeetings.db.dto.room.RoomDTO) Room(org.apache.openmeetings.db.entity.room.Room) Test(org.junit.Test)

Example 7 with RoomDTO

use of org.apache.openmeetings.db.dto.room.RoomDTO 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 8 with RoomDTO

use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.

the class TestRoomService method testCreateWithFiles2.

@Test
public void testCreateWithFiles2() throws IOException {
    // lets create real file
    CallResult<FileItemDTO> fileCall = createVerifiedFile(getDefaultProfilePicture(), "img.jpg", BaseFileItem.Type.Image);
    Room.Type type = Room.Type.presentation;
    String name = "Unit Test Ext Room4";
    String comment = "Unit Test Ext Room Comments4";
    RoomDTO r = new RoomDTO();
    r.setType(type);
    r.setName(name);
    r.setComment(comment);
    r.setCapacity(CAPACITY);
    RoomFileDTO rf = new RoomFileDTO();
    // not existent
    rf.setFileId(fileCall.getObj().getId());
    r.getFiles().add(rf);
    CallResult<RoomDTO> res = createAndValidate(fileCall.getSid(), r);
    assertFalse("Room files should NOT be empty", res.getObj().getFiles().isEmpty());
}
Also used : RoomDTO(org.apache.openmeetings.db.dto.room.RoomDTO) FileItemDTO(org.apache.openmeetings.db.dto.file.FileItemDTO) Room(org.apache.openmeetings.db.entity.room.Room) RoomFileDTO(org.apache.openmeetings.db.dto.room.RoomFileDTO) Test(org.junit.Test)

Example 9 with RoomDTO

use of org.apache.openmeetings.db.dto.room.RoomDTO in project openmeetings by apache.

the class TestRoomService method testCreateWithFiles1.

@Test
public void testCreateWithFiles1() {
    Room.Type type = Room.Type.presentation;
    String name = "Unit Test Ext Room3";
    String comment = "Unit Test Ext Room Comments3";
    RoomDTO r = new RoomDTO();
    r.setType(type);
    r.setName(name);
    r.setComment(comment);
    r.setCapacity(CAPACITY);
    RoomFileDTO rf = new RoomFileDTO();
    // not existent
    rf.setFileId(-666L);
    r.getFiles().add(rf);
    CallResult<RoomDTO> res = createAndValidate(r);
    assertTrue("No room files should be added", res.getObj().getFiles().isEmpty());
}
Also used : RoomDTO(org.apache.openmeetings.db.dto.room.RoomDTO) Room(org.apache.openmeetings.db.entity.room.Room) RoomFileDTO(org.apache.openmeetings.db.dto.room.RoomFileDTO) Test(org.junit.Test)

Aggregations

RoomDTO (org.apache.openmeetings.db.dto.room.RoomDTO)9 Room (org.apache.openmeetings.db.entity.room.Room)7 Test (org.junit.Test)6 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)3 WebMethod (javax.jws.WebMethod)2 Path (javax.ws.rs.Path)2 RoomFileDTO (org.apache.openmeetings.db.dto.room.RoomFileDTO)2 GET (javax.ws.rs.GET)1 POST (javax.ws.rs.POST)1 Form (javax.ws.rs.core.Form)1 Response (javax.ws.rs.core.Response)1 FileItemDTO (org.apache.openmeetings.db.dto.file.FileItemDTO)1