use of com.cloudera.api.swagger.model.ApiClusterTemplateHostInfo in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method verifyHostInfo.
private void verifyHostInfo(List<ApiClusterTemplateHostInfo> hosts, String hostTemplateRefNameExpected, String hostNameExpected, String rackIdExpected) {
Optional<ApiClusterTemplateHostInfo> hostInfoOptional = hosts.stream().filter(h -> h.getHostName().equals(hostNameExpected)).findFirst();
assertThat(hostInfoOptional).isNotEmpty();
ApiClusterTemplateHostInfo hostInfo = hostInfoOptional.get();
assertThat(hostInfo).isNotNull();
assertThat(hostInfo.getHostTemplateRefName()).isEqualTo(hostTemplateRefNameExpected);
assertThat(hostInfo.getRackId()).isEqualTo(rackIdExpected);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateHostInfo in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method addHostsTest.
@Test
void addHostsTest() {
Map<String, List<Map<String, String>>> hostGroupMappings = Map.ofEntries(entry("hostGroup1", List.of()), entry("hostGroup2", List.of(hostAttributes("host2_1", false, null), hostAttributes("host2_2", true, null))), entry("hostGroup3", List.of(hostAttributes("host3_1", true, ""), hostAttributes("host3_2", true, "/rack3_2"))));
underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager.bp"));
ApiClusterTemplate template = underTest.getTemplate();
ApiClusterTemplateInstantiator instantiator = new ApiClusterTemplateInstantiator();
template.setInstantiator(instantiator);
underTest.addHosts(hostGroupMappings);
List<ApiClusterTemplateHostInfo> hosts = instantiator.getHosts();
assertThat(hosts).hasSize(4);
verifyHostInfo(hosts, "hostGroup2", "host2_1", null);
verifyHostInfo(hosts, "hostGroup2", "host2_2", null);
verifyHostInfo(hosts, "hostGroup3", "host3_1", null);
verifyHostInfo(hosts, "hostGroup3", "host3_2", "/rack3_2");
}
Aggregations