Search in sources :

Example 96 with Ignore

use of org.junit.Ignore in project head by mifos.

the class HolidayDaoHibernateIntegrationTest method shouldFindWhetherGivenDateIsAHoliday.

@Ignore
@Test
public void shouldFindWhetherGivenDateIsAHoliday() {
    Short officeId = Short.valueOf("1");
    DateTime secondlastDayOfYear = new DateTime().withMonthOfYear(12).withDayOfMonth(30).toDateMidnight().toDateTime();
    insertHoliday(new HolidayBuilder().from(secondlastDayOfYear).to(secondlastDayOfYear).build());
    assertThat(holidayDao.isHoliday(officeId, secondlastDayOfYear.toLocalDate().toString()), is(true));
    DateTime thirdOfJanNextYear = new DateTime().plusYears(1).withMonthOfYear(1).withDayOfMonth(3).toDateMidnight().toDateTime();
    DateTime sixthOfJanNextYear = new DateTime().plusYears(1).withMonthOfYear(1).withDayOfMonth(6).toDateMidnight().toDateTime();
    DateTime tenthOfJanNextYear = new DateTime().plusYears(1).withMonthOfYear(1).withDayOfMonth(10).toDateMidnight().toDateTime();
    DateTime eleventhOfJanNextYear = new DateTime().plusYears(1).withMonthOfYear(1).withDayOfMonth(11).toDateMidnight().toDateTime();
    insertHoliday(new HolidayBuilder().from(thirdOfJanNextYear).to(tenthOfJanNextYear).build());
    assertThat(holidayDao.isHoliday(officeId, thirdOfJanNextYear.toLocalDate().toString()), is(true));
    assertThat(holidayDao.isHoliday(officeId, sixthOfJanNextYear.toLocalDate().toString()), is(true));
    assertThat(holidayDao.isHoliday(officeId, tenthOfJanNextYear.toLocalDate().toString()), is(true));
    assertThat(holidayDao.isHoliday(officeId, eleventhOfJanNextYear.toLocalDate().toString()), is(false));
}
Also used : HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 97 with Ignore

use of org.junit.Ignore in project head by mifos.

the class HolidayDaoHibernateIntegrationTest method shouldFindAllHolidaysOrderedByFromDateAscending.

@Ignore
@Test
public void shouldFindAllHolidaysOrderedByFromDateAscending() throws Exception {
    DateTime secondlastDayOfYear = new DateTime().withMonthOfYear(12).withDayOfMonth(30).toDateMidnight().toDateTime();
    DateTime lastDayOfYear = secondlastDayOfYear.plusDays(1);
    DateTime secondOfJanNextYear = new DateTime().plusYears(1).withMonthOfYear(1).withDayOfMonth(2).toDateMidnight().toDateTime();
    DateTime thirdOfJanNextYear = new DateTime().plusYears(1).withMonthOfYear(1).withDayOfMonth(3).toDateMidnight().toDateTime();
    List<Holiday> holidays = holidayDao.findAllHolidaysThisYearAndNext(new Short("1"));
    int initialCountOfHolidays = holidays.size();
    List<Holiday> futureHolidays = holidayDao.findAllHolidaysFromDateAndNext(new Short("1"), secondOfJanNextYear.toLocalDate().toString());
    int initialCountOfFutureHolidays = futureHolidays.size();
    Holiday holiday1 = new HolidayBuilder().from(secondlastDayOfYear).to(secondlastDayOfYear).build();
    Holiday holiday2 = new HolidayBuilder().from(secondOfJanNextYear).to(secondOfJanNextYear).build();
    Holiday holiday3 = new HolidayBuilder().from(thirdOfJanNextYear).to(thirdOfJanNextYear).build();
    Holiday holiday4 = new HolidayBuilder().from(lastDayOfYear).to(lastDayOfYear).build();
    insertHoliday(holiday2);
    insertHoliday(holiday3);
    insertHoliday(holiday1);
    insertHoliday(holiday4);
    holidays = holidayDao.findAllHolidaysThisYearAndNext(new Short("1"));
    assertThat(holidays.size() - initialCountOfHolidays, is(4));
    assertTrue(holidays.get(0).encloses(secondlastDayOfYear.toDate()));
    assertTrue(holidays.get(1).encloses(lastDayOfYear.toDate()));
    assertTrue(holidays.get(2).encloses(secondOfJanNextYear.toDate()));
    assertTrue(holidays.get(3).encloses(thirdOfJanNextYear.toDate()));
    futureHolidays = holidayDao.findAllHolidaysFromDateAndNext(new Short("1"), secondOfJanNextYear.toLocalDate().toString());
    assertThat(futureHolidays.size() - initialCountOfFutureHolidays, is(2));
    assertTrue(futureHolidays.get(0).encloses(secondOfJanNextYear.toDate()));
    assertTrue(futureHolidays.get(1).encloses(thirdOfJanNextYear.toDate()));
}
Also used : Holiday(org.mifos.application.holiday.business.Holiday) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 98 with Ignore

