当前位置: 首页>>代码示例>>Java>>正文


Java InputPath类代码示例

本文整理汇总了Java中org.sonar.api.batch.fs.InputPath的典型用法代码示例。如果您正苦于以下问题:Java InputPath类的具体用法?Java InputPath怎么用?Java InputPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InputPath类属于org.sonar.api.batch.fs包,在下文中一共展示了InputPath类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetGithubUrl

import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
@Test
public void testGetGithubUrl() throws Exception {

  File gitBasedir = temp.newFolder();

  PullRequestFacade facade = new PullRequestFacade(mock(GitHubPluginConfiguration.class));
  facade.setGitBaseDir(gitBasedir);
  GHRepository ghRepo = mock(GHRepository.class);
  when(ghRepo.getHtmlUrl()).thenReturn(new URL("https://github.com/SonarSource/sonar-java"));
  facade.setGhRepo(ghRepo);
  GHPullRequest pr = mock(GHPullRequest.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS));
  when(pr.getHead().getSha()).thenReturn("abc123");
  facade.setPr(pr);
  InputPath inputPath = mock(InputPath.class);
  when(inputPath.file()).thenReturn(new File(gitBasedir, "src/main/with space/Foo.java"));
  assertThat(facade.getGithubUrl(inputPath, 10).toString()).isEqualTo("https://github.com/SonarSource/sonar-java/blob/abc123/src/main/with%20space/Foo.java#L10");
}
 
开发者ID:SonarSource,项目名称:sonar-github,代码行数:18,代码来源:PullRequestFacadeTest.java

示例2: getGitLabUrl

import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
@CheckForNull
public String getGitLabUrl(@Nullable String revision, @Nullable InputComponent inputComponent, @Nullable Integer issueLine) {
    if (inputComponent instanceof InputPath) {
        String path = getPath((InputPath) inputComponent);
        return gitLabWrapper.getGitLabUrl(revision, path, issueLine);
    }
    return null;
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:9,代码来源:CommitFacade.java

示例3: getSrc

import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
@CheckForNull
public String getSrc(@Nullable InputComponent inputComponent) {
    if (inputComponent instanceof InputPath) {
        return getPath((InputPath) inputComponent);
    }
    return null;
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:8,代码来源:CommitFacade.java

示例4: getGithubUrl

import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
@CheckForNull
public URL getGithubUrl(@Nullable InputComponent inputComponent, @Nullable Integer issueLine) {
  if (inputComponent instanceof InputPath) {
    String path = getPath((InputPath) inputComponent);
    URL url1 = ghRepo.getHtmlUrl();
    try {
      return new URI(url1.getProtocol(), null, url1.getHost(), url1.getPort(),
        url1.getFile() + "/blob/" + pr.getHead().getSha() + "/" + path, null, issueLine != null ? ("L" + issueLine) : "").toURL();
    } catch (MalformedURLException | URISyntaxException e) {
      LOG.error("Invalid URL", e);
    }
  }
  return null;
}
 
开发者ID:SonarSource,项目名称:sonar-github,代码行数:15,代码来源:PullRequestFacade.java

示例5: getPath

import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
String getPath(InputPath inputPath) {
    String prefix = gitLabPluginConfiguration.prefixDirectory() != null ? gitLabPluginConfiguration.prefixDirectory() : "";
    return prefix + new PathResolver().relativePath(gitBaseDir, inputPath.file());
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:5,代码来源:CommitFacade.java

示例6: getPath

import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
String getPath(InputPath inputPath) {
  return new PathResolver().relativePath(gitBaseDir, inputPath.file());
}
 
开发者ID:SonarSource,项目名称:sonar-github,代码行数:4,代码来源:PullRequestFacade.java


注:本文中的org.sonar.api.batch.fs.InputPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。