本文整理汇总了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");
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例6: getPath
import org.sonar.api.batch.fs.InputPath; //导入依赖的package包/类
String getPath(InputPath inputPath) {
return new PathResolver().relativePath(gitBaseDir, inputPath.file());
}