@Test
@Ignore
public void testBuildStackCreateStackCalledAndContainsEveryRequiredParameter() {
// GIVEN
CreateStackRequest createStackRequest = new CreateStackRequest();
given(awsStackUtil.createCloudFormationClient(Regions.DEFAULT_REGION, (AwsCredential) credential)).willReturn(client);
given(client.createStack(any(CreateStackRequest.class))).willReturn(createStackResult);
given(createStackResult.getStackId()).willReturn(STACK_ID);
given(stackUpdater.updateStackResources(anyLong(), anySet())).willReturn(stack);
given(underTest.createStackRequest()).willReturn(createStackRequest);
given(cfTemplateBuilder.build(anyString(), anyInt(), anyBoolean())).willReturn("templatebody");
Map<String, Object> setupProperties = new HashMap<>();
setupProperties.put(SnsTopicManager.NOTIFICATION_TOPIC_ARN_KEY, "topicArn");
// WHEN
underTest.buildStack(stack, "test-userdata", setupProperties);
// THEN
assertEquals("topicArn", createStackRequest.getNotificationARNs().get(0));
assertEquals("templatebody", createStackRequest.getTemplateBody());
assertTrue(FluentIterable.from(createStackRequest.getParameters()).anyMatch(new Predicate<Parameter>() {
@Override
public boolean apply(Parameter parameter) {
return "SSHLocation".equals(parameter.getParameterKey()) && AwsConnectorTestUtil.SSH_LOCATION.equals(parameter.getParameterValue());
}
}));
assertTrue(FluentIterable.from(createStackRequest.getParameters()).anyMatch(new Predicate<Parameter>() {
@Override
public boolean apply(Parameter parameter) {
return "CBUserData".equals(parameter.getParameterKey()) && "test-userdata".equals(parameter.getParameterValue());
}
}));
assertTrue(FluentIterable.from(createStackRequest.getParameters()).anyMatch(new Predicate<Parameter>() {
@Override
public boolean apply(Parameter parameter) {
return "StackName".equals(parameter.getParameterKey()) && (AwsConnectorTestUtil.STACK_NAME + "-1").equals(parameter.getParameterValue());
}
}));
assertTrue(FluentIterable.from(createStackRequest.getParameters()).anyMatch(new Predicate<Parameter>() {
@Override
public boolean apply(Parameter parameter) {
return "InstanceCount".equals(parameter.getParameterKey()) && AwsConnectorTestUtil.NODE_COUNT.toString().equals(parameter.getParameterValue());
}
}));