use of com.amazonaws.services.cloudformation.model.ValidateTemplateRequest 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 com.amazonaws.services.cloudformation.model.ValidateTemplateRequest in project pipeline-aws-plugin by jenkinsci.
the class CFNValidateStepTests method validateWithUrlFailure.
@Test
public void validateWithUrlFailure() throws Exception {
WorkflowJob job = this.jenkinsRule.jenkins.createProject(WorkflowJob.class, "cfnTest");
AmazonCloudFormationException ex = new AmazonCloudFormationException("invalid template");
Mockito.when(this.cloudFormation.validateTemplate(Mockito.any(ValidateTemplateRequest.class))).thenThrow(ex);
job.setDefinition(new CpsFlowDefinition("" + "node {\n" + " cfnValidate(url: 'foo')" + "}\n", true));
this.jenkinsRule.assertBuildStatus(Result.FAILURE, 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"));
}
Aggregations