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());
}
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");
}
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();
}
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);
}
Aggregations