Package org.springframework.mock.web.portlet

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


    }, "/rubbish");
  }

  @Test
  public void testPassAllParametersToRenderPhase() throws Exception {
    MockActionRequest request = new MockActionRequest();
    request.setParameter("William", "Baskerville");
    request.setParameter("Adso", "Melk");
    MockActionResponse response = new MockActionResponse();
    PortletUtils.passAllParametersToRenderPhase(request, response);
    assertEquals("The render parameters map is obviously not being populated with the request parameters.",
        request.getParameterMap().size(), response.getRenderParameterMap().size());
  }
View Full Code Here


    PortletUtils.getSubmitParameter(null, targetSubmitParameter);
  }

  @Test
  public void testPassAllParametersToRenderPhaseDoesNotPropagateExceptionIfRedirectAlreadySentAtTimeOfCall() throws Exception {
    MockActionRequest request = new MockActionRequest();
    request.setParameter("William", "Baskerville");
    request.setParameter("Adso", "Melk");
    MockActionResponse response = new MockActionResponse() {
      @Override
      public void setRenderParameter(String key, String[] values) {
        throw new IllegalStateException();
      }
View Full Code Here

public class ParameterMappingInterceptorTests extends TestCase {

  public void testDefaultParameterMapped() throws Exception {
    ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
    Object handler = new Object();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    String param = ParameterHandlerMapping.DEFAULT_PARAMETER_NAME;
    String value = "someValue";
    request.setParameter(param, value);
    assertNull(response.getRenderParameter(param));
    boolean shouldProceed = interceptor.preHandleAction(request, response, handler);
    assertTrue(shouldProceed);
    assertNotNull(response.getRenderParameter(param));
    assertEquals(value, response.getRenderParameter(param));
View Full Code Here

  }

  public void testNonDefaultParameterNotMapped() throws Exception {
    ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
    Object handler = new Object();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    String param = "myParam";
    String value = "someValue";
    request.setParameter(param, value);
    assertNull(response.getRenderParameter(param));
    boolean shouldProceed = interceptor.preHandle(request, response, handler);
    assertTrue(shouldProceed);
    assertNull(response.getRenderParameter(param));
    assertNull(response.getRenderParameter(ParameterHandlerMapping.DEFAULT_PARAMETER_NAME));
View Full Code Here

    ParameterHandlerMapping handlerMapping = new ParameterHandlerMapping();
    handlerMapping.setParameterName(param);
    ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
    interceptor.setParameterName(param);
    Object handler = new Object();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setParameter(param, value);
    assertNull(response.getRenderParameter(param));
    boolean shouldProceed = interceptor.preHandleAction(request, response, handler);
    assertTrue(shouldProceed);
    assertNull(response.getRenderParameter(ParameterHandlerMapping.DEFAULT_PARAMETER_NAME));
    assertNotNull(response.getRenderParameter(param));
View Full Code Here

  }

  public void testNoParameterValueSetWithDefaultParameterName() throws Exception {
    ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
    Object handler = new Object();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    String param = ParameterHandlerMapping.DEFAULT_PARAMETER_NAME;
    assertNull(response.getRenderParameter(param));
    boolean shouldProceed = interceptor.preHandle(request, response, handler);
    assertTrue(shouldProceed);
View Full Code Here

  }

  public void testNoParameterValueSetWithNonDefaultParameterName() throws Exception {
    ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
    Object handler = new Object();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    String param = "myParam";
    assertNull(response.getRenderParameter(param));
    boolean shouldProceed = interceptor.preHandle(request, response, handler);
    assertTrue(shouldProceed);
View Full Code Here

    ParameterHandlerMapping handlerMapping = new ParameterHandlerMapping();
    handlerMapping.setParameterName(param);
    ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
    interceptor.setParameterName(param);
    Object handler = new Object();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    assertNull(response.getRenderParameter(param));
    boolean shouldProceed = interceptor.preHandle(request, response, handler);
    assertTrue(shouldProceed);
    assertNull(response.getRenderParameter(param));
View Full Code Here

    assertTrue("Context not published",
        getPortletContext().getAttribute(FrameworkPortlet.PORTLET_CONTEXT_PREFIX + "complex") == null);
  }

  public void testPortletModeParameterMappingHelp1() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.HELP);
    request.setParameter("action", "help1");
    complexDispatcherPortlet.processAction(request, response);
    String param = response.getRenderParameter("param");
    assertEquals("help1 was here", param);
  }
View Full Code Here

    String param = response.getRenderParameter("param");
    assertEquals("help1 was here", param);
  }

  public void testPortletModeParameterMappingHelp2() throws Exception {
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.HELP);
    request.setParameter("action", "help2");
    complexDispatcherPortlet.processAction(request, response);
    String param = response.getRenderParameter("param");
    assertEquals("help2 was here", param);
  }
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.portlet.MockActionRequest

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.