Search in sources :

Example 11 with Builder

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

the class KnoxIdBrokerConfigProviderTest method getRoleConfigWhenIdBrokerAndNoFileSystemAndAzure.

@Test
public void getRoleConfigWhenIdBrokerAndNoFileSystemAndAzure() {
    TemplatePreparationObject tpo = new Builder().withCloudPlatform(CloudPlatform.AZURE).withAccountMappingView(new AccountMappingView(GROUP_MAPPINGS, USER_MAPPINGS)).withProductDetails(generateCMRepo(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_1_0), null).build();
    List<ApiClusterTemplateConfig> result = underTest.getRoleConfigs(IDBROKER, tpo);
    Map<String, String> configNameToValueMap = getConfigNameToValueMap(result);
    assertThat(configNameToValueMap).containsOnly(Map.entry(IDBROKER_AZURE_USER_MAPPING, USER_MAPPINGS_STR), Map.entry(IDBROKER_AZURE_GROUP_MAPPING, GROUP_MAPPINGS_STR));
    Map<String, String> configNameToVariableNameMap = getConfigNameToVariableNameMap(result);
    assertThat(configNameToVariableNameMap).isEmpty();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 12 with Builder

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

the class KnoxIdBrokerConfigProviderTest method getRoleConfigWhenIdBrokerAndWasbFileSystem.

@Test
public void getRoleConfigWhenIdBrokerAndWasbFileSystem() {
    WasbFileSystemConfigurationsView fileSystemConfigurationsView = mock(WasbFileSystemConfigurationsView.class);
    when(fileSystemConfigurationsView.getType()).thenReturn("WASB");
    TemplatePreparationObject tpo = new Builder().withCloudPlatform(CloudPlatform.AZURE).withFileSystemConfigurationView(fileSystemConfigurationsView).withAccountMappingView(new AccountMappingView(GROUP_MAPPINGS, USER_MAPPINGS)).withProductDetails(generateCMRepo(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_1_0), null).build();
    List<ApiClusterTemplateConfig> result = underTest.getRoleConfigs(IDBROKER, tpo);
    Map<String, String> configNameToValueMap = getConfigNameToValueMap(result);
    assertThat(configNameToValueMap).containsOnly(Map.entry(IDBROKER_AZURE_USER_MAPPING, USER_MAPPINGS_STR), Map.entry(IDBROKER_AZURE_GROUP_MAPPING, GROUP_MAPPINGS_STR));
    Map<String, String> configNameToVariableNameMap = getConfigNameToVariableNameMap(result);
    assertThat(configNameToVariableNameMap).isEmpty();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) WasbFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.wasb.WasbFileSystemConfigurationsView) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 13 with Builder

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

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

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

the class DasConfigProviderTest method getServiceConfigs.

@Test
public void getServiceConfigs() {
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(HIVE_DAS);
    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)).build();
    List<ApiClusterTemplateConfig> result = underTest.getServiceConfigs(null, tpo);
    Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateConfig::getName, ApiClusterTemplateConfig::getValue));
    assertThat(paramToVariable).containsOnly(new SimpleEntry<>("data_analytics_studio_database_host", HOST), new SimpleEntry<>("data_analytics_studio_database_port", PORT), new SimpleEntry<>("data_analytics_studio_database_name", DB_NAME), new SimpleEntry<>("data_analytics_studio_database_username", USER_NAME), new SimpleEntry<>("data_analytics_studio_database_password", PASSWORD));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)37 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)35 Test (org.junit.Test)30 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)19 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)14 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)12 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)10 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)10 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)9 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)7 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)6 List (java.util.List)6 ApiClusterTemplateVariable (com.cloudera.api.swagger.model.ApiClusterTemplateVariable)5 HashSet (java.util.HashSet)5 Test (org.junit.jupiter.api.Test)4 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)2 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)2 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)2