Search in sources :

Example 1 with RDSConfig

use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.

the class BlueprintTemplateModelContextBuilder method withRdsConfigs.

public BlueprintTemplateModelContextBuilder withRdsConfigs(Iterable<RDSConfig> rdsConfigs) {
    for (RDSConfig rdsConfig : rdsConfigs) {
        if (rdsConfig != null) {
            RdsView rdsView = new RdsView(rdsConfig);
            String componentName = rdsConfig.getType().toLowerCase();
            this.rds.put(componentName, rdsView);
        }
    }
    return this;
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsView(com.sequenceiq.cloudbreak.blueprint.template.views.RdsView)

Example 2 with RDSConfig

use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.

the class BlueprintTemplateProcessorTest method rdsConfig.

private RDSConfig rdsConfig(String rdsType) {
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setName(rdsType);
    rdsConfig.setConnectionPassword("iamsoosecure");
    rdsConfig.setConnectionUserName("heyitsme");
    rdsConfig.setConnectionURL("jdbc:postgresql://10.1.1.1:5432/" + rdsType);
    rdsConfig.setConnectionDriver("org.postgresql.Driver");
    rdsConfig.setDatabaseEngine("POSTGRES");
    rdsConfig.setType(rdsType);
    return rdsConfig;
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig)

Example 3 with RDSConfig

use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.

the class BlueprintTemplateProcessorTest method cluster.

private Cluster cluster() {
    Cluster cluster = TestUtil.cluster();
    Set<RDSConfig> rdsConfigSet = new HashSet<>();
    rdsConfigSet.add(rdsConfig(RdsType.DRUID.name().toLowerCase()));
    RDSConfig hiveRds = rdsConfig(RdsType.HIVE.name().toLowerCase());
    rdsConfigSet.add(hiveRds);
    rdsConfigSet.add(rdsConfig(RdsType.RANGER.name().toLowerCase()));
    cluster.setRdsConfigs(rdsConfigSet);
    Map<String, String> inputs = new HashMap<>();
    inputs.put("S3_BUCKET", "testbucket");
    try {
        cluster.setBlueprintInputs(new Json(inputs));
    } catch (JsonProcessingException ignored) {
        cluster.setBlueprintInputs(null);
    }
    return cluster;
}
Also used : HashMap(java.util.HashMap) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Json(com.sequenceiq.cloudbreak.domain.json.Json) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) HashSet(java.util.HashSet)

Example 4 with RDSConfig

use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.

the class RdsViewTest method testCreateRdsViewWhenConnectionUrlContainsSubprotocolAndSubname.

@Test
public void testCreateRdsViewWhenConnectionUrlContainsSubprotocolAndSubname() {
    String connectionUrl = "jdbc:postgresql:subname://some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432/ranger";
    RDSConfig rdsConfig = createRdsConfig(connectionUrl);
    RdsView underTest = new RdsView(rdsConfig);
    Assert.assertEquals(ASSERT_ERROR_MSG, "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432", underTest.getHostWithPort());
    Assert.assertEquals("postgresql:subname", underTest.getSubprotocol());
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Test(org.junit.Test)

Example 5 with RDSConfig

use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.

the class RdsViewTest method testCreateRdsViewWhenRDSConfigContainsConnectionUrlWithoutDatabaseName.

@Test
public void testCreateRdsViewWhenRDSConfigContainsConnectionUrlWithoutDatabaseName() {
    String connectionUrl = "jdbc:postgresql://some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432";
    RDSConfig rdsConfig = createRdsConfig(connectionUrl);
    RdsView underTest = new RdsView(rdsConfig);
    Assert.assertEquals(ASSERT_ERROR_MSG, "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432", underTest.getHostWithPort());
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Test(org.junit.Test)

Aggregations

RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)47 Test (org.junit.Test)16 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)7 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)6 RDSConfigRequest (com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest)5 Date (java.util.Date)5 HashSet (java.util.HashSet)5 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)4 Json (com.sequenceiq.cloudbreak.domain.json.Json)4 IOException (java.io.IOException)4 APIResourceType (com.sequenceiq.cloudbreak.common.type.APIResourceType)3 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)3 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)3 Stack (com.sequenceiq.cloudbreak.domain.Stack)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)2 BlueprintParameterJson (com.sequenceiq.cloudbreak.api.model.BlueprintParameterJson)2 ConfigsResponse (com.sequenceiq.cloudbreak.api.model.ConfigsResponse)2 RdsView (com.sequenceiq.cloudbreak.blueprint.template.views.RdsView)2 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)2