use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView in project cloudbreak by hortonworks.
the class StackToBlueprintPreparationObjectConverter method convert.
@Override
public BlueprintPreparationObject convert(Stack source) {
try {
Optional<SmartSenseSubscription> aDefault = smartSenseSubscriptionService.getDefault();
Cluster cluster = clusterService.getById(source.getCluster().getId());
FileSystem fileSystem = cluster.getFileSystem();
LdapConfig ldapConfig = cluster.getLdapConfig();
StackRepoDetails hdpRepo = clusterComponentConfigProvider.getHDPRepo(cluster.getId());
String stackRepoDetailsHdpVersion = hdpRepo != null ? hdpRepo.getHdpVersion() : null;
Map<String, List<InstanceMetaData>> groupInstances = instanceGroupMetadataCollector.collectMetadata(source);
HdfConfigs hdfConfigs = hdfConfigProvider.createHdfConfig(cluster.getHostGroups(), groupInstances, cluster.getBlueprint().getBlueprintText());
BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(cluster.getBlueprint().getBlueprintText());
FileSystemConfigurationView fileSystemConfigurationView = null;
if (source.getCluster().getFileSystem() != null) {
fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, source), fileSystem == null ? false : fileSystem.isDefaultFs());
}
IdentityUser identityUser = userDetailsService.getDetails(cluster.getOwner(), UserFilterField.USERID);
return BlueprintPreparationObject.Builder.builder().withFlexSubscription(source.getFlexSubscription()).withRdsConfigs(postgresConfigService.createRdsConfigIfNeeded(source, cluster)).withHostgroups(hostGroupService.getByCluster(cluster.getId())).withGateway(cluster.getGateway()).withBlueprintView(new BlueprintView(cluster, blueprintStackInfo)).withStackRepoDetailsHdpVersion(stackRepoDetailsHdpVersion).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigsProvider.generalClusterConfigs(source, cluster, identityUser)).withSmartSenseSubscriptionId(aDefault.isPresent() ? aDefault.get().getSubscriptionId() : null).withLdapConfig(ldapConfig).withHdfConfigs(hdfConfigs).withKerberosConfig(cluster.isSecure() ? cluster.getKerberosConfig() : null).build();
} catch (BlueprintProcessingException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
} catch (IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView in project cloudbreak by hortonworks.
the class BlueprintTemplateProcessorTest method testMustacheGeneratorForHiveRDS.
@Test
public void testMustacheGeneratorForHiveRDS() throws Exception {
String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-mustache-test.bp");
Cluster cluster = cluster();
BlueprintStackInfo blueprintStackInfo = new BlueprintStackInfo("hdp", "2.4");
BlueprintPreparationObject blueprintPreparationObject = BlueprintPreparationObject.Builder.builder().withRdsConfigs(cluster.getRdsConfigs()).withGateway(cluster.getGateway()).withLdapConfig(cluster.getLdapConfig()).withGeneralClusterConfigs(generalClusterConfigs()).withBlueprintView(new BlueprintView(testBlueprint, blueprintStackInfo.getVersion(), blueprintStackInfo.getType())).build();
String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
assertTrue(result.contains("\"javax.jdo.option.ConnectionURL\": \"jdbc:postgresql://10.1.1.1:5432/hive\""));
assertTrue(result.contains("\"javax.jdo.option.ConnectionUserName\": \"heyitsme\""));
assertTrue(result.contains("\"javax.jdo.option.ConnectionPassword\": \"iamsoosecure\""));
assertTrue(result.contains("\"javax.jdo.option.ConnectionDriverName\": \"org.postgresql.Driver\""));
assertTrue(result.contains("\"hive_database_type\": \"postgres\""));
assertTrue(result.contains("\"hive_database\": \"Existing postgresql Database\","));
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView in project cloudbreak by hortonworks.
the class BlueprintTemplateProcessorTest method testMustacheGeneratorShouldEscapeNifiHtmlBasedContentsQuotes.
@Test
public void testMustacheGeneratorShouldEscapeNifiHtmlBasedContentsQuotes() throws Exception {
String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-mustache-test.bp");
Cluster cluster = cluster();
BlueprintStackInfo blueprintStackInfo = new BlueprintStackInfo("hdp", "2.4");
GeneralClusterConfigs generalClusterConfigs = generalClusterConfigs();
generalClusterConfigs.setClusterName("dummyCluster");
generalClusterConfigs.setStackName("dummyCluster");
Map<String, Object> properties = new HashMap<>();
properties.put("S3_BUCKET", "testbucket");
HdfConfigs hdfConfigs = new HdfConfigs("<property name=\"Node Identity 1\">CN=hostname-2, OU=NIFI</property>", Optional.empty());
BlueprintPreparationObject blueprintPreparationObject = BlueprintPreparationObject.Builder.builder().withRdsConfigs(cluster.getRdsConfigs()).withGateway(cluster.getGateway()).withLdapConfig(cluster.getLdapConfig()).withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(new BlueprintView(testBlueprint, new Json(properties), blueprintStackInfo.getVersion(), blueprintStackInfo.getType())).withHdfConfigs(hdfConfigs).build();
String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
assertTrue(result.contains("\"content\": \"<property name=\\\"Node Identity 1\\\">CN=hostname-2, OU=NIFI</property>\""));
assertFalse(result.contains("\"content\": \"<property name=\"Node Identity 1\">CN=hostname-2, OU=NIFI</property>\""));
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView in project cloudbreak by hortonworks.
the class BlueprintTemplateProcessorTest method testMustacheGeneratorForRangerRDS.
@Test
public void testMustacheGeneratorForRangerRDS() throws Exception {
String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-mustache-test.bp");
Cluster cluster = cluster();
BlueprintStackInfo blueprintStackInfo = new BlueprintStackInfo("hdp", "2.4");
BlueprintPreparationObject blueprintPreparationObject = BlueprintPreparationObject.Builder.builder().withRdsConfigs(cluster.getRdsConfigs()).withGateway(cluster.getGateway()).withLdapConfig(cluster.getLdapConfig()).withGeneralClusterConfigs(generalClusterConfigs()).withBlueprintView(new BlueprintView(testBlueprint, blueprintStackInfo.getVersion(), blueprintStackInfo.getType())).build();
String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
assertTrue(result.contains("\"db_host\": \"10.1.1.1:5432\""));
assertTrue(result.contains("\"db_user\": \"heyitsme\""));
assertTrue(result.contains("\"db_password\": \"iamsoosecure\""));
assertTrue(result.contains("\"db_name\": \"ranger\""));
assertTrue(result.contains("\"ranger_privelege_user_jdbc_url\": \"jdbc:postgresql://10.1.1.1:5432\""));
assertTrue(result.contains("\"ranger.jpa.jdbc.url\": \"jdbc:postgresql://10.1.1.1:5432/ranger\""));
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView in project cloudbreak by hortonworks.
the class HadoopConfigurationServiceTest method testAdditionalCriteriaWhenTrue.
@Test
public void testAdditionalCriteriaWhenTrue() {
BlueprintPreparationObject source = Builder.builder().withBlueprintView(new BlueprintView("blueprintText", "2.5", "HDP")).build();
boolean actual = underTest.additionalCriteria(source, "blueprintText");
Assert.assertTrue(actual);
}
Aggregations