Search in sources :

Example 16 with ServiceResult

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

the class TestUserService method loginTest.

@Test
public void loginTest() {
    ServiceResult r = login();
    assertNotNull("Valid ServiceResult should be returned", r);
}
Also used : ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Test(org.junit.Test)

Example 17 with ServiceResult

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

the class TestUserService method list.

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

Example 18 with ServiceResult

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

the class TestCalendarService method testDelete.

@Test
public void testDelete() {
    ServiceResult sr = login();
    Response resp = getClient(getCalendarUrl()).path(// non-existent ID
    "/" + Long.MAX_VALUE).query("sid", sr.getMessage()).delete();
    assertNotEquals("Call should NOT be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Test(org.junit.Test)

Example 19 with ServiceResult

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

the class TestErrorService method reportTest.

@Test
public void reportTest() {
    // null report
    Response resp = getClient(getErrorUrl()).path("/report").post("");
    assertNotNull("Not null Response should be returned", resp);
    assertEquals("SUCCESS result should be returned", Response.Status.NO_CONTENT.getStatusCode(), resp.getStatus());
    // report with message
    resp = getClient(getErrorUrl()).path("/report").query("message", "Dummy test").post("");
    assertNotNull("Not null Response should be returned", resp);
    assertEquals("SUCCESS result should be returned", Response.Status.NO_CONTENT.getStatusCode(), resp.getStatus());
    // report with invalid sid and message
    resp = getClient(getErrorUrl()).path("/report").query("message", "Dummy test").query("sid", "n/a").post("");
    assertNotNull("Not null Response should be returned", resp);
    assertEquals("SUCCESS result should be returned", Response.Status.NO_CONTENT.getStatusCode(), resp.getStatus());
    // report with valid sid and no message
    ServiceResult r = login();
    resp = getClient(getErrorUrl()).path("/report").query("sid", r.getMessage()).post("");
    assertNotNull("Not null Response should be returned", resp);
    assertEquals("SUCCESS result should be returned", Response.Status.NO_CONTENT.getStatusCode(), resp.getStatus());
    // report with valid sid and message
    resp = getClient(getErrorUrl()).path("/report").query("sid", r.getMessage()).query("message", "Dummy test").post("");
    assertNotNull("Not null Response should be returned", resp);
    assertEquals("SUCCESS result should be returned", Response.Status.NO_CONTENT.getStatusCode(), resp.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Test(org.junit.Test)

Example 20 with ServiceResult

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

the class TestErrorService method getTest.

@Test
public void getTest() {
    Locale[] locales = Locale.getAvailableLocales();
    ServiceResult sr = getClient(getErrorUrl()).path(String.format("/%s/%s", "error.unknown", 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());
}
Also used : Locale(java.util.Locale) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) 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