Package javax.servlet.http

Examples of javax.servlet.http.HttpServletRequest


  public void testHandleViewRenderingAdapter() throws Exception
  {

    RenderingViewAdapter viewAdapter = createStrictMock(RenderingViewAdapter.class);
    ControllerAction action = createStrictMock(ControllerAction.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    TestAction actionBean = createStrictMock(TestAction.class);
    ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);

    ActionContext actionContext = new TestContextImpl(request);

    // check the expected order of method invocation
    expect(action.getBeanSource()).andReturn(beanSource);
    expect(beanSource.createBean(actionContext)).andReturn(actionBean);
    action.preExecute(actionBean, actionContext);

    expect(action.getBeforeInterceptors()).andReturn(null);
    expect(action.executeController(actionBean, actionContext)).andReturn(viewAdapter);
    expect(action.getAfterInterceptors()).andReturn(null);

    request.setAttribute(InfrastructureKeys.ACTION_BEAN, actionBean);
    action.postExecute(actionBean, actionContext, null);
    viewAdapter.render(actionContext);

    replay(action);
    replay(request);
View Full Code Here


    List<AfterInterceptor> actionAfters = new ArrayList<AfterInterceptor>();
    actionAfters.add(actionAfter1);
    actionAfters.add(actionAfter2);

    ControllerAction action = createStrictMock(ControllerAction.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    TestAction actionBean = createStrictMock(TestAction.class);
    ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);

    ActionContext actionContext = new TestContextImpl(request);

    // check the expected order of method invocation
    expect(action.getBeanSource()).andReturn(beanSource);
    expect(beanSource.createBean(actionContext)).andReturn(actionBean);
    action.preExecute(actionBean, actionContext);

    before1.beforeExecute(actionBean, actionContext);
    before2.beforeExecute(actionBean, actionContext);

    expect(action.getBeforeInterceptors()).andReturn(actionBefores);
    actionBefore1.beforeExecute(actionBean, actionContext);
    actionBefore2.beforeExecute(actionBean, actionContext);

    expect(action.executeController(actionBean, actionContext)).andReturn(
        new ActionForwardViewAdapter(actionForward));

    expect(action.getAfterInterceptors()).andReturn(actionAfters);
    actionAfter1.afterExecute(actionBean, actionContext, null);
    actionAfter2.afterExecute(actionBean, actionContext, null);

    after1.afterExecute(actionBean, actionContext, null);
    after2.afterExecute(actionBean, actionContext, null);
    action.postExecute(actionBean, actionContext, null);

    request.setAttribute(InfrastructureKeys.ACTION_BEAN, actionBean);
    request.setAttribute(InfrastructureKeys.ACTION_FORWARD, actionForward);

    replay(action);
    replay(request);
    replay(actionBean);
    replay(beanSource);
View Full Code Here

    List<AfterInterceptor> actionAfters = new ArrayList<AfterInterceptor>();
    actionAfters.add(actionAfter1);
    actionAfters.add(actionAfter2);

    ControllerAction action = createStrictMock(ControllerAction.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    TestAction actionBean = createStrictMock(TestAction.class);
    ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);

    ActionContext actionContext = new TestContextImpl(request);
View Full Code Here

    Collection<AfterInterceptor> afters = new ArrayList<AfterInterceptor>();
    afters.add(after1);
    afters.add(after2);

    ControllerAction action = createStrictMock(ControllerAction.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    TestAction actionBean = createStrictMock(TestAction.class);
    ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);

    ActionContext actionContext = new TestContextImpl(request);

    // check the expected order of method invocation
    expect(action.getBeanSource()).andReturn(beanSource);
    expect(beanSource.createBean(actionContext)).andReturn(actionBean);
    action.preExecute(actionBean, actionContext);

    expect(action.getBeforeInterceptors()).andReturn(null);
    expect(action.executeController(actionBean, actionContext)).andReturn(null);
    expect(action.getAfterInterceptors()).andReturn(null);

    IllegalStateException exception = new IllegalStateException();
    after1.afterExecute(actionBean, actionContext, null);
    expectLastCall().andThrow(exception);

    // check that we continue - i.e we don't fall over in a heap because the after interceptor
    // failed
    after2.afterExecute(actionBean, actionContext, null);
    request.setAttribute(InfrastructureKeys.ACTION_BEAN, actionBean);
    action.postExecute(actionBean, actionContext, null);

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

    Collection<AfterInterceptor> afters = new ArrayList<AfterInterceptor>();
    afters.add(after1);
    afters.add(after2);

    ControllerAction action = createStrictMock(ControllerAction.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    TestAction actionBean = createStrictMock(TestAction.class);
    ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);

    ActionContext actionContext = new TestContextImpl(request);
View Full Code Here

  public void testDelegatingActionForm() throws Exception
  {
    ServletActionContext sac = getActionContext();
    FormWrapper wrapper = newMock(FormWrapper.class);
    ProcessActionForm processActionForm = getProcessActionForm(wrapper);
    HttpServletRequest request = newMock(HttpServletRequest.class);
    ActionForm actionForm = newMock(ActionForm.class);
    DelegatingForm delegatingForm = new DelegatingForm(actionForm);

    expect(sac.getActionForm()).andReturn(actionForm);
    expect(sac.getRequest()).andReturn(request);
View Full Code Here

    ServletActionContext sac = getActionContext();
    FormPopulateSource formPopulateSource = newMock(FormPopulateSource.class);
    PopulateActionForm populateActionForm = getPopulateActionForm(formPopulateSource);
    ActionMapping actionConfig = newMock(ActionMapping.class);
    ActionForm actionForm = newMock(ActionForm.class);
    HttpServletRequest request = newMock(HttpServletRequest.class);

    expect(sac.getActionForm()).andReturn(actionForm);
    expect(sac.getRequest()).andReturn(request);
    expect(formPopulateSource.prePopulate(actionForm, request)).andReturn(actionForm);
View Full Code Here

  public void testRegularActionForm() throws Exception
  {
    ServletActionContext sac = getActionContext();
    FormWrapper wrapper = newMock(FormWrapper.class);
    ProcessActionForm processActionForm = getProcessActionForm(wrapper);
    HttpServletRequest request = newMock(HttpServletRequest.class);
    ActionForm actionForm = newMock(ActionForm.class);

    expect(sac.getActionForm()).andReturn(actionForm);
    expect(sac.getRequest()).andReturn(request);
    expect(wrapper.wrapForm(actionForm, request)).andReturn(actionForm);
View Full Code Here

  @Test
  public void testGetActionForward()
  {

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    HttpSession session = createStrictMock(HttpSession.class);
    RedirectHelper redirectHelper = createStrictMock(RedirectHelper.class);

    expect(request.getAttribute(InfrastructureKeys.REDIRECT_HELPER)).andReturn(redirectHelper);
    expect(redirectHelper.getRequestParameters()).andReturn(getRequestParameters());
    expect(request.getSession()).andReturn(session);
    expect(redirectHelper.getSessionParameters()).andReturn(getSessionParameters());
    session.setAttribute(InfrastructureKeys.REDIRECT_PARAMETERS, getSessionParameters());

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

  public void testPopulateActionForm() throws Exception
  {
    ServletActionContext sac = getActionContext();
    RequestPreprocessor requestPreprocessor = newMock(RequestPreprocessor.class);
    Preprocess preprocess = getPreprocess(requestPreprocessor);
    HttpServletRequest request = newMock(HttpServletRequest.class);

    expect(sac.getRequest()).andReturn(request);
    requestPreprocessor.preprocessRequest(request);

    replayMocks();
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpServletRequest

Copyright © 2015 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.