dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41280
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21026: Hibernate conf manager, skip check for conf file during unit tests
------------------------------------------------------------
revno: 21026
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-11-11 08:56:25 +0100
message:
Hibernate conf manager, skip check for conf file during unit tests
modified:
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java 2015-11-10 17:56:46 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java 2015-11-11 07:56:25 +0000
@@ -95,6 +95,8 @@
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ boolean testing = "true".equals( System.getProperty( "org.hisp.dhis.test", "false" ) );
+
// ---------------------------------------------------------------------
// Add mapping resources
// ---------------------------------------------------------------------
@@ -141,25 +143,26 @@
// Add custom properties from file system
// ---------------------------------------------------------------------
- try
- {
- Properties fileProperties = configurationProvider.getProperties();
-
- mapDhisToHibernateProperties( fileProperties );
-
- configuration.addProperties( fileProperties );
- }
- catch ( LocationManagerException ex )
- {
- log.info( "Could not read external configuration from file system" );
+ if ( !testing )
+ {
+ try
+ {
+ Properties fileProperties = configurationProvider.getProperties();
+
+ mapToHibernateProperties( fileProperties );
+
+ configuration.addProperties( fileProperties );
+ }
+ catch ( LocationManagerException ex )
+ {
+ log.info( "Could not read external configuration from file system" );
+ }
}
// ---------------------------------------------------------------------
// Disable second-level cache during testing
// ---------------------------------------------------------------------
- boolean testing = "true".equals( System.getProperty( "org.hisp.dhis.test", "false" ) );
-
if ( testing )
{
configuration.setProperty( "hibernate.cache.use_second_level_cache", "false" );
@@ -197,7 +200,7 @@
// Supportive methods
// -------------------------------------------------------------------------
- private void mapDhisToHibernateProperties( Properties properties )
+ private void mapToHibernateProperties( Properties properties )
{
putIfExists( properties, ConfigurationKey.CONNECTION_DIALECT.getKey(), "hibernate.dialect" );
putIfExists( properties, ConfigurationKey.CONNECTION_DRIVER_CLASS.getKey(), "hibernate.connection.driver_class" );