use of com.amazonaws.services.cloudformation.model.RollbackConfiguration in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method updateStack.
@Test
public void updateStack() throws ExecutionException {
TaskListener taskListener = Mockito.mock(TaskListener.class);
Mockito.when(taskListener.getLogger()).thenReturn(System.out);
AmazonCloudFormation client = Mockito.mock(AmazonCloudFormation.class);
Mockito.when(client.waiters()).thenReturn(new AmazonCloudFormationWaiters(client));
Mockito.when(client.describeStacks(new DescribeStacksRequest().withStackName("foo"))).thenReturn(new DescribeStacksResult().withStacks(new Stack().withOutputs(new Output().withOutputKey("bar").withOutputValue("baz"))));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
RollbackConfiguration rollbackConfig = new RollbackConfiguration().withMonitoringTimeInMinutes(10);
Map<String, String> outputs = stack.update("templateBody", null, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), PollConfiguration.DEFAULT, "myarn", rollbackConfig);
ArgumentCaptor<UpdateStackRequest> captor = ArgumentCaptor.forClass(UpdateStackRequest.class);
Mockito.verify(client).updateStack(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new UpdateStackRequest().withStackName("foo").withTemplateBody("templateBody").withCapabilities(Capability.values()).withParameters(Collections.emptyList()).withRoleARN("myarn").withRollbackConfiguration(rollbackConfig));
Mockito.verify(this.eventPrinter).waitAndPrintStackEvents(Mockito.eq("foo"), Mockito.any(Waiter.class), Mockito.eq(PollConfiguration.DEFAULT));
Assertions.assertThat(outputs).containsEntry("bar", "baz").containsEntry("jenkinsStackUpdateStatus", "true");
}
use of com.amazonaws.services.cloudformation.model.RollbackConfiguration in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method updateStackWithPreviousTemplate.
@Test
public void updateStackWithPreviousTemplate() throws ExecutionException {
TaskListener taskListener = Mockito.mock(TaskListener.class);
Mockito.when(taskListener.getLogger()).thenReturn(System.out);
AmazonCloudFormation client = Mockito.mock(AmazonCloudFormation.class);
Mockito.when(client.waiters()).thenReturn(new AmazonCloudFormationWaiters(client));
Mockito.when(client.describeStacks(new DescribeStacksRequest().withStackName("foo"))).thenReturn(new DescribeStacksResult().withStacks(new Stack().withOutputs(new Output().withOutputKey("bar").withOutputValue("baz"))));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
RollbackConfiguration rollbackConfig = new RollbackConfiguration().withMonitoringTimeInMinutes(10);
Map<String, String> outputs = stack.update(null, null, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), PollConfiguration.DEFAULT, "myarn", rollbackConfig);
ArgumentCaptor<UpdateStackRequest> captor = ArgumentCaptor.forClass(UpdateStackRequest.class);
Mockito.verify(client).updateStack(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new UpdateStackRequest().withStackName("foo").withUsePreviousTemplate(true).withCapabilities(Capability.values()).withParameters(Collections.emptyList()).withRoleARN("myarn").withRollbackConfiguration(rollbackConfig));
Mockito.verify(this.eventPrinter).waitAndPrintStackEvents(Mockito.eq("foo"), Mockito.any(Waiter.class), Mockito.eq(PollConfiguration.DEFAULT));
Assertions.assertThat(outputs).containsEntry("bar", "baz").containsEntry("jenkinsStackUpdateStatus", "true");
}
use of com.amazonaws.services.cloudformation.model.RollbackConfiguration in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method updateStackWithTemplateUrl.
@Test
public void updateStackWithTemplateUrl() throws ExecutionException {
TaskListener taskListener = Mockito.mock(TaskListener.class);
Mockito.when(taskListener.getLogger()).thenReturn(System.out);
AmazonCloudFormation client = Mockito.mock(AmazonCloudFormation.class);
Mockito.when(client.waiters()).thenReturn(new AmazonCloudFormationWaiters(client));
Mockito.when(client.describeStacks(new DescribeStacksRequest().withStackName("foo"))).thenReturn(new DescribeStacksResult().withStacks(new Stack().withOutputs(new Output().withOutputKey("bar").withOutputValue("baz"))));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
RollbackConfiguration rollbackConfig = new RollbackConfiguration().withMonitoringTimeInMinutes(10);
Map<String, String> outputs = stack.update(null, "bar", Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), PollConfiguration.DEFAULT, "myarn", rollbackConfig);
ArgumentCaptor<UpdateStackRequest> captor = ArgumentCaptor.forClass(UpdateStackRequest.class);
Mockito.verify(client).updateStack(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new UpdateStackRequest().withStackName("foo").withTemplateURL("bar").withCapabilities(Capability.values()).withParameters(Collections.emptyList()).withRoleARN("myarn").withRollbackConfiguration(rollbackConfig));
Mockito.verify(this.eventPrinter).waitAndPrintStackEvents(Mockito.eq("foo"), Mockito.any(Waiter.class), Mockito.eq(PollConfiguration.DEFAULT));
Assertions.assertThat(outputs).containsEntry("bar", "baz").containsEntry("jenkinsStackUpdateStatus", "true");
}
Aggregations