Search in sources :

Example 6 with SupportedService

use of com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedService in project cloudbreak by hortonworks.

the class DeclaredVersionService method collectDeclaredVersions.

public SupportedServices collectDeclaredVersions(String blueprintText) {
    SupportedServices supportedServices = new SupportedServices();
    Set<SupportedService> services = new HashSet<>();
    CmTemplateProcessor cmTemplateProcessor = cmTemplateProcessorFactory.get(blueprintText);
    String cdhVersion = cmTemplateProcessor.getTemplate().getCdhVersion();
    StackVersion stackVersion = new StackVersion();
    stackVersion.setVersion(cdhVersion);
    stackVersion.setStackType("CDH");
    Set<CdhService> cdhServices = cmTemplateGeneratorConfigurationResolver.cdhConfigurations().get(stackVersion);
    if (cdhServices == null) {
        cdhServices = fallbackForDefault();
    }
    for (ApiClusterTemplateService service : cmTemplateProcessor.getTemplate().getServices()) {
        SupportedService supportedService = new SupportedService();
        supportedService.setName(service.getServiceType());
        for (CdhService cdhService : cdhServices) {
            if (cdhService.getName().equals(service.getServiceType())) {
                supportedService.setVersion(cdhService.getVersion());
            }
        }
        for (ServiceConfig serviceConfig : cmTemplateGeneratorConfigurationResolver.serviceConfigs()) {
            if (serviceConfig.getName().equals(service.getServiceType())) {
                supportedService.setDisplayName(serviceConfig.getDisplayName());
                supportedService.setComponentNameInParcel(serviceConfig.getComponentNameInParcel());
            }
        }
        if (!Strings.isNullOrEmpty(supportedService.getDisplayName()) && !Strings.isNullOrEmpty(supportedService.getVersion())) {
            services.add(supportedService);
        }
    }
    supportedServices.setServices(services);
    return supportedServices;
}
Also used : SupportedService(com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedService) CdhService(com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.versionmatrix.CdhService) ServiceConfig(com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) SupportedServices(com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) HashSet(java.util.HashSet) StackVersion(com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.StackVersion)

Aggregations

SupportedService (com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedService)6 SupportedServices (com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices)4 HashSet (java.util.HashSet)3 SupportedServiceV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.SupportedServiceV4Response)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)2 ServiceConfig (com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig)2 CdhService (com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.versionmatrix.CdhService)2 SupportedVersion (com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedVersion)2 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)1 BlueprintServicesV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintServicesV4Response)1 SupportedVersionV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.SupportedVersionV4Response)1 SupportedVersionsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.SupportedVersionsV4Response)1 CmTemplateGeneratorService (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateGeneratorService)1 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)1 StackVersion (com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.StackVersion)1 SupportedVersions (com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedVersions)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 ImageReaderService (com.sequenceiq.cloudbreak.service.upgrade.sync.component.ImageReaderService)1