Skip to content

Commit

Permalink
JENKINS-26535 can be worked around using a collection of raw types.
Browse files Browse the repository at this point in the history
Originally-Committed-As: b5302ebc2e2479f03c538060460e43d0c1c0b47a
  • Loading branch information
jglick committed Oct 26, 2015
1 parent ac8f743 commit 06ba83c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Expand Up @@ -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;
}

Expand All @@ -58,7 +59,7 @@ public static class Execution extends AbstractSynchronousStepExecution<Void> {
@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) {
Expand Down
Expand Up @@ -54,12 +54,13 @@ public class JobPropertyStepTest {
@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);
Expand Down Expand Up @@ -87,7 +88,6 @@ public class JobPropertyStepTest {
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());
Expand Down

0 comments on commit 06ba83c

Please sign in to comment.