Search in sources :

Example 56 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject 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 57 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject 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)

Example 58 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class ImpalaCloudStorageServiceConfigProviderTest method testImpalaCloudStorageServiceConfigs.

@Test
public void testImpalaCloudStorageServiceConfigs() {
    CmTemplateProcessor templateProcessor = new CmTemplateProcessor(getBlueprintText("input/clouderamanager-host-with-uppercase.bp"));
    TemplatePreparationObject templatePreparationObject = getTemplatePreparationObject(true);
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, templatePreparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("impala_cmd_args_safety_valve", serviceConfigs.get(0).getName());
    assertEquals("--startup_filesystem_check_directories=" + "s3a://bucket/warehouse/tablespace/managed/hive," + "s3a://bucket/warehouse/tablespace/external/hive", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 59 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class ImpalaCloudStorageServiceConfigProviderTest method testImpalaCloudStorageServiceConfigsWithLowerCdhVersion.

@Test
public void testImpalaCloudStorageServiceConfigsWithLowerCdhVersion() {
    CmTemplateProcessor templateProcessor = new CmTemplateProcessor(getBlueprintText("input/cdp-data-mart.bp"));
    TemplatePreparationObject templatePreparationObject = getTemplatePreparationObject(true);
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, templatePreparationObject);
    assertEquals(0, serviceConfigs.size());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 60 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class KafkaDatahubConfigProviderTest method getServiceConfigs.

@ParameterizedTest
@MethodSource("testArgsForGetServiceConfigs")
void getServiceConfigs(String cdhMainVersion, String cdhParcelVersion, Collection<ApiClusterTemplateConfig> expectedConfigs) {
    when(blueprintView.getProcessor()).thenReturn(cmTemplateProcessor);
    when(cmTemplateProcessor.getStackVersion()).thenReturn(cdhMainVersion);
    when(cmTemplateProcessor.getVersion()).thenReturn(Optional.ofNullable(cdhMainVersion));
    TemplatePreparationObject tpo = templatePreparationObject(StackType.WORKLOAD, cdhParcelVersion);
    List<ApiClusterTemplateConfig> serviceConfigs = configProviderUnderTest.getServiceConfigs(cmTemplateProcessor, tpo);
    assertThat(serviceConfigs).as("Expected configs for cdh version: %s / %s", cdhMainVersion, cdhParcelVersion).hasSameElementsAs(expectedConfigs);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)266 Test (org.junit.Test)133 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)127 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)116 Test (org.junit.jupiter.api.Test)87 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)53 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)48 List (java.util.List)45 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)40 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)38 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)36 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)35 ArrayList (java.util.ArrayList)34 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)32 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)23 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)20 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)17 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)16 DisplayName (org.junit.jupiter.api.DisplayName)16