Legacy Mifos 2.x Introduction to Mifos for Programmers
FOR CURRENT MIFOS X INFORMATION, VISIT THE MIFOS X DEVELOPER ZONE Welcome to the Zone
Introduction
This is for new Mifos developers. If you have experience with computer science, Java/J2EE Web applications, testing, databases, etc. but are learning Mifos for the first time, this guide is for you!
This guide is time sensitive. It was started in the Spring of 2011, and is specific to the status of Mifos at that time.
This is not a detailed, comprehensive guide. Instead, it is made to point out key concepts and areas of Mifos, leading you to further study. Think of it as an index into the most important parts of Mifos.
Core functionalities aligned with domain
loans, savings, clients
see Product Features for overview of loans, savings and client functionality
see Functional specifications for center, group, client, loan and savings areas
see Developer oriented domain information for:
Cross-cutting functionality
Transaction Management
Mifos has legacy transaction manager org.mifos.framework.hibernate.helper.HibernateUtil, and some new code which uses spring based declarative transactions manager /mifos-appdomain/src/main/resources/org/mifos/config/resources/persistenceContext.xml.
org.mifos.framework.struts.action.BaseAction is a class which defines legacy session-per-requestion transaction management pattern.
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/transactions.html
http://community.jboss.org/wiki/OpenSessioninView
http://community.jboss.org/wiki/Sessionsandtransactions
Audit Logging
http://mifos.org/functional-specifications/system-processing/change-logs-and-application-logs
/mifos-webapp/src/main/resources/org/mifos/framework/util/resources/audit/ColumnMapping.xml
org.mifos.framework.components.audit.business.AuditLog (mapped to change_log table)
org.mifos.framework.components.audit.business.AuditLogRecord (mapped to change_log_detail table)
Security
Legacy code in Mifos uses a custom security mechanism based on RolesAndPermissions* classes. Handling of security is being transitioned to Spring Security which has been configured to run on top of the legacy security system. Spring security configuration can be found in application/src/main/webapp/WEB-INF/applicationContextSecurity.xml.
See:
Lookup Values
Legacy code in Mifos make use of LookupEntity, LookupValueEntity, LookupValueLocaleEntity, and LookupLabelEntity. Together these objects were supposed to fill multiple purposes including supporting static lists of localizable values, user definable lists of localizable values, user customizable labels.
More detail can be found on the LookupValueBackground page.
Configuration
Mifos has many configuration settings. See mifos.org for the authoritative guide.
Trapdoor settings
Some configuration settings may only be changed once! These settings must be carefully considered before entering data into a new Mifos installation.
http://mifos.org/documentation/configuration#about-the-one-time-settings
LSIM, GLIM, locales in the db
current refactorings in progress
UI conversion
Presentation layer code is being migrated from Struts 1.x/JSP to SpringMVC/Webflow/Freemarker. The goal is to remove all Struts/JSP code and replace it with SpringMVC/Webflow/Freemarker. As such any new functionality added should be implemented as SpringMVC/Webflow/Freemarker.
Service facades
Legacy Mifos code has business logic scattered through the code all the way up to the presentation layer including action classes and JSP pages. The goal is to remove business logic from the presentation layer and have it encapsulated inside Service Facades and Services.
build/developer details/limitations
Most developers use Eclipse, but it is certainly possible to use other IDEs
See:
Time to run acceptance tests
Acceptance tests hit a running instance of Mifos, clicking through the app and filling out forms as users would.
Acceptance tests generally take a long time to complete. The default (developer/local) build only runs a subset of tests, dramatically speeding up builds. Builds on the ci server run the full suite of acceptance tests.
See also:
- performance improvement of acceptance tests and performant approach for managing test data
- Running Acceptance Tests
- The Test Pyramid
- Writing Acceptance Tests
- Maven Acceptance Tests
ci server (birch) running in Seattle office
See Hudson Continuous Integration.
internal resources
the vault
Sensitive information (like passwords) is only shared using strong encryption. Ask an existing Mifos administrator for access to the vault.
Admin contacts: Adam Monsen, Van Mittal-Henkle, Sumit Shah, Udai Gupta
internal confluence wiki
- http://confluence.mifos.org
- runs on a server in the Seattle office
- admin contacts: Ed Cable, Scott Falaschi, Adam Monsen, Sumit Shah, Udai Gupta
Monitoring
- Mifos admins are notified of outages via email.
- Outage notifications are sent to the mifos administrators mailing list.
- OpenNMS runs on a server called "cloudboss". Ask an admin contact for access.
- Monitoring Servers With OpenNMS
- Admin contacts: Adam Monsen, Van Mittal-Henkle, Sumit Shah, Udai Gupta
Mifos administrators mailing list
- http://groups.google.com/forum/#!forum/mifos-adm|http://groups.google.com/forum/#!forum/mifos-adm
- Admin contacts: Adam Monsen, Van Mittal-Henkle, Sumit Shah, Udai Gupta, Emily Tucker, Ed Cable, Kay Chau
Backups
- We regularly remotely backup data on all machines.
- BackupPC runs on a server called "cloudboss". Ask an admin contact for access.
- /wiki/spaces/MIFOSADMIN/pages/8552796 (← must be logged in to view)
Testing infrastructure
Unit and Integration tests in Mifos uses Junit 4.5+ framework and only Acceptance Tests (acceptanceTests module) uses TestNG 1.5+ framework.
Maven Surefire Plugin is used in Maven configuration http://maven.apache.org/plugins/maven-surefire-plugin
Work is in the direction of increasing unit tests coverage and reducing integration tests so that build can be faster
We use different mocking frameworks to mock objects.
- EasyMock http://easymock.org/
- Mockito http://mockito.org/
Unit Testing
Integration Testing
Integration Tests follows a naming convention *IntegrationTest
legacy *StrutsTest
Struts tests are legacy tests related to struts framework and supposed to be removed once the UI Conversion in G is completed.
Acceptance Tests
Selenium is used to drive the user interface for end-to-end testing. Test datasets are maintained to avoid lots of boilerplate application setup for each test.
There is currently a two stage build process where in stage one (mvn clean install on project root) a small selection of the acceptance test get to run. On hudson, this is the head-master-commit job. The second stage build runs all acceptance tests and this corresponds to the head-master-secondary job on hudson.
Page Objects
Acceptance Tests uses Page Objects concept with Selenium.
http://code.google.com/p/selenium/wiki/PageObjects
Reporting
legacy BIRT integration
BIRT Reports in Mifos is used for providing basic reporting capabilities. We have been trying to move to Pentaho since the start of Develop Data Warehouse Strategy.
There are two major things that are remaining to completely removing BIRT from Mifos.
- Converting Existing Standard BIRT Reports to Pentaho reports.
- Replacing http://mifos.org/functional-specifications/retrieving-information/administrative-documents
Pentaho server/reports
Accounting Integration
/mifos-accounting module serves the purpose of getting accounting information from Mifos. Current integration was build to support Tally ERP 9.
Accounting Integration was initially build with Pentaho and then it was completely moved into Mifos (Admin → "View accounting exports")
The documentation explains the plan but not all of that is implemented.
Batch jobs
Mifos uses Spring batch / Quartz for batch jobs which are scheduled bulk processing when system is not in use (usually midnight)
meeting schedule generation
The notion of schedules are used for loans, savings and customer-loan officer meetings in mifos.
When creating a loan, a loan schedule (see loan_schedules table) is created that indicates the repayment dates for the loan along with principal, interest, fees etc.
When creating a savings account, a savings schedule (see saving_schedule table) is created for madatory and voluntary savings. In the case of mandatory savings, the schedule is used to indicate how much mandatory savings should be collected etc and in the case of voluntary savings account, it simply is used to indicate how much one might want to save etc
When creating a customer account (center/group/client) a customer meeting schedule (see customer_schedule table) is created that indicates when a loan officer is due to visit a center/group to administer financial services. At creation ten meeting schedules are created into the future. Fees/charges that are attached to a customer account are then linked with these meeting schedules.
Loan schedules are fixed but savings and customer meetings continue on always so there is an overnight batch job that is responsible for generating new saving_schedules and customer_schedules. It simply detects if the accounts are 'active' and if the number of schedules left is less than five, if so it generates 10 more schedules for the account. (see GenerateMeetingsForCustomerAndSavingsTask.java)
Customers meeting schedule can be changed (ie. from weekly on a monday, to weekly on a friday) and when this happens, mifos automatically adjusts (earlier versions of mifos used to rely on batch jobs to do this overnight) the schedules dates of the customer account and any active savings and loan accounts to the new meeting dates.
NOTE: There is a bug in mifos whereby if you are running with LSIM on, the loan accounts schedules are changed when they shouldnt be.
Database Migration/Upgrades
Mifos started using Liquibase (http://www.liquibase.org) since Mifos 2.1, Database Upgrades give good overview about how changes to database are added as Liquibase scripts.
Before Mifos 2.1 there was in house upgrade framework NSDU (Non Sequential Database Upgrades)
http://mifosforge.jira.com/browse/MIFOS-2896 (NSDU work)
We decided to Move to Liquibase based on these discussions.
Proposal discussion link
https://groups.google.com/d/topic/mifosdeveloper/02S9HXZrZCw/discussion (VERSION 1)
https://groups.google.com/d/topic/mifosdeveloper/2NJKLH9SvJQ/discussion (VERSION 2)
https://groups.google.com/d/topic/mifosdeveloper/cDqsVRPI-I8/discussion (VERSION 3)
http://mifosforge.jira.com/browse/MIFOS-4222 (Liquibase Work)
Read Also: Database Development, Data Migration - Historic data - no updates to be made, Database Neutrality