Search in sources :

Example 6 with BusinessActivityEntity

use of org.mifos.application.master.business.BusinessActivityEntity in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessUnderGroup.

@Test
public void testCreateSuccessUnderGroup() throws Exception {
    createParentCustomer();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("parentGroupId", group.getCustomerId().toString());
    addRequestParameter("groupFlag", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.load_success.toString());
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "next");
    addRequestParameter("officeId", "3");
    addRequestParameter("clientName.salutation", "1");
    addRequestParameter("clientName.firstName", "Client");
    addRequestParameter("clientName.lastName", "LastName");
    addRequestParameter("spouseName.firstName", "Spouse");
    addRequestParameter("spouseName.lastName", "LastName");
    addRequestParameter("spouseName.nameType", "1");
    addRequestDateParameter("dateOfBirth", "20/3/1987");
    addRequestParameter("clientDetailView.gender", "1");
    addRequestParameter("input", "personalInfo");
    addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "20/3/1987");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.next_success.toString());
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.preview_success.toString());
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "create");
    addRequestParameter("input", "create");
    addRequestParameter("status", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.create_success.toString());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 7 with BusinessActivityEntity

use of org.mifos.application.master.business.BusinessActivityEntity in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessUnderGroupInBranch.

@Test
public void testCreateSuccessUnderGroupInBranch() throws Exception {
    try {
        createParentGroup();
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "load");
        addRequestParameter("parentGroupId", group.getCustomerId().toString());
        addRequestParameter("groupFlag", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.load_success.toString());
        List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
        List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "next");
        addRequestParameter("officeId", "3");
        addRequestParameter("clientName.salutation", "1");
        addRequestParameter("clientName.firstName", "Client");
        addRequestParameter("clientName.lastName", "LastName");
        addRequestParameter("spouseName.firstName", "Spouse");
        addRequestParameter("spouseName.lastName", "LastName");
        addRequestParameter("spouseName.nameType", "1");
        addRequestDateParameter("dateOfBirth", "20/3/1987");
        addRequestParameter("clientDetailView.gender", "1");
        addRequestParameter("input", "personalInfo");
        addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
        int i = 0;
        for (CustomFieldDto customFieldDef : customFieldDefs) {
            addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
            addRequestParameter("customField[" + i + "].fieldValue", "20/3/1987");
            i++;
        }
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.next_success.toString());
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "preview");
        addRequestParameter("input", "mfiInfo");
        addRequestParameter("formedByPersonnel", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.preview_success.toString());
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "create");
        addRequestParameter("input", "create");
        addRequestParameter("status", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.create_success.toString());
        ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
        client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) Test(org.junit.Test)

Example 8 with BusinessActivityEntity

use of org.mifos.application.master.business.BusinessActivityEntity in project head by mifos.

the class ClientCustActionStrutsTest method testPreviewFailure_DuplicateOfferingsSelected.

@Test
public void testPreviewFailure_DuplicateOfferingsSelected() throws Exception {
    savingsOffering1 = TestObjectFactory.createSavingsProduct("savingsPrd1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter("groupFlag", "0");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "next");
    addRequestParameter("officeId", "3");
    addRequestParameter("clientName.salutation", "1");
    addRequestParameter("clientName.firstName", "Client");
    addRequestParameter("clientName.lastName", "LastName");
    addRequestParameter("spouseName.firstName", "Spouse");
    addRequestParameter("spouseName.lastName", "LastName");
    addRequestParameter("spouseName.nameType", "1");
    addRequestDateParameter("dateOfBirth", "20/3/1987");
    addRequestParameter("clientDetailView.gender", "1");
    addRequestParameter("input", "personalInfo");
    addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "11");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    List<SavingsDetailDto> savingsOfferingList = getSavingsOfferingsFromSession();
    SavingsDetailDto savingsOffering = savingsOfferingList.get(0);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter("savingsOffering[0]", savingsOffering.getPrdOfferingId().toString());
    addRequestParameter("savingsOffering[1]", savingsOffering.getPrdOfferingId().toString());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, new MeetingBO(RecurrenceType.MONTHLY, Short.valueOf("2"), new Date(), MeetingType.CUSTOMER_MEETING), request);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    Assert.assertEquals("Duplicate Offerings", 1, getErrorSize(ClientConstants.ERRORS_DUPLICATE_OFFERING_SELECTED));
}
Also used : BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Example 9 with BusinessActivityEntity

