Search in sources :

Example 21 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject 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);
}
Also used : GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintTextProcessor(com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) JsonNode(com.fasterxml.jackson.databind.JsonNode) Stack(com.sequenceiq.cloudbreak.domain.Stack) Test(org.junit.Test)

Example 22 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject 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);
}
Also used : GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintTextProcessor(com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) JsonNode(com.fasterxml.jackson.databind.JsonNode) Stack(com.sequenceiq.cloudbreak.domain.Stack) Test(org.junit.Test)

Example 23 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.

the class CentralBlueprintUpdaterNegativeInputTest method testForMissingHostGroupNodeInBlueprint.

@Test
public void testForMissingHostGroupNodeInBlueprint() throws IOException {
    expectedException.expect(BlueprintProcessingException.class);
    BlueprintPreparationObject model = getExtendedPreparedBlueprintBuilder("missing-hostgroups.bp").build();
    getUnderTest().getBlueprintText(model);
}
Also used : BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 24 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.

the class CentralBlueprintUpdaterNegativeInputTest method testForNotExistingHostGroupNameComesFromModel.

@Test
public void testForNotExistingHostGroupNameComesFromModel() throws IOException {
    String dummyHostGroupName = "dummy";
    expectedException.expect(BlueprintProcessingException.class);
    expectedException.expectMessage(String.format("There is no such host group as \"%s\"", dummyHostGroupName));
    BlueprintPreparationObject model = getExtendedPreparedBlueprintBuilder("wrong-hostnames-in-model.bp", dummyHostGroupName).build();
    getUnderTest().getBlueprintText(model);
}
Also used : BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 25 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.

the class CentralBlueprintUpdaterRollingtest method prepareBlueprintPreparationObjectWithBlueprintText.

private BlueprintPreparationObject prepareBlueprintPreparationObjectWithBlueprintText() {
    BlueprintPreparationObject blueprintPreparationObject = params.value().getModel();
    blueprintPreparationObject.getBlueprintView().setBlueprintText(params.value().getInput().getFileContent());
    return blueprintPreparationObject;
}
Also used : BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)

Aggregations

BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)28 Test (org.junit.Test)24 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)11 BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)8 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)6 BlueprintTextProcessor (com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor)5 Matchers.anyString (org.mockito.Matchers.anyString)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)4 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)4 Stack (com.sequenceiq.cloudbreak.domain.Stack)4 KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)2 Json (com.sequenceiq.cloudbreak.domain.json.Json)2 HashMap (java.util.HashMap)2 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)1 GeneratedBlueprintResponse (com.sequenceiq.cloudbreak.api.model.GeneratedBlueprintResponse)1 HostgroupConfigurations (com.sequenceiq.cloudbreak.blueprint.configuration.HostgroupConfigurations)1 SiteConfigurations (com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations)1 HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)1 TestFile (com.sequenceiq.cloudbreak.blueprint.testrepeater.TestFile)1