Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.Path.segment()


    IPath path = new Path(uri.getPath());
    // /gitapi/config/[{key}/]clone/file/{id}
    assertTrue(path.segmentCount() > 4);
    assertEquals(GitServlet.GIT_URI.substring(1), path.segment(0));
    assertEquals(ConfigOption.RESOURCE, path.segment(1));
    assertTrue(Clone.RESOURCE.equals(path.segment(2)) || Clone.RESOURCE.equals(path.segment(3)));
    if (Clone.RESOURCE.equals(path.segment(2)))
      assertTrue("file".equals(path.segment(3)));
    else
      assertTrue("file".equals(path.segment(4)));
  }
View Full Code Here


    // /gitapi/config/[{key}/]clone/file/{id}
    assertTrue(path.segmentCount() > 4);
    assertEquals(GitServlet.GIT_URI.substring(1), path.segment(0));
    assertEquals(ConfigOption.RESOURCE, path.segment(1));
    assertTrue(Clone.RESOURCE.equals(path.segment(2)) || Clone.RESOURCE.equals(path.segment(3)));
    if (Clone.RESOURCE.equals(path.segment(2)))
      assertTrue("file".equals(path.segment(3)));
    else
      assertTrue("file".equals(path.segment(4)));
  }
View Full Code Here

    assertTrue(path.segmentCount() > 4);
    assertEquals(GitServlet.GIT_URI.substring(1), path.segment(0));
    assertEquals(ConfigOption.RESOURCE, path.segment(1));
    assertTrue(Clone.RESOURCE.equals(path.segment(2)) || Clone.RESOURCE.equals(path.segment(3)));
    if (Clone.RESOURCE.equals(path.segment(2)))
      assertTrue("file".equals(path.segment(3)));
    else
      assertTrue("file".equals(path.segment(4)));
  }

  protected static void assertGitSectionExists(JSONObject json) {
View Full Code Here

    assertEquals(ConfigOption.RESOURCE, path.segment(1));
    assertTrue(Clone.RESOURCE.equals(path.segment(2)) || Clone.RESOURCE.equals(path.segment(3)));
    if (Clone.RESOURCE.equals(path.segment(2)))
      assertTrue("file".equals(path.segment(3)));
    else
      assertTrue("file".equals(path.segment(4)));
  }

  protected static void assertGitSectionExists(JSONObject json) {
    JSONObject gitSection = json.optJSONObject(GitConstants.KEY_GIT);
    assertNotNull(gitSection);
View Full Code Here

    return clones.getJSONArray(ProtocolConstants.KEY_CHILDREN);
  }

  protected String workspaceIdFromLocation(URI workspaceLocationURI) {
    IPath path = new Path(workspaceLocationURI.getPath());
    return path.segment(path.segmentCount() - 1);
  }

  /**
   * Helper method to create two test projects for Git clone tests. One
   * project will have the clone location at the root, and the other project
View Full Code Here

    JSONObject project = new JSONObject(response.getText());
    assertEquals(projectName, project.getString(ProtocolConstants.KEY_NAME));
    String projectId = project.optString(ProtocolConstants.KEY_ID, null);
    assertNotNull(projectId);
    IPath workspacePath = new Path(workspaceLocationURI.getPath());
    String workspaceId = workspacePath.segment(workspacePath.segmentCount() - 1);
    testProjectBaseLocation = "/" + workspaceId + '/' + projectName;
    testProjectLocalFileLocation = "/" + project.optString(ProtocolConstants.KEY_ID, null);
    return project;
  }
View Full Code Here

  protected static Repository getRepositoryForContentLocation(String fileLocation) throws CoreException, IOException {
    assertFileUri(fileLocation);

    URI uri = URI.create(fileLocation);
    IPath path = new Path(uri.getPath());
    while (path.segmentCount() != 0 && !path.segment(0).equals("file")) {
      path = path.removeFirstSegments(1);
    }

    //path format is /file/{workspaceId}/{projectName}[/path]
    final IMetaStore metaStore = OrionConfiguration.getMetaStore();
View Full Code Here

      path = path.removeFirstSegments(1);
    }

    //path format is /file/{workspaceId}/{projectName}[/path]
    final IMetaStore metaStore = OrionConfiguration.getMetaStore();
    WorkspaceInfo workspace = metaStore.readWorkspace(path.segment(1));
    assertNotNull(workspace);
    ProjectInfo wp = metaStore.readProject(workspace.getUniqueId(), path.segment(2));
    assertNotNull(wp);
    String userId = workspace.getUserId();
    assertNotNull(userId);
View Full Code Here

    //path format is /file/{workspaceId}/{projectName}[/path]
    final IMetaStore metaStore = OrionConfiguration.getMetaStore();
    WorkspaceInfo workspace = metaStore.readWorkspace(path.segment(1));
    assertNotNull(workspace);
    ProjectInfo wp = metaStore.readProject(workspace.getUniqueId(), path.segment(2));
    assertNotNull(wp);
    String userId = workspace.getUserId();
    assertNotNull(userId);
    IFileStore fsStore = getProjectStore(wp, userId);
    fsStore = fsStore.getFileStore(path.removeFirstSegments(3));
View Full Code Here

  private static void assertRemoteUri(String remoteUri) {
    URI uri = URI.create(toRelativeURI(remoteUri));
    IPath path = new Path(uri.getPath());
    // /git/remote/file/{path}
    assertTrue(path.segmentCount() > 3);
    assertEquals(GitServlet.GIT_URI.substring(1), path.segment(0));
    assertEquals(Remote.RESOURCE, path.segment(1));
    assertEquals("file", path.segment(2));
  }

  protected static void assertCommitUri(String commitUri) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.