Search in sources :

Example 11 with FlowManager

use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.

the class OfficeActionStrutsTest method ignore_testFlowSuccess.

public void ignore_testFlowSuccess() throws Exception {
    setRequestPathInfo("/offAction.do");
    addRequestParameter("method", Methods.load.toString());
    addRequestParameter("officeLevel", "5");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyForward(ActionForwards.load_success.toString());
    flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
    FlowManager fm = (FlowManager) SessionUtils.getAttribute(Constants.FLOWMANAGER, request.getSession());
    Assert.assertEquals(true, fm.isFlowValid(flowKey));
    setRequestPathInfo("/offAction.do");
    addRequestParameter("method", Methods.preview.toString());
    addRequestParameter("officeName", "abcd");
    addRequestParameter("shortName", "abcd");
    addRequestParameter("officeLevel", "5");
    addRequestParameter("parentOfficeId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyInputForward();
    fm = (FlowManager) SessionUtils.getAttribute(Constants.FLOWMANAGER, request.getSession());
    Assert.assertEquals(true, fm.isFlowValid(flowKey));
    setRequestPathInfo("/offAction.do");
    addRequestParameter("method", Methods.create.toString());
    addRequestParameter("officeName", "abcd");
    addRequestParameter("shortName", "abcd");
    addRequestParameter("officeLevel", "5");
    addRequestParameter("parentOfficeId", "1");
    addRequestParameter("address.line1", "123");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyForward(ActionForwards.create_success.toString());
    fm = (FlowManager) SessionUtils.getAttribute(Constants.FLOWMANAGER, request.getSession());
    Assert.assertEquals(false, fm.isFlowValid(flowKey));
}
Also used : FlowManager(org.mifos.framework.util.helpers.FlowManager)

Example 12 with FlowManager

use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.

the class MifosMockStrutsTestCase method createFlow.

protected String createFlow(HttpServletRequest request, Class<?> flowClass) {
    Flow flow = new Flow();
    String flowKey = String.valueOf(System.currentTimeMillis());
    FlowManager flowManager = new FlowManager();
    flowManager.addFLow(flowKey, flow, flowClass.getName());
    request.getSession(false).setAttribute(Constants.FLOWMANAGER, flowManager);
    return flowKey;
}
Also used : FlowManager(org.mifos.framework.util.helpers.FlowManager) Flow(org.mifos.framework.util.helpers.Flow)

Example 13 with FlowManager

use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.

the class FlowKeyInterceptor method createToken.

private void createToken(HttpServletRequest request) {
    String flowKey = String.valueOf(new DateTimeService().getCurrentDateTime().getMillis());
    FlowManager flowManager = (FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER);
    if (flowManager == null) {
        flowManager = new FlowManager();
        request.getSession(false).setAttribute(Constants.FLOWMANAGER, flowManager);
    }
    flowManager.addFLow(flowKey, new Flow(), this.getClass().getName());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
}
Also used : FlowManager(org.mifos.framework.util.helpers.FlowManager) DateTimeService(org.mifos.framework.util.DateTimeService) Flow(org.mifos.framework.util.helpers.Flow)

Aggregations

FlowManager (org.mifos.framework.util.helpers.FlowManager)13 HttpSession (javax.servlet.http.HttpSession)4 Flow (org.mifos.framework.util.helpers.Flow)4 UserContext (org.mifos.security.util.UserContext)4 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)3 DateTimeService (org.mifos.framework.util.DateTimeService)3 JspException (javax.servlet.jsp.JspException)2 XmlBuilder (org.mifos.framework.struts.tags.XmlBuilder)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 Locale (java.util.Locale)1 Random (java.util.Random)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 ActionErrors (org.apache.struts.action.ActionErrors)1 ActionMessage (org.apache.struts.action.ActionMessage)1 Before (org.junit.Before)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 FeeDto (org.mifos.accounts.fees.business.FeeDto)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1