Package org.springframework.mock.web.portlet

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


    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


    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);
    portletConfig.addInitParameter("unknownParam", "unknownValue");
    TestPortletBean portletBean = new TestPortletBean();
    assertNull(portletBean.getTestParam());
    assertNull(portletBean.getAnotherParam());
    portletBean.init(portletConfig);
    assertNotNull(portletBean.getTestParam());
View Full Code Here

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

    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();
    portletBean.addRequiredProperty(testParam);
    assertNull(portletBean.getTestParam());
    portletBean.init(portletConfig);
    assertNotNull(portletBean.getTestParam());
View Full Code Here

    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

  private DispatcherPortlet complexDispatcherPortlet;


  protected void setUp() throws PortletException {
    simplePortletConfig = new MockPortletConfig(new MockPortletContext(), "simple");
    complexPortletConfig = new MockPortletConfig(simplePortletConfig.getPortletContext(), "complex");
    complexPortletConfig.addInitParameter("publishContext", "false");

    simpleDispatcherPortlet = new DispatcherPortlet();
    simpleDispatcherPortlet.setContextClass(SimplePortletApplicationContext.class);
    simpleDispatcherPortlet.init(simplePortletConfig);
View Full Code Here

  public void testNoDetectAllHandlerMappingsWithPortletModeActionRequest() throws Exception {
    DispatcherPortlet complexDispatcherPortlet = new DispatcherPortlet();
    complexDispatcherPortlet.setContextClass(ComplexPortletApplicationContext.class);
    complexDispatcherPortlet.setNamespace("test");
    complexDispatcherPortlet.setDetectAllHandlerMappings(false);
    complexDispatcherPortlet.init(new MockPortletConfig(getPortletContext(), "complex"));
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    request.setPortletMode(PortletMode.EDIT);
    complexDispatcherPortlet.processAction(request, response);
    String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
View Full Code Here

  public void testNoDetectAllHandlerMappingsWithParameterRenderRequest() throws Exception {
    DispatcherPortlet complexDispatcherPortlet = new DispatcherPortlet();
    complexDispatcherPortlet.setContextClass(ComplexPortletApplicationContext.class);
    complexDispatcherPortlet.setNamespace("test");
    complexDispatcherPortlet.setDetectAllHandlerMappings(false);
    complexDispatcherPortlet.init(new MockPortletConfig(getPortletContext(), "complex"));
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    request.setParameter("myParam", "test1");
    complexDispatcherPortlet.doDispatch(request, response);
    Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
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.