Tabnine Logo
MergedContextConfiguration.getContextLoader
Code IndexAdd Tabnine to your IDE (free)

How to use
getContextLoader
method
in
org.springframework.test.context.MergedContextConfiguration

Best Java code snippets using org.springframework.test.context.MergedContextConfiguration.getContextLoader (Showing top 8 results out of 315)

origin: spring-projects/spring-framework

/**
 * Load the {@code ApplicationContext} for the supplied merged context configuration.
 * <p>Supports both the {@link SmartContextLoader} and {@link ContextLoader} SPIs.
 * @throws Exception if an error occurs while loading the application context
 */
protected ApplicationContext loadContextInternal(MergedContextConfiguration mergedContextConfiguration)
    throws Exception {
  ContextLoader contextLoader = mergedContextConfiguration.getContextLoader();
  Assert.notNull(contextLoader, "Cannot load an ApplicationContext with a NULL 'contextLoader'. " +
      "Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.");
  ApplicationContext applicationContext;
  if (contextLoader instanceof SmartContextLoader) {
    SmartContextLoader smartContextLoader = (SmartContextLoader) contextLoader;
    applicationContext = smartContextLoader.loadContext(mergedContextConfiguration);
  }
  else {
    String[] locations = mergedContextConfiguration.getLocations();
    Assert.notNull(locations, "Cannot load an ApplicationContext with a NULL 'locations' array. " +
        "Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.");
    applicationContext = contextLoader.loadContext(locations);
  }
  return applicationContext;
}
origin: spring-projects/spring-framework

void assertMergedConfig(
    MergedContextConfiguration mergedConfig,
    Class<?> expectedTestClass,
    String[] expectedLocations,
    Class<?>[] expectedClasses,
    Set<Class<? extends ApplicationContextInitializer<?>>> expectedInitializerClasses,
    Class<? extends ContextLoader> expectedContextLoaderClass) {
  assertNotNull(mergedConfig);
  assertEquals(expectedTestClass, mergedConfig.getTestClass());
  assertNotNull(mergedConfig.getLocations());
  assertArrayEquals(expectedLocations, mergedConfig.getLocations());
  assertNotNull(mergedConfig.getClasses());
  assertArrayEquals(expectedClasses, mergedConfig.getClasses());
  assertNotNull(mergedConfig.getActiveProfiles());
  if (expectedContextLoaderClass == null) {
    assertNull(mergedConfig.getContextLoader());
  }
  else {
    assertEquals(expectedContextLoaderClass, mergedConfig.getContextLoader().getClass());
  }
  assertNotNull(mergedConfig.getContextInitializerClasses());
  assertEquals(expectedInitializerClasses, mergedConfig.getContextInitializerClasses());
}
origin: Verigreen/verigreen

/**
 * Added in order to support new version of Spring. There is a new
 * {@link org.springframework.test.context.SmartContextLoader} interface implemented in Spring.
 */
@Override
public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
  return mergedConfig.getContextLoader().loadContext(mergedConfig.getLocations());
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Load the {@code ApplicationContext} for the supplied merged context configuration.
 * <p>Supports both the {@link SmartContextLoader} and {@link ContextLoader} SPIs.
 * @throws Exception if an error occurs while loading the application context
 */
protected ApplicationContext loadContextInternal(MergedContextConfiguration mergedContextConfiguration)
    throws Exception {
  ContextLoader contextLoader = mergedContextConfiguration.getContextLoader();
  Assert.notNull(contextLoader, "Cannot load an ApplicationContext with a NULL 'contextLoader'. " +
      "Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.");
  ApplicationContext applicationContext;
  if (contextLoader instanceof SmartContextLoader) {
    SmartContextLoader smartContextLoader = (SmartContextLoader) contextLoader;
    applicationContext = smartContextLoader.loadContext(mergedContextConfiguration);
  }
  else {
    String[] locations = mergedContextConfiguration.getLocations();
    Assert.notNull(locations, "Cannot load an ApplicationContext with a NULL 'locations' array. " +
        "Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.");
    applicationContext = contextLoader.loadContext(locations);
  }
  return applicationContext;
}
origin: apache/servicemix-bundles

