use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.
the class GcpDatabaseServerViewTest method testGcpDatabaseNetworkView.
@Test
public void testGcpDatabaseNetworkView() {
Map<String, Object> map = new HashMap<>();
map.put("engineVersion", "1");
DatabaseServer databaseServer = DatabaseServer.builder().connectionDriver("driver").serverId("driver").connectorJarUrl("driver").engine(DatabaseEngine.POSTGRESQL).location("location").port(99).storageSize(50L).rootUserName("rootUserName").rootPassword("rootPassword").flavor("flavor").useSslEnforcement(true).params(map).build();
GcpDatabaseServerView gcpDatabaseServerView = new GcpDatabaseServerView(databaseServer);
Assert.assertEquals("POSTGRES", gcpDatabaseServerView.getDatabaseType());
Assert.assertEquals("POSTGRES_1", gcpDatabaseServerView.getDatabaseVersion());
Assert.assertEquals("driver", gcpDatabaseServerView.getDbServerName());
Assert.assertEquals("rootUserName", gcpDatabaseServerView.getAdminLoginName());
Assert.assertEquals(Integer.valueOf(99), gcpDatabaseServerView.getPort());
Assert.assertEquals("rootPassword", gcpDatabaseServerView.getAdminPassword());
Assert.assertEquals(Long.valueOf(50L), gcpDatabaseServerView.getAllocatedStorageInGb());
Assert.assertEquals("1", gcpDatabaseServerView.getDbVersion());
}
use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.
the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupNameTestWhenNullServerId.
@Test
void getDBParameterGroupNameTestWhenNullServerId() {
DatabaseServer databaseServer = DatabaseServer.builder().build();
AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
assertThat(underTest.getDBParameterGroupName()).isNull();
}
use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.
the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupNameTestWhenHasServerId.
@Test
void getDBParameterGroupNameTestWhenHasServerId() {
DatabaseServer databaseServer = DatabaseServer.builder().serverId("myserver").build();
AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
assertThat(underTest.getDBParameterGroupName()).isEqualTo("dpg-myserver");
}
use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.
the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupFamilyTestWhenPgSqlAndBadVersionFormat.
// Note: There is no easy way to test the "bad engine variant" case as enum classes are final and hard to mock.
@Test
void getDBParameterGroupFamilyTestWhenPgSqlAndBadVersionFormat() {
DatabaseServer databaseServer = DatabaseServer.builder().engine(DatabaseEngine.POSTGRESQL).build();
databaseServer.putParameter(ENGINE_VERSION, "latest");
AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
assertThatCode(underTest::getDBParameterGroupFamily).isInstanceOf(IllegalStateException.class);
}
use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.
the class DBStackToDatabaseStackConverter method buildDatabaseServer.
private DatabaseServer buildDatabaseServer(DBStack dbStack) {
com.sequenceiq.redbeams.domain.stack.DatabaseServer dbStackDatabaseServer = dbStack.getDatabaseServer();
if (dbStackDatabaseServer == null) {
return null;
}
Map<String, Object> params = buildParameters(dbStack);
SecurityGroup securityGroup = dbStackDatabaseServer.getSecurityGroup();
DatabaseServer.Builder builder = DatabaseServer.builder().serverId(dbStackDatabaseServer.getName()).flavor(dbStackDatabaseServer.getInstanceType()).engine(getDatabaseEngine(dbStackDatabaseServer)).connectionDriver(dbStackDatabaseServer.getConnectionDriver()).rootUserName(dbStackDatabaseServer.getRootUserName()).rootPassword(dbStackDatabaseServer.getRootPassword()).port(dbStackDatabaseServer.getPort()).useSslEnforcement(determineSslEnforcement(dbStack)).storageSize(dbStackDatabaseServer.getStorageSize()).security(securityGroup == null ? null : new Security(Collections.emptyList(), securityGroup.getSecurityGroupIds())).status(CREATE_REQUESTED).location(dbStack.getRegion()).highAvailability(dbStack.isHa()).params(params);
return builder.build();
}
Aggregations