Search in sources :

Example 6 with GroupVOes

use of org.olat.restapi.support.vo.GroupVOes in project OpenOLAT by OpenOLAT.

the class UserMgmtTest method testUserGroupWithPaging.

@Test
public void testUserGroupWithPaging() throws IOException, URISyntaxException {
    RestConnection conn = new RestConnection();
    assertTrue(conn.login("administrator", "openolat"));
    // retrieve all groups
    URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id1.getKey().toString()).path("groups").queryParam("start", 0).queryParam("limit", 1).build();
    HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON + ";pagingspec=1.0", true);
    HttpResponse response = conn.execute(method);
    assertEquals(200, response.getStatusLine().getStatusCode());
    GroupVOes groups = conn.parse(response, GroupVOes.class);
    assertNotNull(groups);
    assertNotNull(groups.getGroups());
    assertEquals(1, groups.getGroups().length);
    // g1, g2 and g3
    assertEquals(3, groups.getTotalCount());
    conn.shutdown();
}
Also used : HttpGet(org.apache.http.client.methods.HttpGet) GroupVOes(org.olat.restapi.support.vo.GroupVOes) HttpResponse(org.apache.http.HttpResponse) URI(java.net.URI) Test(org.junit.Test)

Example 7 with GroupVOes

use of org.olat.restapi.support.vo.GroupVOes in project OpenOLAT by OpenOLAT.

the class UserMgmtTest method testUserGroup_participant.

@Test
public void testUserGroup_participant() throws IOException, URISyntaxException {
    RestConnection conn = new RestConnection();
    assertTrue(conn.login("administrator", "openolat"));
    // retrieve all groups
    URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id1.getKey().toString()).path("groups").path("participant").queryParam("start", 0).queryParam("limit", 1).build();
    HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON + ";pagingspec=1.0", true);
    HttpResponse response = conn.execute(method);
    assertEquals(200, response.getStatusLine().getStatusCode());
    GroupVOes groups = conn.parse(response, GroupVOes.class);
    assertNotNull(groups);
    assertNotNull(groups.getGroups());
    assertEquals(1, groups.getGroups().length);
    // g2 and g3
    assertEquals(2, groups.getTotalCount());
    conn.shutdown();
}
Also used : HttpGet(org.apache.http.client.methods.HttpGet) GroupVOes(org.olat.restapi.support.vo.GroupVOes) HttpResponse(org.apache.http.HttpResponse) URI(java.net.URI) Test(org.junit.Test)

Example 8 with GroupVOes

use of org.olat.restapi.support.vo.GroupVOes in project openolat by klemens.

the class UserMgmtTest method testUserGroupWithPaging.

@Test
public void testUserGroupWithPaging() throws IOException, URISyntaxException {
    RestConnection conn = new RestConnection();
    assertTrue(conn.login("administrator", "openolat"));
    // retrieve all groups
    URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id1.getKey().toString()).path("groups").queryParam("start", 0).queryParam("limit", 1).build();
    HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON + ";pagingspec=1.0", true);
    HttpResponse response = conn.execute(method);
    assertEquals(200, response.getStatusLine().getStatusCode());
    GroupVOes groups = conn.parse(response, GroupVOes.class);
    assertNotNull(groups);
    assertNotNull(groups.getGroups());
    assertEquals(1, groups.getGroups().length);
    // g1, g2 and g3
    assertEquals(3, groups.getTotalCount());
    conn.shutdown();
}
Also used : HttpGet(org.apache.http.client.methods.HttpGet) GroupVOes(org.olat.restapi.support.vo.GroupVOes) HttpResponse(org.apache.http.HttpResponse) URI(java.net.URI) Test(org.junit.Test)

Aggregations

GroupVOes (org.olat.restapi.support.vo.GroupVOes)8 URI (java.net.URI)6 HttpResponse (org.apache.http.HttpResponse)6 HttpGet (org.apache.http.client.methods.HttpGet)6 Test (org.junit.Test)6 BusinessGroup (org.olat.group.BusinessGroup)2 BusinessGroupService (org.olat.group.BusinessGroupService)2 SearchBusinessGroupParams (org.olat.group.model.SearchBusinessGroupParams)2 GroupVO (org.olat.restapi.support.vo.GroupVO)2