Skip to content

Commit

Permalink
TS-33618 Added debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DreierF committed Apr 20, 2023
1 parent 2946037 commit 94132a9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.teamscale.client.TeamscaleServer;
import com.teamscale.jacoco.agent.testimpact.TestwiseCoverageAgent;
import com.teamscale.jacoco.agent.util.LoggingUtils;
import com.teamscale.report.testwise.model.RevisionInfo;
import com.teamscale.jacoco.agent.options.RevisionInfo;
import org.conqat.lib.commons.string.StringUtils;
import org.slf4j.Logger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.teamscale.report.testwise.model;
package com.teamscale.jacoco.agent.options;

import java.io.Serializable;

import com.teamscale.client.CommitDescriptor;
import com.teamscale.report.testwise.model.ERevisionType;

/** Revision information necessary for uploading reports to Teamscale. */
public class RevisionInfo implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public class CoverageToTeamscaleStrategy extends TestEventHandlerStrategyBase {

private final Logger logger = LoggingUtils.getLogger(this);

private final JsonAdapter<TestwiseCoverageReport> testwiseCoverageReportJsonAdapter = new Moshi.Builder().build()
.adapter(TestwiseCoverageReport.class);
private final JsonAdapter<TestwiseCoverageReport> testwiseCoverageReportJsonAdapter;

/**
* The path to the exec file into which the coverage of the current test run is appended to. Will be null if there
Expand All @@ -51,6 +50,8 @@ public class CoverageToTeamscaleStrategy extends TestEventHandlerStrategyBase {
public CoverageToTeamscaleStrategy(JacocoRuntimeController controller, AgentOptions agentOptions,
JaCoCoTestwiseReportGenerator reportGenerator) {
super(agentOptions, controller);
testwiseCoverageReportJsonAdapter = new Moshi.Builder().build()
.adapter(TestwiseCoverageReport.class);
this.reportGenerator = reportGenerator;

if (!agentOptions.getTeamscaleServerOptions().hasCommitOrRevision()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ public class TestExecutionWriter {

private final Logger logger = LoggingUtils.getLogger(this);

private final JsonAdapter<TestExecution> testExecutionAdapter = new Moshi.Builder().build()
.adapter(TestExecution.class);
private final JsonAdapter<TestExecution> testExecutionAdapter;

private final File testExecutionFile;
private boolean hasWrittenAtLeastOneExecution = false;

public TestExecutionWriter(File testExecutionFile) {
testExecutionAdapter = new Moshi.Builder().build()
.adapter(TestExecution.class);
this.testExecutionFile = testExecutionFile;
logger.debug("Writing test executions to {}", testExecutionFile);
}
Expand Down
4 changes: 4 additions & 0 deletions sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jar {
}
}

application {
mainClass = 'Main'
}

dependencies {
// this logback version is the oldest one available that I could get to work and possibly incompatible
// with the one used in the agent. This way, we can test if the shadowing works correctly
Expand Down

0 comments on commit 94132a9

Please sign in to comment.