use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class MysqlConfigProviderTest method testAdditionalCriteriaWhenRdsConfigEmptyThenShouldReturnFalse.
@Test
public void testAdditionalCriteriaWhenRdsConfigEmptyThenShouldReturnFalse() throws IOException {
String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-kerberized-test.bp");
BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().build();
when(blueprintProcessor.componentExistsInBlueprint("MYSQL_SERVER")).thenReturn(true);
when(blueprintProcessor.asText()).thenReturn(blueprintText);
when(blueprintProcessorFactory.get(anyString())).thenReturn(blueprintProcessor);
Assert.assertFalse(underTest.additionalCriteria(object, blueprintText));
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class BlueprintTemplateProcessorTest method testMustacheGeneratorForDruidRDS.
@Test
public void testMustacheGeneratorForDruidRDS() 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("\"druid.metadata.storage.type\": \"postgresql\""));
assertTrue(result.contains("\"druid.metadata.storage.connector.connectURI\": \"jdbc:postgresql://10.1.1.1:5432/druid\""));
assertTrue(result.contains("\"druid.metadata.storage.connector.user\": \"heyitsme\""));
assertTrue(result.contains("\"druid.metadata.storage.connector.password\": \"iamsoosecure\""));
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class BlueprintTemplateProcessorTest method testMustacheGeneratorWithSimpleUseCase.
@Test
public void testMustacheGeneratorWithSimpleUseCase() 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");
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())).build();
String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
assertTrue(result.contains("testbucket"));
assertTrue(result.contains("{{ zookeeper_quorum }}"));
assertTrue(result.contains("{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}"));
assertTrue(result.contains(cluster.getName()));
assertTrue(result.contains("jdbc:postgresql://10.1.1.1:5432/ranger"));
assertTrue(result.contains("cn=users,dc=example,dc=org"));
assertTrue(result.contains("ldap://localhost:389"));
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class BlueprintTemplateProcessorTest method testMustacheGeneratorForCustomRDSType.
@Test
public void testMustacheGeneratorForCustomRDSType() throws Exception {
String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-mustache-test.bp");
Cluster cluster = cluster();
cluster.getRdsConfigs().add(rdsConfig("customRds"));
BlueprintStackInfo blueprintStackInfo = new BlueprintStackInfo("hdp", "2.4");
BlueprintPreparationObject blueprintPreparationObject = BlueprintPreparationObject.Builder.builder().withBlueprintView(new BlueprintView(testBlueprint, blueprintStackInfo.getVersion(), blueprintStackInfo.getType())).withRdsConfigs(cluster.getRdsConfigs()).withGeneralClusterConfigs(generalClusterConfigs(cluster)).build();
String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
assertTrue(result.contains("\"custom.metadata.storage.type\": \"postgresql\""));
assertTrue(result.contains("\"custom.metadata.storage.engine\": \"postgres\""));
assertTrue(result.contains("\"custom.metadata.storage.connector.connectURI\": \"jdbc:postgresql://10.1.1.1:5432/customRds\""));
assertTrue(result.contains("\"custom.metadata.storage.connector.host\": \"10.1.1.1\""));
assertTrue(result.contains("\"custom.metadata.storage.connector.connectionHost\": \"10.1.1.1:5432\""));
assertTrue(result.contains("\"custom.metadata.storage.connector.user\": \"heyitsme\""));
assertTrue(result.contains("\"custom.metadata.storage.connector.password\": \"iamsoosecure\""));
assertTrue(result.contains("\"custom.metadata.storage.connector.databasename\": \"customRds\""));
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class HadoopConfigurationServiceTest method testAdditionalCriteriaWhenFalse.
@Test
public void testAdditionalCriteriaWhenFalse() {
BlueprintPreparationObject source = Builder.builder().withBlueprintView(new BlueprintView("blueprintText", "2.5", "HDF")).build();
boolean actual = underTest.additionalCriteria(source, "blueprintText");
Assert.assertFalse(actual);
}
Aggregations