Package org.springframework.test.context

Examples of org.springframework.test.context.ContextLoader


  @Test
  @SuppressWarnings("unchecked")
  public void assertContextConfigurationLocations() throws Exception {

    final ContextConfiguration contextConfig = this.testClass.getAnnotation(ContextConfiguration.class);
    final ContextLoader contextLoader = new GenericXmlContextLoader();
    final String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig, "locations");
    final String[] processedLocations = contextLoader.processLocations(this.testClass, configuredLocations);

    if (logger.isDebugEnabled()) {
      logger.debug("----------------------------------------------------------------------");
      logger.debug("Configured locations: " + ObjectUtils.nullSafeToString(configuredLocations));
      logger.debug("Expected   locations: " + ObjectUtils.nullSafeToString(this.expectedLocations));
View Full Code Here


   */
  private MergedContextConfiguration buildMergedContextConfiguration(Class<?> testClass,
      List<ContextConfigurationAttributes> configAttributesList, MergedContextConfiguration parentConfig,
      CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) {

    ContextLoader contextLoader = resolveContextLoader(testClass, configAttributesList);
    List<String> locationsList = new ArrayList<String>();
    List<Class<?>> classesList = new ArrayList<Class<?>>();

    for (ContextConfigurationAttributes configAttributes : configAttributesList) {
      if (logger.isTraceEnabled()) {
        logger.trace(String.format("Processing locations and classes for context configuration attributes %s",
          configAttributes));
      }
      if (contextLoader instanceof SmartContextLoader) {
        SmartContextLoader smartContextLoader = (SmartContextLoader) contextLoader;
        smartContextLoader.processContextConfiguration(configAttributes);
        locationsList.addAll(0, Arrays.asList(configAttributes.getLocations()));
        classesList.addAll(0, Arrays.asList(configAttributes.getClasses()));
      }
      else {
        String[] processedLocations = contextLoader.processLocations(configAttributes.getDeclaringClass(),
          configAttributes.getLocations());
        locationsList.addAll(0, Arrays.asList(processedLocations));
        // Legacy ContextLoaders don't know how to process classes
      }
      if (!configAttributes.isInheritLocations()) {
View Full Code Here

  @Test
  public void assertContextConfigurationLocations() throws Exception {

    final ContextConfiguration contextConfig = this.testClass.getAnnotation(ContextConfiguration.class);
    final ContextLoader contextLoader = new GenericXmlContextLoader();
    final String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig);
    final String[] processedLocations = contextLoader.processLocations(this.testClass, configuredLocations);

    if (logger.isDebugEnabled()) {
      logger.debug("----------------------------------------------------------------------");
      logger.debug("Configured locations: " + ObjectUtils.nullSafeToString(configuredLocations));
      logger.debug("Expected   locations: " + ObjectUtils.nullSafeToString(this.expectedLocations));
View Full Code Here

TOP

Related Classes of org.springframework.test.context.ContextLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.