use of org.olat.restapi.support.vo.FileVO in project OpenOLAT by OpenOLAT.
the class VFSWebservice method createFileVO.
public static FileVO createFileVO(VFSItem item, UriInfo uriInfo) {
UriBuilder builder = uriInfo.getAbsolutePathBuilder();
String uri = builder.path(normalize(item.getName())).build().toString();
FileVO link = new FileVO("self", uri, item.getName());
if (item instanceof VFSLeaf) {
link.setSize(((VFSLeaf) item).getSize());
}
return link;
}
use of org.olat.restapi.support.vo.FileVO in project OpenOLAT by OpenOLAT.
the class UserMgmtTest method testUserGroupFolder.
@Test
public void testUserGroupFolder() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login(id1.getName(), "A6B7C8"));
URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id1.getKey().toString()).path("folders").path("group").path(g2.getKey().toString()).build();
HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
InputStream body = response.getEntity().getContent();
List<FileVO> folders = parseFileArray(body);
assertNotNull(folders);
assertFalse(folders.isEmpty());
// private and public
assertEquals(1, folders.size());
FileVO portrait = folders.get(0);
assertEquals("portrait.jpg", portrait.getTitle());
conn.shutdown();
}
use of org.olat.restapi.support.vo.FileVO in project OpenOLAT by OpenOLAT.
the class UserMgmtTest method testOtherUserPersonalFolderOfId3.
@Test
public void testOtherUserPersonalFolderOfId3() throws Exception {
RestConnection conn = new RestConnection();
assertTrue(conn.login(id1.getName(), "A6B7C8"));
URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id3.getKey().toString()).path("folders").path("personal").build();
HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
InputStream body = response.getEntity().getContent();
List<FileVO> files = parseFileArray(body);
assertNotNull(files);
assertFalse(files.isEmpty());
// private and public
assertEquals(1, files.size());
FileVO portrait = files.get(0);
assertEquals("portrait.jpg", portrait.getTitle());
conn.shutdown();
}
use of org.olat.restapi.support.vo.FileVO in project OpenOLAT by OpenOLAT.
the class UserMgmtTest method testUserPersonalFolder.
@Test
public void testUserPersonalFolder() throws Exception {
RestConnection conn = new RestConnection();
assertTrue(conn.login(id1.getName(), "A6B7C8"));
URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id1.getKey().toString()).path("folders").path("personal").build();
HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
InputStream body = response.getEntity().getContent();
List<FileVO> files = parseFileArray(body);
assertNotNull(files);
assertFalse(files.isEmpty());
// private and public
assertEquals(2, files.size());
conn.shutdown();
}
use of org.olat.restapi.support.vo.FileVO in project OpenOLAT by OpenOLAT.
the class UserMgmtTest method testOtherUserPersonalFolder.
@Test
public void testOtherUserPersonalFolder() throws Exception {
RestConnection conn = new RestConnection();
assertTrue(conn.login(id1.getName(), "A6B7C8"));
URI uri = UriBuilder.fromUri(getContextURI()).path("users").path(id2.getKey().toString()).path("folders").path("personal").build();
HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
InputStream body = response.getEntity().getContent();
List<FileVO> files = parseFileArray(body);
assertNotNull(files);
assertTrue(files.isEmpty());
// private and public
assertEquals(0, files.size());
conn.shutdown();
}
Aggregations