Add test
This commit is contained in:
@@ -23,15 +23,16 @@ public class JpaHibernatePropertiesProvider extends HibernatePropertiesProvider
|
||||
|
||||
public JpaHibernatePropertiesProvider(LocalContainerEntityManagerFactoryBean theEntityManagerFactory) {
|
||||
String dialectClass =
|
||||
(String) theEntityManagerFactory.getJpaPropertyMap().get("hibernate.dialect");
|
||||
(String) theEntityManagerFactory.getJpaPropertyMap().get("hibernate.dialect");
|
||||
if (isNotBlank(dialectClass)) {
|
||||
myDialect = ReflectionUtil.newInstanceOrReturnNull(dialectClass, Dialect.class);
|
||||
} else {
|
||||
ourLog.warn("'hibernate.dialect' not set in application configuration! Please explicitly specify a valid HAPI FHIR hibernate dialect.");
|
||||
ourLog.warn(
|
||||
"'hibernate.dialect' not set in application configuration! Please explicitly specify a valid HAPI FHIR hibernate dialect.");
|
||||
DataSource connection = theEntityManagerFactory.getDataSource();
|
||||
try (Connection dbConnection = connection.getConnection()) {
|
||||
myDialect = new StandardDialectResolver()
|
||||
.resolveDialect(new DatabaseMetaDataDialectResolutionInfoAdapter(dbConnection.getMetaData()));
|
||||
.resolveDialect(new DatabaseMetaDataDialectResolutionInfoAdapter(dbConnection.getMetaData()));
|
||||
} catch (SQLException sqlException) {
|
||||
throw new ConfigurationException(sqlException.getMessage(), sqlException);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
|
||||
import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
|
||||
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
|
||||
import ca.uhn.fhir.jpa.starter.cr.CrProperties;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
@@ -80,6 +82,9 @@ class ExampleServerR4IT implements IServerSupport {
|
||||
@Autowired
|
||||
private CrProperties crProperties;
|
||||
|
||||
@Autowired
|
||||
private HibernatePropertiesProvider myHibernatePropertiesProvider;
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
@@ -367,6 +372,11 @@ class ExampleServerR4IT implements IServerSupport {
|
||||
Parameters localResult = ourClient.operation().onType(CodeSystem.class).named("$validate-code").withParameter(Parameters.class, "url", new UrlType(testCodeSystem)).andParameter("coding", new Coding(testCodeSystem, "yes", null)).execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHibernatePropertiesProvider_GetDialect() {
|
||||
assertEquals(HapiFhirH2Dialect.class, myHibernatePropertiesProvider.getDialect().getClass());
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user