Search in sources :

Example 11 with ConfigurationKeyValue

use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.

the class ClientRulesIntegrationTest method testGetGroupCanApplyLoans.

@Test
public void testGetGroupCanApplyLoans() throws Exception {
    MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
    ConfigurationPersistence configPersistence = new ConfigurationPersistence();
    ConfigurationKeyValue savedDBValue = null;
    savedDBValue = configPersistence.getConfigurationKeyValue(ClientRules.GroupCanApplyLoansKey);
    Boolean savedValue = ClientRules.getGroupCanApplyLoans();
    configMgr.setProperty(ClientRules.ClientRulesGroupCanApplyLoans, false);
    configPersistence.updateConfigurationKeyValueInteger(ClientRules.GroupCanApplyLoansKey, Constants.NO);
    ClientRules.refresh();
    // set db value to false, too
    Assert.assertFalse(ClientRules.getGroupCanApplyLoans());
    // now the return value from accounting rules class has to be what is in
    // the database (0)
    ClientRules.refresh();
    Assert.assertFalse(ClientRules.getGroupCanApplyLoans());
    // set the saved value back for following tests
    configPersistence.updateConfigurationKeyValueInteger(ClientRules.GroupCanApplyLoansKey, Integer.parseInt(savedDBValue.getValue()));
    configMgr.setProperty(ClientRules.ClientRulesGroupCanApplyLoans, savedValue);
    ClientRules.refresh();
}
Also used : ConfigurationPersistence(org.mifos.config.persistence.ConfigurationPersistence) ConfigurationKeyValue(org.mifos.config.business.ConfigurationKeyValue) MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager) Test(org.junit.Test)

Example 12 with ConfigurationKeyValue

use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.

the class ClientRulesIntegrationTest method testClientCanExistOutsideGroup.

@Test
public void testClientCanExistOutsideGroup() throws Exception {
    MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
    ConfigurationPersistence configPersistence = new ConfigurationPersistence();
    ConfigurationKeyValue savedDBValue = null;
    savedDBValue = configPersistence.getConfigurationKeyValue(ClientRules.ClientCanExistOutsideGroupKey);
    Boolean savedValue = ClientRules.getClientCanExistOutsideGroup();
    configMgr.setProperty(ClientRules.ClientRulesClientCanExistOutsideGroup, false);
    configPersistence.updateConfigurationKeyValueInteger(ClientRules.ClientCanExistOutsideGroupKey, Constants.NO);
    ClientRules.refresh();
    // set db value to false, too
    Assert.assertFalse(ClientRules.getClientCanExistOutsideGroup());
    // now the return value from accounting rules class has to be what is in
    // the database (0)
    ClientRules.refresh();
    Assert.assertFalse(ClientRules.getClientCanExistOutsideGroup());
    // set the saved value back for following tests
    configPersistence.updateConfigurationKeyValueInteger(ClientRules.ClientCanExistOutsideGroupKey, Integer.parseInt(savedDBValue.getValue()));
    configMgr.setProperty(ClientRules.ClientRulesClientCanExistOutsideGroup, savedValue);
    ClientRules.refresh();
}
Also used : ConfigurationPersistence(org.mifos.config.persistence.ConfigurationPersistence) ConfigurationKeyValue(org.mifos.config.business.ConfigurationKeyValue) MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager) Test(org.junit.Test)

Aggregations

ConfigurationKeyValue (org.mifos.config.business.ConfigurationKeyValue)12 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 Query (org.hibernate.Query)3 ConfigurationPersistence (org.mifos.config.persistence.ConfigurationPersistence)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 MifosConfigurationManager (org.mifos.config.business.MifosConfigurationManager)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 ActionErrors (org.apache.struts.action.ActionErrors)1 ProcessUpdateBo (org.mifos.application.accounting.business.ProcessUpdateBo)1