Search in sources :

Example 1 with HolidayDaoHibernate

use of org.mifos.application.holiday.persistence.HolidayDaoHibernate in project head by mifos.

the class LegacyAccountDaoIntegrationTest method testGetListOfAccountIdsHavingLoanSchedulesWithinAHoliday.

@Test
public void testGetListOfAccountIdsHavingLoanSchedulesWithinAHoliday() throws Exception {
    Set<HolidayBO> holidays;
    DateTime fromDate = new DateMidnight().toDateTime().plusDays(1);
    DateTime thruDate = new DateMidnight().toDateTime().plusDays(30);
    GenericDao genericDao = new GenericDaoHibernate();
    OfficeDao officeDao = new OfficeDaoHibernate(genericDao);
    HolidayDao holidayDao = new HolidayDaoHibernate(genericDao);
    OfficeBO sampleBranch = officeDao.findOfficeById(this.getBranchOffice().getOfficeId());
    holidays = new HashSet<HolidayBO>();
    holiday = new HolidayBuilder().withName("Welcome Holiday").from(fromDate).to(thruDate).build();
    holidayDao.save(holiday);
    holidays.add((HolidayBO) holiday);
    sampleBranch.setHolidays(holidays);
    new OfficePersistence().createOrUpdate(sampleBranch);
    StaticHibernateUtil.flushSession();
    List<Object[]> AccountIds = legacyAccountDao.getListOfAccountIdsHavingLoanSchedulesWithinAHoliday(holiday);
    Assert.assertNotNull(AccountIds);
    assertThat(AccountIds.size(), is(2));
}
Also used : GenericDaoHibernate(org.mifos.accounts.savings.persistence.GenericDaoHibernate) GenericDao(org.mifos.accounts.savings.persistence.GenericDao) DateTime(org.joda.time.DateTime) HolidayDao(org.mifos.application.holiday.persistence.HolidayDao) HolidayDaoHibernate(org.mifos.application.holiday.persistence.HolidayDaoHibernate) DateMidnight(org.joda.time.DateMidnight) OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficeDao(org.mifos.customers.office.persistence.OfficeDao) HolidayBO(org.mifos.application.holiday.business.HolidayBO) OfficeDaoHibernate(org.mifos.customers.office.persistence.OfficeDaoHibernate) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Test(org.junit.Test)

Example 2 with HolidayDaoHibernate

use of org.mifos.application.holiday.persistence.HolidayDaoHibernate in project head by mifos.

the class LegacyAccountDaoIntegrationTest method testGetListOfAccountIdsHavingCustomerSchedulesWithinAHoliday.

@Test
public void testGetListOfAccountIdsHavingCustomerSchedulesWithinAHoliday() throws Exception {
    Set<HolidayBO> holidays;
    DateTime fromDate = new DateMidnight().toDateTime().plusDays(1);
    DateTime thruDate = new DateMidnight().toDateTime().plusDays(30);
    GenericDao genericDao = new GenericDaoHibernate();
    OfficeDao officeDao = new OfficeDaoHibernate(genericDao);
    HolidayDao holidayDao = new HolidayDaoHibernate(genericDao);
    OfficeBO sampleBranch = officeDao.findOfficeById(this.getBranchOffice().getOfficeId());
    holidays = new HashSet<HolidayBO>();
    holiday = new HolidayBuilder().withName("Welcome Holiday").from(fromDate).to(thruDate).build();
    holidayDao.save(holiday);
    holidays.add((HolidayBO) holiday);
    sampleBranch.setHolidays(holidays);
    new OfficePersistence().createOrUpdate(sampleBranch);
    StaticHibernateUtil.flushSession();
    List<Object[]> AccountIds = legacyAccountDao.getListOfAccountIdsHavingCustomerSchedulesWithinAHoliday(holiday);
    Assert.assertNotNull(AccountIds);
    assertThat(AccountIds.size(), is(3));
}
Also used : GenericDaoHibernate(org.mifos.accounts.savings.persistence.GenericDaoHibernate) GenericDao(org.mifos.accounts.savings.persistence.GenericDao) DateTime(org.joda.time.DateTime) HolidayDao(org.mifos.application.holiday.persistence.HolidayDao) HolidayDaoHibernate(org.mifos.application.holiday.persistence.HolidayDaoHibernate) DateMidnight(org.joda.time.DateMidnight) OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficeDao(org.mifos.customers.office.persistence.OfficeDao) HolidayBO(org.mifos.application.holiday.business.HolidayBO) OfficeDaoHibernate(org.mifos.customers.office.persistence.OfficeDaoHibernate) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Test(org.junit.Test)

Aggregations

DateMidnight (org.joda.time.DateMidnight)2 DateTime (org.joda.time.DateTime)2 Test (org.junit.Test)2 GenericDao (org.mifos.accounts.savings.persistence.GenericDao)2 GenericDaoHibernate (org.mifos.accounts.savings.persistence.GenericDaoHibernate)2 HolidayBO (org.mifos.application.holiday.business.HolidayBO)2 HolidayDao (org.mifos.application.holiday.persistence.HolidayDao)2 HolidayDaoHibernate (org.mifos.application.holiday.persistence.HolidayDaoHibernate)2 OfficeBO (org.mifos.customers.office.business.OfficeBO)2 OfficeDao (org.mifos.customers.office.persistence.OfficeDao)2 OfficeDaoHibernate (org.mifos.customers.office.persistence.OfficeDaoHibernate)2 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)2 HolidayBuilder (org.mifos.domain.builders.HolidayBuilder)2