Search in sources :

Example 16 with DatabaseServer

use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.

the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupFamilyTestWhenPgSqlAndMissingMinorVersion.

@Test
void getDBParameterGroupFamilyTestWhenPgSqlAndMissingMinorVersion() {
    DatabaseServer databaseServer = DatabaseServer.builder().engine(DatabaseEngine.POSTGRESQL).build();
    databaseServer.putParameter(ENGINE_VERSION, "10");
    AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
    assertThat(underTest.getDBParameterGroupFamily()).isEqualTo("postgres10");
}
Also used : DatabaseServer(com.sequenceiq.cloudbreak.cloud.model.DatabaseServer) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 17 with DatabaseServer

use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.

the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupFamilyTestWhenPgSqlAndMajorVersionNumericOverflow.

@Test
void getDBParameterGroupFamilyTestWhenPgSqlAndMajorVersionNumericOverflow() {
    DatabaseServer databaseServer = DatabaseServer.builder().engine(DatabaseEngine.POSTGRESQL).build();
    databaseServer.putParameter(ENGINE_VERSION, "12345678901234567890.1");
    AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
    assertThatCode(underTest::getDBParameterGroupFamily).isInstanceOf(NumberFormatException.class);
}
Also used : DatabaseServer(com.sequenceiq.cloudbreak.cloud.model.DatabaseServer) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 18 with DatabaseServer

use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.

the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupFamilyTestWhenPgSqlAndValidVersion.

@ParameterizedTest(name = "{0}")
@MethodSource("validVersionDataProvider")
void getDBParameterGroupFamilyTestWhenPgSqlAndValidVersion(String testCaseName, String version, String familyExpected) {
    DatabaseServer databaseServer = DatabaseServer.builder().engine(DatabaseEngine.POSTGRESQL).build();
    databaseServer.putParameter(ENGINE_VERSION, version);
    AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
    assertThat(underTest.getDBParameterGroupFamily()).isEqualTo(familyExpected);
}
Also used : DatabaseServer(com.sequenceiq.cloudbreak.cloud.model.DatabaseServer) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 19 with DatabaseServer

use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.

the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupFamilyTestWhenNullEngine.

@Test
void getDBParameterGroupFamilyTestWhenNullEngine() {
    DatabaseServer databaseServer = DatabaseServer.builder().build();
    AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
    assertThat(underTest.getDBParameterGroupFamily()).isNull();
}
Also used : DatabaseServer(com.sequenceiq.cloudbreak.cloud.model.DatabaseServer) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 20 with DatabaseServer

use of com.sequenceiq.cloudbreak.cloud.model.DatabaseServer in project cloudbreak by hortonworks.

the class AwsRdsDbParameterGroupViewTest method getDBParameterGroupFamilyTestWhenPgSqlAndUnsupportedMajorVersion.

@ParameterizedTest(name = "{0}")
@MethodSource("unsupportedMajorVersionDataProvider")
void getDBParameterGroupFamilyTestWhenPgSqlAndUnsupportedMajorVersion(String testCaseName, String version) {
    DatabaseServer databaseServer = DatabaseServer.builder().engine(DatabaseEngine.POSTGRESQL).build();
    databaseServer.putParameter(ENGINE_VERSION, version);
    AwsRdsDbParameterGroupView underTest = new AwsRdsDbParameterGroupView(databaseServer);
    assertThatCode(underTest::getDBParameterGroupFamily).isInstanceOf(IllegalStateException.class);
}
Also used : DatabaseServer(com.sequenceiq.cloudbreak.cloud.model.DatabaseServer) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

DatabaseServer (com.sequenceiq.cloudbreak.cloud.model.DatabaseServer)36 Test (org.junit.jupiter.api.Test)27 DatabaseStack (com.sequenceiq.cloudbreak.cloud.model.DatabaseStack)23 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)18 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)17 SQLAdmin (com.google.api.services.sqladmin.SQLAdmin)16 DatabaseInstance (com.google.api.services.sqladmin.model.DatabaseInstance)13 InstancesListResponse (com.google.api.services.sqladmin.model.InstancesListResponse)13 PersistenceNotifier (com.sequenceiq.cloudbreak.cloud.notification.PersistenceNotifier)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 Network (com.sequenceiq.cloudbreak.cloud.model.Network)8 ExternalDatabaseStatus (com.sequenceiq.cloudbreak.cloud.model.ExternalDatabaseStatus)7 Subnet (com.sequenceiq.cloudbreak.cloud.model.Subnet)7 HashMap (java.util.HashMap)7 GcpResourceException (com.sequenceiq.cloudbreak.cloud.gcp.GcpResourceException)6 Settings (com.google.api.services.sqladmin.model.Settings)5 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)5 GoogleJsonError (com.google.api.client.googleapis.json.GoogleJsonError)4 GoogleJsonResponseException (com.google.api.client.googleapis.json.GoogleJsonResponseException)4 Compute (com.google.api.services.compute.Compute)4