Skip to content

Commit

Permalink
Fix JENKINS-14517
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Jul 22, 2012
1 parent ab9fc36 commit 4f2ab0f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
Expand Up @@ -78,7 +78,7 @@ public boolean isApplicable(Class type) {


private Object readResolve() {
return new org.jenkinsci.plugins.xunit.XUnitPublisher(types, thresholds, null);
return new org.jenkinsci.plugins.xunit.XUnitPublisher(types, thresholds, 1);
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java
Expand Up @@ -49,17 +49,17 @@ public class XUnitPublisher extends Recorder implements DryRun, Serializable {

private XUnitThreshold[] thresholds;

private transient String thresholdMode;
private int thresholdMode;

private static final String MODE_NUMBER = "NUMBER";
private static final String MODE_PERCENT = "PERCENT";
private static final int MODE_NUMBER = 1;
private static final int MODE_PERCENT = 2;

public XUnitPublisher(TestType[] types, XUnitThreshold[] thresholds) {
this.types = types;
this.thresholds = thresholds;
}

public XUnitPublisher(TestType[] types, XUnitThreshold[] thresholds, String thresholdMode) {
public XUnitPublisher(TestType[] types, XUnitThreshold[] thresholds, int thresholdMode) {
this.types = types;
this.thresholds = thresholds;
this.thresholdMode = thresholdMode;
Expand All @@ -73,7 +73,7 @@ public XUnitThreshold[] getThresholds() {
return thresholds;
}

public String getThresholdMode() {
public int getThresholdMode() {
return thresholdMode;
}

Expand Down Expand Up @@ -348,7 +348,7 @@ private Result processResultThreshold(XUnitLog log,
for (XUnitThreshold threshold : thresholds) {
log.infoConsoleLogger(String.format("Check '%s' threshold.", threshold.getDescriptor().getDisplayName()));
Result result;
if (MODE_PERCENT.equals(thresholdMode)) {
if (MODE_PERCENT == thresholdMode) {
result = threshold.getResultThresholdPercent(log, build, testResultAction, previousTestResultAction);
} else {
result = threshold.getResultThresholdNumber(log, build, testResultAction, previousTestResultAction);
Expand Down Expand Up @@ -435,7 +435,7 @@ public Publisher newInstance(StaplerRequest req, JSONObject formData) throws For
req, formData, "tools", getListXUnitTypeDescriptors());
List<XUnitThreshold> thresholds = Descriptor.newInstancesFromHeteroList(
req, formData, "thresholds", getListXUnitThresholdDescriptors());
String thresholdMode = formData.getString("thresholdMode");
int thresholdMode = formData.getInt("thresholdMode");
return new XUnitPublisher(types.toArray(new TestType[types.size()]), thresholds.toArray(new XUnitThreshold[thresholds.size()]), thresholdMode);
}
}
Expand Down
Expand Up @@ -21,7 +21,6 @@ public abstract class XUnitThreshold implements ExtensionPoint, Serializable, De

private String failureNewThreshold;


protected XUnitThreshold() {
}

Expand Down
@@ -1,16 +1,13 @@
package org.jenkinsci.plugins.xunit.types;

import com.thalesgroup.dtkit.junit.model.JUnitModel;
import com.thalesgroup.dtkit.metrics.model.InputMetricOther;
import com.thalesgroup.dtkit.util.converter.ConversionException;
import com.thalesgroup.dtkit.util.validator.ValidationError;
import com.thalesgroup.dtkit.util.validator.ValidationException;
import hudson.FilePath;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
Expand Down
Expand Up @@ -18,11 +18,11 @@
<f:advanced>
<f:entry field="thresholdMode" title="${%Choose your threshold mode}">
<f:radio name="thresholdMode"
value="NUMBER"
checked="${instance.thresholdMode=='NUMBER' or h.defaultToTrue(instance.thresholdMode)}"/>
value="1"
checked="${instance.thresholdMode==1 or h.defaultToTrue(instance.thresholdMode)}"/>
<label class="attach-previous">Use a number of tests</label>
<br/>
<f:radio name="thresholdMode" value="PERCENT" checked="${instance.thresholdMode=='PERCENT'}"/>
<f:radio name="thresholdMode" value="2" checked="${instance.thresholdMode==2}"/>
<label class="attach-previous">Use a percent of tests</label>
</f:entry>
</f:advanced>
Expand Down

0 comments on commit 4f2ab0f

Please sign in to comment.