Examples of URIish


Examples of org.eclipse.jgit.transport.URIish

  }

  @Test
  public void testListRemote_BadName() throws IOException, URISyntaxException {
    Repository dst = createBareRepository();
    URIish uri = new URIish(this.remoteURI.toString() + ".invalid");
    Transport t = Transport.open(dst, uri);
    try {
      try {
        t.openFetch();
        fail("fetch connection opened");
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

    RemoteConfig rc = new RemoteConfig(config, remoteName);

    assertNotNull(rc);
    // main uri
    assertEquals(1, rc.getURIs().size());
    assertEquals(new URIish(remoteUri).toString(), rc.getURIs().get(0).toString());
    // fetchRefSpec
    assertEquals(1, rc.getFetchRefSpecs().size());
    assertEquals(new RefSpec(fetchRefSpec), rc.getFetchRefSpecs().get(0));
    // pushUri
    assertEquals(1, rc.getPushURIs().size());
    assertEquals(new URIish(pushUri).toString(), rc.getPushURIs().get(0).toString());
    // pushRefSpec
    assertEquals(1, rc.getPushRefSpecs().size());
    assertEquals(new RefSpec(pushRefSpec), rc.getPushRefSpecs().get(0));
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

    assertBranchUri(clone.getString(GitConstants.KEY_BRANCH));
    return clone;
  }

  protected JSONObject clone(IPath workspacePath, IPath filePath, String name) throws JSONException, IOException, SAXException, CoreException {
    URIish uri = new URIish(gitDir.toURI().toURL());
    return clone(uri, workspacePath, filePath, name, null, null);
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

    URIish uri = new URIish(gitDir.toURI().toURL());
    return clone(uri, workspacePath, filePath, name, null, null);
  }

  protected JSONObject clone(IPath clonePath) throws JSONException, IOException, SAXException, CoreException {
    URIish uri = new URIish(gitDir.toURI().toURL());
    return clone(uri, null, clonePath, null, null, null);
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

    Assume.assumeTrue(privateKey != null);
    Assume.assumeTrue(passphrase != null);

    createWorkspace(SimpleMetaStore.DEFAULT_WORKSPACE_NAME);
    String workspaceId = workspaceIdFromLocation(workspaceLocation);
    URIish uri = new URIish(sshRepo2);

    // clone1: create
    JSONObject project1 = createProjectOrLink(workspaceLocation, getMethodName().concat("Project1"), null);
    IPath clonePath = getClonePath(workspaceId, project1);
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

      assertEquals("secondary/branch", remoteBranchLocations.getJSONObject(0).getJSONArray(ProtocolConstants.KEY_CHILDREN).getJSONObject(0).getString(ProtocolConstants.KEY_NAME));

      // clone the secondary branch and check if the new branch is there
      JSONObject secondProject = createProjectOrLink(workspaceLocation, getMethodName().concat("-second-").concat(Integer.toString(i)), null);
      IPath secondClonePath = getClonePath(workspaceId, secondProject);
      URIish uri = new URIish(dotGitDir.getParentFile().toURI().toURL());
      JSONObject clone2 = clone(uri, null, secondClonePath, null, null, null);
      String cloneLocation2 = clone2.getString(ProtocolConstants.KEY_LOCATION);
      String branchesLocation2 = clone2.getString(GitConstants.KEY_BRANCH);

      String remotesLocation2 = clone2.getString(GitConstants.KEY_REMOTE);
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST,
          "Remote URI must be provided", null));
    }

    try {
      URIish uri = new URIish(remoteURI);
      if (GitUtils.isForbiddenGitUri(uri)) {
        statusHandler.handleRequest(
            request,
            response,
            new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, NLS.bind(
                "Remote URI {0} does not appear to be a git repository", remoteURI), null)); //$NON-NLS-1$
        return false;
      }
    } catch (URISyntaxException e) {
      statusHandler.handleRequest(request, response,
          new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, NLS.bind("Invalid remote URI: {0}", remoteURI), e)); //$NON-NLS-1$
      return false;
    }

    String fetchRefSpec = toPut.optString(GitConstants.KEY_REMOTE_FETCH_REF, null);
    String remotePushURI = toPut.optString(GitConstants.KEY_REMOTE_PUSH_URI, null);
    String pushRefSpec = toPut.optString(GitConstants.KEY_REMOTE_PUSH_REF, null);

    File gitDir = GitUtils.getGitDir(p);
    URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.REMOTE_LIST);
    Repository db = null;
    try {
      db = FileRepositoryBuilder.create(gitDir);
      StoredConfig config = db.getConfig();

      RemoteConfig rc = new RemoteConfig(config, remoteName);
      rc.addURI(new URIish(remoteURI));
      // FetchRefSpec is required, but default version can be generated
      // if it isn't provided
      if (fetchRefSpec == null || fetchRefSpec.isEmpty()) {
        fetchRefSpec = String.format("+refs/heads/*:refs/remotes/%s/*", remoteName); //$NON-NLS-1$
      }
      rc.addFetchRefSpec(new RefSpec(fetchRefSpec));
      // pushURI is optional
      if (remotePushURI != null && !remotePushURI.isEmpty())
        rc.addPushURI(new URIish(remotePushURI));
      // PushRefSpec is optional
      if (pushRefSpec != null && !pushRefSpec.isEmpty())
        rc.addPushRefSpec(new RefSpec(pushRefSpec));

      rc.update(config);
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

    String cloneName = getMethodName();
    JSONObject cloneOne = clone(clonePath, null, cloneName);
    assertEquals(cloneName, cloneOne.get("Name"));

    //now try to clone again with the same clone name
    URIish uri = new URIish(gitDir.toURI().toURL());
    WebRequest request = getPostGitCloneRequest(uri, clonePath, null, cloneName, null, null);
    WebResponse response = webConversation.getResponse(request);
    ServerStatus status = waitForTask(response);
    assertTrue(status.toString(), status.isOK());
    String cloneLocation = status.getJsonData().getString(ProtocolConstants.KEY_LOCATION);
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

  public void testCloneOverSshWithNoKnownHosts() throws Exception {
    Assume.assumeTrue(sshRepo != null);

    createWorkspace(SimpleMetaStore.DEFAULT_WORKSPACE_NAME);
    IPath workspacePath = new Path("workspace").append(getWorkspaceId(workspaceLocation)).makeAbsolute();
    URIish uri = new URIish(sshRepo);
    WebRequest request = new PostGitCloneRequest().setURIish(uri).setWorkspacePath(workspacePath).setName(getMethodName()).getWebRequest();

    // cloning
    WebResponse response = webConversation.getResponse(request);
    ServerStatus status = waitForTask(response);
View Full Code Here

Examples of org.eclipse.jgit.transport.URIish

    Assume.assumeTrue(sshRepo != null);
    Assume.assumeTrue(knownHosts != null);

    createWorkspace(SimpleMetaStore.DEFAULT_WORKSPACE_NAME);
    IPath workspacePath = new Path("workspace").append(getWorkspaceId(workspaceLocation)).makeAbsolute();
    URIish uri = new URIish(sshRepo);
    WebRequest request = new PostGitCloneRequest().setURIish(uri).setWorkspacePath(workspacePath).setName(getMethodName()).setKnownHosts(knownHosts).getWebRequest();

    // cloning
    WebResponse response = webConversation.getResponse(request);
    ServerStatus status = waitForTask(response);
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.