use of com.sequenceiq.cloudbreak.domain.Cluster 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.domain.Cluster 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.domain.Cluster in project cloudbreak by hortonworks.
the class KerberosBlueprintServiceTest method testExtendBlueprintWithKerberosManagedKerberos.
@Test
public void testExtendBlueprintWithKerberosManagedKerberos() throws IOException {
String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized.bp");
Blueprint blueprint = TestUtil.blueprint("name", blueprintText);
Stack stack = TestUtil.stack();
Cluster cluster = TestUtil.cluster(blueprint, stack, 1L, TestUtil.kerberosConfig());
GeneralClusterConfigs generalClusterConfigs = BlueprintTestUtil.generalClusterConfigs();
generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.of("test-1-1"));
generalClusterConfigs.setGatewayInstanceMetadataPresented(false);
BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().withKerberosConfig(cluster.getKerberosConfig()).withGeneralClusterConfigs(generalClusterConfigs).build();
BlueprintTextProcessor b = new BlueprintTextProcessor(blueprint.getBlueprintText());
String actualBlueprint = underTest.customTextManipulation(object, b).asText();
String expectedBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized-cloudbreak-managed-expected.bp");
JsonNode expectedNode = JsonUtil.readTree(expectedBlueprint);
JsonNode resultNode = JsonUtil.readTree(actualBlueprint);
Assert.assertEquals(expectedNode, resultNode);
}
use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class KerberosBlueprintServiceTest method testExtendBlueprintWithKerberosExisting.
@Test
public void testExtendBlueprintWithKerberosExisting() throws IOException {
String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized.bp");
Blueprint blueprint = TestUtil.blueprint("name", blueprintText);
KerberosConfig kerberosConfig = new KerberosConfig();
kerberosConfig.setPrincipal("principal.conf");
kerberosConfig.setPrincipal("passwd.conf");
kerberosConfig.setUrl("url.conf");
kerberosConfig.setAdminUrl("adminUrl.conf");
kerberosConfig.setRealm("realm.conf");
kerberosConfig.setLdapUrl("ldapUrl.conf");
kerberosConfig.setContainerDn("containerDn.conf");
kerberosConfig.setTcpAllowed(true);
Stack stack = TestUtil.stack();
GeneralClusterConfigs generalClusterConfigs = BlueprintTestUtil.generalClusterConfigs();
generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.of("test-1-1"));
generalClusterConfigs.setGatewayInstanceMetadataPresented(false);
Cluster cluster = TestUtil.cluster(blueprint, stack, 1L, kerberosConfig);
BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().withKerberosConfig(cluster.getKerberosConfig()).withGeneralClusterConfigs(generalClusterConfigs).build();
BlueprintTextProcessor b = new BlueprintTextProcessor(blueprint.getBlueprintText());
String actualBlueprint = underTest.customTextManipulation(object, b).asText();
String expectedBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized-existing-expected.bp");
JsonNode expectedNode = JsonUtil.readTree(expectedBlueprint);
JsonNode resultNode = JsonUtil.readTree(actualBlueprint);
Assert.assertEquals(expectedNode, resultNode);
}
use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class BlueprintValidatorTest method testKerberosWithoutKnox.
@Test
public void testKerberosWithoutKnox() throws IOException {
// GIVEN
Blueprint blueprint = createBlueprint();
Set<InstanceGroup> instanceGroups = createInstanceGroups();
Set<HostGroup> hostGroups = createHostGroups(instanceGroups);
instanceGroups.add(createInstanceGroup("gateway", 1));
JsonNode blueprintJsonTree = createJsonTree();
BDDMockito.given(objectMapper.readTree(BLUEPRINT_STRING)).willReturn(blueprintJsonTree);
Cluster cluster = new Cluster();
cluster.setSecure(true);
// WHEN
underTest.validateBlueprintForStack(cluster, blueprint, hostGroups, instanceGroups);
// THEN no exception thrown
}
Aggregations