Package org.springframework.mock.web.portlet

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


    assertTrue(request.getAttribute("test2-remove-after") == null);
  }

  public void testHandlerInterceptorAbort() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    request.setPortletMode(PortletMode.VIEW);
    request.addUserRole("role1");
    request.addParameter("abort", "true");
    complexDispatcherPortlet.doDispatch(request, response);
    assertTrue(request.getAttribute("test1-remove-never") != null);
View Full Code Here


    assertTrue(request.getAttribute("test2-remove-after") == null);
  }

  public void testHandlerInterceptorNotClearingModelAndView() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    request.setPortletMode(PortletMode.VIEW);
    request.addUserRole("role1");
    request.addParameter("noView", "false");
    complexDispatcherPortlet.doDispatch(request, response);
    Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
View Full Code Here

    assertEquals("someViewName", view.getBeanName());
  }

  public void testHandlerInterceptorClearingModelAndView() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    request.setPortletMode(PortletMode.VIEW);
    request.addUserRole("role1");
    request.addParameter("noView", "true");
    complexDispatcherPortlet.doDispatch(request, response);
    Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
View Full Code Here

    assertNull(myPortlet.getPortletConfig());
  }

  public void testPortletHandlerAdapterRenderRequest() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    request.setParameter("myParam", "myPortlet");
    complexDispatcherPortlet.doDispatch(request, response);
    assertEquals("myPortlet was here", response.getContentAsString());
    ComplexPortletApplicationContext.MyPortlet myPortlet =
      (ComplexPortletApplicationContext.MyPortlet)
      complexDispatcherPortlet.getPortletApplicationContext().getBean("myPortlet");
    assertEquals("complex", myPortlet.getPortletConfig().getPortletName());
    assertEquals(getPortletContext(), myPortlet.getPortletConfig().getPortletContext());
View Full Code Here

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

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

  public void testIllegalAccessExceptionInMappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception1");
    request.addParameter("access", "illegal");
    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 testIllegalAccessExceptionInUnmappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception2");
    request.addParameter("access", "illegal");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-illegalaccess", view.getBeanName());
  }
View Full Code Here

  public void testPortletRequestBindingExceptionInMappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception1");
    request.addParameter("binding", "should fail");
    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 testPortletRequestBindingExceptionInUnmappedHandler() throws Exception {
    MockRenderRequest request = new MockRenderRequest();
    request.setPortletMode(PortletMode.HELP);
    request.addParameter("myParam", "exception2");
    request.addParameter("binding", "should fail");
    MockRenderResponse response = new MockRenderResponse();
    complexDispatcherPortlet.doDispatch(request, response);
    InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
    assertEquals("failed-binding", view.getBeanName());
  }
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.