use of org.mifos.dto.domain.HolidayDetails in project head by mifos.
the class HolidayServiceIntegrationTest method shouldCreateHolidayAgainstOfficesOfDifferentLevelThatDoNotExistInSameOfficeHierarchySubTree.
@Test
public void shouldCreateHolidayAgainstOfficesOfDifferentLevelThatDoNotExistInSameOfficeHierarchySubTree() throws Exception {
// setup
HolidayDetails holidayDetails = new HolidayDetails("test", new DateTime().plusDays(1).toDate(), new DateTime().plusDays(1).toDate(), RepaymentRuleTypes.NEXT_MEETING_OR_REPAYMENT.getValue());
List<Short> officeIds = Arrays.asList(areaOffice.getOfficeId(), branch3.getOfficeId());
// exercise test
holidayService.create(holidayDetails, officeIds);
}
use of org.mifos.dto.domain.HolidayDetails in project head by mifos.
the class HolidayServiceIntegrationTest method shouldFailToCreateHolidayAgainstOfficesOfDifferentLevelThatExistInSameOfficeHierarchySubTree.
@Test(expected = BusinessRuleException.class)
public void shouldFailToCreateHolidayAgainstOfficesOfDifferentLevelThatExistInSameOfficeHierarchySubTree() throws Exception {
// setup
HolidayDetails holidayDetails = new HolidayDetails("test", new DateTime().plusDays(1).toDate(), new DateTime().plusDays(1).toDate(), RepaymentRuleTypes.NEXT_MEETING_OR_REPAYMENT.getValue());
List<Short> officeIds = Arrays.asList(headOffice.getOfficeId(), regionalOffice.getOfficeId());
// exercise test
holidayService.create(holidayDetails, officeIds);
StaticHibernateUtil.flushAndClearSession();
}
use of org.mifos.dto.domain.HolidayDetails in project head by mifos.
the class HolidayDaoHibernateIntegrationTest method insertHoliday.
private void insertHoliday(final Holiday holiday) {
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
HolidayDetails holidayDetails = new HolidayDetails("HolidayDaoTest", holiday.getFromDate().toDate(), holiday.getThruDate().toDate(), holiday.getRepaymentRuleType().getValue());
List<Short> officeIds = Arrays.asList(headOffice.getOfficeId());
IntegrationTestObjectMother.createHoliday(holidayDetails, officeIds);
}
use of org.mifos.dto.domain.HolidayDetails in project head by mifos.
the class HolidayDaoHibernateIntegrationTest method shouldNotThrowExceptionWhenFutureHolidaysApplicableToNewParentOfficeDoNotDifferFromPreviousParentOffice.
@Test
public void shouldNotThrowExceptionWhenFutureHolidaysApplicableToNewParentOfficeDoNotDifferFromPreviousParentOffice() throws Exception {
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
// setup
createOfficeHierarchyUnderHeadOffice(headOffice);
DateTime tomorrow = new DateTime().plusDays(1);
HolidayDetails holidayDetails = new HolidayBuilder().withName("areaOffice2Holiday").from(tomorrow).to(tomorrow).buildDto();
IntegrationTestObjectMother.createHoliday(holidayDetails, Arrays.asList(areaOffice2.getOfficeId(), areaOffice1.getOfficeId()));
HolidayDetails branchOnlyHolidayDetails = new HolidayBuilder().withName("branchOnlyHoliday").from(tomorrow).to(tomorrow).buildDto();
IntegrationTestObjectMother.createHoliday(branchOnlyHolidayDetails, Arrays.asList(branch1.getOfficeId()));
// refetch
branch1 = IntegrationTestObjectMother.findOfficeById(branch1.getOfficeId());
// exercise test
holidayDao.validateNoExtraFutureHolidaysApplicableOnParentOffice(branch1.getParentOffice().getOfficeId(), areaOffice2.getOfficeId());
}
use of org.mifos.dto.domain.HolidayDetails in project head by mifos.
the class HolidayServiceFacadeWebTierTest method setupAndInjectDependencies.
@Before
public void setupAndInjectDependencies() {
String name = "testHoliday";
DateTime dateTime = new DateTime();
Date fromDate = dateTime.plusDays(10).toDate();
Date thruDate = dateTime.plusDays(20).toDate();
RepaymentRuleTypes repaymentRule = RepaymentRuleTypes.SAME_DAY;
holidayDetails = new HolidayDetails(name, fromDate, thruDate, repaymentRule.getValue());
holidayServiceFacade = new HolidayServiceFacadeWebTier(holidayService, holidayDao);
locale = new Locale("en", "GB");
dateFormat = computeDateFormat(locale);
officeId = Short.valueOf("1");
}
Aggregations