Skip to content
Permalink
Browse files

Merge pull request #6 from cizezsy/threshold

[JENKINS-51364] Adopt Threshold conditions (e.g. from Cobertura) so t…
  • Loading branch information
cizezsy committed Jun 2, 2018
2 parents c3a07da + e83b007 commit e0992be1941f442d74e86d3b51b293a68194645d
Showing with 1,007 additions and 265 deletions.
  1. +25 −15 src/main/java/io/jenkins/plugins/coverage/CoverageAction.java
  2. +237 −42 src/main/java/io/jenkins/plugins/coverage/CoverageProcessor.java
  3. +72 −20 src/main/java/io/jenkins/plugins/coverage/CoveragePublisher.java
  4. +6 −1 src/main/java/io/jenkins/plugins/coverage/adapter/CoberturaReportAdapter.java
  5. +51 −13 src/main/java/io/jenkins/plugins/coverage/adapter/CoverageReportAdapter.java
  6. +2 −1 src/main/java/io/jenkins/plugins/coverage/adapter/CoverageReportAdapterDescriptor.java
  7. +10 −0 src/main/java/io/jenkins/plugins/coverage/adapter/Detectable.java
  8. +2 −0 src/main/java/io/jenkins/plugins/coverage/adapter/JacocoReportAdapter.java
  9. +10 −27 src/main/java/io/jenkins/plugins/coverage/adapter/XMLCoverageReportAdapter.java
  10. +28 −10 src/main/java/io/jenkins/plugins/coverage/adapter/parser/CoverageParser.java
  11. +2 −2 src/main/java/io/jenkins/plugins/coverage/adapter/parser/JavaCoverageParser.java
  12. +49 −30 src/main/java/io/jenkins/plugins/coverage/adapter/util/XMLUtils.java
  13. +0 −23 src/main/java/io/jenkins/plugins/coverage/exception/ConversionException.java
  14. +23 −0 src/main/java/io/jenkins/plugins/coverage/exception/CoverageException.java
  15. +12 −1 src/main/java/io/jenkins/plugins/coverage/targets/CoverageResult.java
  16. +58 −17 src/main/java/io/jenkins/plugins/coverage/threshold/Threshold.java
  17. +15 −53 src/main/resources/io/jenkins/plugins/coverage/CoveragePublisher/config.jelly
  18. +2 −1 src/main/resources/io/jenkins/plugins/coverage/Messages.properties
  19. +7 −0 src/main/resources/io/jenkins/plugins/coverage/adapter/CoverageReportAdapterDescriptor/config.jelly
  20. +0 −2 src/main/resources/io/jenkins/plugins/coverage/adapter/jacoco-to-standard.xsl
  21. +56 −0 src/main/resources/io/jenkins/plugins/coverage/threshold/Threshold/config.jelly
  22. +3 −7 src/main/webapp/css/style.css
  23. +337 −0 src/test/java/io/jenkins/plugins/coverage/CoveragePublisherPipelineTest.java
  24. 0 src/test/resources/{ → io/jenkins/plugins/coverage}/cobertura-coverage.xml
  25. 0 src/test/resources/{ → io/jenkins/plugins/coverage}/coverage-with-lots-of-data.xml
  26. 0 src/test/resources/{ → io/jenkins/plugins/coverage}/jacoco.xml
@@ -19,7 +19,7 @@

private transient Run<?, ?> owner;
private transient WeakReference<CoverageResult> report;

private HealthReport healthReport;

public CoverageAction(CoverageResult result) {
this.report = new WeakReference<>(result);
@@ -35,9 +35,12 @@ public CoverageAction(CoverageResult result) {
}


/**
* @return Health report
*/
@Override
public HealthReport getBuildHealth() {
return null;
return getHealthReport();
}

/**
@@ -47,24 +50,24 @@ public HealthReport getBuildHealth() {
*/
private CoverageResult getResult() {
if (report != null) {
CoverageResult r = report.get();
if (r != null) {
return r;
CoverageResult coverageResult = report.get();
if (coverageResult != null) {
return coverageResult;
}
}

CoverageResult r = null;
CoverageResult coverageResult = null;
try {
r = CoverageProcessor.recoverReport(owner);
coverageResult = CoverageProcessor.recoverCoverageResult(owner);
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}

if (r != null) {
r.setOwner(owner);
report = new WeakReference<>(r);
if (coverageResult != null) {
coverageResult.setOwner(owner);
report = new WeakReference<>(coverageResult);
}
return r;
return coverageResult;
}

/**
@@ -76,12 +79,20 @@ public Object getTarget() {
}


public HealthReport getHealthReport() {
return healthReport;
}

public void setHealthReport(HealthReport healthReport) {
this.healthReport = healthReport;
}

private synchronized void setOwner(Run<?, ?> owner) {
this.owner = owner;
if (report != null) {
CoverageResult r = report.get();
if (r != null) {
r.setOwner(owner);
CoverageResult coverageResult = report.get();
if (coverageResult != null) {
coverageResult.setOwner(owner);
}

}
@@ -91,7 +102,6 @@ private synchronized void setOwner(Run<?, ?> owner) {
return owner;
}


/**
* {@inheritDoc}
*/

0 comments on commit e0992be

Please sign in to comment.
You can’t perform that action at this time.