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