use of org.joda.time.LocalDate in project head by mifos.
the class AccountRegenerateScheduleIntegrationTestCase method testChangeMeetingScheduleForClosedAndCancelledAccounts.
// for closed and canceled accounts, we expect no change to the schedule
@Test
public void testChangeMeetingScheduleForClosedAndCancelledAccounts() throws Exception {
List<LocalDate> expectedUnchangedMeetingDates = new ArrayList<LocalDate>();
expectedUnchangedMeetingDates.add(new LocalDate(2008, MAY, 23));
expectedUnchangedMeetingDates.add(new LocalDate(2008, MAY, 30));
expectedUnchangedMeetingDates.add(new LocalDate(2008, JUNE, 6));
expectedUnchangedMeetingDates.add(new LocalDate(2008, JUNE, 13));
expectedUnchangedMeetingDates.add(new LocalDate(2008, JUNE, 20));
expectedUnchangedMeetingDates.add(new LocalDate(2008, JUNE, 27));
LocalDate startDate = new LocalDate(2008, MAY, 23);
LocalDate dateWhenMeetingWillBeChanged = new LocalDate(2008, MAY, 30);
MeetingBO meeting = setupWeeklyMeeting(startDate, EVERY_WEEK);
MeetingBO newMeeting = TestObjectFactory.getNewMeeting(RecurrenceType.WEEKLY, EVERY_WEEK, MeetingType.CUSTOMER_MEETING, WeekDay.WEDNESDAY);
testChangeInMeetingScheduleForDates(meeting, meeting, newMeeting, startDate, dateWhenMeetingWillBeChanged, true);
validateSchedulesForClosedAndCancelled(expectedUnchangedMeetingDates, expectedUnchangedMeetingDates);
}
use of org.joda.time.LocalDate in project head by mifos.
the class AccountRegenerateScheduleIntegrationTestCase method testChangeMonthlyMeetingScheduleOnADateInSecondMonth.
@Test
public void testChangeMonthlyMeetingScheduleOnADateInSecondMonth() throws Exception {
List<LocalDate> expectedMeetingDates = new ArrayList<LocalDate>();
expectedMeetingDates.add(new LocalDate(2008, APRIL, 9));
expectedMeetingDates.add(new LocalDate(2008, MAY, 9));
expectedMeetingDates.add(new LocalDate(2008, JUNE, 9));
expectedMeetingDates.add(new LocalDate(2008, JULY, 20));
expectedMeetingDates.add(new LocalDate(2008, AUGUST, 20));
LocalDate startDate = new LocalDate(2008, APRIL, 9);
LocalDate dateWhenMeetingWillBeChanged = new LocalDate(2008, JUNE, 1);
MeetingBO meeting = setupMonthlyMeeting(startDate, 1, 9);
MeetingBO newMeeting = TestObjectFactory.createMeeting(new MeetingBuilder().monthly().every(1).buildMonthlyForDayNumber(20));
testChangeInMeetingScheduleForDates(meeting, newMeeting, startDate, dateWhenMeetingWillBeChanged);
validateSchedules(expectedMeetingDates);
}
use of org.joda.time.LocalDate in project head by mifos.
the class CollectionSheetDaoHibernateIntegrationTest method testShouldFindSavingsDepositsforCustomerHierarchy.
@Test
public void testShouldFindSavingsDepositsforCustomerHierarchy() {
// setup
savingsProduct = new SavingsProductBuilder().mandatory().appliesToCentersOnly().withShortName("SP1").buildForIntegrationTests();
savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCreatedBy(IntegrationTestObjectMother.testUser()).withCustomer(center).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
savingsProduct2 = new SavingsProductBuilder().withName("product2").withShortName("SP2").mandatory().appliesToCentersOnly().buildForIntegrationTests();
savingsAccount2 = new SavingsAccountBuilder().withSavingsProduct(savingsProduct2).withCustomer(center).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct2, savingsAccount2);
final Integer customerAtTopOfHierarchyId = center.getCustomerId();
final Short branchId = center.getOffice().getOfficeId();
final String searchId = center.getSearchId() + ".%";
final LocalDate transactionDate = new LocalDate();
final CustomerHierarchyParams customerHierarchyParams = new CustomerHierarchyParams(customerAtTopOfHierarchyId, branchId, searchId, transactionDate);
// exercise test
final List<CollectionSheetCustomerSavingsAccountDto> allSavingsDeposits = collectionSheetDao.findAllSavingAccountsForCustomerHierarchy(customerHierarchyParams);
// verification
Assert.assertThat(allSavingsDeposits.size(), is(2));
}
use of org.joda.time.LocalDate in project head by mifos.
the class CollectionSheetDaoHibernateIntegrationTest method testShouldFindOutstandingFeesForCustomerAccountsXXX.
@Test
@Ignore
public void testShouldFindOutstandingFeesForCustomerAccountsXXX() {
// setup
final Short branchId = center.getOffice().getOfficeId();
final String searchId = center.getSearchId() + ".%";
final LocalDate transactionDate = new LocalDate();
// exercise test
Map<Integer, List<CollectionSheetCustomerAccountCollectionDto>> allOutstandingFeesByCustomerId = collectionSheetDao.findOutstandingFeesForCustomerAccountOnCustomerHierarchy(branchId, searchId, transactionDate, center.getCustomerId());
// verification
Assert.assertNotNull(allOutstandingFeesByCustomerId);
final List<CollectionSheetCustomerAccountCollectionDto> accountCollectionFees = allOutstandingFeesByCustomerId.get(group.getCustomerId());
Assert.assertNotNull(accountCollectionFees);
Assert.assertThat(accountCollectionFees.size(), is(1));
Assert.assertThat(accountCollectionFees.get(0).getAccountId(), is(group.getCustomerAccount().getAccountId()));
Assert.assertThat(accountCollectionFees.get(0).getCustomerId(), is(group.getCustomerId()));
Assert.assertThat(accountCollectionFees.get(0).getMiscFeesDue(), is(new BigDecimal("0")));
Assert.assertThat(accountCollectionFees.get(0).getMiscFeesPaid(), is(new BigDecimal("0")));
Assert.assertThat(accountCollectionFees.get(0).getAccountCollectionPayment(), is(Double.valueOf("0.0")));
}
use of org.joda.time.LocalDate in project head by mifos.
the class CollectionSheetDaoHibernateIntegrationTest method testShouldRetrieveCustomerHierarchyWithACenterAsRootByBranchId.
@Test
public void testShouldRetrieveCustomerHierarchyWithACenterAsRootByBranchId() throws Exception {
// setup
final Integer customerId = center.getCustomerId();
final LocalDate transactionDate = new LocalDate();
// exercise test
final List<CollectionSheetCustomerDto> customerHierarchy = collectionSheetDao.findCustomerHierarchy(customerId, transactionDate);
// verification
Assert.assertNotNull(customerHierarchy);
Assert.assertFalse(customerHierarchy.isEmpty());
Assert.assertNotNull(customerHierarchy.get(0));
Assert.assertEquals(center.getCustomerId(), customerHierarchy.get(0).getCustomerId());
Assert.assertThat(customerHierarchy.get(0).getParentCustomerId(), is(nullValue()));
Assert.assertEquals(center.getDisplayName(), customerHierarchy.get(0).getName());
Assert.assertEquals(center.getSearchId(), customerHierarchy.get(0).getSearchId());
Assert.assertEquals(center.getLevel().getValue(), customerHierarchy.get(0).getLevelId());
Assert.assertNull("center should have no attendance against them", customerHierarchy.get(0).getAttendanceId());
Assert.assertNotNull(customerHierarchy.get(1));
Assert.assertEquals(group.getCustomerId(), customerHierarchy.get(1).getCustomerId());
Assert.assertThat(customerHierarchy.get(1).getParentCustomerId(), is(center.getCustomerId()));
Assert.assertEquals(group.getDisplayName(), customerHierarchy.get(1).getName());
Assert.assertEquals(group.getSearchId(), customerHierarchy.get(1).getSearchId());
Assert.assertEquals(group.getLevel().getValue(), customerHierarchy.get(1).getLevelId());
Assert.assertNull("group should have no attendance against them", customerHierarchy.get(1).getAttendanceId());
}
Aggregations