congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
MergedContextConfiguration.hasLocations
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-framework

/**
 * Determine if this {@code MergedContextConfiguration} instance has
 * either path-based context resource locations or class-based resources.
 * @return {@code true} if either the {@link #getLocations() locations}
 * or the {@link #getClasses() classes} array is not empty
 * @since 4.0.4
 * @see #hasLocations()
 * @see #hasClasses()
 */
public boolean hasResources() {
  return (hasLocations() || hasClasses());
}
origin: spring-projects/spring-framework

private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) {
  if (loader == getAnnotationConfigLoader()) {
    return (mergedConfig.hasClasses() && !mergedConfig.hasLocations());
  }
  else {
    return (mergedConfig.hasLocations() && !mergedConfig.hasClasses());
  }
}
origin: spring-projects/spring-framework

/**
 * Ensure that the supplied {@link MergedContextConfiguration} does not
 * contain {@link MergedContextConfiguration#getLocations() locations}.
 * @since 4.0.4
 * @see AbstractGenericContextLoader#validateMergedContextConfiguration
 */
@Override
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
  if (mergedConfig.hasLocations()) {
    String msg = String.format("Test class [%s] has been configured with @ContextConfiguration's 'locations' " +
            "(or 'value') attribute %s, but %s does not support resource locations.",
        mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getLocations()),
        getClass().getSimpleName());
    logger.error(msg);
    throw new IllegalStateException(msg);
  }
}
origin: spring-projects/spring-framework

@Override
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
  Assert.isTrue(mergedConfig.hasClasses() || mergedConfig.hasLocations(), getClass().getSimpleName()
      + " requires either classes or locations");
}
origin: spring-projects/spring-framework

Assert.notNull(mergedConfig, "MergedContextConfiguration must not be null");
Assert.state(!(mergedConfig.hasLocations() && mergedConfig.hasClasses()), () -> String.format(
    "Neither %s nor %s supports loading an ApplicationContext from %s: " +
    "declare either 'locations' or 'classes' but not both.", name(getXmlLoader()),
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Determine if this {@code MergedContextConfiguration} instance has
 * either path-based context resource locations or class-based resources.
 * @return {@code true} if either the {@link #getLocations() locations}
 * or the {@link #getClasses() classes} array is not empty
 * @since 4.0.4
 * @see #hasLocations()
 * @see #hasClasses()
 */
public boolean hasResources() {
  return (hasLocations() || hasClasses());
}
origin: apache/servicemix-bundles

/**
 * Determine if this {@code MergedContextConfiguration} instance has
 * either path-based context resource locations or class-based resources.
 * @return {@code true} if either the {@link #getLocations() locations}
 * or the {@link #getClasses() classes} array is not empty
 * @since 4.0.4
 * @see #hasLocations()
 * @see #hasClasses()
 */
public boolean hasResources() {
  return (hasLocations() || hasClasses());
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) {
  if (loader == getAnnotationConfigLoader()) {
    return (mergedConfig.hasClasses() && !mergedConfig.hasLocations());
  }
  else {
    return (mergedConfig.hasLocations() && !mergedConfig.hasClasses());
  }
}
origin: apache/servicemix-bundles

private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) {
  if (loader == getAnnotationConfigLoader()) {
    return (mergedConfig.hasClasses() && !mergedConfig.hasLocations());
  }
  else {
    return (mergedConfig.hasLocations() && !mergedConfig.hasClasses());
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Ensure that the supplied {@link MergedContextConfiguration} does not
 * contain {@link MergedContextConfiguration#getLocations() locations}.
 * @since 4.0.4
 * @see AbstractGenericContextLoader#validateMergedContextConfiguration
 */
@Override
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
  if (mergedConfig.hasLocations()) {
    String msg = String.format("Test class [%s] has been configured with @ContextConfiguration's 'locations' " +
            "(or 'value') attribute %s, but %s does not support resource locations.",
        mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getLocations()),
        getClass().getSimpleName());
    logger.error(msg);
    throw new IllegalStateException(msg);
  }
}
origin: apache/servicemix-bundles

/**
 * Ensure that the supplied {@link MergedContextConfiguration} does not
 * contain {@link MergedContextConfiguration#getLocations() locations}.
 * @since 4.0.4
 * @see AbstractGenericContextLoader#validateMergedContextConfiguration
 */
@Override
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
  if (mergedConfig.hasLocations()) {
    String msg = String.format("Test class [%s] has been configured with @ContextConfiguration's 'locations' " +
            "(or 'value') attribute %s, but %s does not support resource locations.",
        mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getLocations()),
        getClass().getSimpleName());
    logger.error(msg);
    throw new IllegalStateException(msg);
  }
}
origin: org.springframework.boot/spring-boot-test

protected Class<?>[] getOrFindConfigurationClasses(
    MergedContextConfiguration mergedConfig) {
  Class<?>[] classes = mergedConfig.getClasses();
  if (containsNonTestComponent(classes) || mergedConfig.hasLocations()) {
    return classes;
  }
  Class<?> found = new AnnotatedClassFinder(SpringBootConfiguration.class)
      .findFromClass(mergedConfig.getTestClass());
  Assert.state(found != null,
      "Unable to find a @SpringBootConfiguration, you need to use "
          + "@ContextConfiguration or @SpringBootTest(classes=...) "
          + "with your test");
  logger.info("Found @SpringBootConfiguration " + found.getName() + " for test "
      + mergedConfig.getTestClass());
  return merge(found, classes);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

Assert.notNull(mergedConfig, "MergedContextConfiguration must not be null");
Assert.state(!(mergedConfig.hasLocations() && mergedConfig.hasClasses()), () -> String.format(
    "Neither %s nor %s supports loading an ApplicationContext from %s: " +
    "declare either 'locations' or 'classes' but not both.", name(getXmlLoader()),
origin: apache/servicemix-bundles

Assert.notNull(mergedConfig, "MergedContextConfiguration must not be null");
if (mergedConfig.hasLocations() && mergedConfig.hasClasses()) {
  throw new IllegalStateException(String.format(
      "Neither %s nor %s supports loading an ApplicationContext from %s: " +
org.springframework.test.contextMergedContextConfigurationhasLocations

Javadoc

Determine if this MergedContextConfiguration instance has path-based context resource locations.

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().
  • getContextLoader
    Get the resolved ContextLoader 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
  • 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

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSystemService (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Path (java.nio.file)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Join (org.hibernate.mapping)
  • Top Vim plugins
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