use of org.eclipse.che.api.project.shared.dto.ItemReference in project che by eclipse.
the class ProjectServiceLinksInjectorTest method verifyFolderLinks.
@Test
public void verifyFolderLinks() throws Exception {
ItemReference itemReference = DtoFactory.newDto(ItemReference.class);
itemReference.withPath(FOLDER_PATH);
ItemReference result = projectServiceLinksInjector.injectFolderLinks(itemReference, serviceContext);
assertEquals(3, result.getLinks().size());
Link getChildrenLink = result.getLink("children");
assertNotNull(getChildrenLink);
assertEquals("localhost:8080/project/children/project1/folder", getChildrenLink.getHref());
assertEquals(HttpMethod.GET, getChildrenLink.getMethod());
assertEquals(LINK_REL_CHILDREN, getChildrenLink.getRel());
assertEquals(APPLICATION_JSON, getChildrenLink.getProduces());
Link getTreeLink = result.getLink("tree");
assertNotNull(getTreeLink);
assertEquals("localhost:8080/project/tree/project1/folder", getTreeLink.getHref());
assertEquals(HttpMethod.GET, getTreeLink.getMethod());
assertEquals(LINK_REL_TREE, getTreeLink.getRel());
assertEquals(APPLICATION_JSON, getTreeLink.getProduces());
Link deleteLink = result.getLink("delete");
assertNotNull(deleteLink);
assertEquals("localhost:8080/project/project1/folder", deleteLink.getHref());
assertEquals(HttpMethod.DELETE, deleteLink.getMethod());
assertEquals(LINK_REL_DELETE, deleteLink.getRel());
}
Aggregations