Search in sources :

Example 6 with Dialect

use of org.sonar.db.dialect.Dialect in project sonarqube by SonarSource.

the class BlobColumnDefTest method generateSqlType_thows_IAE_for_unknown_dialect.

@Test
public void generateSqlType_thows_IAE_for_unknown_dialect() {
    Dialect dialect = mock(Dialect.class);
    when(dialect.getId()).thenReturn("AAA");
    assertThatThrownBy(() -> underTest.generateSqlType(dialect)).isInstanceOf(IllegalArgumentException.class).hasMessage("Unsupported dialect id AAA");
}
Also used : Dialect(org.sonar.db.dialect.Dialect) Test(org.junit.Test)

Example 7 with Dialect

use of org.sonar.db.dialect.Dialect in project sonarqube by SonarSource.

the class AutoDbMigration method start.

@Override
public void start() {
    if (!serverUpgradeStatus.isFreshInstall()) {
        return;
    }
    Loggers.get(getClass()).info("Automatically perform DB migration on fresh install");
    Dialect dialect = dbClient.getDatabase().getDialect();
    if (H2.ID.equals(dialect.getId())) {
        installH2();
    } else {
        migrationEngine.execute();
    }
}
Also used : Dialect(org.sonar.db.dialect.Dialect)

Example 8 with Dialect

use of org.sonar.db.dialect.Dialect in project sonarqube by SonarSource.

the class IntegerColumnDefTest method generateSqlType_thows_IAE_for_unknown_dialect.

@Test
public void generateSqlType_thows_IAE_for_unknown_dialect() {
    Dialect dialect = mock(Dialect.class);
    when(dialect.getId()).thenReturn("AAA");
    assertThatThrownBy(() -> underTest.generateSqlType(dialect)).isInstanceOf(IllegalArgumentException.class).hasMessage("Unsupported dialect id AAA");
}
Also used : Dialect(org.sonar.db.dialect.Dialect) Test(org.junit.Test)

Example 9 with Dialect

use of org.sonar.db.dialect.Dialect in project sonarqube by SonarSource.

the class TinyIntColumnDefTest method fail_with_UOE_to_generate_sql_type_when_unknown_dialect.

@Test
public void fail_with_UOE_to_generate_sql_type_when_unknown_dialect() {
    assertThatThrownBy(() -> {
        TinyIntColumnDef def = new TinyIntColumnDef.Builder().setColumnName("foo").setIsNullable(true).build();
        Dialect dialect = mock(Dialect.class);
        when(dialect.getId()).thenReturn("unknown");
        def.generateSqlType(dialect);
    }).isInstanceOf(UnsupportedOperationException.class).hasMessage("Unknown dialect 'unknown'");
}
Also used : Dialect(org.sonar.db.dialect.Dialect) Test(org.junit.Test)

Example 10 with Dialect

use of org.sonar.db.dialect.Dialect in project sonarqube by SonarSource.

the class DecimalColumnDefTest method fail_with_UOE_to_generate_sql_type_when_unknown_dialect.

@Test
public void fail_with_UOE_to_generate_sql_type_when_unknown_dialect() {
    assertThatThrownBy(() -> {
        DecimalColumnDef def = new DecimalColumnDef.Builder().setColumnName("issues").setPrecision(30).setScale(20).setIsNullable(true).build();
        Dialect dialect = mock(Dialect.class);
        when(dialect.getId()).thenReturn("unknown");
        def.generateSqlType(dialect);
    }).isInstanceOf(UnsupportedOperationException.class).hasMessage("Unknown dialect 'unknown'");
}
Also used : Dialect(org.sonar.db.dialect.Dialect) Test(org.junit.Test)

Aggregations

Dialect (org.sonar.db.dialect.Dialect)10 Test (org.junit.Test)6