Package org.springframework.mock.web.portlet

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


  public void testIllegalArgumentExceptionInMappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception1");
    request.addParameter("unknown", "");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-runtime", view.getBeanName());
  }
View Full Code Here


  public void testIllegalArgumentExceptionInUnmappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception2");
    request.addParameter("unknown", "");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-default-1", view.getBeanName());
  }
View Full Code Here

  public void testExceptionInMappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception1");
    request.addParameter("generic", "123");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-exception", view.getBeanName());
  }
View Full Code Here

  public void testExceptionInUnmappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception2");
    request.addParameter("generic", "123");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-default-1", view.getBeanName());
  }
View Full Code Here

  public void testRuntimeExceptionInMappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception1");
    request.addParameter("runtime", "true");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-runtime", view.getBeanName());
  }
View Full Code Here

  public void testRuntimeExceptionInUnmappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception2");
    request.addParameter("runtime", "true");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-default-1", view.getBeanName());
  }
View Full Code Here

      LocaleContext servletLocaleContext = LocaleContextHolder.getLocaleContext();
      RequestAttributes servletRequestAttrs = RequestContextHolder.getRequestAttributes();

      MockRenderRequest request = new MockRenderRequest();
      MockRenderResponse response = new MockRenderResponse();
      request.setParameter("action", "form");
      request.setParameter("age", "29");
      simpleDispatcherPortlet.doDispatch(request, response);

      assertSame(servletLocaleContext, LocaleContextHolder.getLocaleContext());
View Full Code Here

      LocaleContext servletLocaleContext = LocaleContextHolder.getLocaleContext();
      RequestAttributes servletRequestAttrs = RequestContextHolder.getRequestAttributes();

      MockRenderRequest request = new MockRenderRequest();
      MockRenderResponse response = new MockRenderResponse();
      try {
        simpleDispatcherPortlet.doDispatch(request, response);
        fail("should have failed to find a handler and raised an UnavailableException");
      }
      catch (UnavailableException ex) {
View Full Code Here

  public void testRenderRequestWithViewNameSet() throws Exception {
    ParameterizableViewController controller = new ParameterizableViewController();
    String viewName = "testView";
    controller.setViewName(viewName);
    RenderRequest request = new MockRenderRequest();
    RenderResponse response = new MockRenderResponse();
    ModelAndView mav = controller.handleRenderRequest(request, response);
    assertEquals(viewName, mav.getViewName());
  }
View Full Code Here

    controller = new PortletModeNameViewController();
  }
 
  public void testEditPortletMode() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    request.setPortletMode(PortletMode.EDIT);
    ModelAndView mav = controller.handleRenderRequest(request, response);
    assertEquals("edit", mav.getViewName());
  }
View Full Code Here

TOP

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

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.