Skip to content

Commit

Permalink
Remove tests of hardcoded dialects
Browse files Browse the repository at this point in the history
These tests are not absolutely necessary since we have integration
tests for each database kind, which would fail if we targeted a
non-existing dialect.

And we won't be able to (easily) execute those tests after the next
commit anyway.
  • Loading branch information
yrodiere committed May 30, 2022
1 parent 4ad8dd6 commit 11b3ba4
Showing 1 changed file with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,12 @@

import static org.assertj.core.api.Assertions.assertThatCode;

import java.util.Collections;
import java.util.Set;

import org.hibernate.dialect.DB297Dialect;
import org.hibernate.dialect.DerbyTenSevenDialect;
import org.hibernate.dialect.MariaDB106Dialect;
import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.dialect.Oracle12cDialect;
import org.hibernate.dialect.SQLServer2016Dialect;
import org.jboss.jandex.DotName;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;
import io.quarkus.hibernate.orm.runtime.dialect.QuarkusH2Dialect;
import io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL10Dialect;

public class ConstantsTest {
@ParameterizedTest
@MethodSource("provideConstantsToTest")
Expand All @@ -33,23 +19,4 @@ void testClassNameRefersToExistingClass(DotName constant) {
private static Set<DotName> provideConstantsToTest() {
return ClassNames.CREATED_CONSTANTS;
}

@Test
public void testDialectNames() {
assertDialectMatch(DatabaseKind.DB2, DB297Dialect.class);
assertDialectMatch(DatabaseKind.POSTGRESQL, QuarkusPostgreSQL10Dialect.class);
assertDialectMatch(DatabaseKind.H2, QuarkusH2Dialect.class);
assertDialectMatch(DatabaseKind.MARIADB, MariaDB106Dialect.class);
assertDialectMatch(DatabaseKind.MYSQL, MySQL8Dialect.class);
assertDialectMatch(DatabaseKind.DERBY, DerbyTenSevenDialect.class);
assertDialectMatch(DatabaseKind.MSSQL, SQLServer2016Dialect.class);
assertDialectMatch(DatabaseKind.ORACLE, Oracle12cDialect.class);
}

private void assertDialectMatch(String dbName, Class<?> dialectClass) {
final String guessDialect = Dialects
.guessDialect(PersistenceUnitUtil.DEFAULT_PERSISTENCE_UNIT_NAME, dbName, Collections.emptyList());
Assertions.assertEquals(dialectClass.getName(), guessDialect);
}

}

0 comments on commit 11b3ba4

Please sign in to comment.