use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class ReverseLoanDisbursalActionStrutsTest method createLoanAccount.
private void createLoanAccount() {
Date startDate = new Date(System.currentTimeMillis());
createInitialCustomers();
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(this.getClass().getSimpleName() + " LOAN", "L", startDate, center.getCustomerMeeting().getMeeting());
loan = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_APPROVED, startDate, loanOffering);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class ProductMixValidatorIntegrationTest method testShouldAllowValidProductMix.
@Test
public void testShouldAllowValidProductMix() throws Exception {
LoanBO loanMock1 = createMock(LoanBO.class);
LoanBO loanMock2 = createMock(LoanBO.class);
LoanOfferingBO loanOfferingMock1 = createMock(LoanOfferingBO.class);
LoanOfferingBO loanOfferingMock2 = createMock(LoanOfferingBO.class);
expect(loanMock1.getLoanOffering()).andReturn(loanOfferingMock1);
expect(loanMock2.getLoanOffering()).andReturn(loanOfferingMock2);
expect(productMixBusinessServiceMock.canProductsCoExist(loanOfferingMock2, loanOfferingMock1)).andReturn(true);
replay(loanMock1, loanMock2, loanOfferingMock1, loanOfferingMock2, productMixBusinessServiceMock);
try {
new ProductMixValidator(configServiceMock, productMixBusinessServiceMock) {
@Override
void handleConflict(LoanBO newloan, LoanBO loan) throws AccountException {
throw new AccountException("Some exception code");
}
}.validateProductMix(loanMock2, Arrays.asList(loanMock1));
verify(loanMock1, loanMock2, loanOfferingMock1, loanOfferingMock2, productMixBusinessServiceMock);
} catch (AccountException e) {
Assert.fail("Invalid Product mix conflict detected");
}
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class MultipleLoanAccountsCreationActionStrutsTest method testGetPrdOfferingsApplicableForCustomersWithMeeting.
@SuppressWarnings("unchecked")
@Test
public void testGetPrdOfferingsApplicableForCustomersWithMeeting() throws Exception {
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
createInitialCustomers();
LoanOfferingBO loanOffering1 = getLoanOffering("vcxvxc", "a123", ApplicableTo.CLIENTS, WEEKLY, EVERY_WEEK);
LoanOfferingBO loanOffering2 = getLoanOffering("fgdsghdh", "4fdh", ApplicableTo.CLIENTS, WEEKLY, EVERY_WEEK);
LoanOfferingBO loanOffering3 = getLoanOffering("mgkkkj", "6tyu", ApplicableTo.GROUPS, WEEKLY, EVERY_WEEK);
LoanOfferingBO loanOffering4 = getLoanOffering("aq12sfdsf", "456j", ApplicableTo.CLIENTS, MONTHLY, EVERY_MONTH);
LoanOfferingBO loanOffering5 = getLoanOffering("bdfhgfh", "6yu7", ApplicableTo.CLIENTS, WEEKLY, (short) 3);
setRequestPathInfo("/multipleloansaction.do");
addRequestParameter("method", "getPrdOfferings");
addRequestParameter("branchOfficeId", "1");
addRequestParameter("loanOfficerId", "1");
addRequestParameter("centerId", center.getCustomerId().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
SessionUtils.setAttribute(LoanConstants.IS_CENTER_HIERARCHY_EXISTS, Constants.YES, request);
/*
* Why two calls to actionPerform? Are we trying to test the case where the user clicks twice or is this just a
* mistake?
*/
actionPerform();
performNoErrors();
verifyForward(ActionForwards.load_success.toString());
Assert.assertEquals(3, ((List<LoanOfferingBO>) SessionUtils.getAttribute(LoanConstants.LOANPRDOFFERINGS, request)).size());
TestObjectFactory.removeObject(loanOffering1);
TestObjectFactory.removeObject(loanOffering2);
TestObjectFactory.removeObject(loanOffering3);
TestObjectFactory.removeObject(loanOffering4);
TestObjectFactory.removeObject(loanOffering5);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class MultipleLoanAccountsCreationActionStrutsTest method testGetPrdOfferings.
@Test
public void testGetPrdOfferings() throws Exception {
createInitialCustomers();
LoanOfferingBO loanOffering1 = getLoanOffering("Loan Offering123", "LOOF", ApplicableTo.CLIENTS, WEEKLY, EVERY_WEEK);
setRequestPathInfo("/multipleloansaction.do");
addRequestParameter("method", "load");
actionPerform();
setRequestPathInfo("/multipleloansaction.do");
addRequestParameter("method", "getLoanOfficers");
addRequestParameter("branchOfficeId", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
setRequestPathInfo("/multipleloansaction.do");
addRequestParameter("method", "getCenters");
addRequestParameter("branchOfficeId", "1");
addRequestParameter("loanOfficerId", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
setRequestPathInfo("/multipleloansaction.do");
addRequestParameter("method", "getPrdOfferings");
addRequestParameter("loanOfficerId", "1");
addRequestParameter("branchOfficeId", "1");
addRequestParameter("centerId", center.getCustomerId().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
performNoErrors();
verifyForward(ActionForwards.load_success.toString());
Assert.assertNotNull(SessionUtils.getAttribute(LoanConstants.MULTIPLE_LOANS_OFFICES_LIST, request));
Assert.assertNotNull(SessionUtils.getAttribute(LoanConstants.IS_CENTER_HIERARCHY_EXISTS, request));
Assert.assertNotNull(SessionUtils.getAttribute(LoanConstants.MULTIPLE_LOANS_LOAN_OFFICERS_LIST, request));
Assert.assertNotNull(SessionUtils.getAttribute(LoanConstants.MULTIPLE_LOANS_CENTERS_LIST, request));
Assert.assertNotNull(SessionUtils.getAttribute(LoanConstants.LOANPRDOFFERINGS, request));
TestObjectFactory.removeObject(loanOffering1);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class MultipleLoanAccountsCreationActionStrutsTest method testGetWithoutClients.
@Test
public void testGetWithoutClients() throws Exception {
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
LoanOfferingBO loanOffering1 = getLoanOffering("vcxvxc", "a123", ApplicableTo.CLIENTS, WEEKLY, EVERY_WEEK);
setRequestPathInfo("/multipleloansaction.do");
addRequestParameter("method", "get");
addRequestParameter("branchOfficeId", center.getOffice().getOfficeId().toString());
SessionUtils.setAttribute(LoanConstants.IS_CENTER_HIERARCHY_EXISTS, Constants.YES, request);
addRequestParameter("loanOfficerId", center.getPersonnel().getPersonnelId().toString());
addRequestParameter("centerId", center.getCustomerId().toString());
addRequestParameter("prdOfferingId", loanOffering1.getPrdOfferingId().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyActionErrors(new String[] { LoanConstants.NOSEARCHRESULTS });
verifyForwardPath("/pages/application/loan/jsp/CreateMultipleLoanAccounts.jsp");
TestObjectFactory.removeObject(loanOffering1);
}
Aggregations