use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.
the class SavingsBOIntegrationTest method testGenerateMeetingForNextYear.
@Test
public void testGenerateMeetingForNextYear() throws Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
center = TestObjectFactory.createWeeklyFeeCenter("center1", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
SavingsTestHelper SavingsTestHelper = new SavingsTestHelper();
SavingsOfferingBO savingsOfferingBO = SavingsTestHelper.createSavingsOffering("dfasdasd1", "sad1");
savingsOfferingBO.setRecommendedAmntUnit(RecommendedAmountUnit.COMPLETE_GROUP);
SavingsBO savingsBO = SavingsTestHelper.createSavingsAccount(savingsOfferingBO, group, AccountState.SAVINGS_ACTIVE, TestUtils.makeUser());
Short LastInstallmentId = savingsBO.getLastInstallmentId();
AccountActionDateEntity lastYearLastInstallment = savingsBO.getAccountActionDate(LastInstallmentId);
Integer installmetId = lastYearLastInstallment.getInstallmentId().intValue() + (short) 1;
List<Days> workingDays = new FiscalCalendarRules().getWorkingDaysAsJodaTimeDays();
List<Holiday> holidays = new ArrayList<Holiday>();
savingsBO.generateNextSetOfMeetingDates(workingDays, holidays);
TestObjectFactory.updateObject(savingsBO);
TestObjectFactory.updateObject(center);
TestObjectFactory.updateObject(group);
TestObjectFactory.updateObject(savingsBO);
center = (CustomerBO) StaticHibernateUtil.getSessionTL().get(CustomerBO.class, center.getCustomerId());
group = (CustomerBO) StaticHibernateUtil.getSessionTL().get(CustomerBO.class, group.getCustomerId());
savingsBO = (SavingsBO) StaticHibernateUtil.getSessionTL().get(SavingsBO.class, savingsBO.getAccountId());
MeetingBO meetingBO = center.getCustomerMeeting().getMeeting();
meetingBO.setMeetingStartDate(lastYearLastInstallment.getActionDate());
List<Date> meetingDates = TestObjectFactory.getMeetingDates(group.getOfficeId(), meetingBO, 10);
meetingDates.remove(0);
Date FirstSavingInstallmetDate = savingsBO.getAccountActionDate(installmetId.shortValue()).getActionDate();
Calendar calendar2 = Calendar.getInstance();
calendar2.setTime(meetingDates.get(0));
Calendar calendar3 = Calendar.getInstance();
calendar3.setTime(FirstSavingInstallmetDate);
Assert.assertEquals(0, new GregorianCalendar(calendar3.get(Calendar.YEAR), calendar3.get(Calendar.MONTH), calendar3.get(Calendar.DATE), 0, 0, 0).compareTo(new GregorianCalendar(calendar2.get(Calendar.YEAR), calendar2.get(Calendar.MONTH), calendar2.get(Calendar.DATE), 0, 0, 0)));
}
use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.
the class SavingsActionStrutsTest method ignore_testSuccessfulGetStatusHistory.
/**
* ignoring as test fails due to lazy init which doesnt happen in application
*/
public void ignore_testSuccessfulGetStatusHistory() throws Exception {
SavingsTestHelper helper = new SavingsTestHelper();
createInitialObjects();
savingsOffering = helper.createSavingsOffering("asfddsf", "213a");
savings = helper.createSavingsAccount("000100000000017", savingsOffering, group, AccountStates.SAVINGS_ACC_PARTIALAPPLICATION, userContext);
Hibernate.initialize(savings);
savingsOffering = null;
AccountStateMachines.getInstance().initialize(AccountTypes.SAVINGS_ACCOUNT, null);
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
savings.changeStatus(AccountState.SAVINGS_PENDING_APPROVAL, null, "notes", loggedInUser);
Assert.assertEquals(AccountStates.SAVINGS_ACC_PENDINGAPPROVAL, savings.getAccountState().getId().shortValue());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
SessionUtils.setAttribute(Constants.USER_CONTEXT_KEY, TestUtils.makeUser(), request.getSession());
setRequestPathInfo("/savingsAction.do");
addRequestParameter("method", "getStatusHistory");
addRequestParameter("globalAccountNum", savings.getGlobalAccountNum());
actionPerform();
verifyForward("getStatusHistory_success");
verifyNoActionErrors();
verifyNoActionMessages();
Assert.assertEquals(2, ((List<SavingsTransactionHistoryDto>) SessionUtils.getAttribute(SavingsConstants.STATUS_CHANGE_HISTORY_LIST, request)).size());
}
use of org.mifos.accounts.savings.util.helpers.SavingsTestHelper in project head by mifos.
the class SavingsOverDueDepositsTagIntegrationTest method createInitialObjects.
private void createInitialObjects() throws Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center_Active_test", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
SavingsTestHelper helper = new SavingsTestHelper();
savingsOffering = helper.createSavingsOffering("2333dsf", "2132");
savings = helper.createSavingsAccount(savingsOffering, group, AccountState.SAVINGS_ACTIVE, TestUtils.makeUser());
}
Aggregations