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;
}
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);
}
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());
}
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);
}
Aggregations