use of com.sequenceiq.cloudbreak.cloud.openstack.heat.HeatTemplateBuilder.ModelContext in project cloudbreak by hortonworks.
the class HeatTemplateBuilderTest method buildTestWithAssignFloatingIpWithoutExistingNetworkAndExistingSubnet.
@Test
public void buildTestWithAssignFloatingIpWithoutExistingNetworkAndExistingSubnet() throws Exception {
// GIVEN
boolean existingNetwork = false;
boolean existingSubnet = false;
NeutronNetworkView neutronNetworkView = createNeutronNetworkView("floating_pool_id");
// WHEN
when(openStackUtil.adjustStackNameLength(Mockito.anyString())).thenReturn("t");
ModelContext modelContext = new ModelContext();
modelContext.withExistingNetwork(existingNetwork);
modelContext.withExistingSubnet(existingSubnet);
modelContext.withGroups(groups);
modelContext.withInstanceUserData(image);
modelContext.withLocation(location());
modelContext.withStackName(stackName);
modelContext.withNeutronNetworkView(neutronNetworkView);
modelContext.withTemplateString(heatTemplateBuilder.getTemplate());
String templateString = heatTemplateBuilder.build(modelContext);
// THEN
assertThat(templateString, containsString("name: cb-sec-group_" + 't'));
assertThat(templateString, not(containsString("app_net_id")));
assertThat(templateString, containsString("app_network"));
assertThat(templateString, containsString("subnet_id"));
assertThat(templateString, containsString("app_subnet"));
assertThat(templateString, containsString("network_id"));
assertThat(templateString, containsString("public_net_id"));
}
Aggregations