Search in sources :

Example 1 with AmbariDatabaseDetailsJson

use of com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson in project cloudbreak by hortonworks.

the class AmbariDatabaseMapperImpl method mapAmbariDatabaseToAmbariDatabaseDetailJson.

@Override
public AmbariDatabaseDetailsJson mapAmbariDatabaseToAmbariDatabaseDetailJson(AmbariDatabase ambariDatabase) {
    if (ambariDatabase == null) {
        return null;
    }
    AmbariDatabaseDetailsJson ambariDatabaseDetailsJson = new AmbariDatabaseDetailsJson();
    ambariDatabaseDetailsJson.setVendor(mapVendorByValue(ambariDatabase.getVendor()));
    ambariDatabaseDetailsJson.setName(ambariDatabase.getName());
    ambariDatabaseDetailsJson.setHost(ambariDatabase.getHost());
    ambariDatabaseDetailsJson.setPort(ambariDatabase.getPort());
    ambariDatabaseDetailsJson.setUserName(ambariDatabase.getUserName());
    ambariDatabaseDetailsJson.setPassword(ambariDatabase.getPassword());
    return ambariDatabaseDetailsJson;
}
Also used : AmbariDatabaseDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson)

Example 2 with AmbariDatabaseDetailsJson

use of com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson in project cloudbreak by hortonworks.

the class AmbariDatabaseToRdsConfigMigrationService method createRdsConfig.

private RDSConfig createRdsConfig(ClusterComponent component, Cluster cluster) throws IOException {
    LOGGER.debug("Creating RdsConfig for component id: [{}]", component.getId());
    AmbariDatabaseDetailsJson ambariDatabaseDetailsJson = ambariDatabaseMapper.mapAmbariDatabaseToAmbariDatabaseDetailJson(component.getAttributes().get(AmbariDatabase.class));
    RDSConfig rdsConfig = ambariDatabaseMapper.mapAmbariDatabaseDetailsJsonToRdsConfig(ambariDatabaseDetailsJson, cluster, null, false);
    if (DatabaseVendor.EMBEDDED.name().equalsIgnoreCase(rdsConfig.getDatabaseEngine())) {
        rdsConfig.setStatus(ResourceStatus.DEFAULT);
    }
    return rdsConfigService.create(rdsConfig);
}
Also used : AmbariDatabase(com.sequenceiq.cloudbreak.cloud.model.AmbariDatabase) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) AmbariDatabaseDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson)

Example 3 with AmbariDatabaseDetailsJson

use of com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson in project cloudbreak by hortonworks.

the class AmbariDatabaseMapperTest method testMapAmbariDatabaseToAmbariDatabaseDetailJson.

@Test
public void testMapAmbariDatabaseToAmbariDatabaseDetailJson() {
    AmbariDatabase ambariDatabase = new AmbariDatabase();
    ambariDatabase.setVendor(DatabaseVendor.POSTGRES.ambariVendor());
    AmbariDatabaseDetailsJson ambariDatabaseDetailsJson = mapper.mapAmbariDatabaseToAmbariDatabaseDetailJson(ambariDatabase);
    assertEquals(mapper.mapVendorByValue(DatabaseVendor.POSTGRES.ambariVendor()), ambariDatabaseDetailsJson.getVendor());
}
Also used : AmbariDatabase(com.sequenceiq.cloudbreak.cloud.model.AmbariDatabase) AmbariDatabaseDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson) Test(org.junit.Test)

Example 4 with AmbariDatabaseDetailsJson

use of com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson in project cloudbreak by hortonworks.

the class AmbariDatabaseMapperTest method setUp.

@Before
public void setUp() {
    mapper = Mappers.getMapper(AmbariDatabaseMapper.class);
    json = new AmbariDatabaseDetailsJson();
    json.setHost("testHost");
    json.setPort(1234);
    json.setName("testName");
    json.setVendor(DatabaseVendor.POSTGRES);
    cluster = new Cluster();
    cluster.setId(1L);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster) AmbariDatabaseDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson) Before(org.junit.Before)

Aggregations

AmbariDatabaseDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariDatabaseDetailsJson)4 AmbariDatabase (com.sequenceiq.cloudbreak.cloud.model.AmbariDatabase)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)1 Before (org.junit.Before)1 Test (org.junit.Test)1