當前位置: 首頁>>代碼示例>>Java>>正文


Java URIish.getScheme方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.transport.URIish.getScheme方法的典型用法代碼示例。如果您正苦於以下問題:Java URIish.getScheme方法的具體用法?Java URIish.getScheme怎麽用?Java URIish.getScheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.transport.URIish的用法示例。


在下文中一共展示了URIish.getScheme方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSshUri

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
protected static boolean isSshUri(Object uri) {
	if(uri != null) {
		try {
			URIish urIish = new URIish(uri.toString());
			String scheme = urIish.getScheme();
			if(scheme == null && hasText(urIish.getHost()) && hasText(urIish.getUser())) {
				//JGit returns null if using SCP URI but user and host will be populated
				return true;
			}
			return scheme != null && !scheme.matches("^(http|https)$");

		} catch (URISyntaxException e) {
			return false;
		}
	}
	return false;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-config,代碼行數:18,代碼來源:SshPropertyValidator.java

示例2: format

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private static String format(URIish uri) {
    StringBuilder r = new StringBuilder();

    if (uri.getScheme() != null) r.append(uri.getScheme()).append("://");

    if (uri.getHost() != null) {
        r.append(uri.getHost());
        if (uri.getScheme() != null && uri.getPort() > 0) r.append(':').append(uri.getPort());
    }

    if (uri.getPath() != null) {
        if (uri.getScheme() != null) {
            if (!uri.getPath().startsWith("/") && !uri.getPath().isEmpty()) r.append('/');
        } else if(uri.getHost() != null) r.append(':');

        if (uri.getScheme() != null) r.append(uri.getRawPath());
        else r.append(uri.getPath());
    }

    return r.toString();
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:22,代碼來源:GitRepository.java

示例3: isSSH

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private static boolean isSSH(URIish uri) {
  String scheme = uri.getScheme();
  if (!uri.isRemote()) {
    return false;
  }
  if (scheme != null && scheme.toLowerCase().contains("ssh")) {
    return true;
  }
  if (scheme == null && uri.getHost() != null && uri.getPath() != null) {
    return true;
  }
  return false;
}
 
開發者ID:GerritCodeReview,項目名稱:plugins_replication,代碼行數:14,代碼來源:ReplicationQueue.java

示例4: testToHTTPMirrorSuccess

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
@Test
public void testToHTTPMirrorSuccess() throws IOException, GitAPIException {
    final File parentFolder = createTempDirectory();
    final File directory = new File(parentFolder,
                                    TARGET_GIT);
    new Clone(directory,
              ORIGIN,
              true,
              CredentialsProvider.getDefault(),
              null).execute();

    final Git cloned = Git.open(directory);

    assertThat(cloned).isNotNull();

    assertThat(cloned.getRepository().getAllRefs()).is(new Condition<Map<String, Ref>>() {
        @Override
        public boolean matches(final Map<String, Ref> refs) {
            final boolean hasMasterRef = refs.get("refs/heads/master") != null;
            final boolean hasPullRequestRef = refs.get("refs/pull/1/head") != null;

            return hasMasterRef && hasPullRequestRef;
        }
    });

    final boolean isMirror = cloned.getRepository().getConfig().getBoolean("remote",
                                                                           "origin",
                                                                           "mirror",
                                                                           false);
    assertTrue(isMirror);

    URIish remoteUri = cloned.remoteList().call().get(0).getURIs().get(0);
    String remoteUrl = remoteUri.getScheme() + "://" + remoteUri.getHost() + remoteUri.getPath();
    assertThat(remoteUrl).isEqualTo(ORIGIN);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:36,代碼來源:JGitMirrorTest.java

示例5: testToHTTPUnmirrorSuccess

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
@Test
public void testToHTTPUnmirrorSuccess() throws IOException, GitAPIException {
    final File parentFolder = createTempDirectory();
    final File directory = new File(parentFolder,
                                    TARGET_GIT);
    new Clone(directory,
              ORIGIN,
              false,
              CredentialsProvider.getDefault(),
              null).execute();

    final Git cloned = Git.open(directory);

    assertThat(cloned).isNotNull();

    assertThat(cloned.getRepository().getAllRefs()).is(new Condition<Map<String, Ref>>() {
        @Override
        public boolean matches(final Map<String, Ref> refs) {
            final boolean hasMasterRef = refs.get("refs/heads/master") != null;
            final boolean hasPullRequestRef = refs.get("refs/pull/1/head") != null;

            return hasMasterRef && !hasPullRequestRef;
        }
    });

    final boolean isMirror = cloned.getRepository().getConfig().getBoolean("remote",
                                                                           "origin",
                                                                           "mirror",
                                                                           false);
    assertFalse(isMirror);

    assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo("refs/heads/master");

    URIish remoteUri = cloned.remoteList().call().get(0).getURIs().get(0);
    String remoteUrl = remoteUri.getScheme() + "://" + remoteUri.getHost() + remoteUri.getPath();
    assertThat(remoteUrl).isEqualTo(ORIGIN);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:38,代碼來源:JGitMirrorTest.java

示例6: testEmptyCredentials

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
@Test
public void testEmptyCredentials() throws IOException, GitAPIException {
    final File parentFolder = createTempDirectory();
    final File directory = new File(parentFolder,
                                    TARGET_GIT);
    new Clone(directory,
              ORIGIN,
              false,
              null,
              null).execute();

    final Git cloned = Git.open(directory);

    assertThat(cloned).isNotNull();

    assertThat(new ListRefs(cloned.getRepository()).execute()).is(new Condition<List<Ref>>() {
        @Override
        public boolean matches(final List<Ref> refs) {
            return refs.size() > 0;
        }
    });

    assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo("refs/heads/master");

    URIish remoteUri = cloned.remoteList().call().get(0).getURIs().get(0);
    String remoteUrl = remoteUri.getScheme() + "://" + remoteUri.getHost() + remoteUri.getPath();
    assertThat(remoteUrl).isEqualTo(ORIGIN);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:29,代碼來源:JGitMirrorTest.java

示例7: isGerrit

import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private static boolean isGerrit(URIish uri) {
  String scheme = uri.getScheme();
  return scheme != null && scheme.toLowerCase().equals("gerrit+ssh");
}
 
開發者ID:GerritCodeReview,項目名稱:plugins_replication,代碼行數:5,代碼來源:ReplicationQueue.java


注:本文中的org.eclipse.jgit.transport.URIish.getScheme方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。