Package org.springframework.mock.web.portlet

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


    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

      }
    }.runTest();
  }

  public void testGetTempDirSunnyDay() throws Exception {
    MockPortletContext ctx = new MockPortletContext();
    Object expectedTempDir = new File("doesn't exist but that's ok in the context of this test");
    ctx.setAttribute(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE, expectedTempDir);
    assertSame(expectedTempDir, PortletUtils.getTempDir(ctx));
  }
View Full Code Here

  }

  public void testGetRealPathWithNullPath() throws Exception {
    new AssertThrows(NullPointerException.class) {
      public void test() throws Exception {
        PortletUtils.getRealPath(new MockPortletContext(), null);
      }
    }.runTest();
  }
View Full Code Here

  }

  public void testGetRealPathWithPathThatCannotBeResolvedToFile() throws Exception {
    new AssertThrows(FileNotFoundException.class) {
      public void test() throws Exception {
        PortletUtils.getRealPath(new MockPortletContext() {
          public String getRealPath(String path) {
            return null;
          }
        }, "/rubbish");
      }
View Full Code Here

  public static final String CONF = "/org/springframework/web/portlet/handler/portletModeMapping.xml";
 
  private ConfigurablePortletApplicationContext pac;
 
  public void setUp() throws Exception {
    MockPortletContext portletContext = new MockPortletContext();
    pac = new XmlPortletApplicationContext();
    pac.setPortletContext(portletContext);
    pac.setConfigLocations(new String[] {CONF});
    pac.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.