Package org.springframework.mock.web.portlet

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


* @author Mark Fisher
*/
public class GenericPortletBeanTests extends TestCase {

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


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

  public void testInitParameterNotSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    TestPortletBean portletBean = new TestPortletBean();
    assertNull(portletBean.getTestParam());
    portletBean.init(portletConfig);
    assertNull(portletBean.getTestParam());
View Full Code Here

    portletBean.init(portletConfig);
    assertNull(portletBean.getTestParam());
  }

  public void testMultipleInitParametersSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testValue = "testValue";
    String anotherValue = "anotherValue";
    portletConfig.addInitParameter("testParam", testValue);
    portletConfig.addInitParameter("anotherParam", anotherValue);
View Full Code Here

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

  public void testMultipleInitParametersOnlyOneSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testValue = "testValue";
    portletConfig.addInitParameter("testParam", testValue);
    portletConfig.addInitParameter("unknownParam", "unknownValue");
    TestPortletBean portletBean = new TestPortletBean();
View Full Code Here

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

  public void testRequiredInitParameterSet() 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();
View Full Code Here

    assertNotNull(portletBean.getTestParam());
    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());
View Full Code Here

      // expected
    }
  }

  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();
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();
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

  public void parameterDispatchingController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      @Override
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.setPortletContext(new MockPortletContext());
        RootBeanDefinition bd = new RootBeanDefinition(MyParameterDispatchingController.class);
        bd.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller", bd);
        AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
        wac.refresh();
View Full Code Here

TOP

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

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.