HHH-17295 Change which constructor is looked-up in DialectContext test utils
This commit is contained in:
parent
4bf9bfac5a
commit
30241bbe9f
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DialectContext;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DialectContextTest {
|
||||
|
||||
@Test
|
||||
public void smoke() {
|
||||
Dialect current = DialectContext.getDialect();
|
||||
assertThat( current ).isNotNull();
|
||||
}
|
||||
}
|
|
@ -14,8 +14,6 @@ import java.util.Properties;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.jdbc.dialect.spi.DatabaseMetaDataDialectResolutionInfoAdapter;
|
||||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
|
||||
/**
|
||||
|
@ -33,13 +31,13 @@ public final class DialectContext {
|
|||
}
|
||||
try {
|
||||
final Class<? extends Dialect> dialectClass = ReflectHelper.classForName( dialectName );
|
||||
final Constructor<? extends Dialect> constructor = dialectClass.getConstructor( DialectResolutionInfo.class );
|
||||
final Constructor<? extends Dialect> constructor = dialectClass.getConstructor();
|
||||
Driver driver = (Driver) Class.forName( properties.getProperty( Environment.DRIVER ) ).newInstance();
|
||||
Properties props = new Properties();
|
||||
props.setProperty( "user", properties.getProperty( Environment.USER ) );
|
||||
props.setProperty( "password", properties.getProperty( Environment.PASS ) );
|
||||
try (Connection connection = driver.connect( properties.getProperty( Environment.URL ), props )) {
|
||||
dialect = constructor.newInstance( new DatabaseMetaDataDialectResolutionInfoAdapter( connection.getMetaData() ) );
|
||||
dialect = constructor.newInstance();
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException cnfe) {
|
||||
|
|
Loading…
Reference in New Issue