Search in sources :

Example 61 with LocalDate

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);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 62 with LocalDate

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);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 63 with LocalDate

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));
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) CustomerHierarchyParams(org.mifos.application.servicefacade.CustomerHierarchyParams) CollectionSheetCustomerSavingsAccountDto(org.mifos.application.servicefacade.CollectionSheetCustomerSavingsAccountDto) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 64 with LocalDate

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")));
}
Also used : CollectionSheetCustomerAccountCollectionDto(org.mifos.application.servicefacade.CollectionSheetCustomerAccountCollectionDto) List(java.util.List) LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 65 with LocalDate

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());
}
Also used : LocalDate(org.joda.time.LocalDate) CollectionSheetCustomerDto(org.mifos.application.servicefacade.CollectionSheetCustomerDto) Test(org.junit.Test)

Aggregations

LocalDate (org.joda.time.LocalDate)1094 Test (org.testng.annotations.Test)553 BigDecimal (java.math.BigDecimal)401 DateTime (org.joda.time.DateTime)231 ArrayList (java.util.ArrayList)217 Test (org.junit.Test)187 Invoice (org.killbill.billing.invoice.api.Invoice)165 UUID (java.util.UUID)148 Account (org.killbill.billing.account.api.Account)139 InvoiceItem (org.killbill.billing.invoice.api.InvoiceItem)118 DefaultEntitlement (org.killbill.billing.entitlement.api.DefaultEntitlement)104 FixedPriceInvoiceItem (org.killbill.billing.invoice.model.FixedPriceInvoiceItem)101 RecurringInvoiceItem (org.killbill.billing.invoice.model.RecurringInvoiceItem)95 ExpectedInvoiceItemCheck (org.killbill.billing.beatrix.util.InvoiceChecker.ExpectedInvoiceItemCheck)85 DefaultInvoice (org.killbill.billing.invoice.model.DefaultInvoice)82 RepairAdjInvoiceItem (org.killbill.billing.invoice.model.RepairAdjInvoiceItem)71 ItemAdjInvoiceItem (org.killbill.billing.invoice.model.ItemAdjInvoiceItem)69 PlanPhaseSpecifier (org.killbill.billing.catalog.api.PlanPhaseSpecifier)63 Date (java.util.Date)57 MockPlan (org.killbill.billing.catalog.MockPlan)52