Search in sources :

Example 1 with ServiceDependencyMatrix

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());
}
Also used : ServiceDependencyMatrix(com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix) Test(org.junit.Test)

Example 2 with ServiceDependencyMatrix

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());
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Dependencies(com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.Dependencies) ServiceDependencyMatrix(com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix) Test(org.junit.jupiter.api.Test)

Example 3 with ServiceDependencyMatrix

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;
}
Also used : Services(com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.Services) ServiceConfig(com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig) Dependencies(com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.Dependencies) ServiceDependencyMatrix(com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix) HashSet(java.util.HashSet)

Aggregations

ServiceDependencyMatrix (com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix)3 Dependencies (com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.Dependencies)2 ServiceConfig (com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig)1 Services (com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.Services)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1