/**
 * Load the {@code ApplicationContext} for the supplied merged context configuration.
 * <p>Supports both the {@link SmartContextLoader} and {@link ContextLoader} SPIs.
 * @throws Exception if an error occurs while loading the application context
 */
protected ApplicationContext loadContextInternal(MergedContextConfiguration mergedContextConfiguration)
    throws Exception {
  ContextLoader contextLoader = mergedContextConfiguration.getContextLoader();
  Assert.notNull(contextLoader, "Cannot load an ApplicationContext with a NULL 'contextLoader'. " +
      "Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.");
  ApplicationContext applicationContext;
  if (contextLoader instanceof SmartContextLoader) {
    SmartContextLoader smartContextLoader = (SmartContextLoader) contextLoader;
    applicationContext = smartContextLoader.loadContext(mergedContextConfiguration);
  }
  else {
    String[] locations = mergedContextConfiguration.getLocations();
    Assert.notNull(locations, "Cannot load an ApplicationContext with a NULL 'locations' array. " +
        "Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.");
    applicationContext = contextLoader.loadContext(locations);
  }
  return applicationContext;
}
origin: org.tinygroup/org.tinygroup.tinyspringtest431

    .getContextLoader();
if (contextLoader == null) {
  contextLoader = BeanUtils.instantiateClass(
origin: org.tinygroup/org.tinygroup.tinyspringtest431

    .getContextLoader();
if (contextLoader == null) {
  contextLoader = BeanUtils.instantiateClass(
origin: org.springframework.boot/spring-boot-test

/**
 * Create a new {@link MergedContextConfiguration} with different classes and
 * properties.
 * @param mergedConfig the source config
 * @param classes the replacement classes
 * @param propertySourceProperties the replacement properties
 * @return a new {@link MergedContextConfiguration}
 */
protected final MergedContextConfiguration createModifiedConfig(
    MergedContextConfiguration mergedConfig, Class<?>[] classes,
    String[] propertySourceProperties) {
  return new MergedContextConfiguration(mergedConfig.getTestClass(),
      mergedConfig.getLocations(), classes,
      mergedConfig.getContextInitializerClasses(),
      mergedConfig.getActiveProfiles(),
      mergedConfig.getPropertySourceLocations(), propertySourceProperties,
      mergedConfig.getContextCustomizers(), mergedConfig.getContextLoader(),
      getCacheAwareContextLoaderDelegate(), mergedConfig.getParent());
}
org.springframework.test.contextMergedContextConfigurationgetContextLoader

Javadoc

Get the resolved ContextLoader for the #getTestClass().

Popular methods of MergedContextConfiguration

  • getLocations
    Get the merged resource locations for ApplicationContextconfiguration files for the #getTestClass().
  • getTestClass
    Get the Class associated with this MergedContextConfiguration.
  • getActiveProfiles
    Get the merged active bean definition profiles for the #getTestClass().
  • getClasses
    Get the merged annotated classes for the #getTestClass().
  • <init>
    Create a new MergedContextConfiguration instance by copying all fields from the supplied MergedConte
  • getParent
    Get the MergedContextConfiguration for the parent application context in a context hierarchy.
  • getParentApplicationContext
    Get the parent ApplicationContext for the context defined by this MergedContextConfiguration from th
  • getContextInitializerClasses
    Get the merged ApplicationContextInitializer classes for the #getTestClass().
  • getPropertySourceProperties
    Get the merged test PropertySource properties for the #getTestClass().Properties will be loaded into
  • hasLocations
    Determine if this MergedContextConfiguration instance has path-based context resource locations.
  • getContextCustomizers
    Get the merged ContextCustomizer that will be applied when the application context is loaded.
  • getPropertySourceLocations
    Get the merged resource locations for test PropertySourcesfor the #getTestClass().
  • getContextCustomizers,
  • getPropertySourceLocations,
  • hasClasses,
  • hashCode,
  • equals,
  • nullSafeClassName,
  • processActiveProfiles,
  • processClasses,
  • processContextCustomizers

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • findViewById (Activity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Path (java.nio.file)
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now