Search in sources :

Example 41 with BlueprintView

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

the class HueConfigProviderTest method getServiceConfigsWhenKnoxConfiguredToExternalDomain.

@Test
public void getServiceConfigsWhenKnoxConfiguredToExternalDomain() {
    BlueprintView blueprintView = getMockBlueprintView("7.0.2", "7.0.2");
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setExternalFQDN("myaddress.cloudera.site");
    generalClusterConfigs.setKnoxUserFacingCertConfigured(true);
    generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.of("private-gateway.cloudera.site"));
    TemplatePreparationObject tpo = new Builder().withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(blueprintView).withGateway(new Gateway(), "", new HashSet<>()).build();
    List<ApiClusterTemplateConfig> result = underTest.getServiceConfigs(null, tpo);
    Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateConfig::getName, ApiClusterTemplateConfig::getVariable));
    assertThat(paramToVariable).containsOnly(new SimpleEntry<>("database_host", "hue-hue_database_host"), new SimpleEntry<>("database_port", "hue-hue_database_port"), new SimpleEntry<>("database_name", "hue-hue_database_name"), new SimpleEntry<>("database_type", "hue-hue_database_type"), new SimpleEntry<>("database_user", "hue-hue_database_user"), new SimpleEntry<>("database_password", "hue-hue_database_password"), new SimpleEntry<>("hue_service_safety_valve", "hue-hue_service_safety_valve"));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 42 with BlueprintView

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

the class HueConfigProviderTest method getServiceConfigs.

@Test
public void getServiceConfigs() {
    BlueprintView blueprintView = getMockBlueprintView("7.0.2", "7.0.2");
    TemplatePreparationObject tpo = new Builder().withBlueprintView(blueprintView).build();
    List<ApiClusterTemplateConfig> result = underTest.getServiceConfigs(null, tpo);
    Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateConfig::getName, ApiClusterTemplateConfig::getVariable));
    assertThat(paramToVariable).containsOnly(new SimpleEntry<>("database_host", "hue-hue_database_host"), new SimpleEntry<>("database_port", "hue-hue_database_port"), new SimpleEntry<>("database_name", "hue-hue_database_name"), new SimpleEntry<>("database_type", "hue-hue_database_type"), new SimpleEntry<>("database_user", "hue-hue_database_user"), new SimpleEntry<>("database_password", "hue-hue_database_password"));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 43 with BlueprintView

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

the class AbstractHbaseConfigProviderTest method getTemplatePreparationObject.

protected TemplatePreparationObject getTemplatePreparationObject(boolean includeLocations, boolean datalakeCluster, String cdhVersion, Map<String, String> defaultTags, CloudPlatform cloudPlatform) {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    List<StorageLocationView> locations = new ArrayList<>();
    if (includeLocations) {
        StorageLocation hbaseRootDir = new StorageLocation();
        hbaseRootDir.setProperty("hbase.rootdir");
        hbaseRootDir.setValue("s3a://bucket/cluster1/hbase");
        locations.add(new StorageLocationView(hbaseRootDir));
    }
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    SharedServiceConfigsView sharedServicesConfigsView = new SharedServiceConfigsView();
    sharedServicesConfigsView.setDatalakeCluster(datalakeCluster);
    String inputJson = getBlueprintText("input/clouderamanager.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    cmTemplateProcessor.setCdhVersion(cdhVersion);
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setAccountId(Optional.of("1234"));
    return TemplatePreparationObject.Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withBlueprintView(new BlueprintView(inputJson, "", "", cmTemplateProcessor)).withSharedServiceConfigs(sharedServicesConfigsView).withHostgroupViews(Set.of(master, worker)).withGeneralClusterConfigs(generalClusterConfigs).withDefaultTags(defaultTags).withCloudPlatform(cloudPlatform).build();
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) ArrayList(java.util.ArrayList) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) SharedServiceConfigsView(com.sequenceiq.cloudbreak.template.views.SharedServiceConfigsView) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem)

Example 44 with BlueprintView

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

the class RangerCloudStorageServiceConfigProviderTest method defaultRangerHdfsAuditUrlWithSingleNamenode.

@Test
public void defaultRangerHdfsAuditUrlWithSingleNamenode() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    BlueprintView blueprintView = mock(BlueprintView.class);
    when(blueprintView.getProcessor()).thenReturn(templateProcessor);
    when(templateProcessor.getHostGroupsWithComponent(HdfsRoles.NAMENODE)).thenReturn(Set.of("gateway"));
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(false, false).withBlueprintView(blueprintView).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.0"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("hdfs://g", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 45 with BlueprintView

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

the class RangerRoleConfigProviderTest method validateRangerServiceConfigPost72.

@Test
public void validateRangerServiceConfigPost72() {
    String inputJson = getBlueprintText("input/cb6720.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    TemplatePreparationObject preparationObject = Builder.builder().withHostgroupViews(Set.of(master)).withBlueprintView(new BlueprintView(inputJson, "", "", cmTemplateProcessor)).withRdsConfigs(Set.of(rdsConfig(DatabaseType.RANGER))).withProductDetails(generateCmRepo(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_2_2), null).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject);
    assertThat(serviceConfigs.size()).isEqualTo(6);
    assertThat(serviceConfigs.get(0).getName()).isEqualTo(RANGER_DATABASE_HOST);
    assertThat(serviceConfigs.get(0).getValue()).isEqualTo("10.1.1.1");
    assertThat(serviceConfigs.get(1).getName()).isEqualTo(RANGER_DATABASE_NAME);
    assertThat(serviceConfigs.get(1).getValue()).isEqualTo("ranger");
    assertThat(serviceConfigs.get(2).getName()).isEqualTo(RANGER_DATABASE_TYPE);
    assertThat(serviceConfigs.get(2).getValue()).isEqualTo("postgresql");
    assertThat(serviceConfigs.get(3).getName()).isEqualTo(RANGER_DATABASE_USER);
    assertThat(serviceConfigs.get(3).getValue()).isEqualTo("heyitsme");
    assertThat(serviceConfigs.get(4).getName()).isEqualTo(RANGER_DATABASE_PASSWORD);
    assertThat(serviceConfigs.get(4).getValue()).isEqualTo("iamsoosecure");
    assertThat(serviceConfigs.get(5).getName()).isEqualTo(RANGER_DATABASE_PORT);
    assertThat(serviceConfigs.get(5).getValue()).isEqualTo("5432");
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

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