use of com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices in project cloudbreak by hortonworks.
the class SupportedVersionService method collectSupportedVersions.
public SupportedVersions collectSupportedVersions() {
SupportedVersions supportedVersions = new SupportedVersions();
Set<SupportedVersion> supportedVersionsSet = new HashSet<>();
resolver.cdhConfigurations().forEach((key, value) -> {
SupportedVersion supportedVersion = new SupportedVersion();
supportedVersion.setType(key.getStackType());
supportedVersion.setVersion(key.getVersion());
SupportedServices supportedServices = new SupportedServices();
for (CdhService serviceName : value) {
for (ServiceConfig serviceInformation : resolver.serviceConfigs()) {
if (serviceInformation.getName().equals(serviceName.getName())) {
SupportedService supportedService = new SupportedService();
supportedService.setName(serviceInformation.getName());
supportedService.setDisplayName(serviceInformation.getDisplayName());
supportedService.setVersion(serviceName.getVersion());
supportedServices.getServices().add(supportedService);
break;
}
}
}
supportedVersion.setSupportedServices(supportedServices);
supportedVersionsSet.add(supportedVersion);
});
supportedVersions.setSupportedVersions(supportedVersionsSet);
return supportedVersions;
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices in project cloudbreak by hortonworks.
the class ParcelFilterServiceTest method testShouldReturnAllParcelsWhenTheServiceNamesInTheBlueprintContainsANullValue.
@Test
void testShouldReturnAllParcelsWhenTheServiceNamesInTheBlueprintContainsANullValue() {
String parcelUrl = "http://parcel1.com/";
String parcelName = "CUSTOM";
ClouderaManagerProduct parcel = new ClouderaManagerProduct().withParcel(parcelUrl).withName(parcelName);
SupportedService supportedService = new SupportedService();
supportedService.setComponentNameInParcel(null);
SupportedServices supportedServices = new SupportedServices();
supportedServices.setServices(Set.of(supportedService));
when(clusterTemplateGeneratorService.getServicesByBlueprint(BLUEPRINT_TEXT)).thenReturn(supportedServices);
assertEquals(1, underTest.filterParcelsByBlueprint(STACK_ID, Set.of(parcel), getBlueprint()).size());
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices in project cloudbreak by hortonworks.
the class ParcelFilterServiceTest method getSupportedServices.
private SupportedServices getSupportedServices(Set<String> componentNames) {
SupportedServices supportedServices = new SupportedServices();
Set<SupportedService> services = componentNames.stream().map(s -> {
SupportedService supportedService = new SupportedService();
supportedService.setComponentNameInParcel(s);
return supportedService;
}).collect(Collectors.toSet());
supportedServices.setServices(services);
return supportedServices;
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices 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;
}
Aggregations