use of com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method updateStackWithStackChangeSet.
@Test
public void updateStackWithStackChangeSet() 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));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
stack.createChangeSet("c1", "templateBody", null, Collections.<Parameter>emptyList(), Collections.<Tag>emptyList(), 25, ChangeSetType.UPDATE, "myarn");
ArgumentCaptor<CreateChangeSetRequest> captor = ArgumentCaptor.forClass(CreateChangeSetRequest.class);
Mockito.verify(client).createChangeSet(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new CreateChangeSetRequest().withChangeSetType(ChangeSetType.UPDATE).withStackName("foo").withTemplateBody("templateBody").withCapabilities(Capability.values()).withParameters(Collections.<Parameter>emptyList()).withChangeSetName("c1").withRoleARN("myarn"));
Mockito.verify(this.eventPrinter).waitAndPrintChangeSetEvents(Mockito.eq("foo"), Mockito.eq("c1"), Mockito.any(Waiter.class), Mockito.eq(25L));
}
use of com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method deleteStack.
@Test
public void deleteStack() 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));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
stack.delete(7);
ArgumentCaptor<DeleteStackRequest> captor = ArgumentCaptor.forClass(DeleteStackRequest.class);
Mockito.verify(client).deleteStack(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new DeleteStackRequest().withStackName("foo"));
Mockito.verify(this.eventPrinter).waitAndPrintStackEvents(Mockito.eq("foo"), Mockito.any(Waiter.class), Mockito.eq(7L));
}
use of com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters 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));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
stack.update(null, "bar", Collections.<Parameter>emptyList(), Collections.<Tag>emptyList(), 21, "myarn");
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.<Parameter>emptyList()).withRoleARN("myarn"));
Mockito.verify(this.eventPrinter).waitAndPrintStackEvents(Mockito.eq("foo"), Mockito.any(Waiter.class), Mockito.eq(21L));
}
use of com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method createStackWithNoTemplate.
@Test(expected = IllegalArgumentException.class)
public void createStackWithNoTemplate() throws ExecutionException {
AmazonCloudFormation client = Mockito.mock(AmazonCloudFormation.class);
try {
TaskListener taskListener = Mockito.mock(TaskListener.class);
Mockito.when(client.waiters()).thenReturn(new AmazonCloudFormationWaiters(client));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
stack.create(null, null, Collections.<Parameter>emptyList(), Collections.<Tag>emptyList(), 3, 21, "myarn", OnFailure.ROLLBACK.toString());
} finally {
Mockito.verifyZeroInteractions(client);
}
}
use of com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters in project pipeline-aws-plugin by jenkinsci.
the class CloudformationStackTests method createStackWithTemplateUrl.
@Test
public void createStackWithTemplateUrl() 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));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
stack.create(null, "bar", Collections.<Parameter>emptyList(), Collections.<Tag>emptyList(), 3, 21, "myarn", OnFailure.DO_NOTHING.toString());
ArgumentCaptor<CreateStackRequest> captor = ArgumentCaptor.forClass(CreateStackRequest.class);
Mockito.verify(client).createStack(captor.capture());
Assertions.assertThat(captor.getValue()).isEqualTo(new CreateStackRequest().withStackName("foo").withTemplateURL("bar").withCapabilities(Capability.values()).withParameters(Collections.<Parameter>emptyList()).withTimeoutInMinutes(3).withOnFailure(OnFailure.DO_NOTHING).withRoleARN("myarn"));
Mockito.verify(this.eventPrinter).waitAndPrintStackEvents(Mockito.eq("foo"), Mockito.any(Waiter.class), Mockito.eq(21L));
}
Aggregations