Package org.springframework.mock.web.portlet

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


  public void testDispatcherPortletRefresh() throws PortletException {
    MockPortletContext portletContext = new MockPortletContext("org/springframework/web/portlet/context");
    DispatcherPortlet portlet = new DispatcherPortlet();

    portlet.init(new MockPortletConfig(portletContext, "empty"));
    PortletContextAwareBean contextBean = (PortletContextAwareBean)
        portlet.getPortletApplicationContext().getBean("portletContextAwareBean");
    PortletConfigAwareBean configBean = (PortletConfigAwareBean)
        portlet.getPortletApplicationContext().getBean("portletConfigAwareBean");
    assertSame(portletContext, contextBean.getPortletContext());
View Full Code Here


  public void testDispatcherPortletContextRefresh() throws PortletException {
    MockPortletContext portletContext = new MockPortletContext("org/springframework/web/portlet/context");
    DispatcherPortlet portlet = new DispatcherPortlet();

    portlet.init(new MockPortletConfig(portletContext, "empty"));
    PortletContextAwareBean contextBean = (PortletContextAwareBean)
        portlet.getPortletApplicationContext().getBean("portletContextAwareBean");
    PortletConfigAwareBean configBean = (PortletConfigAwareBean)
        portlet.getPortletApplicationContext().getBean("portletConfigAwareBean");
    assertSame(portletContext, contextBean.getPortletContext());
View Full Code Here

  private ConfigurablePortletApplicationContext root;
 
  protected ConfigurableApplicationContext createContext() throws Exception {
    root = new XmlPortletApplicationContext();
    PortletContext portletContext = new MockPortletContext();
    PortletConfig portletConfig = new MockPortletConfig(portletContext);
    root.setPortletConfig(portletConfig);
    root.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/applicationContext.xml"});
    root.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
      public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        beanFactory.addBeanPostProcessor(new BeanPostProcessor() {
View Full Code Here

   * Overridden in order to use MockPortletConfig
   * @see org.springframework.web.context.XmlWebApplicationContextTests#testWithoutMessageSource()
   */
  public void testWithoutMessageSource() throws Exception {
    MockPortletContext portletContext = new MockPortletContext("");
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    XmlPortletApplicationContext pac = new XmlPortletApplicationContext();
    pac.setParent(root);
    pac.setPortletConfig(portletConfig);
    pac.setNamespace("testNamespace");
    pac.setConfigLocations(new String[] {"/org/springframework/web/portlet/context/WEB-INF/test-portlet.xml"});
View Full Code Here

        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyController.class));
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.VIEW);
    MockRenderResponse response = new MockRenderResponse();
    portlet.render(request, response);
    assertEquals("test", response.getContentAsString());
View Full Code Here

        wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());

    MockActionRequest actionRequest = new MockActionRequest(PortletMode.VIEW);
    MockActionResponse actionResponse = new MockActionResponse();
    portlet.processAction(actionRequest, actionResponse);
    assertEquals("value", actionResponse.getRenderParameter("test"));
View Full Code Here

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("name", "name1");
    request.addParameter("age", "value2");
    MockRenderResponse response = new MockRenderResponse();
View Full Code Here

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("name", "name1");
    request.addParameter("age", "value2");
    MockRenderResponse response = new MockRenderResponse();
View Full Code Here

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        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");
View Full Code Here

      }
      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
      }
    };
    portlet.init(new MockPortletConfig());

    MockRenderRequest request = new MockRenderRequest(PortletMode.VIEW);
    request.addParameter("myParam", "myValue");
    request.addParameter("defaultName", "10");
    request.addParameter("age", "value2");
View Full Code Here

TOP

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

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.