aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2019-01-17 16:03:25 +0100
committerSonarTech <sonartech@sonarsource.com>2019-01-17 20:21:00 +0100
commitb5cc29188339a2bf7187de25be38853553a81482 (patch)
tree53d8a0c81a324ae2da694f7e71fa06179f4c33fe /sonar-scanner-protocol
parent51578709a9f2168f6774de9da88ad5975b9455fd (diff)
downloadsonarqube-b5cc29188339a2bf7187de25be38853553a81482.tar.gz
sonarqube-b5cc29188339a2bf7187de25be38853553a81482.zip
SONAR-11632 Remove api/tests WS
- Drop api/tests WS - Drop persistance of tests and coverage details from compute engine - Drop tests and coverage details from scanner report
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/FileStructure.java3
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportReader.java20
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java12
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java19
-rw-r--r--sonar-scanner-protocol/src/main/protobuf/scanner_report.proto26
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java60
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java20
7 files changed, 5 insertions, 155 deletions
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/FileStructure.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/FileStructure.java
index b03e915b4a3..6e4b419c843 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/FileStructure.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/FileStructure.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.protocol.output;
import java.io.File;
-
import javax.annotation.concurrent.Immutable;
/**
@@ -40,8 +39,6 @@ public class FileStructure {
CHANGESETS("changesets-", Domain.PB),
SYMBOLS("symbols-", Domain.PB),
COVERAGES("coverages-", Domain.PB),
- TESTS("tests-", Domain.PB),
- COVERAGE_DETAILS("coverage-details-", Domain.PB),
SOURCE("source-", ".txt"),
SGNIFICANT_CODE("sgnificant-code-", Domain.PB),
CHANGED_LINES("changed-lines-", Domain.PB);
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportReader.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportReader.java
index 916adcf62a3..90e6143b9ca 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportReader.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportReader.java
@@ -181,26 +181,6 @@ public class ScannerReportReader {
return null;
}
- @CheckForNull
- public File readTests(int testFileRef) {
- File file = fileStructure.fileFor(FileStructure.Domain.TESTS, testFileRef);
- if (fileExists(file)) {
- return file;
- }
-
- return null;
- }
-
- @CheckForNull
- public File readCoverageDetails(int testFileRef) {
- File file = fileStructure.fileFor(FileStructure.Domain.COVERAGE_DETAILS, testFileRef);
- if (fileExists(file)) {
- return file;
- }
-
- return null;
- }
-
public CloseableIterator<ScannerReport.ContextProperty> readContextProperties() {
File file = fileStructure.contextProperties();
if (!fileExists(file)) {
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java
index cfa15c7553f..e20e37ff852 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java
@@ -154,18 +154,6 @@ public class ScannerReportWriter {
return file;
}
- public File writeTests(int componentRef, Iterable<ScannerReport.Test> tests) {
- File file = fileStructure.fileFor(FileStructure.Domain.TESTS, componentRef);
- Protobuf.writeStream(tests, file, false);
- return file;
- }
-
- public File writeCoverageDetails(int componentRef, Iterable<ScannerReport.CoverageDetail> tests) {
- File file = fileStructure.fileFor(FileStructure.Domain.COVERAGE_DETAILS, componentRef);
- Protobuf.writeStream(tests, file, false);
- return file;
- }
-
public File writeContextProperties(Iterable<ScannerReport.ContextProperty> properties) {
File file = fileStructure.contextProperties();
Protobuf.writeStream(properties, file, false);
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
index 0b2f132e1c3..0260f1fcb2e 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
@@ -25,7 +25,6 @@ import java.awt.Dimension;
import java.awt.EventQueue;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
@@ -256,7 +255,6 @@ public class ScannerReportViewerApp {
updateSymbols(component);
updateSource(component);
updateCoverage(component);
- updateTests(component);
updateDuplications(component);
updateIssues(component);
updateExternalIssues(component);
@@ -348,23 +346,6 @@ public class ScannerReportViewerApp {
}
}
- private void updateTests(Component component) {
- testsEditor.setText("");
- File tests = reader.readTests(component.getRef());
- if (tests == null) {
- return;
- }
- try (InputStream inputStream = FileUtils.openInputStream(tests)) {
- ScannerReport.Test test = ScannerReport.Test.parser().parseDelimitedFrom(inputStream);
- while (test != null) {
- testsEditor.getDocument().insertString(testsEditor.getDocument().getEndPosition().getOffset(), test + "\n", null);
- test = ScannerReport.Test.parser().parseDelimitedFrom(inputStream);
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
private void updateSource(Component component) {
File sourceFile = reader.getFileStructure().fileFor(Domain.SOURCE, component.getRef());
sourceEditor.setText("");
diff --git a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
index 57f86f9a73a..92e917a65f1 100644
--- a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
+++ b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
@@ -321,32 +321,6 @@ message SyntaxHighlightingRule {
}
}
-message Test {
- string name = 1;
- TestStatus status = 2;
- int64 duration_in_ms = 3;
- string stacktrace = 4;
- string msg = 5;
-
- enum TestStatus {
- UNSET = 0;
- OK = 1;
- FAILURE = 2;
- ERROR = 3;
- SKIPPED = 4;
- }
-}
-
-message CoverageDetail {
- string test_name = 1;
- repeated CoveredFile covered_file = 2;
-
- message CoveredFile {
- int32 file_ref = 1;
- repeated int32 covered_line = 2 [packed = true];
- }
-}
-
message AnalysisWarning {
string text = 1;
int64 timestamp = 2;
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
index 68fe5aa7188..928166b5a31 100644
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
+++ b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
@@ -32,7 +32,6 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.core.util.CloseableIterator;
import org.sonar.scanner.protocol.output.ScannerReport.Measure.StringValue;
import org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType;
-import org.sonar.scanner.protocol.output.ScannerReport.Test.TestStatus;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
@@ -45,9 +44,9 @@ public class ScannerReportReaderTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
- File dir;
+ private File dir;
- ScannerReportReader underTest;
+ private ScannerReportReader underTest;
@Before
public void setUp() throws Exception {
@@ -211,7 +210,7 @@ public class ScannerReportReaderTest {
}
@Test
- public void read_syntax_highlighting() throws Exception {
+ public void read_syntax_highlighting() {
ScannerReportWriter writer = new ScannerReportWriter(dir);
writer.writeMetadata(ScannerReport.Metadata.newBuilder()
.setRootComponentRef(1)
@@ -276,7 +275,7 @@ public class ScannerReportReaderTest {
}
@Test
- public void read_coverage() throws Exception {
+ public void read_coverage() {
ScannerReportWriter writer = new ScannerReportWriter(dir);
writer.writeMetadata(ScannerReport.Metadata.newBuilder()
.setRootComponentRef(1)
@@ -324,55 +323,6 @@ public class ScannerReportReaderTest {
}
@Test
- public void read_tests() throws Exception {
- ScannerReportWriter writer = new ScannerReportWriter(dir);
- writer.writeTests(1, asList(
- ScannerReport.Test.newBuilder()
- .setDurationInMs(60_000)
- .setStacktrace("stacktrace")
- .setMsg("message")
- .setStatus(TestStatus.OK)
- .build()));
-
- try (InputStream inputStream = FileUtils.openInputStream(underTest.readTests(1))) {
- ScannerReport.Test testResult = ScannerReport.Test.parser().parseDelimitedFrom(inputStream);
- assertThat(testResult.getDurationInMs()).isEqualTo(60_000);
- assertThat(testResult.getStacktrace()).isEqualTo("stacktrace");
- assertThat(testResult.getMsg()).isEqualTo("message");
- assertThat(testResult.getStatus()).isEqualTo(TestStatus.OK);
- }
- }
-
- @Test
- public void null_if_no_test_found() {
- assertThat(underTest.readTests(UNKNOWN_COMPONENT_REF)).isNull();
- }
-
- @Test
- public void read_coverage_details() throws Exception {
- ScannerReportWriter writer = new ScannerReportWriter(dir);
- writer.writeCoverageDetails(1, asList(
- ScannerReport.CoverageDetail.newBuilder()
- .setTestName("test-name")
- .addCoveredFile(ScannerReport.CoverageDetail.CoveredFile.newBuilder()
- .addAllCoveredLine(asList(1, 2, 3, 5, 7))
- .setFileRef(2))
- .build()));
-
- try (InputStream inputStream = FileUtils.openInputStream(underTest.readCoverageDetails(1))) {
- ScannerReport.CoverageDetail coverageDetail = ScannerReport.CoverageDetail.parser().parseDelimitedFrom(inputStream);
- assertThat(coverageDetail.getTestName()).isEqualTo("test-name");
- assertThat(coverageDetail.getCoveredFile(0).getFileRef()).isEqualTo(2);
- assertThat(coverageDetail.getCoveredFile(0).getCoveredLineList()).containsExactly(1, 2, 3, 5, 7);
- }
- }
-
- @Test
- public void null_if_no_coverage_detail_found() {
- assertThat(underTest.readCoverageDetails(UNKNOWN_COMPONENT_REF)).isNull();
- }
-
- @Test
public void read_file_source() throws Exception {
ScannerReportWriter writer = new ScannerReportWriter(dir);
try (FileOutputStream outputStream = new FileOutputStream(writer.getSourceFile(1))) {
@@ -385,7 +335,7 @@ public class ScannerReportReaderTest {
}
@Test
- public void return_null_when_no_file_source() throws Exception {
+ public void return_null_when_no_file_source() {
assertThat(underTest.readFileSource(UNKNOWN_COMPONENT_REF)).isNull();
}
}
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
index ec33c74d38e..3a6f84961dd 100644
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
+++ b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
@@ -353,24 +353,4 @@ public class ScannerReportWriterTest {
assertThat(underTest.hasComponentData(FileStructure.Domain.COVERAGES, 1)).isTrue();
}
- @Test
- public void write_tests() {
- assertThat(underTest.hasComponentData(FileStructure.Domain.TESTS, 1)).isFalse();
-
- underTest.writeTests(1, asList(
- ScannerReport.Test.getDefaultInstance()));
-
- assertThat(underTest.hasComponentData(FileStructure.Domain.TESTS, 1)).isTrue();
-
- }
-
- @Test
- public void write_coverage_details() {
- assertThat(underTest.hasComponentData(FileStructure.Domain.COVERAGE_DETAILS, 1)).isFalse();
-
- underTest.writeCoverageDetails(1, asList(
- ScannerReport.CoverageDetail.getDefaultInstance()));
-
- assertThat(underTest.hasComponentData(FileStructure.Domain.COVERAGE_DETAILS, 1)).isTrue();
- }
}