use of org.sonarsource.sonarlint.core.client.api.connected.ProjectBinding in project sonarlint-core by SonarSource.
the class ConnectedDeveloperIssueDownloadTest method download_all_issues_for_branch.
@Test
public void download_all_issues_for_branch() throws IOException {
engine.downloadServerIssues(endpointParams(ORCHESTRATOR), sqHttpClient(), PROJECT_KEY, false, LONG_BRANCH, null);
var file1Issues = engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/500lines.xoo");
var file2Issues = engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/10000lines.xoo");
// Number of issues is not limited to 10k
assertThat(file1Issues.size() + file2Issues.size()).isEqualTo(10_500);
Map<String, ServerIssue> allIssues = new HashMap<>();
engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/500lines.xoo").forEach(i -> allIssues.put(i.key(), i));
engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/10000lines.xoo").forEach(i -> allIssues.put(i.key(), i));
assertThat(allIssues).hasSize(10_500);
assertThat(allIssues.get(wfIssue.getKey()).resolution()).isEqualTo("WONTFIX");
assertThat(allIssues.get(fpIssue.getKey()).resolution()).isEqualTo("FALSE-POSITIVE");
assertThat(allIssues.get(overridenSeverityIssue.getKey()).severity()).isEqualTo("BLOCKER");
assertThat(allIssues.get(overridenTypeIssue.getKey()).type()).isEqualTo("BUG");
// No hotspots
assertThat(allIssues.values()).allSatisfy(i -> assertThat(i.type()).isIn("CODE_SMELL", "BUG", "VULNERABILITY"));
}
use of org.sonarsource.sonarlint.core.client.api.connected.ProjectBinding in project sonarlint-core by SonarSource.
the class ConnectedCommunityIssueDownloadTest method download_all_issues_not_limited_to_10k.
@Test
public void download_all_issues_not_limited_to_10k() throws IOException {
engine.update(endpointParams(ORCHESTRATOR), sqHttpClient(), null);
engine.updateProject(endpointParams(ORCHESTRATOR), sqHttpClient(), PROJECT_KEY, false, null, null);
engine.downloadServerIssues(endpointParams(ORCHESTRATOR), sqHttpClient(), PROJECT_KEY, false, null, null);
var file1Issues = engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/500lines.xoo");
var file2Issues = engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/10000lines.xoo");
// Number of issues is not limited to 10k
assertThat(file1Issues.size() + file2Issues.size()).isEqualTo(10_500);
Map<String, ServerIssue> allIssues = new HashMap<>();
engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/500lines.xoo").forEach(i -> allIssues.put(i.key(), i));
engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/10000lines.xoo").forEach(i -> allIssues.put(i.key(), i));
assertThat(allIssues).hasSize(10_500);
assertThat(allIssues.get(wfIssue.getKey()).resolution()).isEqualTo("WONTFIX");
assertThat(allIssues.get(fpIssue.getKey()).resolution()).isEqualTo("FALSE-POSITIVE");
assertThat(allIssues.get(overridenSeverityIssue.getKey()).severity()).isEqualTo("BLOCKER");
assertThat(allIssues.get(overridenTypeIssue.getKey()).type()).isEqualTo("BUG");
// No hotspots
assertThat(allIssues.values()).allSatisfy(i -> assertThat(i.type()).isIn("CODE_SMELL", "BUG", "VULNERABILITY"));
}
use of org.sonarsource.sonarlint.core.client.api.connected.ProjectBinding in project sonarlint-core by SonarSource.
the class TaintVulnerabilitiesDownloadTest method download_all_issues_include_taint_vulnerabilities_and_code_snippets.
@Test
public void download_all_issues_include_taint_vulnerabilities_and_code_snippets() throws IOException {
engine.update(endpointParams(ORCHESTRATOR), sqHttpClient(), null);
engine.updateProject(endpointParams(ORCHESTRATOR), sqHttpClient(), PROJECT_KEY, true, null, null);
var sinkIssues = engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/main/java/foo/DbHelper.java");
assertThat(sinkIssues.size()).isEqualTo(1);
// Reload
engine.downloadServerIssues(endpointParams(ORCHESTRATOR), sqHttpClient(), PROJECT_KEY, true, null, null);
sinkIssues = engine.getServerIssues(new ProjectBinding(PROJECT_KEY, "", ""), "src/main/java/foo/DbHelper.java");
assertThat(sinkIssues.size()).isEqualTo(1);
var taintIssue = sinkIssues.get(0);
assertThat(taintIssue.getCodeSnippet()).isEqualTo("statement.executeQuery(query)");
assertThat(taintIssue.getFlows()).isNotEmpty();
var flow = taintIssue.getFlows().get(0);
assertThat(flow.locations()).isNotEmpty();
assertThat(flow.locations().get(0).getCodeSnippet()).isEqualTo("statement.executeQuery(query)");
assertThat(flow.locations().get(flow.locations().size() - 1).getCodeSnippet()).isIn("request.getParameter(\"user\")", "request.getParameter(\"pass\")");
}
Aggregations