Search in sources :

Example 1 with TestingDialectResolutionInfo

use of org.hibernate.dialect.resolver.TestingDialectResolutionInfo in project hibernate-orm by hibernate.

the class StandardDialectResolverTest method runDialectTest.

private static void runDialectTest(String productName, int majorVersion, int minorVersion, Class<? extends Dialect> expectedDialect) {
    TestingDialectResolutionInfo info = TestingDialectResolutionInfo.forDatabaseInfo(productName, majorVersion, minorVersion);
    Dialect dialect = StandardDialectResolver.INSTANCE.resolveDialect(info);
    StringBuilder builder = new StringBuilder(productName).append(" ").append(majorVersion);
    if (minorVersion > 0) {
        builder.append(".").append(minorVersion);
    }
    String dbms = builder.toString();
    assertNotNull("Dialect for " + dbms + " should not be null", dialect);
    assertTrue("Dialect for " + dbms + " should be " + expectedDialect.getSimpleName(), expectedDialect.isInstance(dialect));
}
Also used : TestingDialectResolutionInfo(org.hibernate.dialect.resolver.TestingDialectResolutionInfo) SQLServer2012Dialect(org.hibernate.dialect.SQLServer2012Dialect) SQLServer2005Dialect(org.hibernate.dialect.SQLServer2005Dialect) SQLServer2008Dialect(org.hibernate.dialect.SQLServer2008Dialect) PostgreSQL81Dialect(org.hibernate.dialect.PostgreSQL81Dialect) SQLServerDialect(org.hibernate.dialect.SQLServerDialect) PostgreSQL9Dialect(org.hibernate.dialect.PostgreSQL9Dialect) Dialect(org.hibernate.dialect.Dialect) PostgreSQL82Dialect(org.hibernate.dialect.PostgreSQL82Dialect)

Aggregations

Dialect (org.hibernate.dialect.Dialect)1 PostgreSQL81Dialect (org.hibernate.dialect.PostgreSQL81Dialect)1 PostgreSQL82Dialect (org.hibernate.dialect.PostgreSQL82Dialect)1 PostgreSQL9Dialect (org.hibernate.dialect.PostgreSQL9Dialect)1 SQLServer2005Dialect (org.hibernate.dialect.SQLServer2005Dialect)1 SQLServer2008Dialect (org.hibernate.dialect.SQLServer2008Dialect)1 SQLServer2012Dialect (org.hibernate.dialect.SQLServer2012Dialect)1 SQLServerDialect (org.hibernate.dialect.SQLServerDialect)1 TestingDialectResolutionInfo (org.hibernate.dialect.resolver.TestingDialectResolutionInfo)1