use of com.cloudera.api.swagger.model.ApiClusterTemplate in project cloudbreak by hortonworks.
the class CentralCmTemplateUpdaterTest method danglingVariableReferencesAreRemoved.
@Test
public void danglingVariableReferencesAreRemoved() {
when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-variables.bp"));
ApiClusterTemplate generated = testGetCmTemplate();
assertMatchesBlueprintAtPath("output/clouderamanager-variables.bp", generated);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplate in project cloudbreak by hortonworks.
the class CentralCmTemplateUpdaterTest method getCmTemplate.
@Test
public void getCmTemplate() {
when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager.bp"));
ApiClusterTemplate generated = testGetCmTemplate();
assertMatchesBlueprintAtPath("output/clouderamanager.bp", generated);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplate in project cloudbreak by hortonworks.
the class CentralCmTemplateUpdaterTest method getCmTemplateWhenShouldNotSplitJNAndZK.
@Test
public void getCmTemplateWhenShouldNotSplitJNAndZK() {
when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/cb5660.bp"));
ApiClusterTemplate generated = testGetCmTemplate();
assertMatchesBlueprintAtPath("output/cb5660.bp", generated);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplate in project cloudbreak by hortonworks.
the class CentralCmTemplateUpdaterTest method getCmTemplateNoMetastore.
@Test
public void getCmTemplateNoMetastore() {
when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-nometastore.bp"));
ApiClusterTemplate generated = testGetCmTemplate();
assertMatchesBlueprintAtPath("output/clouderamanager-nometastore.bp", generated);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplate in project cloudbreak by hortonworks.
the class StackResponseUtils method getRoleConfigNameForHostGroup.
public String getRoleConfigNameForHostGroup(StackV4Response stackResponse, String hostGroupName, String serviceType, String roleType) throws Exception {
String template = stackResponse.getCluster().getBlueprint().getBlueprint();
ApiClusterTemplate cmTemplate = JsonUtil.readValue(template, ApiClusterTemplate.class);
Set<String> hostGroupRoleConfigNames = cmTemplate.getHostTemplates().stream().filter(clusterTemplate -> clusterTemplate.getRefName().equalsIgnoreCase(hostGroupName)).findFirst().map(ApiClusterTemplateHostTemplate::getRoleConfigGroupsRefNames).orElse(List.of()).stream().collect(Collectors.toSet());
String roleReferenceName = cmTemplate.getServices().stream().filter(s -> s.getServiceType().equalsIgnoreCase(serviceType)).findFirst().map(ApiClusterTemplateService::getRoleConfigGroups).orElse(List.of()).stream().filter(rcg -> rcg.getRoleType().equalsIgnoreCase(roleType)).filter(rcg -> hostGroupRoleConfigNames.contains(rcg.getRefName())).map(ApiClusterTemplateRoleConfigGroup::getRefName).findFirst().orElseThrow(() -> new Exception(String.format("Unable to retrieve RoleConfigGroupRefName for Service '%s', RoleType '%s'," + " HostGroup '%s', Cluster '%s'", serviceType, roleType, hostGroupName, stackResponse.getCrn())));
return roleReferenceName;
}
Aggregations