Search in sources :

Example 11 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class RangerRazBaseConfigProviderTest method getServiceTypesConfigWheAAWSAnd729ShouldNOTAddProperty.

@Test
public void getServiceTypesConfigWheAAWSAnd729ShouldNOTAddProperty() {
    BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
    when(blueprintTextProcessor.getVersion()).thenReturn(Optional.of("7.2.9"));
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withStackType(StackType.WORKLOAD).withBlueprintView(new BlueprintView("", "7.2.9", "CDH", blueprintTextProcessor)).withCloudPlatform(CloudPlatform.AWS).withGeneralClusterConfigs(new GeneralClusterConfigs()).withDataLakeView(new DatalakeView(false)).build();
    List<ApiClusterTemplateConfig> roleConfigs = underTest.getRoleConfigs("", preparationObject);
    assertEquals(0, roleConfigs.size());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) BlueprintTextProcessor(com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) DatalakeView(com.sequenceiq.cloudbreak.template.views.DatalakeView) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 12 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class SchemaRegistryJarStorageConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(Integer... instanceCountsForSchemaRegistryHostGroups) {
    List<HostgroupView> srHostGroups = Arrays.stream(instanceCountsForSchemaRegistryHostGroups).map(nodeCnt -> new HostgroupView(null, 0, InstanceGroupType.CORE, nodeCnt)).collect(toList());
    TemplatePreparationObject tpo = mock(TemplatePreparationObject.class, withSettings().lenient());
    when(tpo.getHostGroupsWithComponent(SCHEMA_REGISTRY_SERVER)).thenAnswer(__ -> srHostGroups.stream());
    when(tpo.getBlueprintView()).thenReturn(blueprintView);
    return tpo;
}
Also used : VolumeConfigProviderTestHelper.hostGroupWithVolumeCount(com.sequenceiq.cloudbreak.cmtemplate.configproviders.VolumeConfigProviderTestHelper.hostGroupWithVolumeCount) Arrays(java.util.Arrays) ConfigUtils.config(com.sequenceiq.cloudbreak.cmtemplate.configproviders.ConfigUtils.config) Mock(org.mockito.Mock) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) CONFIG_JAR_STORAGE_DIRECTORY_PATH(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryJarStorageConfigProvider.CONFIG_JAR_STORAGE_DIRECTORY_PATH) FileReaderUtils(com.sequenceiq.cloudbreak.util.FileReaderUtils) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) Set(java.util.Set) CONFIG_JAR_STORAGE_TYPE(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryJarStorageConfigProvider.CONFIG_JAR_STORAGE_TYPE) SCHEMA_REGISTRY_SERVER(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryRoles.SCHEMA_REGISTRY_SERVER) Mockito.when(org.mockito.Mockito.when) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) Test(org.junit.jupiter.api.Test) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Optional(java.util.Optional) Mockito.withSettings(org.mockito.Mockito.withSettings) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) SchemaRegistryJarStorageConfigProvider.getSchemaRegistryInstanceCount(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryJarStorageConfigProvider.getSchemaRegistryInstanceCount) Mockito.mock(org.mockito.Mockito.mock) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView)

