Package org.springframework.mock.web.portlet

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


        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("defaultName", "myDefaultName");
    request.addParameter("age", "value2");
    request.addParameter("date", "2007-10-02");
    MockRenderResponse response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myView-String:myDefaultName-typeMismatch-tb1-myOriginalValue", response.getContentAsString());
  }
View Full Code Here


        return wac;
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.VIEW);
    MockRenderResponse response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("view", "other");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myOtherView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("view", "my");
    request.addParameter("lang", "de");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myLangView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("surprise", "!");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("mySurpriseView", response.getContentAsString());
  }
View Full Code Here

        return wac;
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.HELP);
    MockRenderResponse response = new MockRenderResponse();
    try {
      portlet.render(request, response);
      fail("Should have thrown UnavailableException");
    }
    catch (UnavailableException ex) {
      // expected
    }

    request = new MockRenderRequest(PortletMode.EDIT);
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myDefaultView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.EDIT);
    request.addParameter("myParam", "myValue");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.EDIT);
    request.addParameter("myParam", "mySpecialValue");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("mySpecialView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.EDIT);
    request.addParameter("myParam", "myOtherSpecialValue");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myOtherSpecialView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.VIEW);
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.EDIT);
    request.addParameter("myParam", "myValue");
    request.addParameter("view", "other");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myOtherView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.EDIT);
    request.addParameter("myParam", "myValue");
    request.addParameter("view", "my");
    request.addParameter("lang", "de");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("myLangView", response.getContentAsString());

    request = new MockRenderRequest(PortletMode.EDIT);
    request.addParameter("myParam", "myValue");
    request.addParameter("surprise", "!");
    response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("mySurpriseView", response.getContentAsString());
  }
View Full Code Here

    super.setUp();

    context = ActionContext.getContext();
    stack = context.getValueStack();

    renderRequest = new MockRenderRequest();
    renderRequest.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
    renderUrl = new MockPortletUrl("render");
    actionUrl = new MockPortletUrl("action");
    renderResponse = new MockRenderResponse() {
      @Override
View Full Code Here

   */
  public void testShouldIncludeCurrentNamespaceIfNoNamespaceSpecifiedForRenderUrl()
      throws Exception {
    final MockPortletURL portletUrl = new MockPortletURL(
        new MockPortalContext(), "render");
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse() {
      @Override
      public PortletURL createRenderURL() {
        return portletUrl;
      }
View Full Code Here

   */
  public void testShouldIncludeCurrentNamespaceIfNoNamespaceSpecifiedForRenderFormUrl()
      throws Exception {
    final MockPortletURL portletUrl = new MockPortletURL(
        new MockPortalContext(), "render");
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse() {
      @Override
      public PortletURL createActionURL() {
        return portletUrl;
      }
View Full Code Here

        ((MockPortletPreferences) preferences).setValue("showtitle", "true");
        ((MockPortletPreferences) preferences).setValue("showtextinput", "true");
        ((MockPortletPreferences) preferences).setValue("minrefresh", "900");
        ((MockPortletPreferences) preferences).setValue("disableescape", "false");
       
        MockRenderRequest request = new MockRenderRequest(portletContext);
        request.setPreferences(preferences);
        request.addLocale(Locale.ENGLISH);
        MockRenderResponse response = new MockRenderResponse();
       
        rssPortlet.render(request, response);
        rssPortlet.cache.clearCache();
       
View Full Code Here

        ((MockPortletPreferences) preferences).setValue("showtitle", "true");
        ((MockPortletPreferences) preferences).setValue("showtextinput", "true");
        ((MockPortletPreferences) preferences).setValue("minrefresh", "900");
        ((MockPortletPreferences) preferences).setValue("disableescape", "true");
       
        MockRenderRequest request = new MockRenderRequest(portletContext);
        request.setPreferences(preferences);
        request.addLocale(Locale.ENGLISH);
        MockRenderResponse response = new MockRenderResponse();
       
        rssPortlet.render(request, response);
        rssPortlet.cache.clearCache();
       
View Full Code Here

    context = new MockPortletContext();
    renderUrl = new MockPortletURL(
        new MockPortalContext(), "render");
    actionUrl = new MockPortletURL(
        new MockPortalContext(), "action");
    request = new MockRenderRequest();
    response = new MockRenderResponse() {
      @Override
      public PortletURL createActionURL() {
        return actionUrl;
      }
View Full Code Here

    controller.setPortletContext(portletContext);
    controller.afterPropertiesSet();

    actionRequest = new MockActionRequest();
    actionResponse = new MockActionResponse();
    renderRequest = new MockRenderRequest();
    renderResponse = new MockRenderResponse();
    actionContext = new PortletExternalContext(portletContext, actionRequest, actionResponse,
        controller.getFlowUrlHandler());
    renderContext = new PortletExternalContext(portletContext, renderRequest, renderResponse,
        controller.getFlowUrlHandler());
View Full Code Here

TOP

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

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.