Package org.apache.struts.action

Examples of org.apache.struts.action.ActionMapping


  @Test
  public void testPreValidateNoValidate()
  {

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    replay(mapping);
    replay(request);

    FormValidationHandlerImpl delegate = new FormValidationHandlerImpl();
    assert null == delegate.preValidate(request, null);
View Full Code Here


  @Test
  public void testPostValidateSucceeded()
  {

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);

    replay(mapping);
    replay(request);

    FormValidationHandlerImpl delegate = new FormValidationHandlerImpl();
View Full Code Here

    action.setKeyMethodMap(hashMap);

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);

    action.setServlet(servlet);

    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);
    expect(messageResources.getMessage(Locale.getDefault(), "insert.key")).andReturn("Insert Stuff Here");
    actionBean.insert();
    expect(actionBean.getNavigationResult()).andReturn("inserted");
    expect(mapping.findForward("inserted")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(request);
    replay(session);
View Full Code Here

    action.setKeyMethodMap(hashMap);

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);

    action.setServlet(servlet);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);

    expect(mapping.getPath()).andReturn("appPath");

    replay(actionBean);
    replay(mapping);
    replay(request);
    replay(session);
View Full Code Here

    action.setKeyMethodMap(hashMap);

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(Boolean.TRUE);
    actionBean.cancel();
    expect(actionBean.getNavigationResult()).andReturn("cancelled");
    expect(mapping.findForward("cancelled")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(request);
View Full Code Here

  {

    ActionForward actionForward = new ActionForward();

    NavigableFormSubmitBean actionBean = createStrictMock(NavigableFormSubmitBean.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    actionBean.preBind();
    form.bindInwards(actionBean);
    actionBean.execute();
    expect(actionBean.getSuccessResult()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
    replay(request);
View Full Code Here

  {

    ActionForward actionForward = new ActionForward();

    NavigableFormSubmitBean actionBean = createStrictMock(NavigableFormSubmitBean.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(Boolean.TRUE);
    actionBean.cancel();
    expect(actionBean.getSuccessResult()).andReturn("cancel");
    expect(mapping.findForward("cancel")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
    replay(request);
View Full Code Here

  {

    ActionForward actionForward = new ActionForward();

    NavigableFormSubmitBean actionBean = createStrictMock(NavigableFormSubmitBean.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    BasicActionForm form = createStrictMock(BasicActionForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    actionBean.execute();
    expect(actionBean.getSuccessResult()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
    replay(request);
View Full Code Here

  {

    ActionForward actionForward = new ActionForward();

    NavigableFormSubmitBean actionBean = createStrictMock(NavigableFormSubmitBean.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    BasicActionForm form = createStrictMock(BasicActionForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(Boolean.TRUE);
    actionBean.cancel();
    expect(actionBean.getSuccessResult()).andReturn("cancel");
    expect(mapping.findForward("cancel")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
    replay(request);
View Full Code Here

    action.setNavigationHolder(navigationReader.getNavigationHolder());

    ActionForward actionForward = new ActionForward();

    NavigableReadOnlyBean actionBean = createMock(NavigableReadOnlyBean.class);
    ActionMapping mapping = createMock(ActionMapping.class);

    actionBean.execute();
    expect(actionBean.getSuccessResult()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);

    ViewAdapter viewAdapter = action.executeAction(actionBean, new TestContextImpl(null, mapping));
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.