use of com.sequenceiq.cloudbreak.cloud.aws.CloudFormationTemplateBuilder.ModelContext in project cloudbreak by hortonworks.
the class CloudFormationTemplateBuilderTest method buildTestWithVPCAndIGWAndPublicIpOnLaunchAndInstanceProfileAndRole.
@Test
public void buildTestWithVPCAndIGWAndPublicIpOnLaunchAndInstanceProfileAndRole() throws Exception {
// GIVEN
boolean existingVPC = true;
boolean existingIGW = true;
boolean mapPublicIpOnLaunch = true;
boolean enableInstanceProfile = true;
boolean instanceProfileAvailable = true;
// WHEN
modelContext = new ModelContext().withAuthenticatedContext(authenticatedContext).withStack(cloudStack).withExistingVpc(existingVPC).withExistingIGW(existingIGW).withExistingSubnetCidr(Lists.newArrayList(existingSubnetCidr)).mapPublicIpOnLaunch(mapPublicIpOnLaunch).withEnableInstanceProfile(enableInstanceProfile).withInstanceProfileAvailable(instanceProfileAvailable).withTemplate(awsCloudFormationTemplate);
when(defaultCostTaggingService.prepareAllTagsForTemplate()).thenReturn(defaultTags);
String templateString = cloudFormationTemplateBuilder.build(modelContext);
// THEN
assertThat(templateString, containsString("InstanceProfile"));
assertThat(templateString, containsString("VPCId"));
assertThat(templateString, not(containsString("SubnetCIDR")));
assertThat(templateString, containsString("SubnetId"));
assertThat(templateString, not(containsString("SubnetConfig")));
assertThat(templateString, not(containsString("\"AttachGateway\"")));
assertThat(templateString, not(containsString("\"InternetGateway\"")));
assertThat(templateString, containsString("AvailabilitySet"));
assertThat(templateString, containsString("EIP"));
}
use of com.sequenceiq.cloudbreak.cloud.aws.CloudFormationTemplateBuilder.ModelContext in project cloudbreak by hortonworks.
the class CloudFormationTemplateBuilderTest method buildTestWithVPCAndIGWAndInstanceProfileAndRoleWithoutPublicIpOnLaunch.
@Test
public void buildTestWithVPCAndIGWAndInstanceProfileAndRoleWithoutPublicIpOnLaunch() throws Exception {
// GIVEN
boolean existingVPC = true;
boolean existingIGW = true;
boolean mapPublicIpOnLaunch = false;
boolean enableInstanceProfile = true;
boolean instanceProfileAvailable = true;
// WHEN
modelContext = new ModelContext().withAuthenticatedContext(authenticatedContext).withStack(cloudStack).withExistingVpc(existingVPC).withExistingIGW(existingIGW).withExistingSubnetCidr(Lists.newArrayList(existingSubnetCidr)).mapPublicIpOnLaunch(mapPublicIpOnLaunch).withEnableInstanceProfile(enableInstanceProfile).withInstanceProfileAvailable(instanceProfileAvailable).withTemplate(awsCloudFormationTemplate);
when(defaultCostTaggingService.prepareAllTagsForTemplate()).thenReturn(defaultTags);
String templateString = cloudFormationTemplateBuilder.build(modelContext);
// THEN
assertThat(templateString, containsString("InstanceProfile"));
assertThat(templateString, containsString("VPCId"));
assertThat(templateString, not(containsString("SubnetCIDR")));
assertThat(templateString, containsString("SubnetId"));
assertThat(templateString, not(containsString("SubnetConfig")));
assertThat(templateString, not(containsString("\"AttachGateway\"")));
assertThat(templateString, not(containsString("\"InternetGateway\"")));
assertThat(templateString, containsString("AvailabilitySet"));
assertThat(templateString, not(containsString("EIP")));
}
use of com.sequenceiq.cloudbreak.cloud.aws.CloudFormationTemplateBuilder.ModelContext in project cloudbreak by hortonworks.
the class CloudFormationTemplateBuilderTest method buildTestWithVPCWithoutIGWAndPublicIpOnLaunchAndInstanceProfileAndRole.
@Test
public void buildTestWithVPCWithoutIGWAndPublicIpOnLaunchAndInstanceProfileAndRole() throws Exception {
// GIVEN
boolean existingVPC = true;
boolean existingIGW = false;
boolean mapPublicIpOnLaunch = false;
boolean enableInstanceProfile = false;
boolean instanceProfileAvailable = false;
// WHEN
modelContext = new ModelContext().withAuthenticatedContext(authenticatedContext).withStack(cloudStack).withExistingVpc(existingVPC).withExistingIGW(existingIGW).withExistingSubnetCidr(Lists.newArrayList(existingSubnetCidr)).mapPublicIpOnLaunch(mapPublicIpOnLaunch).withEnableInstanceProfile(enableInstanceProfile).withInstanceProfileAvailable(instanceProfileAvailable).withTemplate(awsCloudFormationTemplate);
when(defaultCostTaggingService.prepareAllTagsForTemplate()).thenReturn(defaultTags);
String templateString = cloudFormationTemplateBuilder.build(modelContext);
// THEN
assertThat(templateString, not(containsString("InstanceProfile")));
assertThat(templateString, containsString("VPCId"));
assertThat(templateString, not(containsString("SubnetCIDR")));
assertThat(templateString, containsString("SubnetId"));
assertThat(templateString, not(containsString("SubnetConfig")));
assertThat(templateString, not(containsString("\"AttachGateway\"")));
assertThat(templateString, not(containsString("\"InternetGateway\"")));
assertThat(templateString, containsString("AvailabilitySet"));
assertThat(templateString, not(containsString("EIP")));
}
use of com.sequenceiq.cloudbreak.cloud.aws.CloudFormationTemplateBuilder.ModelContext in project cloudbreak by hortonworks.
the class CloudFormationTemplateBuilderTest method buildTestWithVPCAndIGWAndPublicIpOnLaunchAndRoleWithoutInstanceProfile.
@Test
public void buildTestWithVPCAndIGWAndPublicIpOnLaunchAndRoleWithoutInstanceProfile() throws Exception {
// GIVEN
boolean existingVPC = true;
boolean existingIGW = true;
boolean mapPublicIpOnLaunch = true;
boolean enableInstanceProfile = false;
boolean instanceProfileAvailable = true;
// WHEN
modelContext = new ModelContext().withAuthenticatedContext(authenticatedContext).withStack(cloudStack).withExistingVpc(existingVPC).withExistingIGW(existingIGW).withExistingSubnetCidr(Lists.newArrayList(existingSubnetCidr)).mapPublicIpOnLaunch(mapPublicIpOnLaunch).withEnableInstanceProfile(enableInstanceProfile).withInstanceProfileAvailable(instanceProfileAvailable).withTemplate(awsCloudFormationTemplate);
when(defaultCostTaggingService.prepareAllTagsForTemplate()).thenReturn(defaultTags);
String templateString = cloudFormationTemplateBuilder.build(modelContext);
// THEN
assertThat(templateString, containsString("InstanceProfile"));
assertThat(templateString, containsString("VPCId"));
assertThat(templateString, not(containsString("SubnetCIDR")));
assertThat(templateString, containsString("SubnetId"));
assertThat(templateString, not(containsString("SubnetConfig")));
assertThat(templateString, not(containsString("\"AttachGateway\"")));
assertThat(templateString, not(containsString("\"InternetGateway\"")));
assertThat(templateString, containsString("AvailabilitySet"));
assertThat(templateString, containsString("EIP"));
}
use of com.sequenceiq.cloudbreak.cloud.aws.CloudFormationTemplateBuilder.ModelContext in project cloudbreak by hortonworks.
the class CloudFormationTemplateBuilderTest method buildTestWithVPCAndIGWAndRoleWithoutPublicIpOnLaunchAndInstanceProfile.
@Test
public void buildTestWithVPCAndIGWAndRoleWithoutPublicIpOnLaunchAndInstanceProfile() throws Exception {
// GIVEN
boolean existingVPC = true;
boolean existingIGW = true;
boolean mapPublicIpOnLaunch = false;
boolean enableInstanceProfile = false;
boolean instanceProfileAvailable = true;
// WHEN
modelContext = new ModelContext().withAuthenticatedContext(authenticatedContext).withStack(cloudStack).withExistingVpc(existingVPC).withExistingIGW(existingIGW).withExistingSubnetCidr(Lists.newArrayList(existingSubnetCidr)).mapPublicIpOnLaunch(mapPublicIpOnLaunch).withEnableInstanceProfile(enableInstanceProfile).withInstanceProfileAvailable(instanceProfileAvailable).withTemplate(awsCloudFormationTemplate);
when(defaultCostTaggingService.prepareAllTagsForTemplate()).thenReturn(defaultTags);
String templateString = cloudFormationTemplateBuilder.build(modelContext);
// THEN
assertThat(templateString, containsString("InstanceProfile"));
assertThat(templateString, containsString("VPCId"));
assertThat(templateString, not(containsString("SubnetCIDR")));
assertThat(templateString, containsString("SubnetId"));
assertThat(templateString, not(containsString("SubnetConfig")));
assertThat(templateString, not(containsString("\"AttachGateway\"")));
assertThat(templateString, not(containsString("\"InternetGateway\"")));
assertThat(templateString, containsString("AvailabilitySet"));
assertThat(templateString, not(containsString("EIP")));
}
Aggregations