Search in sources :

Example 11 with SavingsTestHelper

use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.

the class PrdOfferingPersistenceIntegrationTest method testGetPrdOfferingNameCountWithDifferentName.

@Test
public void testGetPrdOfferingNameCountWithDifferentName() throws PersistenceException {
    SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("fsaf6", "ads6");
    Assert.assertEquals(Integer.valueOf("0"), new PrdOfferingPersistence().getProductOfferingNameCount("Savings product"));
    savingsOffering = null;
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Test(org.junit.Test)

Example 12 with SavingsTestHelper

use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.

the class PrdOfferingPersistenceIntegrationTest method testGetPrdOfferingShortNameCountWithDifferentName.

@Test
public void testGetPrdOfferingShortNameCountWithDifferentName() throws PersistenceException {
    SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("fsaf6", "ads6");
    Assert.assertEquals(Integer.valueOf("0"), new PrdOfferingPersistence().getProductOfferingShortNameCount("SAVP"));
    savingsOffering = null;
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Test(org.junit.Test)

Example 13 with SavingsTestHelper

use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.

the class GenerateMeetingsForCustomerAndSavingsHelperIntegrationTest method getSavingsAccountForCenter.

private SavingsBO getSavingsAccountForCenter() throws Exception {
    createInitialObjects();
    client1 = TestObjectFactory.createClient("client1", CustomerStatus.CLIENT_ACTIVE, group);
    client2 = TestObjectFactory.createClient("client2", CustomerStatus.CLIENT_ACTIVE, group);
    SavingsTestHelper helper = new SavingsTestHelper();
    savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
    return helper.createSavingsAccount(savingsOffering, center, AccountState.SAVINGS_ACTIVE, userContext);
}
Also used : SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper)

Example 14 with SavingsTestHelper

use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.

the class SavingsPersistenceIntegrationTest method testGetMissedDepositsPaidAfterDueDate.

@Test
public void testGetMissedDepositsPaidAfterDueDate() throws Exception {
    SavingsTestHelper helper = new SavingsTestHelper();
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    savingsOffering = helper.createSavingsOffering("SavingPrd1", "cvfg", Short.valueOf("1"), Short.valueOf("1"));
    ;
    savings = TestObjectFactory.createSavingsAccount("43245434", group, Short.valueOf("16"), new Date(System.currentTimeMillis()), savingsOffering);
    AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate((short) 1);
    SavingBOTestUtils.setActionDate(accountActionDateEntity, offSetCurrentDate(7));
    accountActionDateEntity.setPaymentStatus(PaymentStatus.PAID);
    Calendar currentDateCalendar = new GregorianCalendar();
    java.sql.Date currentDate = new java.sql.Date(currentDateCalendar.getTimeInMillis());
    SavingBOTestUtils.setPaymentDate(accountActionDateEntity, currentDate);
    savings.update();
    StaticHibernateUtil.flushSession();
    savings = savingsDao.findById(savings.getAccountId());
    savings.setUserContext(userContext);
    StaticHibernateUtil.flushSession();
    Assert.assertEquals(savingsPersistence.getMissedDepositsPaidAfterDueDate(savings.getAccountId()), 1);
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) MeetingBO(org.mifos.application.meeting.business.MeetingBO) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Date(java.util.Date) Test(org.junit.Test)

Example 15 with SavingsTestHelper

use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.

the class SavingsPersistenceIntegrationTest method testGetMissedDeposits.

@Test
public void testGetMissedDeposits() throws Exception {
    SavingsTestHelper helper = new SavingsTestHelper();
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    savingsOffering = helper.createSavingsOffering("SavingPrd1", "wsed", Short.valueOf("1"), Short.valueOf("1"));
    savings = TestObjectFactory.createSavingsAccount("43245434", group, Short.valueOf("16"), new Date(System.currentTimeMillis()), savingsOffering);
    AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate((short) 1);
    SavingBOTestUtils.setActionDate(accountActionDateEntity, offSetCurrentDate(7));
    savings.update();
    StaticHibernateUtil.flushSession();
    savings = savingsDao.findById(savings.getAccountId());
    savings.setUserContext(userContext);
    StaticHibernateUtil.flushSession();
    Calendar currentDateCalendar = new GregorianCalendar();
    java.sql.Date currentDate = new java.sql.Date(currentDateCalendar.getTimeInMillis());
    Assert.assertEquals(savingsPersistence.getMissedDeposits(savings.getAccountId(), currentDate), 1);
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) MeetingBO(org.mifos.application.meeting.business.MeetingBO) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Date(java.util.Date) Test(org.junit.Test)

Aggregations

SavingsTestHelper (org.mifos.accounts.savings.util.helpers.SavingsTestHelper)18 Test (org.junit.Test)14 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)8 MeetingBO (org.mifos.application.meeting.business.MeetingBO)6 Date (java.util.Date)4 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)4 Calendar (java.util.Calendar)3 GregorianCalendar (java.util.GregorianCalendar)3 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)3 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)2 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1 Days (org.joda.time.Days)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 SavingsTrxnDetailEntity (org.mifos.accounts.savings.business.SavingsTrxnDetailEntity)1 Holiday (org.mifos.application.holiday.business.Holiday)1 FiscalCalendarRules (org.mifos.config.FiscalCalendarRules)1 SavingsTransactionHistoryDto (org.mifos.dto.screen.SavingsTransactionHistoryDto)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 DateTimeService (org.mifos.framework.util.DateTimeService)1