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"));
}
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"));
}
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();
}
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());
}
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");
}
Aggregations