• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ContextConfigurationAttributes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.test.context.ContextConfigurationAttributes的典型用法代码示例。如果您正苦于以下问题:Java ContextConfigurationAttributes类的具体用法?Java ContextConfigurationAttributes怎么用?Java ContextConfigurationAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ContextConfigurationAttributes类属于org.springframework.test.context包,在下文中一共展示了ContextConfigurationAttributes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveInitializerClasses

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Resolve the set of merged {@code ApplicationContextInitializer} classes for the
 * supplied list of {@code ContextConfigurationAttributes}.
 *
 * <p>Note that the {@link ContextConfiguration#inheritInitializers inheritInitializers}
 * flag of {@link ContextConfiguration @ContextConfiguration} will be taken into
 * consideration. Specifically, if the {@code inheritInitializers} flag is set to
 * {@code true} for a given level in the class hierarchy represented by the provided
 * configuration attributes, context initializer classes defined at the given level
 * will be merged with those defined in higher levels of the class hierarchy.
 *
 * @param configAttributesList the list of configuration attributes to process; must
 * not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em>
 * (i.e., as if we were traversing up the class hierarchy)
 * @return the set of merged context initializer classes, including those from
 * superclasses if appropriate (never {@code null})
 * @since 3.2
 */
static Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> resolveInitializerClasses(
		List<ContextConfigurationAttributes> configAttributesList) {
	Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty");

	final Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses = //
	new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();

	for (ContextConfigurationAttributes configAttributes : configAttributesList) {
		if (logger.isTraceEnabled()) {
			logger.trace(String.format("Processing context initializers for context configuration attributes %s",
				configAttributes));
		}

		initializerClasses.addAll(Arrays.asList(configAttributes.getInitializers()));

		if (!configAttributes.isInheritInitializers()) {
			break;
		}
	}

	return initializerClasses;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:41,代码来源:ApplicationContextInitializerUtils.java


示例2: resolveContextLoader

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Resolve the {@link ContextLoader} {@linkplain Class class} to use for the
 * supplied list of {@link ContextConfigurationAttributes} and then instantiate
 * and return that {@code ContextLoader}.
 * <p>If the user has not explicitly declared which loader to use, the value
 * returned from {@link #getDefaultContextLoaderClass} will be used as the
 * default context loader class. For details on the class resolution process,
 * see {@link #resolveExplicitContextLoaderClass} and
 * {@link #getDefaultContextLoaderClass}.
 * @param testClass the test class for which the {@code ContextLoader} should be
 * resolved; must not be {@code null}
 * @param configAttributesList the list of configuration attributes to process; must
 * not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em>
 * (i.e., as if we were traversing up the class hierarchy)
 * @return the resolved {@code ContextLoader} for the supplied {@code testClass}
 * (never {@code null})
 * @throws IllegalStateException if {@link #getDefaultContextLoaderClass(Class)}
 * returns {@code null}
 */
protected ContextLoader resolveContextLoader(Class<?> testClass,
		List<ContextConfigurationAttributes> configAttributesList) {

	Assert.notNull(testClass, "Class must not be null");
	Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty");

	Class<? extends ContextLoader> contextLoaderClass = resolveExplicitContextLoaderClass(configAttributesList);
	if (contextLoaderClass == null) {
		contextLoaderClass = getDefaultContextLoaderClass(testClass);
		if (contextLoaderClass == null) {
			throw new IllegalStateException("getDefaultContextLoaderClass() must not return null");
		}
	}
	if (logger.isTraceEnabled()) {
		logger.trace(String.format("Using ContextLoader class [%s] for test class [%s]",
			contextLoaderClass.getName(), testClass.getName()));
	}
	return BeanUtils.instantiateClass(contextLoaderClass, ContextLoader.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:39,代码来源:AbstractTestContextBootstrapper.java


示例3: resolveExplicitContextLoaderClass

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Resolve the {@link ContextLoader} {@linkplain Class class} to use for the supplied
 * list of {@link ContextConfigurationAttributes}.
 * <p>Beginning with the first level in the context configuration attributes hierarchy:
 * <ol>
 * <li>If the {@link ContextConfigurationAttributes#getContextLoaderClass()
 * contextLoaderClass} property of {@link ContextConfigurationAttributes} is
 * configured with an explicit class, that class will be returned.</li>
 * <li>If an explicit {@code ContextLoader} class is not specified at the current
 * level in the hierarchy, traverse to the next level in the hierarchy and return to
 * step #1.</li>
 * </ol>
 * @param configAttributesList the list of configuration attributes to process;
 * must not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em>
 * (i.e., as if we were traversing up the class hierarchy)
 * @return the {@code ContextLoader} class to use for the supplied configuration
 * attributes, or {@code null} if no explicit loader is found
 * @throws IllegalArgumentException if supplied configuration attributes are
 * {@code null} or <em>empty</em>
 */
protected Class<? extends ContextLoader> resolveExplicitContextLoaderClass(
		List<ContextConfigurationAttributes> configAttributesList) {

	Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty");
	for (ContextConfigurationAttributes configAttributes : configAttributesList) {
		if (logger.isTraceEnabled()) {
			logger.trace(String.format("Resolving ContextLoader for context configuration attributes %s",
				configAttributes));
		}
		Class<? extends ContextLoader> contextLoaderClass = configAttributes.getContextLoaderClass();
		if (ContextLoader.class != contextLoaderClass) {
			if (logger.isDebugEnabled()) {
				logger.debug(String.format(
					"Found explicit ContextLoader class [%s] for context configuration attributes %s",
					contextLoaderClass.getName(), configAttributes));
			}
			return contextLoaderClass;
		}
	}
	return null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:42,代码来源:AbstractTestContextBootstrapper.java


示例4: resolveContextConfigurationAttributes

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Resolve the list of {@linkplain ContextConfigurationAttributes context
 * configuration attributes} for the supplied {@linkplain Class test class} and its
 * superclasses.
 * <p>Note that the {@link ContextConfiguration#inheritLocations inheritLocations} and
 * {@link ContextConfiguration#inheritInitializers() inheritInitializers} flags of
 * {@link ContextConfiguration @ContextConfiguration} will <strong>not</strong>
 * be taken into consideration. If these flags need to be honored, that must be
 * handled manually when traversing the list returned by this method.
 * @param testClass the class for which to resolve the configuration attributes
 * (must not be {@code null})
 * @return the list of configuration attributes for the specified class, ordered
 * <em>bottom-up</em> (i.e., as if we were traversing up the class hierarchy);
 * never {@code null}
 * @throws IllegalArgumentException if the supplied class is {@code null} or if
 * {@code @ContextConfiguration} is not <em>present</em> on the supplied class
 */
static List<ContextConfigurationAttributes> resolveContextConfigurationAttributes(Class<?> testClass) {
	Assert.notNull(testClass, "Class must not be null");

	List<ContextConfigurationAttributes> attributesList = new ArrayList<ContextConfigurationAttributes>();
	Class<ContextConfiguration> annotationType = ContextConfiguration.class;

	AnnotationDescriptor<ContextConfiguration> descriptor = findAnnotationDescriptor(testClass, annotationType);
	if (descriptor == null) {
		throw new IllegalArgumentException(String.format(
				"Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]",
				annotationType.getName(), testClass.getName()));
	}

	while (descriptor != null) {
		convertContextConfigToConfigAttributesAndAddToList(descriptor.synthesizeAnnotation(),
				descriptor.getRootDeclaringClass(), attributesList);
		descriptor = findAnnotationDescriptor(descriptor.getRootDeclaringClass().getSuperclass(), annotationType);
	}

	return attributesList;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:39,代码来源:ContextLoaderUtils.java


示例5: resolveContextHierarchyAttributesForSingleTestClassWithTripleLevelContextHierarchy

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveContextHierarchyAttributesForSingleTestClassWithTripleLevelContextHierarchy() {
	Class<SingleTestClassWithTripleLevelContextHierarchy> testClass = SingleTestClassWithTripleLevelContextHierarchy.class;
	List<List<ContextConfigurationAttributes>> hierarchyAttributes = resolveContextHierarchyAttributes(testClass);
	assertEquals(1, hierarchyAttributes.size());

	List<ContextConfigurationAttributes> configAttributesList = hierarchyAttributes.get(0);
	assertNotNull(configAttributesList);
	assertEquals(3, configAttributesList.size());
	debugConfigAttributes(configAttributesList);
	assertAttributes(configAttributesList.get(0), testClass, new String[] { "A.xml" }, EMPTY_CLASS_ARRAY,
		ContextLoader.class, true);
	assertAttributes(configAttributesList.get(1), testClass, new String[] { "B.xml" }, EMPTY_CLASS_ARRAY,
		ContextLoader.class, true);
	assertAttributes(configAttributesList.get(2), testClass, new String[] { "C.xml" }, EMPTY_CLASS_ARRAY,
		ContextLoader.class, true);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:ContextLoaderUtilsContextHierarchyTests.java


示例6: resolveContextHierarchyAttributesForTestClassHierarchyWithSingleLevelContextHierarchies

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveContextHierarchyAttributesForTestClassHierarchyWithSingleLevelContextHierarchies() {
	List<List<ContextConfigurationAttributes>> hierarchyAttributes = resolveContextHierarchyAttributes(TestClass3WithSingleLevelContextHierarchy.class);
	assertEquals(3, hierarchyAttributes.size());

	List<ContextConfigurationAttributes> configAttributesListClassLevel1 = hierarchyAttributes.get(0);
	debugConfigAttributes(configAttributesListClassLevel1);
	assertEquals(1, configAttributesListClassLevel1.size());
	assertThat(configAttributesListClassLevel1.get(0).getLocations()[0], equalTo("one.xml"));

	List<ContextConfigurationAttributes> configAttributesListClassLevel2 = hierarchyAttributes.get(1);
	debugConfigAttributes(configAttributesListClassLevel2);
	assertEquals(1, configAttributesListClassLevel2.size());
	assertArrayEquals(new String[] { "two-A.xml", "two-B.xml" },
		configAttributesListClassLevel2.get(0).getLocations());

	List<ContextConfigurationAttributes> configAttributesListClassLevel3 = hierarchyAttributes.get(2);
	debugConfigAttributes(configAttributesListClassLevel3);
	assertEquals(1, configAttributesListClassLevel3.size());
	assertThat(configAttributesListClassLevel3.get(0).getLocations()[0], equalTo("three.xml"));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:22,代码来源:ContextLoaderUtilsContextHierarchyTests.java


示例7: resolveContextHierarchyAttributesForTestClassHierarchyWithMultiLevelContextHierarchies

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveContextHierarchyAttributesForTestClassHierarchyWithMultiLevelContextHierarchies() {
	List<List<ContextConfigurationAttributes>> hierarchyAttributes = resolveContextHierarchyAttributes(TestClass3WithMultiLevelContextHierarchy.class);
	assertEquals(3, hierarchyAttributes.size());

	List<ContextConfigurationAttributes> configAttributesListClassLevel1 = hierarchyAttributes.get(0);
	debugConfigAttributes(configAttributesListClassLevel1);
	assertEquals(2, configAttributesListClassLevel1.size());
	assertThat(configAttributesListClassLevel1.get(0).getLocations()[0], equalTo("1-A.xml"));
	assertThat(configAttributesListClassLevel1.get(1).getLocations()[0], equalTo("1-B.xml"));

	List<ContextConfigurationAttributes> configAttributesListClassLevel2 = hierarchyAttributes.get(1);
	debugConfigAttributes(configAttributesListClassLevel2);
	assertEquals(2, configAttributesListClassLevel2.size());
	assertThat(configAttributesListClassLevel2.get(0).getLocations()[0], equalTo("2-A.xml"));
	assertThat(configAttributesListClassLevel2.get(1).getLocations()[0], equalTo("2-B.xml"));

	List<ContextConfigurationAttributes> configAttributesListClassLevel3 = hierarchyAttributes.get(2);
	debugConfigAttributes(configAttributesListClassLevel3);
	assertEquals(3, configAttributesListClassLevel3.size());
	assertThat(configAttributesListClassLevel3.get(0).getLocations()[0], equalTo("3-A.xml"));
	assertThat(configAttributesListClassLevel3.get(1).getLocations()[0], equalTo("3-B.xml"));
	assertThat(configAttributesListClassLevel3.get(2).getLocations()[0], equalTo("3-C.xml"));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:25,代码来源:ContextLoaderUtilsContextHierarchyTests.java


示例8: buildContextHierarchyMapForTestClassHierarchyWithMultiLevelContextHierarchies

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void buildContextHierarchyMapForTestClassHierarchyWithMultiLevelContextHierarchies() {
	Map<String, List<ContextConfigurationAttributes>> map = buildContextHierarchyMap(TestClass3WithMultiLevelContextHierarchy.class);

	assertThat(map.size(), is(3));
	assertThat(map.keySet(), hasItems("alpha", "beta", "gamma"));

	List<ContextConfigurationAttributes> alphaConfig = map.get("alpha");
	assertThat(alphaConfig.size(), is(3));
	assertThat(alphaConfig.get(0).getLocations()[0], is("1-A.xml"));
	assertThat(alphaConfig.get(1).getLocations()[0], is("2-A.xml"));
	assertThat(alphaConfig.get(2).getLocations()[0], is("3-A.xml"));

	List<ContextConfigurationAttributes> betaConfig = map.get("beta");
	assertThat(betaConfig.size(), is(3));
	assertThat(betaConfig.get(0).getLocations()[0], is("1-B.xml"));
	assertThat(betaConfig.get(1).getLocations()[0], is("2-B.xml"));
	assertThat(betaConfig.get(2).getLocations()[0], is("3-B.xml"));

	List<ContextConfigurationAttributes> gammaConfig = map.get("gamma");
	assertThat(gammaConfig.size(), is(1));
	assertThat(gammaConfig.get(0).getLocations()[0], is("3-C.xml"));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:ContextLoaderUtilsContextHierarchyTests.java


示例9: buildContextHierarchyMap

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Used to reproduce bug reported in https://jira.spring.io/browse/SPR-10997
 */
@Test
public void buildContextHierarchyMapForTestClassHierarchyWithMultiLevelContextHierarchiesAndOverriddenInitializers() {
	Map<String, List<ContextConfigurationAttributes>> map = buildContextHierarchyMap(TestClass2WithMultiLevelContextHierarchyWithOverriddenInitializers.class);

	assertThat(map.size(), is(2));
	assertThat(map.keySet(), hasItems("alpha", "beta"));

	List<ContextConfigurationAttributes> alphaConfig = map.get("alpha");
	assertThat(alphaConfig.size(), is(2));
	assertThat(alphaConfig.get(0).getLocations().length, is(1));
	assertThat(alphaConfig.get(0).getLocations()[0], is("1-A.xml"));
	assertThat(alphaConfig.get(0).getInitializers().length, is(0));
	assertThat(alphaConfig.get(1).getLocations().length, is(0));
	assertThat(alphaConfig.get(1).getInitializers().length, is(1));
	assertEquals(DummyApplicationContextInitializer.class, alphaConfig.get(1).getInitializers()[0]);

	List<ContextConfigurationAttributes> betaConfig = map.get("beta");
	assertThat(betaConfig.size(), is(2));
	assertThat(betaConfig.get(0).getLocations().length, is(1));
	assertThat(betaConfig.get(0).getLocations()[0], is("1-B.xml"));
	assertThat(betaConfig.get(0).getInitializers().length, is(0));
	assertThat(betaConfig.get(1).getLocations().length, is(0));
	assertThat(betaConfig.get(1).getInitializers().length, is(1));
	assertEquals(DummyApplicationContextInitializer.class, betaConfig.get(1).getInitializers()[0]);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:ContextLoaderUtilsContextHierarchyTests.java


示例10: processContextConfiguration

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
	String className = "io.leopard.javahost.AutoUnitRunnable";
	try {
		Runnable runnable = (Runnable) Class.forName(className).newInstance();
		runnable.run();
	}
	catch (Exception e) {
		// System.err.println("init hosts error:" + e.toString());
		// e.printStackTrace();
	}
	String[] locations = new String[0];
	if (locations.length == 0) {
		locations = new ApplicationContextLocationImpl().get();
	}
	// files = ArrayUtil.insertFirst(files, "/leopard-test/annotation-config.xml");
	locations = StringUtils.addStringToArray(locations, "/leopard-test/annotation-config.xml");
	configAttributes.setLocations(locations);
	// System.err.println("processContextConfiguration:" + org.apache.commons.lang.StringUtils.join(configAttributes.getLocations(), ","));
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:21,代码来源:TestContextLoader.java


示例11: createContextCustomizer

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Override
public ContextCustomizer createContextCustomizer(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes) {
    AutoConfigureEmbeddedDatabase databaseAnnotation = AnnotatedElementUtils.findMergedAnnotation(testClass, AutoConfigureEmbeddedDatabase.class);

    if (databaseAnnotation != null
            && databaseAnnotation.type() == EmbeddedDatabaseType.POSTGRES
            && databaseAnnotation.replace() != Replace.NONE) {
        return new PreloadableEmbeddedPostgresContextCustomizer(databaseAnnotation);
    }

    return null;
}
 
开发者ID:zonkyio,项目名称:embedded-database-spring-test,代码行数:13,代码来源:EmbeddedPostgresContextCustomizerFactory.java


示例12: delegateProcessing

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
private static void delegateProcessing(SmartContextLoader loader, ContextConfigurationAttributes configAttributes) {
	if (logger.isDebugEnabled()) {
		logger.debug(String.format("Delegating to %s to process context configuration %s.", name(loader),
			configAttributes));
	}
	loader.processContextConfiguration(configAttributes);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AbstractDelegatingSmartContextLoader.java


示例13: buildContextHierarchyMap

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Build a <em>context hierarchy map</em> for the supplied {@linkplain Class
 * test class} and its superclasses, taking into account context hierarchies
 * declared via {@link ContextHierarchy @ContextHierarchy} and
 * {@link ContextConfiguration @ContextConfiguration}.
 * <p>Each value in the map represents the consolidated list of {@linkplain
 * ContextConfigurationAttributes context configuration attributes} for a
 * given level in the context hierarchy (potentially across the test class
 * hierarchy), keyed by the {@link ContextConfiguration#name() name} of the
 * context hierarchy level.
 * <p>If a given level in the context hierarchy does not have an explicit
 * name (i.e., configured via {@link ContextConfiguration#name}), a name will
 * be generated for that hierarchy level by appending the numerical level to
 * the {@link #GENERATED_CONTEXT_HIERARCHY_LEVEL_PREFIX}.
 * @param testClass the class for which to resolve the context hierarchy map
 * (must not be {@code null})
 * @return a map of context configuration attributes for the context hierarchy,
 * keyed by context hierarchy level name; never {@code null}
 * @throws IllegalArgumentException if the lists of context configuration
 * attributes for each level in the {@code @ContextHierarchy} do not define
 * unique context configuration within the overall hierarchy.
 * @since 3.2.2
 * @see #resolveContextHierarchyAttributes(Class)
 */
static Map<String, List<ContextConfigurationAttributes>> buildContextHierarchyMap(Class<?> testClass) {
	final Map<String, List<ContextConfigurationAttributes>> map = new LinkedHashMap<String, List<ContextConfigurationAttributes>>();
	int hierarchyLevel = 1;

	for (List<ContextConfigurationAttributes> configAttributesList : resolveContextHierarchyAttributes(testClass)) {
		for (ContextConfigurationAttributes configAttributes : configAttributesList) {
			String name = configAttributes.getName();

			// Assign a generated name?
			if (!StringUtils.hasText(name)) {
				name = GENERATED_CONTEXT_HIERARCHY_LEVEL_PREFIX + hierarchyLevel;
			}

			// Encountered a new context hierarchy level?
			if (!map.containsKey(name)) {
				hierarchyLevel++;
				map.put(name, new ArrayList<ContextConfigurationAttributes>());
			}

			map.get(name).add(configAttributes);
		}
	}

	// Check for uniqueness
	Set<List<ContextConfigurationAttributes>> set = new HashSet<List<ContextConfigurationAttributes>>(map.values());
	if (set.size() != map.size()) {
		String msg = String.format("The @ContextConfiguration elements configured via @ContextHierarchy in " +
				"test class [%s] and its superclasses must define unique contexts per hierarchy level.",
				testClass.getName());
		logger.error(msg);
		throw new IllegalStateException(msg);
	}

	return map;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:60,代码来源:ContextLoaderUtils.java


示例14: convertContextConfigToConfigAttributesAndAddToList

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
/**
 * Convenience method for creating a {@link ContextConfigurationAttributes}
 * instance from the supplied {@link ContextConfiguration} annotation and
 * declaring class and then adding the attributes to the supplied list.
 */
private static void convertContextConfigToConfigAttributesAndAddToList(ContextConfiguration contextConfiguration,
		Class<?> declaringClass, final List<ContextConfigurationAttributes> attributesList) {

	if (logger.isTraceEnabled()) {
		logger.trace(String.format("Retrieved @ContextConfiguration [%s] for declaring class [%s].",
				contextConfiguration, declaringClass.getName()));
	}
	ContextConfigurationAttributes attributes =
			new ContextConfigurationAttributes(declaringClass, contextConfiguration);
	if (logger.isTraceEnabled()) {
		logger.trace("Resolved context configuration attributes: " + attributes);
	}
	attributesList.add(attributes);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:ContextLoaderUtils.java


示例15: processContextConfiguration

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@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()));
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:HybridContextLoader.java


示例16: resolveConfigAttributesWithBareAnnotations

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveConfigAttributesWithBareAnnotations() {
	Class<BareAnnotations> testClass = BareAnnotations.class;
	List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(testClass);
	assertNotNull(attributesList);
	assertEquals(1, attributesList.size());
	assertAttributes(attributesList.get(0),
			testClass, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, ContextLoader.class, true);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:ContextLoaderUtilsConfigurationAttributesTests.java


示例17: resolveConfigAttributesWithLocalAnnotationAndLocations

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveConfigAttributesWithLocalAnnotationAndLocations() {
	List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(LocationsFoo.class);
	assertNotNull(attributesList);
	assertEquals(1, attributesList.size());
	assertLocationsFooAttributes(attributesList.get(0));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:ContextLoaderUtilsConfigurationAttributesTests.java


示例18: resolveConfigAttributesWithMetaAnnotationAndLocations

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveConfigAttributesWithMetaAnnotationAndLocations() {
	Class<MetaLocationsFoo> testClass = MetaLocationsFoo.class;
	List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(testClass);
	assertNotNull(attributesList);
	assertEquals(1, attributesList.size());
	assertAttributes(attributesList.get(0),
			testClass, new String[] {"/foo.xml"}, EMPTY_CLASS_ARRAY, ContextLoader.class, true);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:ContextLoaderUtilsConfigurationAttributesTests.java


示例19: resolveConfigAttributesWithMetaAnnotationAndLocationsAndOverrides

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveConfigAttributesWithMetaAnnotationAndLocationsAndOverrides() {
	Class<MetaLocationsFooWithOverrides> testClass = MetaLocationsFooWithOverrides.class;
	List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(testClass);
	assertNotNull(attributesList);
	assertEquals(1, attributesList.size());
	assertAttributes(attributesList.get(0),
			testClass, new String[] {"/foo.xml"}, EMPTY_CLASS_ARRAY, ContextLoader.class, true);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:ContextLoaderUtilsConfigurationAttributesTests.java


示例20: resolveConfigAttributesWithMetaAnnotationAndLocationsAndOverriddenAttributes

import org.springframework.test.context.ContextConfigurationAttributes; //导入依赖的package包/类
@Test
public void resolveConfigAttributesWithMetaAnnotationAndLocationsAndOverriddenAttributes() {
	Class<MetaLocationsFooWithOverriddenAttributes> testClass = MetaLocationsFooWithOverriddenAttributes.class;
	List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(testClass);
	assertNotNull(attributesList);
	assertEquals(1, attributesList.size());
	assertAttributes(attributesList.get(0),
			testClass, new String[] {"foo1.xml", "foo2.xml"}, EMPTY_CLASS_ARRAY, ContextLoader.class, true);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:ContextLoaderUtilsConfigurationAttributesTests.java



注:本文中的org.springframework.test.context.ContextConfigurationAttributes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Screenshot类代码示例发布时间:2022-05-22
下一篇:
Java SimpleJdbcDaoSupport类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap