Search in sources :

Example 6 with CheckListPersistence

use of org.mifos.customers.checklist.persistence.CheckListPersistence in project head by mifos.

the class CheckListActionStrutsTest method testCreate_product.

@Test
public void testCreate_product() throws Exception {
    setRequestPathInfo("/chkListAction");
    addRequestParameter("method", "create");
    addRequestParameter("masterTypeId", "1");
    addRequestParameter("isCustomer", "false");
    addRequestParameter("stateId", "13");
    addRequestParameter("checklistName", "new checklistName");
    addRequestParameter("detailsList[0]", "newdetails");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyForward(ActionForwards.create_success.toString());
    List<AccountCheckListBO> accountCheckLists = new CheckListPersistence().retreiveAllAccountCheckLists();
    Assert.assertNotNull(accountCheckLists);
    Assert.assertEquals(1, accountCheckLists.size());
    Assert.assertNull(request.getAttribute(Constants.CURRENTFLOWKEY));
    for (AccountCheckListBO checkList : accountCheckLists) {
        Assert.assertEquals("new checklistName", checkList.getChecklistName());
        Assert.assertEquals("1", checkList.getProductTypeEntity().getProductTypeID().toString());
        Assert.assertEquals("1", checkList.getChecklistStatus().toString());
        Assert.assertEquals(1, checkList.getChecklistDetails().size());
    }
}
Also used : CheckListPersistence(org.mifos.customers.checklist.persistence.CheckListPersistence) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) Test(org.junit.Test)

Example 7 with CheckListPersistence

use of org.mifos.customers.checklist.persistence.CheckListPersistence 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());
    }
}
Also used : CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) CheckListPersistence(org.mifos.customers.checklist.persistence.CheckListPersistence) Test(org.junit.Test)

Aggregations

CheckListPersistence (org.mifos.customers.checklist.persistence.CheckListPersistence)7 AccountCheckListBO (org.mifos.customers.checklist.business.AccountCheckListBO)4 CustomerCheckListBO (org.mifos.customers.checklist.business.CustomerCheckListBO)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 Test (org.junit.Test)2 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)2 CheckListBO (org.mifos.customers.checklist.business.CheckListBO)2 CheckListException (org.mifos.customers.checklist.exceptions.CheckListException)2 ChkListActionForm (org.mifos.customers.checklist.struts.actionforms.ChkListActionForm)2 CheckListMasterDto (org.mifos.dto.domain.CheckListMasterDto)2 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)2 MifosUser (org.mifos.security.MifosUser)2 UserContext (org.mifos.security.util.UserContext)2 BusinessRuleException (org.mifos.service.BusinessRuleException)2 ArrayList (java.util.ArrayList)1 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 ProductTypeEntity (org.mifos.accounts.productdefinition.business.ProductTypeEntity)1 ProductCategoryBusinessService (org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService)1 CustomerLevelEntity (org.mifos.customers.business.CustomerLevelEntity)1