use of hudson.model.TaskListener 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));
Mockito.when(client.describeStacks(new DescribeStacksRequest().withStackName("foo"))).thenReturn(new DescribeStacksResult().withStacks(new Stack().withStackStatus("CREATE_COMPLETE")));
CloudFormationStack stack = new CloudFormationStack(client, "foo", taskListener);
stack.createChangeSet("c1", "templateBody", null, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), PollConfiguration.DEFAULT, ChangeSetType.UPDATE, "myarn", null);
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.emptyList()).withChangeSetName("c1").withRoleARN("myarn"));
Mockito.verify(this.eventPrinter).waitAndPrintChangeSetEvents(Mockito.eq("foo"), Mockito.eq("c1"), Mockito.any(Waiter.class), Mockito.eq(PollConfiguration.DEFAULT));
}
use of hudson.model.TaskListener in project pipeline-aws-plugin by jenkinsci.
the class EBTestingUtils method setupStepContext.
static StepContext setupStepContext() throws Exception {
StepContext context = Mockito.mock(StepContext.class);
TaskListener listener = Mockito.mock(TaskListener.class);
Mockito.when(listener.getLogger()).thenReturn(Mockito.mock(PrintStream.class));
Mockito.when(context.get(TaskListener.class)).thenReturn(listener);
Mockito.when(context.get(EnvVars.class)).thenReturn(new EnvVars());
return context;
}
Aggregations