Search in sources :

Example 1 with BlueprintView

use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView 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\""));
}
Also used : BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 2 with BlueprintView

use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView 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"));
}
Also used : BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) HashMap(java.util.HashMap) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Json(com.sequenceiq.cloudbreak.domain.json.Json) Test(org.junit.Test)

Example 3 with BlueprintView

use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView 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\""));
}
Also used : BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 4 with BlueprintView

use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView 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);
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 5 with BlueprintView

use of com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView in project cloudbreak by hortonworks.

the class StackRequestToBlueprintPreparationObjectConverter method convert.

@Override
public BlueprintPreparationObject convert(StackV2Request source) {
    try {
        IdentityUser identityUser = userDetailsService.getDetails(source.getOwner(), UserFilterField.USERID);
        FlexSubscription flexSubscription = getFlexSubscription(source);
        String smartsenseSubscriptionId = getSmartsenseSubscriptionId(source, flexSubscription);
        KerberosConfig kerberosConfig = getKerberosConfig(source);
        LdapConfig ldapConfig = getLdapConfig(source, identityUser);
        FileSystemConfigurationView fileSystemConfigurationView = getFileSystemConfigurationView(source);
        Set<RDSConfig> rdsConfigs = getRdsConfigs(source, identityUser);
        Blueprint blueprint = getBlueprint(source, identityUser);
        BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(blueprint.getBlueprintText());
        Set<HostgroupView> hostgroupViews = getHostgroupViews(source);
        BlueprintView blueprintView = new BlueprintView(blueprint.getBlueprintText(), blueprintStackInfo.getVersion(), blueprintStackInfo.getType());
        GeneralClusterConfigs generalClusterConfigs = generalClusterConfigsProvider.generalClusterConfigs(source, identityUser);
        return BlueprintPreparationObject.Builder.builder().withFlexSubscription(flexSubscription).withRdsConfigs(rdsConfigs).withHostgroupViews(hostgroupViews).withBlueprintView(blueprintView).withStackRepoDetailsHdpVersion(blueprintStackInfo.getVersion()).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigs).withSmartSenseSubscriptionId(smartsenseSubscriptionId).withLdapConfig(ldapConfig).withKerberosConfig(kerberosConfig).build();
    } catch (BlueprintProcessingException e) {
        throw new CloudbreakServiceException(e.getMessage(), e);
    } catch (IOException e) {
        throw new CloudbreakServiceException(e.getMessage(), e);
    }
}
Also used : BlueprintProcessingException(com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) IOException(java.io.IOException) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) FlexSubscription(com.sequenceiq.cloudbreak.domain.FlexSubscription) FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)

Aggregations

BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)11 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)8 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)8 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)8 Test (org.junit.Test)8 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)3 BlueprintProcessingException (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException)2 HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)2 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)2 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)2 Json (com.sequenceiq.cloudbreak.domain.json.Json)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.service.CloudbreakServiceException)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 HostgroupView (com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 FlexSubscription (com.sequenceiq.cloudbreak.domain.FlexSubscription)1