use of org.mifos.application.master.business.BusinessActivityEntity in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessWithoutGroup.

@Test
public void testCreateSuccessWithoutGroup() throws Exception {
    SecurityContext securityContext = new SecurityContextImpl();
    MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
    Authentication authentication = new TestingAuthenticationToken(principal, principal);
    securityContext.setAuthentication(authentication);
    SecurityContextHolder.setContext(securityContext);
    //        List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter("groupFlag", "0");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "next");
    addRequestParameter("officeId", "3");
    addRequestParameter("clientName.salutation", "1");
    addRequestParameter("clientName.firstName", "Client");
    addRequestParameter("clientName.lastName", "LastName");
    addRequestParameter("spouseName.firstName", "Spouse");
    addRequestParameter("spouseName.lastName", "LastName");
    addRequestParameter("spouseName.nameType", "1");
    addRequestDateParameter("dateOfBirth", "20/3/1987");
    addRequestParameter("clientDetailView.gender", "1");
    addRequestParameter("input", "personalInfo");
    addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "Req");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    MeetingBO weeklyMeeting = new MeetingBuilder().weekly().every(1).occuringOnA(WeekDay.WEDNESDAY).build();
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.preview_success.toString());
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "create");
    addRequestParameter("input", "create");
    addRequestParameter("status", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.create_success.toString());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
//        removeFees(feesToRemove);
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) MifosUser(org.mifos.security.MifosUser) MifosUserBuilder(org.mifos.builders.MifosUserBuilder) TestingAuthenticationToken(org.springframework.security.authentication.TestingAuthenticationToken) Authentication(org.springframework.security.core.Authentication) SecurityContext(org.springframework.security.core.context.SecurityContext) List(java.util.List) ArrayList(java.util.ArrayList) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) Test(org.junit.Test)

Example 10 with BusinessActivityEntity

use of org.mifos.application.master.business.BusinessActivityEntity in project head by mifos.

the class ClientCustActionStrutsTest method testSuccessfulPreviewWithSavingsOfferingsSelected.

@Test
public void testSuccessfulPreviewWithSavingsOfferingsSelected() throws Exception {
    savingsOffering1 = TestObjectFactory.createSavingsProduct("savingsPrd1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter("groupFlag", "0");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "next");
    addRequestParameter("officeId", "3");
    addRequestParameter("clientName.salutation", "1");
    addRequestParameter("clientName.firstName", "Client");
    addRequestParameter("clientName.lastName", "LastName");
    addRequestParameter("spouseName.firstName", "Spouse");
    addRequestParameter("spouseName.lastName", "LastName");
    addRequestParameter("spouseName.nameType", "1");
    addRequestDateParameter("dateOfBirth", "20/3/1987");
    addRequestParameter("clientDetailView.gender", "1");
    addRequestParameter("input", "personalInfo");
    addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "11");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    List<SavingsDetailDto> savingsOfferingList = getSavingsOfferingsFromSession();
    SavingsDetailDto savingsOffering = savingsOfferingList.get(0);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter("savingsOffering[0]", savingsOffering.getPrdOfferingId().toString());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, new MeetingBO(RecurrenceType.MONTHLY, Short.valueOf("2"), new Date(), MeetingType.CUSTOMER_MEETING), request);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyForward(ActionForwards.preview_success.toString());
}
Also used : BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)12 BusinessActivityEntity (org.mifos.application.master.business.BusinessActivityEntity)12 List (java.util.List)10 Test (org.junit.Test)10 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)9 Date (java.util.Date)6 MeetingBO (org.mifos.application.meeting.business.MeetingBO)6 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)5 SavingsDetailDto (org.mifos.dto.domain.SavingsDetailDto)4 FeeDto (org.mifos.accounts.fees.business.FeeDto)3 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)3 MifosUser (org.mifos.security.MifosUser)3 MifosUserBuilder (org.mifos.builders.MifosUserBuilder)2 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)2 ValueListElement (org.mifos.dto.domain.ValueListElement)2 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)2 Authentication (org.springframework.security.core.Authentication)2 SecurityContext (org.springframework.security.core.context.SecurityContext)2 SecurityContextImpl (org.springframework.security.core.context.SecurityContextImpl)2 IOException (java.io.IOException)1