Search in sources :

Example 11 with ServiceResult

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

the class TestGroupService method list.

@Test
public void list() {
    ServiceResult r = login();
    Collection<? extends GroupDTO> groups = getClient(getGroupUrl()).path("/").query("sid", r.getMessage()).getCollection(GroupDTO.class);
    assertNotNull("Collection should be not null", groups);
    assertFalse("Collection should be not empty", groups.isEmpty());
}
Also used : ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Test(org.junit.Test)

Example 12 with ServiceResult

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

the class TestGroupService method putTest.

@Test
public void putTest() {
    ServiceResult r = login();
    Response resp = getClient(getGroupUrl()).path("/").query("sid", r.getMessage()).put("");
    assertEquals("Call should NOT be successful", Response.Status.METHOD_NOT_ALLOWED.getStatusCode(), resp.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Test(org.junit.Test)

Example 13 with ServiceResult

use of org.apache.openmeetings.db.dto.basic.ServiceResult 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 14 with ServiceResult

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

the class TestRoomService method testHash.

@Test
public void testHash() {
    List<Room> rooms = getBean(RoomDao.class).get(0, 100);
    assertFalse("Room list should not be empty", rooms.isEmpty());
    ServiceResult sr = login();
    ServiceResult res = getClient(getRoomUrl()).path("/hash").query("sid", sr.getMessage()).query("invite", new InvitationDTO().setFirstname("Mark").setLastname("Steven").setEmail("abc@gmail.com").setPassword("Sys@123!").setPasswordProtected(true).setSubject("Health Meeting").setRoomId(rooms.get(0).getId()).setMessage("Meeting").setValid(Valid.Period).setValidFrom("2018-03-19 02:25:12").setValidTo("2018-04-20 02:25:12").toString()).post("", ServiceResult.class);
    assertEquals("Login should be successful", Type.SUCCESS.name(), res.getType());
}
Also used : RoomDao(org.apache.openmeetings.db.dao.room.RoomDao) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) InvitationDTO(org.apache.openmeetings.db.dto.room.InvitationDTO) Room(org.apache.openmeetings.db.entity.room.Room) Test(org.junit.Test)

Example 15 with ServiceResult

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

the class TestUserService method addUserTest.

@Test
public void addUserTest() {
    String[] tzList = TimeZone.getAvailableIDs();
    String tz = TimeZone.getTimeZone(tzList[rnd.nextInt(tzList.length)]).getID();
    ServiceResult r = login();
    UserDTO u = new UserDTO();
    String uuid = UUID.randomUUID().toString();
    u.setLogin("test" + uuid);
    u.setPassword(createPass());
    u.setFirstname("testF" + uuid);
    u.setLastname("testL" + uuid);
    u.setAddress(new Address());
    u.getAddress().setEmail(uuid + "@local");
    u.getAddress().setCountry(Locale.getDefault().getCountry());
    u.setTimeZoneId(tz);
    u.setExternalId(uuid);
    u.setExternalType(UNIT_TEST_EXT_TYPE);
    UserDTO user = getClient(getUserUrl()).path("/").query("sid", r.getMessage()).type(APPLICATION_FORM_URLENCODED).post(new Form().param("user", u.toString()).param("confirm", "" + false), UserDTO.class);
    assertNotNull("Valid UserDTO should be returned", user);
    assertNotNull("Id should not be NULL", user.getId());
    assertEquals("OM Call should be successful", u.getLogin(), user.getLogin());
    assertEquals("OM Call should be successful", tz, user.getTimeZoneId());
}
Also used : ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Address(org.apache.openmeetings.db.entity.user.Address) Form(javax.ws.rs.core.Form) UserDTO(org.apache.openmeetings.db.dto.user.UserDTO) ExternalUserDTO(org.apache.openmeetings.db.dto.user.ExternalUserDTO) 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