Spring Framework AbstractContextLoader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AbstractContextLoader class.

This code example shows how to use the following methods:isGenerateDefaultLocations, processContextConfiguration
	} 
 
	@Override 
	public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
		// Detect default XML configuration files: 
		super.processContextConfiguration(configAttributes);
 
		// Detect default configuration classes: 
		if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
			configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
		} 
	} 
 
	@Override 
	protected void loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) {
		// Order doesn't matter: <bean> always wins over @Bean. 
		new XmlBeanDefinitionReader(context).loadBeanDefinitions(mergedConfig.getLocations());
		new AnnotatedBeanDefinitionReader(context).register(mergedConfig.getClasses());
	} 
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
import org.nimbustools.api.brain.NimbusFileSystemXmlApplicationContext; 
import org.springframework.context.ApplicationContext; 
import org.springframework.test.context.support.AbstractContextLoader; 
 
public class NimbusTestContextLoader extends AbstractContextLoader { 
 
    protected String getResourceSuffix() { 
        return "-main.xml"; 
    } 
 
    public ApplicationContext loadContext(String... confDirs) throws Exception { 
         
        return new NimbusFileSystemXmlApplicationContext(confDirs); 
    } 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * be refreshed multiple times, unlike the default GenericApplicationContext which can be refreshed 
 * only once. This class is used for @ContextConfiguration in WebModuleActivatorTest 
 */ 
public class TestContextLoader extends AbstractContextLoader { 
	 
	public TestContextLoader() { 
	} 
	 
	@Override 
	public final ConfigurableApplicationContext loadContext(String... locations) throws Exception { 
		XmlWebApplicationContext context = new XmlWebApplicationContext(); 
		context.setConfigLocations(locations); 
		MockServletContext sc = new MockServletContext(); 
		sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); 
		context.setServletContext(sc); 
		context.refresh(); 
		return context; 
	} 
	 
	@Override 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * Context loader that initializes the TdsContext for the tests. 
 *  
 * @author mhermida 
 *  
 */ 
public class MockTdsContextLoader extends AbstractContextLoader { 
 
	private TdsContentRootPath tdsContentRootPath; 
 
	public ApplicationContext loadContext(MergedContextConfiguration mcc) throws Exception { 
 
		return loadContext( mcc.getLocations() ); 
 
	} 
	 
	@Override 
	public ApplicationContext loadContext(String... locations) throws Exception { 
	 
		final MockServletContext servletContext = new MockTdsServletContext();			 
		final MockServletConfig servletConfig = new MockServletConfig(servletContext); 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import org.springframework.mock.web.MockServletContext; 
import org.springframework.test.context.MergedContextConfiguration; 
import org.springframework.test.context.support.AbstractContextLoader; 
import org.springframework.web.context.support.GenericWebApplicationContext; 
 
public class MessageBrokerContextLoader extends AbstractContextLoader { 
 
    public ApplicationContext loadContext(String... locations) throws Exception { 
        ConfigurableApplicationContext parentContext = createParentContext(); 
 
        GenericWebApplicationContext context = new GenericWebApplicationContext(); 
        context.setServletContext(new MockServletContext(new TestWebInfResourceLoader(context))); 
         
        if (MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER) != null) { 
            FlexContext.clearThreadLocalObjects(); 
            MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER).stop(); 
        } 
         
        new XmlBeanDefinitionReader(context).loadBeanDefinitions(locations); 
        AnnotationConfigUtils.registerAnnotationConfigProcessors(context); 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import org.springframework.mock.web.MockServletContext; 
import org.springframework.test.context.MergedContextConfiguration; 
import org.springframework.test.context.support.AbstractContextLoader; 
import org.springframework.web.context.support.GenericWebApplicationContext; 
 
public class MessageBrokerContextLoader extends AbstractContextLoader { 
 
    public ApplicationContext loadContext(String... locations) throws Exception { 
        ConfigurableApplicationContext parentContext = createParentContext(); 
 
        GenericWebApplicationContext context = new GenericWebApplicationContext(); 
        context.setServletContext(new MockServletContext(new TestWebInfResourceLoader(context))); 
         
        if (MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER) != null) { 
            FlexContext.clearThreadLocalObjects(); 
            MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER).stop(); 
        } 
         
        new XmlBeanDefinitionReader(context).loadBeanDefinitions(locations); 
        AnnotationConfigUtils.registerAnnotationConfigProcessors(context); 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
import flex.messaging.FlexContext; 
import flex.messaging.MessageBroker; 
 
 
public class MessageBrokerContextLoader extends AbstractContextLoader { 
 
    public ApplicationContext loadContext(String... locations) throws Exception { 
        ConfigurableApplicationContext parentContext = createParentContext(); 
 
        GenericWebApplicationContext context = new GenericWebApplicationContext(); 
        context.setServletContext(new MockServletContext(new TestWebInfResourceLoader(context))); 
         
        if (MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER) != null) { 
            FlexContext.clearThreadLocalObjects(); 
            MessageBroker.getMessageBroker(BeanIds.MESSAGE_BROKER).stop(); 
        } 
         
        new XmlBeanDefinitionReader(context).loadBeanDefinitions(locations); 
        AnnotationConfigUtils.registerAnnotationConfigProcessors(context); 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java