use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project workflow-cps-plugin by jenkinsci.
the class DSLTest method dollar_class_must_die2.
/**
* Split arguments between meta step and state
*/
@Issue("JENKINS-29922")
@Test
public void dollar_class_must_die2() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "die2");
p.setDefinition(new CpsFlowDefinition("california ocean:'pacific', mountain:'sierra', moderate:true", true));
assertThat(JenkinsRule.getLog(r.assertBuildStatusSuccess(p.scheduleBuild2(0))).replace("\r\n", "\n"), containsString("Introducing california\nCalifornia from pacific to sierra"));
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project workflow-cps-plugin by jenkinsci.
the class DSLTest method monomorphic.
/**
* Tests the ability to execute a step with an unnamed monomorphic describable argument.
*/
@Issue("JENKINS-29711")
@Test
public void monomorphic() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "mon");
p.setDefinition(new CpsFlowDefinition("monomorphStep([firstArg:'one', secondArg:'two'])", true));
r.assertLogContains("First arg: one, second arg: two", r.assertBuildStatusSuccess(p.scheduleBuild2(0)));
WorkflowRun run = p.getLastBuild();
LinearScanner scanner = new LinearScanner();
FlowNode node = scanner.findFirstMatch(run.getExecution().getCurrentHeads(), new NodeStepTypePredicate("monomorphStep"));
ArgumentsAction argumentsAction = node.getPersistentAction(ArgumentsAction.class);
Assert.assertNotNull(argumentsAction);
Assert.assertEquals("one,two", ArgumentsAction.getStepArgumentsAsString(node));
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project workflow-cps-plugin by jenkinsci.
the class DSLTest method monomorphicSymbol.
@Issue("JENKINS-29711")
@Test
public void monomorphicSymbol() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "monSymbol");
p.setDefinition(new CpsFlowDefinition("monomorphWithSymbolStep monomorphSymbol(firstArg: 'one', secondArg: 'two')", true));
r.assertLogContains("First arg: one, second arg: two", r.assertBuildStatusSuccess(p.scheduleBuild2(0)));
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project workflow-cps-plugin by jenkinsci.
the class DSLTest method monomorphicList.
/**
* Tests the ability to execute a step with an unnamed monomorphic list argument.
*/
@Issue("JENKINS-29711")
@Test
public void monomorphicList() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "monList");
p.setDefinition(new CpsFlowDefinition("monomorphListStep([[firstArg:'one', secondArg:'two'], [firstArg:'three', secondArg:'four']])", true));
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
r.assertLogContains("First arg: one, second arg: two", b);
r.assertLogContains("First arg: three, second arg: four", b);
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project workflow-cps-plugin by jenkinsci.
the class CpsStringGroovyMethodsTest method replaceAll.
@Test
public void replaceAll() throws Exception {
WorkflowJob j = r.createProject(WorkflowJob.class, "replaceAll");
j.setDefinition(new CpsFlowDefinition("assert 'foobarfoobarfoo'.replaceAll('foo') {\n" + " it.reverse()\n" + "} == 'oofbaroofbaroof'\n", true));
r.buildAndAssertSuccess(j);
}
Aggregations