Search in sources :

Example 16 with ConfigurationPersistence

use of org.mifos.config.persistence.ConfigurationPersistence in project head by mifos.

the class CloseLoanActionStrutsTest method tearDown.

@After
public void tearDown() throws Exception {
    new ConfigurationPersistence().updateConfigurationKeyValueInteger(LoanConstants.REPAYMENT_SCHEDULES_INDEPENDENT_OF_MEETING_IS_ENABLED, lsim);
    new DateTimeService().resetToCurrentSystemDateTime();
    loanBO = null;
    group = null;
    center = null;
}
Also used : ConfigurationPersistence(org.mifos.config.persistence.ConfigurationPersistence) DateTimeService(org.mifos.framework.util.DateTimeService) After(org.junit.After)

Example 17 with ConfigurationPersistence

use of org.mifos.config.persistence.ConfigurationPersistence in project head by mifos.

the class CloseLoanActionStrutsTest method setUp.

@Before
public void setUp() throws Exception {
    currentDate = new DateTime(2010, 12, 23, 12, 0, 0, 0);
    new DateTimeService().setCurrentDateTime(currentDate);
    ConfigurationPersistence configurationPersistence = new ConfigurationPersistence();
    lsim = configurationPersistence.getConfigurationValueInteger(LoanConstants.REPAYMENT_SCHEDULES_INDEPENDENT_OF_MEETING_IS_ENABLED);
    configurationPersistence.updateConfigurationKeyValueInteger(LoanConstants.REPAYMENT_SCHEDULES_INDEPENDENT_OF_MEETING_IS_ENABLED, 1);
    userContext = TestObjectFactory.getContext();
    request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
    addRequestParameter("recordLoanOfficerId", "1");
    addRequestParameter("recordOfficeId", "1");
    request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
    flowKey = createFlow(request, LoanDisbursementAction.class);
    setRequestPathInfo("/editStatusAction");
}
Also used : ConfigurationPersistence(org.mifos.config.persistence.ConfigurationPersistence) DateTimeService(org.mifos.framework.util.DateTimeService) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Example 18 with ConfigurationPersistence

use of org.mifos.config.persistence.ConfigurationPersistence in project head by mifos.

the class RepayLoanActionStrutsTest method setUp.

@Before
public void setUp() throws Exception {
    DateTime date = new DateTime(2010, 12, 23, 12, 0, 0, 0);
    new DateTimeService().setCurrentDateTime(date);
    ConfigurationPersistence configurationPersistence = new ConfigurationPersistence();
    lsim = configurationPersistence.getConfigurationValueInteger(LoanConstants.REPAYMENT_SCHEDULES_INDEPENDENT_OF_MEETING_IS_ENABLED);
    configurationPersistence.updateConfigurationKeyValueInteger(LoanConstants.REPAYMENT_SCHEDULES_INDEPENDENT_OF_MEETING_IS_ENABLED, 1);
    userContext = TestObjectFactory.getContext();
    request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
    addRequestParameter("recordLoanOfficerId", "1");
    addRequestParameter("recordOfficeId", "1");
    request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
    flowKey = createFlow(request, RepayLoanAction.class);
    accountBO = getLoanAccount();
    ((LoanBO) accountBO).approve(legacyPersonnelDao.getPersonnel(PersonnelConstants.TEST_USER), "approved", date.toLocalDate());
    StaticHibernateUtil.flushSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
}
Also used : ConfigurationPersistence(org.mifos.config.persistence.ConfigurationPersistence) LoanBO(org.mifos.accounts.loan.business.LoanBO) DateTimeService(org.mifos.framework.util.DateTimeService) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Example 19 with ConfigurationPersistence

use of org.mifos.config.persistence.ConfigurationPersistence 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 20 with ConfigurationPersistence

use of org.mifos.config.persistence.ConfigurationPersistence 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

ConfigurationPersistence (org.mifos.config.persistence.ConfigurationPersistence)28 LocalDate (org.joda.time.LocalDate)9 DateTime (org.joda.time.DateTime)8 CustomerPersistence (org.mifos.customers.persistence.CustomerPersistence)8 Date (java.util.Date)7 AccountException (org.mifos.accounts.exceptions.AccountException)6 Test (org.junit.Test)5 Money (org.mifos.framework.util.helpers.Money)5 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)4 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)4 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)4 BusinessRuleException (org.mifos.service.BusinessRuleException)4 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 ConfigurationKeyValue (org.mifos.config.business.ConfigurationKeyValue)3 MifosConfigurationManager (org.mifos.config.business.MifosConfigurationManager)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 DateTimeService (org.mifos.framework.util.DateTimeService)3 ArrayList (java.util.ArrayList)2 After (org.junit.After)2 Before (org.junit.Before)2