use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class HbaseConfigProviderTest method testCustomTextManipulationWhenThereAreMissingHbaseClients.
@Test
public void testCustomTextManipulationWhenThereAreMissingHbaseClients() throws IOException {
String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-kerberized-test.bp");
BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().build();
Set<String> masters = Sets.newHashSet("master", "slave_1", "slave_2", "compute");
Set<String> clients = Sets.newHashSet("slave_1", "slave_2", "compute_1");
Set<String> missing = Sets.newHashSet("master", "compute");
when(blueprintProcessor.getHostGroupsWithComponent("HBASE_MASTER")).thenReturn(masters);
when(blueprintProcessor.getHostGroupsWithComponent("HBASE_CLIENT")).thenReturn(clients);
when(blueprintProcessor.addComponentToHostgroups("HBASE_CLIENT", missing)).thenReturn(blueprintProcessor);
when(blueprintProcessor.asText()).thenReturn(blueprintText);
when(blueprintProcessorFactory.get(anyString())).thenReturn(blueprintProcessor);
String result = underTest.customTextManipulation(object, blueprintProcessor).asText();
Assert.assertEquals(blueprintText, result);
verify(blueprintProcessor, times(1)).getHostGroupsWithComponent("HBASE_MASTER");
verify(blueprintProcessor, times(1)).getHostGroupsWithComponent("HBASE_CLIENT");
verify(blueprintProcessor, times(1)).addComponentToHostgroups("HBASE_CLIENT", missing);
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class KerberosBlueprintServiceTest method testExtendBlueprintWithKerberosOnKerberizedBlueprint.
@Test
public void testExtendBlueprintWithKerberosOnKerberizedBlueprint() throws IOException {
String expectedBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-kerberized-test.bp");
Blueprint blueprint = TestUtil.blueprint("name", expectedBlueprint);
Stack stack = TestUtil.stack();
Cluster cluster = TestUtil.cluster(blueprint, stack, 1L, TestUtil.kerberosConfig());
BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().withKerberosConfig(cluster.getKerberosConfig()).withGeneralClusterConfigs(BlueprintTestUtil.generalClusterConfigs()).build();
BlueprintTextProcessor b = new BlueprintTextProcessor(blueprint.getBlueprintText());
String actualBlueprint = underTest.customTextManipulation(object, b).asText();
JsonNode expectedNode = JsonUtil.readTree(expectedBlueprint);
JsonNode resultNode = JsonUtil.readTree(actualBlueprint);
Assert.assertEquals(expectedNode, resultNode);
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class KerberosBlueprintServiceTest method testExtendBlueprintWithKerberosCustomConfig.
@Test
public void testExtendBlueprintWithKerberosCustomConfig() throws IOException {
String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized.bp");
Blueprint blueprint = TestUtil.blueprint("name", blueprintText);
Stack stack = TestUtil.stack();
KerberosConfig kerberosConfig = new KerberosConfig();
kerberosConfig.setDescriptor("{\"kerberos-env\":{\"properties\":{\"install_packages\":false,\"realm\":\"REALM.BP\",\"kdc_type\":\"mit-kdc\"," + "\"kdc_hosts\":\"kdc_host.bp\",\"admin_server_host\":\"admin_server_host.bp\",\"encryption_types\":\"enc_types.bp\",\"ldap_url\":\"\"," + "\"container_dn\":\"\"}}}");
kerberosConfig.setKrb5Conf("{\"krb5-conf\":{\"properties\":{\"domains\":\".domains.bp\",\"manage_krb5_conf\":\"true\",\"content\":\"content.bp\"}}}");
kerberosConfig.setTcpAllowed(true);
Cluster cluster = TestUtil.cluster(blueprint, stack, 1L, kerberosConfig);
BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().withKerberosConfig(cluster.getKerberosConfig()).withGeneralClusterConfigs(BlueprintTestUtil.generalClusterConfigs()).build();
BlueprintTextProcessor b = new BlueprintTextProcessor(blueprint.getBlueprintText());
String actualBlueprint = underTest.customTextManipulation(object, b).asText();
String expectedBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized-custom-config-expected.bp");
JsonNode expectedNode = JsonUtil.readTree(expectedBlueprint);
JsonNode resultNode = JsonUtil.readTree(actualBlueprint);
Assert.assertEquals(expectedNode, resultNode);
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class CentralBlueprintUpdaterNegativeInputTest method testForMissingBlueprintsBlockInBlueprint.
@Test
public void testForMissingBlueprintsBlockInBlueprint() throws IOException {
expectedException.expect(BlueprintProcessingException.class);
BlueprintPreparationObject model = getExtendedPreparedBlueprintBuilder("missing-blueprints-block.bp").build();
getUnderTest().getBlueprintText(model);
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.
the class CentralBlueprintUpdaterNegativeInputTest method testInvalidJsonInput.
@Test
public void testInvalidJsonInput() throws IOException {
expectedException.expect(BlueprintProcessingException.class);
BlueprintPreparationObject model = getExtendedPreparedBlueprintBuilder("invalid-json.bp").build();
getUnderTest().getBlueprintText(model);
}
Aggregations