List of usage examples for org.springframework.web.context ContextLoader CONTEXT_CLASS_PARAM
String CONTEXT_CLASS_PARAM
To view the source code for org.springframework.web.context ContextLoader CONTEXT_CLASS_PARAM.
Click Source Link
From source file:org.jasig.springframework.web.portlet.context.PortletContextLoaderTests.java
@Test public void testContextLoaderWithCustomContextAndParent() throws Exception { MockServletContext sc = new MockServletContext(""); sc.addInitParameter(ContextLoader.CONTEXT_CLASS_PARAM, StaticWebApplicationContext.class.getName()); sc.addInitParameter(PortletContextLoader.CONTEXT_CLASS_PARAM, SimplePortletApplicationContext.class.getName()); ContextLoaderListener servletListener = new ContextLoaderListener(); ServletContextListener listener = new PortletContextLoaderListener(); ServletContextEvent event = new ServletContextEvent(sc); servletListener.contextInitialized(event); listener.contextInitialized(event);//from w w w . ja v a2 s . c om //initialize the portlet application context, needed because PortletContextLoaderListener.contextInitialized doesn't actually create //the portlet app context due to lack of PortletContext reference MockPortletContext pc = new MockPortletContext(sc); PortletApplicationContextUtils2.getPortletApplicationContext(pc); PortletApplicationContext wc = (PortletApplicationContext) pc .getAttribute(PortletApplicationContext.ROOT_PORTLET_APPLICATION_CONTEXT_ATTRIBUTE); assertTrue("Correct PortletApplicationContext exposed in PortletContext", wc instanceof SimplePortletApplicationContext); }