Example 13 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class SchemaRegistryJarStorageConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(HostgroupView hostGroup) {
    String inputJson = FileReaderUtils.readFileFromClasspathQuietly("input/kafka.bp");
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withHostgroupViews(Set.of(hostGroup)).withBlueprintView(new BlueprintView(inputJson, "CDP", "1.0", new CmTemplateProcessor(inputJson))).build();
    return preparationObject;
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 14 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class HueConfigProviderTest method getProxyHostsWhenLoadBalancerConfigured.

@Test
public void getProxyHostsWhenLoadBalancerConfigured() {
    BlueprintView blueprintView = getMockBlueprintView("7.0.1", "7.0.1");
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(HUE);
    rdsConfig.setConnectionURL(String.format("jdbc:%s://%s:%s/%s", DB_PROVIDER, HOST, PORT, DB_NAME));
    rdsConfig.setConnectionUserName(USER_NAME);
    rdsConfig.setConnectionPassword(PASSWORD);
    String expectedExternalFQDN = "myaddress.cloudera.site";
    String expectedLBFQDN = "loadbalancer-gateway.cloudera.site";
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setExternalFQDN(expectedExternalFQDN);
    generalClusterConfigs.setKnoxUserFacingCertConfigured(true);
    generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.empty());
    generalClusterConfigs.setLoadBalancerGatewayFqdn(Optional.of(expectedLBFQDN));
    TemplatePreparationObject tpo = new Builder().withGeneralClusterConfigs(generalClusterConfigs).withGateway(new Gateway(), "", new HashSet<>()).withBlueprintView(blueprintView).withRdsConfigs(Set.of(rdsConfig)).build();
    List<ApiClusterTemplateVariable> result = underTest.getServiceConfigVariables(tpo);
    Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateVariable::getName, ApiClusterTemplateVariable::getValue));
    String proxyHostsExpected1 = String.join(",", expectedExternalFQDN, expectedLBFQDN);
    String proxyHostsExpected2 = String.join(",", expectedLBFQDN, expectedExternalFQDN);
    String expectedSafetyValveValue1 = "[desktop]\n[[knox]]\nknox_proxyhosts=".concat(proxyHostsExpected1);
    String expectedSafetyValveValue2 = "[desktop]\n[[knox]]\nknox_proxyhosts=".concat(proxyHostsExpected2);
    assertThat(paramToVariable).containsAnyOf(new SimpleEntry<>("hue-hue_service_safety_valve", expectedSafetyValveValue1), new SimpleEntry<>("hue-hue_service_safety_valve", expectedSafetyValveValue2));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ApiClusterTemplateVariable(com.cloudera.api.swagger.model.ApiClusterTemplateVariable) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 15 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class HueConfigProviderTest method getServiceConfigVariables.

@Test
public void getServiceConfigVariables() {
    BlueprintView blueprintView = getMockBlueprintView("7.2.0", "7.1.0");
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(HUE);
    rdsConfig.setConnectionURL(String.format("jdbc:%s://%s:%s/%s", DB_PROVIDER, HOST, PORT, DB_NAME));
    rdsConfig.setConnectionUserName(USER_NAME);
    rdsConfig.setConnectionPassword(PASSWORD);
    TemplatePreparationObject tpo = new Builder().withRdsConfigs(Set.of(rdsConfig)).withBlueprintView(blueprintView).build();
    List<ApiClusterTemplateVariable> result = underTest.getServiceConfigVariables(tpo);
    Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateVariable::getName, ApiClusterTemplateVariable::getValue));
    assertThat(paramToVariable).containsOnly(new SimpleEntry<>("hue-hue_database_host", HOST), new SimpleEntry<>("hue-hue_database_port", PORT), new SimpleEntry<>("hue-hue_database_name", DB_NAME), new SimpleEntry<>("hue-hue_database_type", DB_PROVIDER), new SimpleEntry<>("hue-hue_database_user", USER_NAME), new SimpleEntry<>("hue-hue_database_password", PASSWORD));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ApiClusterTemplateVariable(com.cloudera.api.swagger.model.ApiClusterTemplateVariable) Test(org.junit.Test)

Aggregations

BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)46 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)32 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)19 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)15 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)14 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)14 Test (org.junit.jupiter.api.Test)14 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)13 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)13 Test (org.junit.Test)13 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)11 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)9 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)9 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)7 HashSet (java.util.HashSet)7 IdBroker (com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker)6 ApiClusterTemplateVariable (com.cloudera.api.swagger.model.ApiClusterTemplateVariable)5 DatalakeView (com.sequenceiq.cloudbreak.template.views.DatalakeView)5