Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private String createTestwiseCoverageReport(boolean partial) throws IOException,
if (execution == null) {
return null;
} else {
return execution.getUniformPath();
return execution.uniformPath;
}
}).collect(toList());

Expand All @@ -132,10 +132,9 @@ private String createTestwiseCoverageReport(boolean partial) throws IOException,
reportGenerator.updateClassDirCache();
TestwiseCoverage testwiseCoverage = reportGenerator.convert(testExecFile);
logger.debug("Created testwise coverage report (containing coverage for tests `{}`)",
testwiseCoverage.getTests().stream().map(TestCoverageBuilder::getUniformPath).collect(toList()));
testwiseCoverage.getTests().values().stream().map(TestCoverageBuilder::getUniformPath).collect(toList()));

TestwiseCoverageReport report = TestwiseCoverageReportBuilder
.createFrom(availableTests, testwiseCoverage.getTests(), testExecutions, partial);
TestwiseCoverageReport report = TestwiseCoverageReportBuilder.createFrom(availableTests, testwiseCoverage.getTests().values(), testExecutions, partial);

testExecFile.delete();
testExecFile = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.teamscale.report.testwise.model.builder.TestInfoBuilder;
import org.slf4j.Logger;

import java.util.Objects;

/**
* Strategy which directly converts the collected coverage into a JSON object in place and returns the result to the
* caller as response to the http request. If a test execution is given it is merged into the representation and
Expand All @@ -36,12 +38,12 @@ public TestInfo testEnd(String test, TestExecution testExecution)
TestInfoBuilder builder = new TestInfoBuilder(test);
Dump dump = controller.dumpAndReset();
reportGenerator.updateClassDirCache();
builder.setCoverage(reportGenerator.convert(dump));
builder.setCoverage(Objects.requireNonNull(reportGenerator.convert(dump)));
if (testExecution != null) {
builder.setExecution(testExecution);
}
TestInfo testInfo = builder.build();
logger.debug("Generated test info {}", testInfo.toString());
logger.debug("Generated test info {}", testInfo);
return testInfo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testStart(String test) {
public TestInfo testEnd(String test,
TestExecution testExecution) throws JacocoRuntimeController.DumpException, CoverageGenerationException {
if (testExecution != null) {
testExecution.setUniformPath(test);
testExecution.uniformPath = test;
if (startTimestamp != -1) {
long endTimestamp = System.currentTimeMillis();
testExecution.setDurationMillis(endTimestamp - startTimestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private File createZipFile(CoverageFile coverageFile) throws IOException {
*/
private void fillZipFile(ZipOutputStream zipOutputStream, CoverageFile coverageFile) throws IOException {
zipOutputStream.putNextEntry(new ZipEntry(getZipEntryCoverageFileName(coverageFile)));
coverageFile.copy(zipOutputStream);
coverageFile.copyStream(zipOutputStream);

for (Path additionalFile : additionalMetaDataFiles) {
zipOutputStream.putNextEntry(new ZipEntry(additionalFile.getFileName().toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class SystemTestUtils {
* Example: {@code file1.java:1,7-12;file2.java:9-22,33}
*/
public static String getCoverageString(TestInfo info) {
return info.paths.stream().flatMap(path -> path.getFiles().stream())
return info.paths.stream().flatMap(path -> path.files.stream())
.map(file -> file.fileName + ":" + file.coveredLines).collect(
Collectors.joining(";"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ void testInteractionWithListenersAndCoverageApi() {

assertThat(testExecutions).hasSize(2);
assertThat(testExecutions).anySatisfy(testExecution ->
assertThat(testExecution.getUniformPath()).isEqualTo("MyClass/impactedTestCase()"));
assertThat(testExecution.uniformPath).isEqualTo("MyClass/impactedTestCase()"));
assertThat(testExecutions).anySatisfy(testExecution ->
assertThat(testExecution.getUniformPath()).isEqualTo("MyClass/regularSkippedTestCase()"));
assertThat(testExecution.uniformPath).isEqualTo("MyClass/regularSkippedTestCase()"));
}

@Test
Expand Down Expand Up @@ -125,6 +125,6 @@ void testSkipOfTestClass() {

assertThat(testExecutions).hasSize(2);
assertThat(testExecutions)
.allMatch(testExecution -> testExecution.getResult().equals(ETestExecutionResult.SKIPPED));
.allMatch(testExecution -> testExecution.result.equals(ETestExecutionResult.SKIPPED));
}
}
1 change: 1 addition & 0 deletions report-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
com.teamscale.`java-convention`
com.teamscale.coverage
com.teamscale.publish
kotlin("jvm")
}

publishAs {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading