Skip to content
Permalink
Browse files

JENKINS-26535 can be worked around using a collection of raw types.

Originally-Committed-As: b5302ebc2e2479f03c538060460e43d0c1c0b47a
  • Loading branch information
jglick committed Oct 26, 2015
1 parent ac8f743 commit 06ba83c54aec8e8cacd34737d16667469383b5d7
@@ -41,15 +41,16 @@
/**
* Resets the properties of the current job.
*/
@SuppressWarnings("rawtypes") // TODO JENKINS-26535: cannot bind List<JobProperty<?>>
public class JobPropertyStep extends AbstractStepImpl {

private final List<JobProperty<?>> properties;
private final List<JobProperty> properties;

@DataBoundConstructor public JobPropertyStep(List<JobProperty<?>> properties) {
@DataBoundConstructor public JobPropertyStep(List<JobProperty> properties) {
this.properties = properties;
}

public List<JobProperty<?>> getProperties() {
public List<JobProperty> getProperties() {
return properties;
}

@@ -58,7 +59,7 @@
@Inject transient JobPropertyStep step;
@StepContextParameter Run<?,?> build;

@SuppressWarnings({"unchecked", "rawtypes"}) // untypable
@SuppressWarnings("unchecked") // untypable
@Override protected Void run() throws Exception {
Job<?,?> job = build.getParent();
for (JobProperty prop : step.properties) {
@@ -54,12 +54,13 @@
@Rule public JenkinsRule r = new JenkinsRule();
@Rule public GitSampleRepoRule sampleRepo = new GitSampleRepoRule();

@SuppressWarnings("rawtypes")
@Issue("JENKINS-30519")
@Test public void configRoundTrip() throws Exception {
StepConfigTester tester = new StepConfigTester(r);
// TODO fails (returns null)
assertEquals(Collections.emptyList(), tester.configRoundTrip(new JobPropertyStep(Collections.<JobProperty<?>>emptyList())).getProperties());
List<JobProperty<?>> properties = tester.configRoundTrip(new JobPropertyStep(Collections.<JobProperty<?>>singletonList(new ParametersDefinitionProperty(new BooleanParameterDefinition("flag", true, null))))).getProperties();
assertEquals(Collections.emptyList(), tester.configRoundTrip(new JobPropertyStep(Collections.<JobProperty>emptyList())).getProperties());
List<JobProperty> properties = tester.configRoundTrip(new JobPropertyStep(Collections.<JobProperty>singletonList(new ParametersDefinitionProperty(new BooleanParameterDefinition("flag", true, null))))).getProperties();
assertEquals(1, properties.size());
assertEquals(ParametersDefinitionProperty.class, properties.get(0));
ParametersDefinitionProperty pdp = (ParametersDefinitionProperty) properties.get(0);
@@ -87,7 +88,6 @@
r.waitUntilNoActivity();
WorkflowRun b1 = p.getLastBuild();
assertEquals(1, b1.getNumber());
// TODO fails due to JENKINS-28510
r.assertLogContains("received default value", b1);
WorkflowRun b2 = r.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("myparam", "special value"))));
assertEquals(2, b2.getNumber());

0 comments on commit 06ba83c

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