Search in sources :

Example 1 with TestCollectionSheetRetrieveSavingsAccountsUtils

use of org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils in project head by mifos.

the class LegacyAccountDaoIntegrationTest method testGetSavingsSchedulesForAccountThatAreWithinDates.

@Test
public void testGetSavingsSchedulesForAccountThatAreWithinDates() throws Exception {
    savingsBO = new TestCollectionSheetRetrieveSavingsAccountsUtils().createSavingsAccount(group, "clm", "3.0", false, false);
    DateTime fromDate = new DateMidnight().toDateTime().plusDays(1);
    DateTime thruDate = new DateMidnight().toDateTime().plusDays(37);
    List<SavingsScheduleEntity> affectedDates = legacyAccountDao.getSavingsSchedulesForAccountThatAreWithinDates(savingsBO.getAccountId(), fromDate, thruDate);
    Assert.assertNotNull(affectedDates);
    Assert.assertEquals(5, affectedDates.size());
}
Also used : DateMidnight(org.joda.time.DateMidnight) TestCollectionSheetRetrieveSavingsAccountsUtils(org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 2 with TestCollectionSheetRetrieveSavingsAccountsUtils

use of org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils in project head by mifos.

the class BulkEntryActionStrutsTest method testSuccessfulGet.

@SuppressWarnings("unchecked")
@Test
public void testSuccessfulGet() throws Exception {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    client = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
    account = getLoanAccount(group, meeting);
    // Using utility method that uses builder pattern to create savings accounts - TestObjectFactory was creating
    // installments for all savings accounts (which is wrong)
    TestCollectionSheetRetrieveSavingsAccountsUtils collectionSheetRetrieveSavingsAccountsUtils = new TestCollectionSheetRetrieveSavingsAccountsUtils();
    centerSavingsAccount = collectionSheetRetrieveSavingsAccountsUtils.createSavingsAccount(center, "cemi", "120.00", false, false);
    groupSavingsAccount = collectionSheetRetrieveSavingsAccountsUtils.createSavingsAccount(group, "gvcg", "180.00", true, false);
    clientSavingsAccount = collectionSheetRetrieveSavingsAccountsUtils.createSavingsAccount(client, "clm", "222.00", false, false);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    CustomerDto customerDto = new CustomerDto();
    customerDto.setCustomerId(center.getCustomerId());
    customerDto.setCustomerSearchId(center.getSearchId());
    customerDto.setCustomerLevelId(center.getCustomerLevel().getId());
    final OfficeDetailsDto officeDetailsDto = new OfficeDetailsDto(Short.valueOf("3"), "", OfficeLevel.BRANCHOFFICE.getValue(), "levelNameKey", Integer.valueOf(-1));
    final PersonnelDto personnelDto = new PersonnelDto(Short.valueOf("3"), "");
    SessionUtils.setAttribute(CollectionSheetEntryConstants.COLLECTION_SHEET_ENTRY_FORM_DTO, createCollectionSheetDto(customerDto, officeDetailsDto, personnelDto), request);
    SessionUtils.setCollectionAttribute(CollectionSheetEntryConstants.PAYMENT_TYPES_LIST, Arrays.asList(getPaymentTypeView()), request);
    SessionUtils.setAttribute(CollectionSheetEntryConstants.ISCENTERHIERARCHYEXISTS, Constants.YES, request);
    setMasterListInSession(center.getCustomerId());
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "get");
    addRequestParameter("officeId", "3");
    addRequestParameter("loanOfficerId", "3");
    addRequestParameter("paymentId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    Calendar meetinDateCalendar = new GregorianCalendar();
    meetinDateCalendar.setTime(getMeetingDates(account.getOffice().getOfficeId(), meeting));
    int year = meetinDateCalendar.get(Calendar.YEAR);
    int month = meetinDateCalendar.get(Calendar.MONTH);
    int day = meetinDateCalendar.get(Calendar.DAY_OF_MONTH);
    meetinDateCalendar = new GregorianCalendar(year, month, day);
    SessionUtils.setAttribute("LastMeetingDate", new java.sql.Date(meetinDateCalendar.getTimeInMillis()), request);
    addRequestDateParameter("transactionDate", day + "/" + (month + 1) + "/" + year);
    addRequestParameter("receiptId", "1");
    addRequestDateParameter("receiptDate", "20/03/2006");
    addRequestParameter("customerId", String.valueOf(center.getCustomerId().intValue()));
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward("get_success");
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) TestCollectionSheetRetrieveSavingsAccountsUtils(org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils) CustomerDto(org.mifos.dto.domain.CustomerDto) GregorianCalendar(java.util.GregorianCalendar) PersonnelDto(org.mifos.dto.domain.PersonnelDto) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Test(org.junit.Test)

Example 3 with TestCollectionSheetRetrieveSavingsAccountsUtils

use of org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils in project head by mifos.

the class ApplyHolidayChangesHelperIntegrationTest method cleanDatabaseTablesAndSetupCustomerTestDataBeforeTest.

@Before
public void cleanDatabaseTablesAndSetupCustomerTestDataBeforeTest() throws Exception {
    databaseCleaner.clean();
    dateTimeService.setCurrentDateTime(new DateTime().withYear(2010).withMonthOfYear(DateTimeConstants.FEBRUARY).withDayOfMonth(23));
    ApplyHolidayChangesTask applyHolidayChangesTask = new ApplyHolidayChangesTask();
    applyHolidayChangesHelper = (ApplyHolidayChangesHelper) applyHolidayChangesTask.getTaskHelper();
    testSaveCollectionSheetUtils = new TestSaveCollectionSheetUtils();
    testCollectionSheetRetrieveSavingsAccountsUtils = new TestCollectionSheetRetrieveSavingsAccountsUtils();
    // create center hierarchy with loan and savings and customer accounts.
    createCenterHierarchy(dateTimeService.getCurrentJavaDateTime());
    StaticHibernateUtil.flushAndClearSession();
}
Also used : TestSaveCollectionSheetUtils(org.mifos.application.servicefacade.TestSaveCollectionSheetUtils) TestCollectionSheetRetrieveSavingsAccountsUtils(org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Example 4 with TestCollectionSheetRetrieveSavingsAccountsUtils

use of org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils in project head by mifos.

the class SavingsBOMoreIntegrationTest method cleanDatabaseTables.

@Before
public void cleanDatabaseTables() throws Exception {
    databaseCleaner.clean();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    center = new CenterBuilder().with(weeklyMeeting).withName("Savings Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.createCenter(center, weeklyMeeting);
    group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Savings Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
    IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Savings Client").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    String recommendedAmountString = "3.0";
    recommendedAmount = new Money(Money.getDefaultCurrency(), recommendedAmountString);
    savings = new TestCollectionSheetRetrieveSavingsAccountsUtils().createSavingsAccount(client, "clm", recommendedAmountString, false, false);
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GroupBuilder(org.mifos.domain.builders.GroupBuilder) TestCollectionSheetRetrieveSavingsAccountsUtils(org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Before(org.junit.Before)

Aggregations

TestCollectionSheetRetrieveSavingsAccountsUtils (org.mifos.application.servicefacade.TestCollectionSheetRetrieveSavingsAccountsUtils)4 DateTime (org.joda.time.DateTime)2 Before (org.junit.Before)2 Test (org.junit.Test)2 MeetingBO (org.mifos.application.meeting.business.MeetingBO)2 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 DateMidnight (org.joda.time.DateMidnight)1 SavingsScheduleEntity (org.mifos.accounts.savings.business.SavingsScheduleEntity)1 TestSaveCollectionSheetUtils (org.mifos.application.servicefacade.TestSaveCollectionSheetUtils)1 CenterBuilder (org.mifos.domain.builders.CenterBuilder)1 ClientBuilder (org.mifos.domain.builders.ClientBuilder)1 GroupBuilder (org.mifos.domain.builders.GroupBuilder)1 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)1 CustomerDto (org.mifos.dto.domain.CustomerDto)1 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)1 PersonnelDto (org.mifos.dto.domain.PersonnelDto)1 Money (org.mifos.framework.util.helpers.Money)1