Package org.springframework.test.context

Examples of org.springframework.test.context.MergedContextConfiguration


      if (logger.isInfoEnabled()) {
        logger.info(String.format(
          "Neither @ContextConfiguration nor @ContextHierarchy found for test class [%s]",
          testClass.getName()));
      }
      return new MergedContextConfiguration(testClass, null, null, null, null);
    }

    if (AnnotationUtils.findAnnotation(testClass, ContextHierarchy.class) != null) {
      Map<String, List<ContextConfigurationAttributes>> hierarchyMap = ContextLoaderUtils.buildContextHierarchyMap(testClass);
      MergedContextConfiguration parentConfig = null;
      MergedContextConfiguration mergedConfig = null;

      for (List<ContextConfigurationAttributes> list : hierarchyMap.values()) {
        List<ContextConfigurationAttributes> reversedList = new ArrayList<ContextConfigurationAttributes>(list);
        Collections.reverse(reversedList);
View Full Code Here


    Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses = //
    ApplicationContextInitializerUtils.resolveInitializerClasses(configAttributesList);
    String[] activeProfiles = ActiveProfilesUtils.resolveActiveProfiles(testClass);
    MergedTestPropertySources mergedTestPropertySources = TestPropertySourceUtils.buildMergedTestPropertySources(testClass);

    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(testClass, locations, classes,
      initializerClasses, activeProfiles, mergedTestPropertySources.getLocations(),
      mergedTestPropertySources.getProperties(), contextLoader, cacheAwareContextLoaderDelegate, parentConfig);

    return processMergedContextConfiguration(mergedConfig);
  }
View Full Code Here

  public void configMustNotContainAnnotatedClasses() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(containsString("does not support annotated classes"));

    GenericXmlContextLoader loader = new GenericXmlContextLoader();
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
      new Class<?>[] { getClass() }, EMPTY_STRING_ARRAY, loader);
    loader.loadContext(mergedConfig);
  }
View Full Code Here

  public void configMustNotContainAnnotatedClasses() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(containsString("does not support annotated classes"));

    GenericPropertiesContextLoader loader = new GenericPropertiesContextLoader();
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
      new Class<?>[] { getClass() }, EMPTY_STRING_ARRAY, loader);
    loader.loadContext(mergedConfig);
  }
View Full Code Here

  @Test
  public void configMustNotContainLocations() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(containsString("does not support resource locations"));

    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(),
      new String[] { "config.xml" }, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, contextLoader);
    contextLoader.loadContext(mergedConfig);
  }
View Full Code Here

    Class<?>[] expectedClasses = new Class<?>[] { FooConfig.class };
    Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> expectedInitializerClasses//
    = new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
    expectedInitializerClasses.add(FooInitializer.class);

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses, expectedInitializerClasses,
      DelegatingSmartContextLoader.class);
  }
View Full Code Here

    Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> expectedInitializerClasses//
    = new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
    expectedInitializerClasses.add(FooInitializer.class);
    expectedInitializerClasses.add(BarInitializer.class);

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses, expectedInitializerClasses,
      DelegatingSmartContextLoader.class);
  }
View Full Code Here

    Class<?>[] expectedClasses = new Class<?>[] { FooConfig.class, BarConfig.class };
    Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> expectedInitializerClasses//
    = new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
    expectedInitializerClasses.add(BarInitializer.class);

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses, expectedInitializerClasses,
      DelegatingSmartContextLoader.class);
  }
View Full Code Here

    Class<?>[] expectedClasses = new Class<?>[] { BarConfig.class };
    Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> expectedInitializerClasses//
    = new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
    expectedInitializerClasses.add(BarInitializer.class);

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses, expectedInitializerClasses,
      DelegatingSmartContextLoader.class);
  }
View Full Code Here

public class BootstrapTestUtilsMergedConfigTests extends AbstractContextConfigurationUtilsTests {

  @Test
  public void buildMergedConfigWithoutAnnotation() {
    Class<?> testClass = Enigma.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);

    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, null);
  }
View Full Code Here

TOP

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

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.