Search in sources :

Example 21 with AmazonCloudFormation

use of com.amazonaws.services.cloudformation.AmazonCloudFormation 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));
}
Also used : AmazonCloudFormation(com.amazonaws.services.cloudformation.AmazonCloudFormation) TaskListener(hudson.model.TaskListener) AmazonCloudFormationWaiters(com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters) Waiter(com.amazonaws.waiters.Waiter) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

AmazonCloudFormation (com.amazonaws.services.cloudformation.AmazonCloudFormation)21 TaskListener (hudson.model.TaskListener)17 Test (org.junit.Test)17 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)17 AmazonCloudFormationWaiters (com.amazonaws.services.cloudformation.waiters.AmazonCloudFormationWaiters)10 Waiter (com.amazonaws.waiters.Waiter)9 AwsSyncClientBuilder (com.amazonaws.client.builder.AwsSyncClientBuilder)4 Before (org.junit.Before)4 EnvVars (hudson.EnvVars)3 StepContext (org.jenkinsci.plugins.workflow.steps.StepContext)1