Search in sources :

Example 1 with BooleanParameterValue

use of hudson.model.BooleanParameterValue in project workflow-cps-plugin by jenkinsci.

the class SnippetizerTest method buildTriggerStep.

@Test
public void buildTriggerStep() throws Exception {
    BuildTriggerStep step = new BuildTriggerStep("downstream");
    st.assertRoundTrip(step, "build 'downstream'");
    step.setParameters(Arrays.asList(new StringParameterValue("branch", "default"), new BooleanParameterValue("correct", true)));
    if (StringParameterDefinition.DescriptorImpl.class.isAnnotationPresent(Symbol.class)) {
        st.assertRoundTrip(step, "build job: 'downstream', parameters: [string(name: 'branch', value: 'default'), booleanParam(name: 'correct', value: true)]");
    } else {
        // TODO 2.x delete
        st.assertRoundTrip(step, "build job: 'downstream', parameters: [[$class: 'StringParameterValue', name: 'branch', value: 'default'], [$class: 'BooleanParameterValue', name: 'correct', value: true]]");
    }
}
Also used : StringParameterDefinition(hudson.model.StringParameterDefinition) BooleanParameterValue(hudson.model.BooleanParameterValue) StringParameterValue(hudson.model.StringParameterValue) BuildTriggerStep(org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStep) Test(org.junit.Test)

Example 2 with BooleanParameterValue

use of hudson.model.BooleanParameterValue in project workflow-cps-plugin by jenkinsci.

the class ParamsVariableTest method smokes.

@Issue("JENKINS-27295")
@Test
public void smokes() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("echo(/TEXT=${params.TEXT} FLAG=${params.FLAG ? 'yes' : 'no'} PASS=${params.PASS}/)", true));
    p.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("TEXT", ""), new BooleanParameterDefinition("FLAG", false, null), new PasswordParameterDefinition("PASS", "", null)));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("TEXT", "hello"), new BooleanParameterValue("FLAG", true), new PasswordParameterValue("PASS", "s3cr3t"))));
    r.assertLogContains("TEXT=hello", b);
    r.assertLogContains("FLAG=yes", b);
    r.assertLogContains("PASS=s3cr3t", b);
}
Also used : StringParameterDefinition(hudson.model.StringParameterDefinition) BooleanParameterDefinition(hudson.model.BooleanParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) BooleanParameterValue(hudson.model.BooleanParameterValue) PasswordParameterDefinition(hudson.model.PasswordParameterDefinition) StringParameterValue(hudson.model.StringParameterValue) PasswordParameterValue(hudson.model.PasswordParameterValue) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) ParametersAction(hudson.model.ParametersAction) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test)

Aggregations

BooleanParameterValue (hudson.model.BooleanParameterValue)2 StringParameterDefinition (hudson.model.StringParameterDefinition)2 StringParameterValue (hudson.model.StringParameterValue)2 Test (org.junit.Test)2 BooleanParameterDefinition (hudson.model.BooleanParameterDefinition)1 ParametersAction (hudson.model.ParametersAction)1 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)1 PasswordParameterDefinition (hudson.model.PasswordParameterDefinition)1 PasswordParameterValue (hudson.model.PasswordParameterValue)1 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)1 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)1 BuildTriggerStep (org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStep)1 Issue (org.jvnet.hudson.test.Issue)1