Search in sources :

Example 26 with ItemReference

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());
}
Also used : ItemReference(org.eclipse.che.api.project.shared.dto.ItemReference) Link(org.eclipse.che.api.core.rest.shared.dto.Link) Test(org.testng.annotations.Test)

Aggregations

ItemReference (org.eclipse.che.api.project.shared.dto.ItemReference)26 Test (org.testng.annotations.Test)22 ContainerResponse (org.everrest.core.impl.ContainerResponse)20 ArrayList (java.util.ArrayList)14 LinkedHashSet (java.util.LinkedHashSet)13 List (java.util.List)13 Collections.singletonList (java.util.Collections.singletonList)11 LinkedList (java.util.LinkedList)11 TreeElement (org.eclipse.che.api.project.shared.dto.TreeElement)4 Link (org.eclipse.che.api.core.rest.shared.dto.Link)2 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 Command (com.google.gwt.user.client.Command)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ConflictException (org.eclipse.che.api.core.ConflictException)1 NotFoundException (org.eclipse.che.api.core.NotFoundException)1 Function (org.eclipse.che.api.promises.client.Function)1