use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project pipeline-aws-plugin by jenkinsci.
the class CFNDescribeStackTests method describe.
@Test
public void describe() throws Exception {
WorkflowJob job = this.jenkinsRule.jenkins.createProject(WorkflowJob.class, "cfnTest");
Mockito.when(this.stack.describeOutputs()).thenReturn(Collections.singletonMap("foo", "bar"));
job.setDefinition(new CpsFlowDefinition("" + "node {\n" + " def outputs = cfnDescribe(stack: 'foo')\n" + " echo \"foo=${outputs['foo']}\"" + "}\n", true));
Run run = this.jenkinsRule.assertBuildStatusSuccess(job.scheduleBuild2(0));
this.jenkinsRule.assertLogContains("foo=bar", run);
PowerMockito.verifyNew(CloudFormationStack.class).withArguments(Mockito.any(AmazonCloudFormation.class), Mockito.eq("foo"), Mockito.any(TaskListener.class));
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project pipeline-aws-plugin by jenkinsci.
the class CFNExecuteChangeSetTests method executeChangeSet.
@Test
public void executeChangeSet() throws Exception {
WorkflowJob job = this.jenkinsRule.jenkins.createProject(WorkflowJob.class, "cfnTest");
job.setDefinition(new CpsFlowDefinition("" + "node {\n" + " cfnExecuteChangeSet(stack: 'foo', changeSet: 'bar')" + "}\n", true));
this.jenkinsRule.assertBuildStatusSuccess(job.scheduleBuild2(0));
PowerMockito.verifyNew(CloudFormationStack.class, Mockito.atLeastOnce()).withArguments(Mockito.any(AmazonCloudFormation.class), Mockito.eq("foo"), Mockito.any(TaskListener.class));
Mockito.verify(this.stack).executeChangeSet(Mockito.eq("bar"), Mockito.anyLong());
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project pipeline-aws-plugin by jenkinsci.
the class CFNValidateStepTests method validateWithUrlSuccess.
@Test
public void validateWithUrlSuccess() throws Exception {
WorkflowJob job = this.jenkinsRule.jenkins.createProject(WorkflowJob.class, "cfnTest");
job.setDefinition(new CpsFlowDefinition("" + "node {\n" + " cfnValidate(url: 'foo')" + "}\n", true));
this.jenkinsRule.assertBuildStatusSuccess(job.scheduleBuild2(0));
ArgumentCaptor<ValidateTemplateRequest> captor = ArgumentCaptor.forClass(ValidateTemplateRequest.class);
Mockito.verify(this.cloudFormation).validateTemplate(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new ValidateTemplateRequest().withTemplateURL("foo"));
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary_with_text.
@Test
public void createSummary_with_text() throws Exception {
String icon = randomUUID().toString();
String text = randomUUID().toString();
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("def summary = createSummary(icon:\"" + icon + "\", text:\"" + text + "\")", true));
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
List<BadgeSummaryAction> summaryActions = b.getActions(BadgeSummaryAction.class);
assertEquals(1, summaryActions.size());
BadgeSummaryAction action = summaryActions.get(0);
assertTrue(action.getIconPath().endsWith(icon));
assertEquals(text, action.getText());
}
use of org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary.
private BadgeSummaryAction createSummary(String script) throws Exception {
String icon = randomUUID().toString();
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("def summary = createSummary(\"" + icon + "\")\n" + script, true));
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
List<BadgeSummaryAction> summaryActions = b.getActions(BadgeSummaryAction.class);
assertEquals(1, summaryActions.size());
BadgeSummaryAction action = summaryActions.get(0);
assertTrue(action.getIconPath().endsWith(icon));
return action;
}
Aggregations