Skip to content

Commit

Permalink
avoid wildcard in @DataBoundConstructor
Browse files Browse the repository at this point in the history
[FIXES JENKINS-41086]
  • Loading branch information
daspilker committed Feb 24, 2017
1 parent 2c37d53 commit 062b215
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
Expand Up @@ -166,7 +166,7 @@ public PerformancePublisher(int errorFailedThreshold,
boolean modeOfThreshold,
boolean failBuildIfNoResultFile,
boolean compareBuildPrevious,
List<? extends PerformanceReportParser> parsers,
List<PerformanceReportParser> parsers,
boolean modeThroughput) {

this.errorFailedThreshold = errorFailedThreshold;
Expand Down
Expand Up @@ -8,16 +8,15 @@
import org.jvnet.hudson.test.TestBuilder;

import java.io.IOException;

import static java.util.Arrays.asList;
import java.util.Collections;

/**
* @author Kohsuke Kawaguchi
*/
public class PerformancePublisherTest extends HudsonTestCase {
public void testConfigRoundtrip() throws Exception {
PerformancePublisher before = new PerformancePublisher(10, 20, "", 0, 0, 0, 0, 0, false, "", false, false, false,
asList(new JMeterParser("**/*.jtl")), false);
Collections.<PerformanceReportParser>singletonList(new JMeterParser("**/*.jtl")), false);

FreeStyleProject p = createFreeStyleProject();
p.getPublishersList().add(before);
Expand Down Expand Up @@ -52,7 +51,7 @@ public boolean perform(AbstractBuild<?, ?> build,
}
});
p.getPublishersList().add(
new PerformancePublisher(0, 0, "", 0, 0, 0, 0, 0, false, "", false, false, false, asList(new JMeterParser(
new PerformancePublisher(0, 0, "", 0, 0, 0, 0, 0, false, "", false, false, false, Collections.<PerformanceReportParser>singletonList(new JMeterParser(
"**/*.jtl")), false));

FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0).get());
Expand Down Expand Up @@ -82,7 +81,7 @@ public boolean perform(AbstractBuild<?, ?> build,
}
});
p.getPublishersList().add(
new PerformancePublisher(0, 0, "", 0, 0, 0, 0, 0, false, "", false, false, false, asList(new JMeterParser(
new PerformancePublisher(0, 0, "", 0, 0, 0, 0, 0, false, "", false, false, false, Collections.<PerformanceReportParser>singletonList(new JMeterParser(
"${JOB_NAME}/*.jtl")), false));

FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0).get());
Expand Down Expand Up @@ -113,7 +112,7 @@ public boolean perform(AbstractBuild<?, ?> build,
}
});
p.getPublishersList().add(
new PerformancePublisher(0, 0, "test.jtl:100", 0, 0, 0, 0, 0, false, "", false, false, false, asList(new JMeterParser(
new PerformancePublisher(0, 0, "test.jtl:100", 0, 0, 0, 0, 0, false, "", false, false, false, Collections.<PerformanceReportParser>singletonList(new JMeterParser(
"**/*.jtl")), false));

FreeStyleBuild b = assertBuildStatus(Result.UNSTABLE, p.scheduleBuild2(0).get());
Expand Down Expand Up @@ -144,7 +143,7 @@ public boolean perform(AbstractBuild<?, ?> build,
}
});
p.getPublishersList().add(
new PerformancePublisher(0, 0, "test.jtl:5000", 0, 0, 0, 0, 0, false, "", false, false, false, asList(new JMeterParser(
new PerformancePublisher(0, 0, "test.jtl:5000", 0, 0, 0, 0, 0, false, "", false, false, false, Collections.<PerformanceReportParser>singletonList(new JMeterParser(
"**/*.jtl")), false));

FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0).get());
Expand Down Expand Up @@ -173,7 +172,7 @@ public void buildUnstableAverageResponseTimeRelativeThreshold() throws Exception
FreeStyleProject p = createFreeStyleProject();

p.getPublishersList().add(
new PerformancePublisher(0, 0, null, 100.0d, 0, 50.0d, 0, 0, false, "ART", true, false, true, asList(new JUnitParser(
new PerformancePublisher(0, 0, null, 100.0d, 0, 50.0d, 0, 0, false, "ART", true, false, true, Collections.<PerformanceReportParser>singletonList(new JUnitParser(
"**/*.xml")), false));
// first build
p.getBuildersList().add(new TestBuilder() {
Expand Down
Expand Up @@ -16,9 +16,9 @@
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
import hudson.plugins.performance.AbstractParser;
import hudson.plugins.performance.JMeterParser;
import hudson.plugins.performance.PerformancePublisher;
import hudson.plugins.performance.PerformanceReportParser;
import hudson.plugins.performance.constraints.AbstractConstraint.Escalation;
import hudson.plugins.performance.constraints.AbstractConstraint.Metric;
import hudson.plugins.performance.constraints.AbstractConstraint.Operator;
Expand Down Expand Up @@ -47,7 +47,7 @@ public void informationModeDoesntAffectBuildStatus() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -93,7 +93,7 @@ public void warningModeMakesBuildUnstable() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -139,7 +139,7 @@ public void errorModeMakesBuildFail() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -185,7 +185,7 @@ public void equalValuesWithNotGreaterOperator() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -231,7 +231,7 @@ public void calculatedValueGreaterWithNotGreaterOperator() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -277,7 +277,7 @@ public void equalValuesWithNotEqualOperator() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -323,7 +323,7 @@ public void notEqualValueWithNotEqualOperator() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -369,7 +369,7 @@ public void equalValuesWithNotLessOperator() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down Expand Up @@ -415,7 +415,7 @@ public void calculatedValueLessWithNotLessOperator() throws Exception{
List<AbstractConstraint> abstractBuildsList = new ArrayList<AbstractConstraint>();
abstractBuildsList.add(absoluteConstraint);

List<AbstractParser> abstractParserList = new ArrayList<AbstractParser>();
List<PerformanceReportParser> abstractParserList = new ArrayList<PerformanceReportParser>();
abstractParserList.add(new JMeterParser("testResult.xml"));

PerformancePublisher performancePublisher = new PerformancePublisher(10, 20, "",0,0,0,0,0,false,"",false,true,false,
Expand Down

0 comments on commit 062b215

Please sign in to comment.