use of com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor in project cloudbreak by hortonworks.
the class KerberosBlueprintExtendTest method testAddKerberosConfigToKerberosConfiguredBlueprintWithDescriptorNotForced.
@Test
public void testAddKerberosConfigToKerberosConfiguredBlueprintWithDescriptorNotForced() throws IOException {
String json = FileReaderUtils.readFileFromClasspath("extend-blueprint/multi-node-hdfs-yarn-default-kerb_descriptor.json");
String expected = FileReaderUtils.readFileFromClasspath("extend-blueprint/multi-node-hdfs-yarn-default-kerb_descriptor_fixed.json");
BlueprintTextProcessor b = new BlueprintTextProcessor(json);
String result = underTest.extendBlueprintWithKerberos(b, kerberosEnv, "node.dc1.consul,node.consul", false, null, false).asText();
JsonNode expectedNode = JsonUtil.readTree(expected);
JsonNode resultNode = JsonUtil.readTree(result);
Assert.assertEquals(expectedNode, resultNode);
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor in project cloudbreak by hortonworks.
the class KerberosBlueprintExtendTest method testAddKerberosConfigToKerberosConfiguredBlueprintWithDescriptorForced.
@Test
public void testAddKerberosConfigToKerberosConfiguredBlueprintWithDescriptorForced() throws IOException {
String json = FileReaderUtils.readFileFromClasspath("extend-blueprint/multi-node-hdfs-yarn-default-kerb_descriptor.json");
String expected = FileReaderUtils.readFileFromClasspath("extend-blueprint/multi-node-hdfs-yarn-default-kerb_descriptor_forced_fixed.json");
BlueprintTextProcessor b = new BlueprintTextProcessor(json);
String result = underTest.extendBlueprintWithKerberos(b, kerberosEnv, "node.dc1.consul,node.consul", false, null, true).asText();
JsonNode expectedNode = JsonUtil.readTree(expected);
JsonNode resultNode = JsonUtil.readTree(result);
Assert.assertEquals(expectedNode, resultNode);
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor 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.blueprint.BlueprintTextProcessor 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.blueprint.BlueprintTextProcessor in project cloudbreak by hortonworks.
the class HadoopConfigurationServiceTest method testConfigure.
@Test
public void testConfigure() throws IOException {
BlueprintPreparationObject source = Builder.builder().build();
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
when(configService.getHostGroupConfiguration(blueprintTextProcessor, source.getHostgroupViews())).thenReturn(emptyMap());
when(configService.getComponentsByHostGroup(blueprintTextProcessor, source.getHostgroupViews())).thenReturn(emptyMap());
when(blueprintTextProcessor.extendBlueprintHostGroupConfiguration(any(HostgroupConfigurations.class), anyBoolean())).thenReturn(blueprintTextProcessor);
when(blueprintTextProcessor.extendBlueprintGlobalConfiguration(any(SiteConfigurations.class), anyBoolean())).thenReturn(blueprintTextProcessor);
BlueprintTextProcessor actual = underTest.customTextManipulation(source, blueprintTextProcessor);
Assert.assertEquals(blueprintTextProcessor, actual);
}
Aggregations