Examples of MockActionResponse


Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertEquals("The render parameters map must not be being populated with the request parameters (Action.sendRedirect(..) aleady called).",
        0, response.getRenderParameterMap().size());
  }

  public void testClearAllRenderParameters() throws Exception {
    MockActionResponse response = new MockActionResponse();
    response.setRenderParameter("William", "Baskerville");
    response.setRenderParameter("Adso", "Melk");
    PortletUtils.clearAllRenderParameters(response);
    assertEquals("The render parameters map is obviously not being cleared out.",
        0, response.getRenderParameterMap().size());
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertEquals("The render parameters map is obviously not being cleared out.",
        0, response.getRenderParameterMap().size());
  }

  public void testClearAllRenderParametersDoesNotPropagateExceptionIfRedirectAlreadySentAtTimeOfCall() throws Exception {
    MockActionResponse response = new MockActionResponse() {
      public void setRenderParameters(Map parameters) {
        throw new IllegalStateException();
      }
    };
    response.setRenderParameter("William", "Baskerville");
    response.setRenderParameter("Adso", "Melk");
    PortletUtils.clearAllRenderParameters(response);
    assertEquals("The render parameters map must not be cleared if ActionResponse.sendRedirect() has been called (already).",
        2, response.getRenderParameterMap().size());
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    complexDispatcherPortlet.setContextClass(ComplexPortletApplicationContext.class);
    complexDispatcherPortlet.setNamespace("test");
    complexDispatcherPortlet.setDetectAllHandlerMappings(false);
    complexDispatcherPortlet.init(new MockPortletConfig(getPortletContext(), "complex"));
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.EDIT);
    complexDispatcherPortlet.processAction(request, response);
    String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
    assertNotNull(exceptionParam);
    assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertEquals("failed-unavailable", view.getBeanName());
  }

  public void testExistingMultipartRequest() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.EDIT);
    ComplexPortletApplicationContext.MockMultipartResolver multipartResolver =
        (ComplexPortletApplicationContext.MockMultipartResolver)
        complexDispatcherPortlet.getPortletApplicationContext().getBean("portletMultipartResolver");
    MultipartActionRequest multipartRequest = multipartResolver.resolveMultipart(request);
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertNotNull(request.getAttribute("cleanedUp"));
  }

  public void testMultipartResolutionFailed() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.EDIT);
    request.addUserRole("role1");
    request.setAttribute("fail", Boolean.TRUE);
    complexDispatcherPortlet.processAction(request, response);
    String exception = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
    assertTrue(exception.startsWith(MaxUploadSizeExceededException.class.getName()));
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

  }
 
  public void testActionRequestNotHandled() throws Exception {
    ParameterizableViewController controller = new ParameterizableViewController();
    ActionRequest request = new MockActionRequest();
    ActionResponse response = new MockActionResponse();
    try {
      controller.handleActionRequest(request, response);
      fail("should have thrown PortletException");
    }
    catch (PortletException ex) {
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertTrue(exception.startsWith(MaxUploadSizeExceededException.class.getName()));
  }

  public void testActionRequestHandledEvent() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    complexDispatcherPortlet.processAction(request, response);
    ComplexPortletApplicationContext.TestApplicationListener listener =
        (ComplexPortletApplicationContext.TestApplicationListener)
        complexDispatcherPortlet.getPortletApplicationContext().getBean("testListener");
    assertEquals(1, listener.counter);
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

  }

  public void testPublishEventsOff() throws Exception {
    complexDispatcherPortlet.setPublishEvents(false);
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setParameter("action", "checker");
    complexDispatcherPortlet.processAction(request, response);
    ComplexPortletApplicationContext.TestApplicationListener listener =
        (ComplexPortletApplicationContext.TestApplicationListener)
        complexDispatcherPortlet.getPortletApplicationContext().getBean("testListener");
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertNull(view);
  }

  public void testParameterMappingInterceptorWithCorrectParam() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.VIEW);
    request.addUserRole("role1");
    request.addParameter("interceptingParam", "test1");
    complexDispatcherPortlet.processAction(request, response);
    assertEquals("test1", response.getRenderParameter("interceptingParam"));
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockActionResponse

    assertEquals("test1", response.getRenderParameter("interceptingParam"));
  }

  public void testParameterMappingInterceptorWithIncorrectParam() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.VIEW);
    request.addUserRole("role1");
    request.addParameter("incorrect", "test1");
    complexDispatcherPortlet.processAction(request, response);
    assertNull(response.getRenderParameter("incorrect"));
    assertNull(response.getRenderParameter("interceptingParam"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.