Package org.springframework.mock.web.portlet

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


    assertEquals(testValue, portletBean.getTestParam());
  }

  public void testRequiredInitParameterNotSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    TestPortletBean portletBean = new TestPortletBean();
    portletBean.addRequiredProperty(testParam);
    assertNull(portletBean.getTestParam());
    try {
View Full Code Here


    }
  }

  public void testRequiredInitParameterNotSetOtherParameterNotSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    String testValue = "testValue";
    portletConfig.addInitParameter(testParam, testValue);
    TestPortletBean portletBean = new TestPortletBean();
    portletBean.addRequiredProperty("anotherParam");
    assertNull(portletBean.getTestParam());
    try {
      portletBean.init(portletConfig);
View Full Code Here

    assertNull(portletBean.getTestParam());
  }

  public void testUnknownRequiredInitParameter() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    String testValue = "testValue";
    portletConfig.addInitParameter(testParam, testValue);
    TestPortletBean portletBean = new TestPortletBean();
    portletBean.addRequiredProperty("unknownParam");
    assertNull(portletBean.getTestParam());
    try {
      portletBean.init(portletConfig);
View Full Code Here


  @Before
  public void setUp() {
    ConfigurablePortletApplicationContext applicationContext = new MyApplicationContext();
    MockPortletConfig config = new MockPortletConfig(new MockPortletContext(), "wrappedPortlet");
    applicationContext.setPortletConfig(config);
    applicationContext.refresh();
    controller = (PortletWrappingController) applicationContext.getBean(PORTLET_WRAPPING_CONTROLLER_BEAN_NAME);
  }
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(MyController.class));
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());

    MockResourceRequest resourceRequest = new MockResourceRequest("/resource1");
    MockResourceResponse resourceResponse = new MockResourceResponse();
    portlet.serveResource(resourceRequest, resourceResponse);
    assertEquals("/resource1", resourceResponse.getForwardedUrl());
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

      @Override
      protected void render(ModelAndView mv, PortletRequest request, MimeResponse 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

      @Override
      protected void render(ModelAndView mv, PortletRequest request, MimeResponse 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

      @Override
      protected void render(ModelAndView mv, PortletRequest request, MimeResponse 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

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.