Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Summary

local.properties is now used for overriding database settings used during runtime and testing. This file should be placed in Mifos Configuration Locations.

Details

Detailed development notes from work during story 1405 follow.
list-table:: Mifos Database Connections:header-rows: 1

  • - database connection - how settings are gathered and used
  • - Mifos web application - Connection properties from mainDatabase.properties (in VCS) is loaded and combined with "main.database.*" settings from local.properties. Both .properties files are found via ConfigurationLocator.
  • - legacy build - "build_test_db" and "run_test" targets use "integration.database." settings in local.properties and build.properties to build JDBC connections. Mifos Configuration Locations is searched for local.properties. "build_db" and "build_production_db" use different settings (main.database.) in the same .properties files. Settings in both files are combined as per the rules of the Ant <property> task (see Notes, below).
  • - legacy integration tests - "run_test" target sets Java system property "mifos.mode" to "integration". Database connection established with help from TestingService (see Notes, below).
  • - integration tests using spring - propertyConfigurer.xml loads settings from integrationDatabase.properties and searches Mifos Configuration Locations for local.properties. "integration.database.*" settings are then used in test-context.xml to configure JDBC connection.
  • - acceptance tests - same as 'integration tests using spring' except s/integration/acceptance/
  • - acceptance tests: sql-maven-plugin - Load acceptanceDatabase.properties (formerly jdbc.properties) directly from source tree using properties-maven-plugin, then search Mifos Configuration Locations for local.properties. "acceptance.database.*" settings are then referenced explicitly in POM. Set <quiet>true</quiet> in properties-maven-plugin so absence of local.properties doesn't halt the build (this removes the need for local.property.overrides hack in acceptanceTests/pom.xml).
  • - acceptance tests: cargo - Similar to 'legacy integration tests' except set "mifos.mode" to "acceptance".

Notes

  • with ant <properties> task, properties are immutable once set: first one wins
  • with properties-maven-plugin, last one wins
  • in lieu of Maven/Spring/Ant-specific interfaces to ConfigurationLocator, all files with hardcoded paths mentioned in ConfigurationLocator should also include the string "mimics ConfigurationLocator directory search behavior" in a comment
  • TestingService encapsulates all logic necessary to have the application behave differently during acceptance and integration tests. While setting up a database connection, ConfigureSession.configure() will ask this service which settings to read, and from which properties files