use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class CheckListActionStrutsTest method testCreate_customer.
@Test
public void testCreate_customer() throws Exception {
setRequestPathInfo("/chkListAction");
addRequestParameter("method", "create");
addRequestParameter("masterTypeId", "1");
addRequestParameter("masterTypeName", "kendra");
addRequestParameter("isCustomer", "true");
addRequestParameter("type", "1");
addRequestParameter("stateId", "13");
addRequestParameter("stateName", "active");
addRequestParameter("checklistName", "new checklistName");
addRequestParameter("detailsList[0]", "newdetails");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.create_success.toString());
List<CustomerCheckListBO> customerCheckLists = new CheckListPersistence().retreiveAllCustomerCheckLists();
Assert.assertNotNull(customerCheckLists);
Assert.assertNull(request.getAttribute(Constants.CURRENTFLOWKEY));
Assert.assertEquals(1, customerCheckLists.size());
for (CustomerCheckListBO checkList : customerCheckLists) {
Assert.assertEquals("new checklistName", checkList.getChecklistName());
Assert.assertEquals("1", checkList.getCustomerLevel().getId().toString());
Assert.assertEquals("13", checkList.getCustomerStatus().getId().toString());
Assert.assertEquals("1", checkList.getChecklistStatus().toString());
Assert.assertEquals(1, checkList.getChecklistDetails().size());
}
}
use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class CheckListActionStrutsTest method testUpdate_customer.
@Test
public void testUpdate_customer() throws Exception {
CheckListBO checkList = TestObjectFactory.createCustomerChecklist(CustomerLevel.CENTER.getValue(), CustomerStatus.CENTER_ACTIVE.getValue(), (short) 1);
StaticHibernateUtil.flushSession();
checkList = (CheckListBO) TestObjectFactory.getObject(CustomerCheckListBO.class, checkList.getChecklistId());
setRequestPathInfo("/chkListAction");
addRequestParameter("method", "update");
addRequestParameter("checklistName", checkList.getChecklistName());
addRequestParameter("isCustomer", "true");
addRequestParameter("detailsList[0]", "newdetails");
addRequestParameter("masterTypeId", ((CustomerCheckListBO) checkList).getCustomerLevel().getId().toString());
addRequestParameter("stateId", ((CustomerCheckListBO) checkList).getCustomerStatus().getId().toString());
addRequestParameter("checklistStatus", CheckListConstants.STATUS_INACTIVE.toString());
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, checkList, request);
actionPerform();
verifyNoActionErrors();
verifyForward(ActionForwards.update_success.toString());
Assert.assertNull(request.getAttribute(Constants.CURRENTFLOWKEY));
StaticHibernateUtil.flushSession();
checkList = (CheckListBO) TestObjectFactory.getObject(CustomerCheckListBO.class, checkList.getChecklistId());
Assert.assertEquals(1, checkList.getChecklistDetails().size());
checkList = null;
}
Aggregations