use of org.junit.Ignore in project head by mifos.

the class GroupPerformanceHistoryUsingCustomerServiceIntegrationTest method portfolioAtRisk.

/**
     * generate portfolio at risk test requires loan account to be set up with loan_schedule.
     *
     * The first/next installment due should be set so portfolio at risk calculates.
     */
@Ignore
@Test
public void portfolioAtRisk() throws Exception {
    existingGroup = customerDao.findGroupBySystemId(existingGroup.getGlobalCustNum());
    existingActiveClient = customerDao.findClientBySystemId(existingActiveClient.getGlobalCustNum());
    // exercise test
    existingGroup.getGroupPerformanceHistory().generatePortfolioAtRisk();
    Money portfolioAtRisk = existingGroup.getGroupPerformanceHistory().getPortfolioAtRisk();
    // verification
    assertThat(portfolioAtRisk.getAmountDoubleValue(), is(Double.valueOf("0.0")));
}
Also used : Money(org.mifos.framework.util.helpers.Money) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 99 with Ignore

use of org.junit.Ignore in project head by mifos.

the class GroupTransferServiceIntegrationTest method transferingGroupToCenterWithDifferentMeetingDayOfWeekCausesFutureSchedulesToBeRegeneratedForGroupsChildren.

@Ignore
@Test
public void transferingGroupToCenterWithDifferentMeetingDayOfWeekCausesFutureSchedulesToBeRegeneratedForGroupsChildren() throws Exception {
    // setup
    OfficeBO branchOffice = anExistingBranchOffice(new OfficeBuilder().withGlobalOfficeNum("xxxx-003").withName("builder-branch-office1").withShortName("bf1").withSearchId("1.1.1.1."));
    OfficeBO branchOffice2 = new OfficeBuilder().withParentOffice(branchOffice.getParentOffice()).branchOffice().withGlobalOfficeNum("xxxx-004").withName("builder-branch-office2").withShortName("bf1").withSearchId("1.1.1.2.").build();
    IntegrationTestObjectMother.createOffice(branchOffice2);
    DateTime todaySixWeeksAgo = new DateMidnight().toDateTime().minusWeeks(6);
    MeetingBO weeklyMeeting = aWeeklyMeeting().withLocation("weeklyMeeting-sixWeeksAgo").startingFrom(todaySixWeeksAgo.toDate()).build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    CenterBuilder centerWithWeeklyMeeting = anActiveCenter().withName("center-with-no-children").with(weeklyMeeting).with(branchOffice).withActivationDate(todaySixWeeksAgo).withLoanOfficer(anExistingLoanOfficer());
    CenterBO centerWithNoChildren = anExistingActiveCenter(centerWithWeeklyMeeting);
    DateTime tomorrowTwoWeeksAgo = new DateMidnight().toDateTime().minusWeeks(2).plusDays(1);
    MeetingBO differentWeeklyMeeting = aWeeklyMeeting().withLocation("weeklyMeeting-tomorrow-twoWeeksAgo").withStartDate(tomorrowTwoWeeksAgo.minusWeeks(1)).build();
    IntegrationTestObjectMother.saveMeeting(differentWeeklyMeeting);
    CenterBuilder centerInDifferentBranchWithDifferentMeeting = centerWithWeeklyMeeting.withName("center-with-group").with(branchOffice2).with(differentWeeklyMeeting).withActivationDate(tomorrowTwoWeeksAgo);
    GroupBO groupForTransfer = anExistingGroupUnderCenterInDifferentBranchAs(centerInDifferentBranchWithDifferentMeeting);
    ClientBO child1 = new ClientBuilder().active().withName("client1").withParentCustomer(groupForTransfer).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(child1, child1.getCustomerMeetingValue());
    // pre-verification
    ClientBO client = customerDao.findClientBySystemId(child1.getGlobalCustNum());
    TestUtils.assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(client, WeekDay.getJodaWeekDay(tomorrowTwoWeeksAgo.getDayOfWeek()));
    // exercise test
    groupForTransfer = customerDao.findGroupBySystemId(groupForTransfer.getGlobalCustNum());
    groupForTransfer.setUserContext(TestUtils.makeUser());
    customerService.transferGroupTo(groupForTransfer, centerWithNoChildren);
    // verification
    client = customerDao.findClientBySystemId(child1.getGlobalCustNum());
    TestUtils.assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(client, WeekDay.getJodaWeekDay(tomorrowTwoWeeksAgo.getDayOfWeek()));
// TO-FIX TestUtils.assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(client, WeekDay.getJodaWeekDay(todaySixWeeksAgo.getDayOfWeek()));
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO) DateMidnight(org.joda.time.DateMidnight) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ClientBO(org.mifos.customers.client.business.ClientBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) CenterBO(org.mifos.customers.center.business.CenterBO) GroupBO(org.mifos.customers.group.business.GroupBO) DateTime(org.joda.time.DateTime) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 100 with Ignore

