use of com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix in project cloudbreak by hortonworks.
the class ServiceDependencyMatrixServiceTest method test.
@Test
public void test() {
ServiceDependencyMatrix serviceDependencyMatrix = serviceDependencyMatrixService().collectServiceDependencyMatrix(inputs, stackType, version);
Assert.assertEquals(dependencies, serviceDependencyMatrix.getDependencies().getServices());
Assert.assertEquals(inputs, serviceDependencyMatrix.getServices().getServices());
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix in project cloudbreak by hortonworks.
the class ClusterTemplateGeneratorServiceTest method testGenerateTemplateByServicesShouldCallGenerationWithTheSetOfSpecifiedAndDependentServices.
@Test
void testGenerateTemplateByServicesShouldCallGenerationWithTheSetOfSpecifiedAndDependentServices() {
Set<String> services = Set.of("HDFS", "HIVE");
ServiceDependencyMatrix dependentServices = new ServiceDependencyMatrix();
Dependencies dependencies = new Dependencies();
dependencies.setServices(Set.of("ZOOKEEPER"));
dependentServices.setDependencies(dependencies);
when(serviceDependencyMatrixService.collectServiceDependencyMatrix(services, "CDH", "6.1.1")).thenReturn(dependentServices);
underTest.generateTemplateByServices(services, "CDH-6.1.1");
verify(generatedCMTemplateService).prepareClouderaManagerTemplate(captor.capture(), anyString(), anyString(), anyString());
Set<String> expectedServicesArgument = Set.of("HDFS", "HIVE", "ZOOKEEPER");
Assertions.assertEquals(expectedServicesArgument, captor.getValue());
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix in project cloudbreak by hortonworks.
the class ServiceDependencyMatrixService method collectServiceDependencyMatrix.
public ServiceDependencyMatrix collectServiceDependencyMatrix(Set<String> services, String stackType, String version) {
ServiceDependencyMatrix serviceDependencyMatrix = new ServiceDependencyMatrix();
Services servicesObject = new Services();
servicesObject.setServices(services);
serviceDependencyMatrix.setServices(servicesObject);
Dependencies dependencies = new Dependencies();
Set<String> deps = new HashSet<>();
for (String service : services) {
for (ServiceConfig serviceInformation : resolver.serviceConfigs()) {
if (service.toUpperCase().equals(serviceInformation.getName())) {
for (String dependency : serviceInformation.getDependencies()) {
deps.add(dependency.toUpperCase());
}
break;
}
}
}
dependencies.setServices(deps);
serviceDependencyMatrix.setDependencies(dependencies);
return serviceDependencyMatrix;
}
Aggregations