use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class GenerateMeetingsForCustomerAndSavingsHelperIntegrationTest method testExecuteForSavingsAccount.
@Test
public void testExecuteForSavingsAccount() throws Exception {
int configuredValue = GeneralConfig.getOutputIntervalForBatchJobs();
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
int outputInterval = 1;
try {
// force output for every account
configMgr.setProperty(GeneralConfig.OutputIntervalForBatchJobs, outputInterval);
savings = getSavingsAccountForCenter();
int noOfInstallments = savings.getAccountActionDates().size();
AccountTestUtils.changeInstallmentDatesToPreviousDate(savings);
StaticHibernateUtil.flushSession();
savings = TestObjectFactory.getObject(SavingsBO.class, savings.getAccountId());
new GenerateMeetingsForCustomerAndSavingsTask().getTaskHelper().execute(System.currentTimeMillis());
savings = TestObjectFactory.getObject(SavingsBO.class, savings.getAccountId());
Assert.assertEquals(noOfInstallments + 20, savings.getAccountActionDates().size());
} finally {
// restore original output interval value
configMgr.setProperty(GeneralConfig.OutputIntervalForBatchJobs, configuredValue);
}
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class GeneralConfigTest method testGetOutputIntervalForBatchJobs.
public void testGetOutputIntervalForBatchJobs() {
int configuredValue = GeneralConfig.getOutputIntervalForBatchJobs();
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
int currentValue = 500;
configMgr.setProperty(GeneralConfig.OutputIntervalForBatchJobs, currentValue);
Assert.assertEquals(currentValue, GeneralConfig.getOutputIntervalForBatchJobs());
configMgr.clearProperty(GeneralConfig.OutputIntervalForBatchJobs);
int defaultValue = GeneralConfig.getOutputIntervalForBatchJobs();
int expectedDefaultValue = 1000;
Assert.assertEquals(defaultValue, expectedDefaultValue);
// save it back
configMgr.setProperty(GeneralConfig.OutputIntervalForBatchJobs, configuredValue);
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class GeneralConfigTest method testGetBatchSizeForBatchJobs.
public void testGetBatchSizeForBatchJobs() {
int configuredValue = GeneralConfig.getBatchSizeForBatchJobs();
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
int currentValue = 40;
configMgr.setProperty(GeneralConfig.BatchSizeForBatchJobs, currentValue);
Assert.assertEquals(currentValue, GeneralConfig.getBatchSizeForBatchJobs());
// clear the BatchSizeForBatchJobs property from the config file so
// should get the default value
configMgr.clearProperty(GeneralConfig.BatchSizeForBatchJobs);
int defaultValue = GeneralConfig.getBatchSizeForBatchJobs();
int expectedDefaultValue = 40;
Assert.assertEquals(defaultValue, expectedDefaultValue);
// save it back
configMgr.setProperty(GeneralConfig.BatchSizeForBatchJobs, configuredValue);
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class GeneralConfigTest method testGetRecordCommittingSizeForBatchJobs.
public void testGetRecordCommittingSizeForBatchJobs() {
int configuredValue = GeneralConfig.getRecordCommittingSizeForBatchJobs();
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
int currentValue = 500;
configMgr.setProperty(GeneralConfig.RecordCommittingSizeForBatchJobs, currentValue);
Assert.assertEquals(currentValue, GeneralConfig.getRecordCommittingSizeForBatchJobs());
// clear the BatchSizeForBatchJobs property from the config file so
// should get the default value
configMgr.clearProperty(GeneralConfig.RecordCommittingSizeForBatchJobs);
int defaultValue = GeneralConfig.getRecordCommittingSizeForBatchJobs();
int expectedDefaultValue = 1000;
Assert.assertEquals(defaultValue, expectedDefaultValue);
// save it back
configMgr.setProperty(GeneralConfig.RecordCommittingSizeForBatchJobs, configuredValue);
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class AccountingRulesTest method testGetInitialRoundingMode.
@Test
public void testGetInitialRoundingMode() {
RoundingMode configuredMode = AccountingRules.getInitialRoundingMode();
String roundingMode = "FLOOR";
RoundingMode configRoundingMode = RoundingMode.FLOOR;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
configMgr.setProperty(AccountingRulesConstants.INITIAL_ROUNDING_MODE, roundingMode);
// return value from accounting rules class has to be the value defined
// in the config file
assertEquals(configRoundingMode, AccountingRules.getInitialRoundingMode());
// clear the RoundingRule property from the config file
configMgr.clearProperty(AccountingRulesConstants.INITIAL_ROUNDING_MODE);
RoundingMode defaultValue = AccountingRules.getInitialRoundingMode();
assertEquals(defaultValue, RoundingMode.HALF_UP);
// now set a wrong rounding mode in config
roundingMode = "UP";
configMgr.addProperty(AccountingRulesConstants.INITIAL_ROUNDING_MODE, roundingMode);
try {
AccountingRules.getInitialRoundingMode();
fail();
} catch (RuntimeException e) {
assertEquals("InitialRoundingMode defined in the config file is not CEILING, FLOOR, HALF_UP. It is " + roundingMode, e.getMessage());
}
// save it back
configMgr.setProperty(AccountingRulesConstants.INITIAL_ROUNDING_MODE, configuredMode.toString());
}
Aggregations