use of org.junit.Ignore in project head by mifos.

the class LoanArrearsAgingHelperIntegrationTest method testLoanWithOnePaymentMadeAndOneOverduePayments.

/**
     * unsure why its failing.
     */
@Ignore
@Test
public void testLoanWithOnePaymentMadeAndOneOverduePayments() throws Exception {
    LoanBO loan = setUpLoan(dateTime, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING);
    Assert.assertNull(loan.getLoanArrearsAgingEntity());
    short daysOverdue = 3;
    // advance time daysOverdue past the second repayment interval
    dateTime = dateTime.plusDays(2 * repaymentInterval + daysOverdue);
    new DateTimeService().setCurrentDateTimeFixed(dateTime);
    // make one payment, so we should still be one payment behind after that
    PaymentData paymentData = PaymentData.createPaymentData(new Money(Configuration.getInstance().getSystemConfig().getCurrency(), "" + onePayment), loan.getPersonnel(), Short.valueOf("1"), dateTime.toDate());
    IntegrationTestObjectMother.applyAccountPayment(loan, paymentData);
    runLoanArrearsThenLoanArrearsAging();
    StaticHibernateUtil.flushAndClearSession();
    loan = legacyLoanDao.getAccount(loan.getAccountId());
    Assert.assertNotNull(loan.getLoanArrearsAgingEntity());
    LoanArrearsAgingEntity loanArrearsAgingEntity = loan.getLoanArrearsAgingEntity();
    Assert.assertEquals(new Money(getCurrency(), "" + (loanAmount - principalForOneInstallment)), loanArrearsAgingEntity.getUnpaidPrincipal());
    Assert.assertEquals(new Money(getCurrency(), "" + (totalInterest - interestForOneInstallment)), loanArrearsAgingEntity.getUnpaidInterest());
    Assert.assertEquals(new Money(getCurrency(), "" + principalForOneInstallment), loanArrearsAgingEntity.getOverduePrincipal());
    Assert.assertEquals(new Money(getCurrency(), "" + interestForOneInstallment), loanArrearsAgingEntity.getOverdueInterest());
    Assert.assertEquals(new Money(getCurrency(), "" + (principalForOneInstallment + interestForOneInstallment)), loanArrearsAgingEntity.getOverdueBalance());
    Assert.assertEquals(Short.valueOf(daysOverdue), loanArrearsAgingEntity.getDaysInArrears());
}
Also used : PaymentData(org.mifos.accounts.util.helpers.PaymentData) Money(org.mifos.framework.util.helpers.Money) LoanBO(org.mifos.accounts.loan.business.LoanBO) LoanArrearsAgingEntity(org.mifos.accounts.loan.business.LoanArrearsAgingEntity) DateTimeService(org.mifos.framework.util.DateTimeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Ignore (org.junit.Ignore)5092 Test (org.junit.Test)4807 File (java.io.File)445 ArrayList (java.util.ArrayList)374 IOException (java.io.IOException)217 HashMap (java.util.HashMap)187 List (java.util.List)171 CountDownLatch (java.util.concurrent.CountDownLatch)118 Map (java.util.Map)103 LocalDate (java.time.LocalDate)94 Dataset (org.apache.jena.query.Dataset)93 InputStream (java.io.InputStream)89 Date (java.util.Date)88 Random (java.util.Random)85 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)83 Properties (java.util.Properties)78 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)78 HashSet (java.util.HashSet)71 ByteArrayOutputStream (java.io.ByteArrayOutputStream)70 ExecutorService (java.util.concurrent.ExecutorService)70