Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
$Id: 59688 2009-04-03 23:45:02Z $ Copyright (c) 2008 The Sakai Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
package org.sakaiproject.test;
import static org.sakaiproject.test.ComponentContainerEmulator.setTestSakaiHome;
Allows for Spring dependency injection from Sakai while using an emulated component container (i.e., without running Tomcat or another web server). As with the Spring superclass, AbstractDependencyInjectionSpringContextTests, you can set up your own Spring application context by returning a list of resource locations from "getConfigLocations()", The difference is that your application context will have Sakai's component-level context as its parent. This models the bean visibility you get with a Sakai web application (although the classloading still won't be completely realistic). If you run more than one integration test and you need a clean start between tests to avoid static debris in the component system, make sure to include a call to "setDirty()" in a "tearDown()" or "oneTimeTearDown()" method.
	private static final Log log = LogFactory.getLog(SakaiDependencyInjectionTests.class);
		if (.isDebugEnabled()) .debug("createApplicationContext locations=" + Arrays.asList(locations));
		// WARNING: Copied from the superclass! The only change is to add a 
		// parent application context to the application context constructor.
		GenericApplicationContext context = new GenericApplicationContext(componentContext);
		return context;
	protected void setDirty() {
		// The above call will have closed this test's application context, but
		// make sure the component manager context is closed as well.
	protected static final void setSakaiHome(String path) {
New to GrepCode? Check out our FAQ X