use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.
the class AbstractWebServiceTest method createAndValidate.
protected static CallResult<RoomDTO> createAndValidate(String sid, RoomDTO r) {
if (sid == null) {
ServiceResult sr = login();
sid = sr.getMessage();
}
RoomDTO room = getClient(getRoomUrl()).query("sid", sid).type(APPLICATION_FORM_URLENCODED).post(new Form().param("room", r.toString()), 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", room.getId())).query("sid", sid).get(RoomDTO.class);
assertNotNull("Valid room should be returned", room1);
assertEquals("Room with same ID should be returned", room.getId(), room1.getId());
assertEquals("Room with same Name should be returned", r.getName(), room1.getName());
assertEquals("Room with same ExternalType should be returned", r.getExternalType(), room1.getExternalType());
assertEquals("Room with same ExternalId should be returned", r.getExternalId(), room1.getExternalId());
// TODO check other fields
return new CallResult<>(sid, room1);
}
use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.
the class TestCalendarService method actualTest.
private void actualTest(Room r) throws Exception {
String uuid = UUID.randomUUID().toString();
User u = getUser(uuid);
u.getGroupUsers().add(new GroupUser(getBean(GroupDao.class).get(1L), u));
webCreateUser(u);
ServiceResult sr = login(u.getLogin(), createPass());
u = getBean(UserDao.class).get(u.getId());
Date start = new Date();
Appointment a = AbstractJUnitDefaults.createAppointment(getBean(AppointmentDao.class), getAppointment(u, r, start, new Date(start.getTime() + ONE_HOUR)));
AppointmentDTO app = getClient(getCalendarUrl()).path("/room/" + a.getRoom().getId()).query("sid", sr.getMessage()).get(AppointmentDTO.class);
assertNotNull("Valid DTO should be returned", app);
}
use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.
the class TestCalendarService method testCreateWithOmMm.
@Test
public void testCreateWithOmMm() throws Exception {
JSONObject o = createAppointment("test").put("meetingMembers", new JSONArray().put(new JSONObject().put("user", new JSONObject().put("id", 1))));
String uuid = UUID.randomUUID().toString();
User u = getUser(uuid);
u.getGroupUsers().add(new GroupUser(getBean(GroupDao.class).get(1L), u));
u = createUser(getBean(UserDao.class), u);
ServiceResult sr = login(u.getLogin(), createPass());
Response resp = getClient(getCalendarUrl()).path("/").query("sid", sr.getMessage()).form(new Form().param("appointment", o.toString()));
assertNotNull("Valid AppointmentDTO should be returned", resp);
assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
AppointmentDTO dto = resp.readEntity(AppointmentDTO.class);
assertNotNull("Valid DTO should be returned", dto);
assertNotNull("DTO id should be valid", dto.getId());
}
use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.
the class TestCalendarService method loginNewUser.
private String loginNewUser() throws Exception {
String uuid = UUID.randomUUID().toString();
User u = getUser(uuid);
u.getGroupUsers().add(new GroupUser(getBean(GroupDao.class).get(1L), u));
webCreateUser(u);
ServiceResult sr = login(u.getLogin(), createPass());
return sr.getMessage();
}
use of org.apache.openmeetings.db.dto.basic.ServiceResult in project openmeetings by apache.
the class TestErrorService method getTestBadKey.
@Test
public void getTestBadKey() {
Locale[] locales = Locale.getAvailableLocales();
ServiceResult sr = getClient(getErrorUrl()).path(String.format("/%s/%s", UUID.randomUUID().toString(), LabelDao.getLanguage(locales[rnd.nextInt(locales.length)], 1L))).get(ServiceResult.class);
assertNotNull("Valid Result should be returned", sr);
assertEquals("SUCCESS result should be returned", ServiceResult.Type.SUCCESS.name(), sr.getType());
}
Aggregations