Search in sources :

Example 6 with ApiClusterTemplate

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);
}
Also used : ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 7 with ApiClusterTemplate

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);
}
Also used : ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 8 with ApiClusterTemplate

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);
}
Also used : ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 9 with ApiClusterTemplate

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);
}
Also used : ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 10 with ApiClusterTemplate

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;
}
Also used : ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) InstanceMetadataType(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceMetadataType) InstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus) Set(java.util.Set) JsonUtil(com.sequenceiq.cloudbreak.common.json.JsonUtil) ApiClusterTemplateHostTemplate(com.cloudera.api.swagger.model.ApiClusterTemplateHostTemplate) Collectors(java.util.stream.Collectors) InstanceMetaDataV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.instancemetadata.InstanceMetaDataV4Response) List(java.util.List) Service(org.springframework.stereotype.Service) Map(java.util.Map) ApiClusterTemplateRoleConfigGroup(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup) Optional(java.util.Optional) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) ApiClusterTemplateRoleConfigGroup(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate)

Aggregations

ApiClusterTemplate (com.cloudera.api.swagger.model.ApiClusterTemplate)15 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)3 ApiException (com.cloudera.api.swagger.client.ApiException)2 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)2 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)2 ClusterClientInitException (com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException)2 ClouderaManagerClientInitException (com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException)2 CloudStorageConfigurationFailedException (com.sequenceiq.cloudbreak.cm.exception.CloudStorageConfigurationFailedException)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)2 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)2 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)2 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)2 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)2 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)2 IOException (java.io.IOException)2 List (java.util.List)2 ClouderaManagerResourceApi (com.cloudera.api.swagger.ClouderaManagerResourceApi)1