moved ApplicationContext-dependent .beans.factory.xml.* tests from .testsuite -> .context
This commit is contained in:
parent
be53a80657
commit
7a0d9c7533
|
|
@ -7,12 +7,12 @@
|
|||
Not yet in use: illustration of possible approach.
|
||||
-->
|
||||
<bean id="autoProxiedOverload" lazy-init="true"
|
||||
class="org.springframework.beans.factory.xml.LookupMethodWrappedByCglibProxyTests$OverloadLookup">
|
||||
class="org.springframework.beans.factory.xml.OverloadLookup">
|
||||
<lookup-method name="newTestBean" bean="jenny"/>
|
||||
</bean>
|
||||
|
||||
<bean id="regularlyProxiedOverloadTarget" scope="prototype"
|
||||
class="org.springframework.beans.factory.xml.LookupMethodWrappedByCglibProxyTests$OverloadLookup">
|
||||
class="org.springframework.beans.factory.xml.OverloadLookup">
|
||||
<lookup-method name="newTestBean" bean="jenny"/>
|
||||
</bean>
|
||||
|
||||
|
|
@ -32,13 +32,18 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class LookupMethodWrappedByCglibProxyTests {
|
||||
public final class LookupMethodWrappedByCglibProxyTests {
|
||||
|
||||
private static final Class<?> CLASS = LookupMethodWrappedByCglibProxyTests.class;
|
||||
private static final String CLASSNAME = CLASS.getSimpleName();
|
||||
|
||||
private static final String CONTEXT = CLASSNAME + "-context.xml";
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.applicationContext = new ClassPathXmlApplicationContext("overloadOverrides.xml", getClass());
|
||||
this.applicationContext = new ClassPathXmlApplicationContext(CONTEXT, CLASS);
|
||||
resetInterceptor();
|
||||
}
|
||||
|
||||
|
|
@ -74,14 +79,15 @@ public class LookupMethodWrappedByCglibProxyTests {
|
|||
return (DebugInterceptor) applicationContext.getBean("interceptor");
|
||||
}
|
||||
|
||||
|
||||
public static abstract class OverloadLookup {
|
||||
|
||||
public abstract ITestBean newTestBean();
|
||||
|
||||
public String testMethod() {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
abstract class OverloadLookup {
|
||||
|
||||
public abstract ITestBean newTestBean();
|
||||
|
||||
public String testMethod() {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -16,7 +16,9 @@
|
|||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.util.ClassUtils.convertClassNameToResourcePath;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
|
|
@ -36,10 +38,11 @@ import org.springframework.context.support.StaticApplicationContext;
|
|||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class QualifierAnnotationTests {
|
||||
public final class QualifierAnnotationTests {
|
||||
|
||||
private static final String CLASSNAME = QualifierAnnotationTests.class.getName();
|
||||
private static final String CONFIG_LOCATION =
|
||||
"classpath:org/springframework/beans/factory/xml/qualifierAnnotationTests.xml";
|
||||
format("classpath:%s-context.xml", convertClassNameToResourcePath(CLASSNAME));
|
||||
|
||||
|
||||
@Test
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
||||
http://www.springframework.org/schema/beans/test http://www.springframework.org/schema/beans/factory/xml/support/spring-test.xsd">
|
||||
http://www.springframework.org/schema/beans/test http://www.springframework.org/schema/beans/factory/xml/support/CustomNamespaceHandlerTests.xsd">
|
||||
|
||||
<test:testBean id="testBean" name="Rob Harrop" age="23"/>
|
||||
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.beans.factory.xml.support;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -26,37 +27,59 @@ import java.util.Set;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.config.AbstractInterceptorDrivenBeanDefinitionDecorator;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.interceptor.DebugInterceptor;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.ITestBean;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.TestBean;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
|
||||
import org.springframework.beans.factory.xml.NamespaceHandlerResolver;
|
||||
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.beans.factory.xml.PluggableSchemaResolver;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import test.interceptor.NopInterceptor;
|
||||
|
||||
/**
|
||||
* Unit tests for custom XML namespace handler implementations.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public final class CustomNamespaceHandlerTests {
|
||||
|
||||
private static final Class<?> CLASS = CustomNamespaceHandlerTests.class;
|
||||
private static final String CLASSNAME = CLASS.getSimpleName();
|
||||
private static final String FQ_PATH = "org/springframework/beans/factory/xml/support";
|
||||
|
||||
private static final String NS_PROPS = format("%s/%s.properties", FQ_PATH, CLASSNAME);
|
||||
private static final String NS_XML = format("%s/%s-context.xml", FQ_PATH, CLASSNAME);
|
||||
private static final String TEST_XSD = format("%s/%s.xsd", FQ_PATH, CLASSNAME);
|
||||
|
||||
private DefaultListableBeanFactory beanFactory;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
String location = "org/springframework/beans/factory/xml/support/customNamespace.properties";
|
||||
NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader(), location);
|
||||
NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
|
||||
this.beanFactory = new DefaultListableBeanFactory();
|
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
||||
reader.setNamespaceHandlerResolver(resolver);
|
||||
|
|
@ -142,21 +165,21 @@ public final class CustomNamespaceHandlerTests {
|
|||
}
|
||||
|
||||
private Resource getResource() {
|
||||
return new ClassPathResource("customNamespace.xml", getClass());
|
||||
return new ClassPathResource(NS_XML);
|
||||
}
|
||||
|
||||
|
||||
private final class DummySchemaResolver extends PluggableSchemaResolver {
|
||||
|
||||
public DummySchemaResolver() {
|
||||
super(CustomNamespaceHandlerTests.this.getClass().getClassLoader());
|
||||
super(CLASS.getClassLoader());
|
||||
}
|
||||
|
||||
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws IOException {
|
||||
InputSource source = super.resolveEntity(publicId, systemId);
|
||||
if (source == null) {
|
||||
Resource resource = new ClassPathResource("org/springframework/beans/factory/xml/support/spring-test.xsd");
|
||||
Resource resource = new ClassPathResource(TEST_XSD);
|
||||
source = new InputSource(resource.getInputStream());
|
||||
source.setPublicId(publicId);
|
||||
source.setSystemId(systemId);
|
||||
|
|
@ -166,3 +189,90 @@ public final class CustomNamespaceHandlerTests {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Custom namespace handler implementation.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
final class TestNamespaceHandler extends NamespaceHandlerSupport {
|
||||
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("testBean", new TestBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("person", new PersonDefinitionParser());
|
||||
|
||||
registerBeanDefinitionDecorator("set", new PropertyModifyingBeanDefinitionDecorator());
|
||||
registerBeanDefinitionDecorator("debug", new DebugBeanDefinitionDecorator());
|
||||
registerBeanDefinitionDecorator("nop", new NopInterceptorBeanDefinitionDecorator());
|
||||
registerBeanDefinitionDecoratorForAttribute("object-name", new ObjectNameBeanDefinitionDecorator());
|
||||
}
|
||||
|
||||
private static class TestBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
RootBeanDefinition definition = new RootBeanDefinition();
|
||||
definition.setBeanClass(TestBean.class);
|
||||
|
||||
MutablePropertyValues mpvs = new MutablePropertyValues();
|
||||
mpvs.addPropertyValue("name", element.getAttribute("name"));
|
||||
mpvs.addPropertyValue("age", element.getAttribute("age"));
|
||||
definition.setPropertyValues(mpvs);
|
||||
|
||||
parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), definition);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class PersonDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return TestBean.class;
|
||||
}
|
||||
|
||||
protected void doParse(Element element, BeanDefinitionBuilder builder) {
|
||||
builder.addPropertyValue("name", element.getAttribute("name"));
|
||||
builder.addPropertyValue("age", element.getAttribute("age"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PropertyModifyingBeanDefinitionDecorator implements BeanDefinitionDecorator {
|
||||
|
||||
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
Element element = (Element) node;
|
||||
BeanDefinition def = definition.getBeanDefinition();
|
||||
|
||||
MutablePropertyValues mpvs = (def.getPropertyValues() == null) ? new MutablePropertyValues() : def.getPropertyValues();
|
||||
mpvs.addPropertyValue("name", element.getAttribute("name"));
|
||||
mpvs.addPropertyValue("age", element.getAttribute("age"));
|
||||
|
||||
((AbstractBeanDefinition) def).setPropertyValues(mpvs);
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
|
||||
private static class DebugBeanDefinitionDecorator extends AbstractInterceptorDrivenBeanDefinitionDecorator {
|
||||
|
||||
protected BeanDefinition createInterceptorDefinition(Node node) {
|
||||
return new RootBeanDefinition(DebugInterceptor.class);
|
||||
}
|
||||
}
|
||||
|
||||
private static class NopInterceptorBeanDefinitionDecorator extends AbstractInterceptorDrivenBeanDefinitionDecorator {
|
||||
|
||||
protected BeanDefinition createInterceptorDefinition(Node node) {
|
||||
return new RootBeanDefinition(NopInterceptor.class);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ObjectNameBeanDefinitionDecorator implements BeanDefinitionDecorator {
|
||||
|
||||
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
Attr objectNameAttribute = (Attr) node;
|
||||
definition.getBeanDefinition().setAttribute("objectName", objectNameAttribute.getValue());
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<version>1</version>
|
||||
<pluginVersion><![CDATA[2.2.0.v200809261800]]></pluginVersion>
|
||||
<configSuffixes>
|
||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
||||
</configSuffixes>
|
||||
<enableImports><![CDATA[true]]></enableImports>
|
||||
<configs>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/advice-precedence-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/after-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/afterReturning-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/afterThrowing-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/ambiguous-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/args-mismatch.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/around-advice-circular-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/around-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/aspectj.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/bean-name-pointcut-atAspect-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/bean-name-pointcut-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/before-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/declare-parents-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/implicit-jp-argument-matching-atAspectJ-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/implicit-jp-argument-matching-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/overloaded-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/proceedTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/property-dependent-aspect-property-after-aspect-test.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/property-dependent-aspect-property-before-aspect-test.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/property-dependent-atAspectJ-aspect-property-after-aspect-test.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/property-dependent-atAspectJ-aspect-property-before-aspect-test.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/targetPointcutSelectionTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/this-and-target-selectionOnly-pointcuts-atAspectJ-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/this-and-target-selectionOnly-pointcuts-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/topsy-turvy-aspect.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/afterThrowingAdviceTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/annotationPointcut.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/around-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/aspect-implementing-interface-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/aspects.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsPlusAdvisor.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsWithAbstractBean.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsWithCGLIB.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsWithOrdering.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/ataspectj-around-advice-tests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/lazy.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/pertarget.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/perthis.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/retryAspect.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/twoAdviceAspect.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/twoAdviceAspectPrototype.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/usesInclude.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/usesJoinPointAspect.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/aspectj.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/springAop.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/autoproxy/spr3064/annotationbinding-spr3064.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/generic/afterReturningGenericTypeMatchingTests-context.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/generic/genericBridgeMethodMatchingTests-classProxy-context.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/generic/genericBridgeMethodMatchingTests-context.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/aspectj/generic/genericParameterMatchingTests-context.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerAdviceTypeOKTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerArgNamesErrorTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerArgNamesOKTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerProxyTargetClassTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerReturningOKTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerScopeTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/aopNamespaceHandlerThrowingOKTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/config/prototypeProxy.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/frozenProxyFactoryBean.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/innerBeanTarget.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/invalidProxyFactory.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/prototypeTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/proxyFactoryBeanAutowiringTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/proxyFactoryDoubleTargetSourceTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/proxyFactoryTargetSourceNotLastTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/proxyFactoryTargetSourceTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/proxyFactoryTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/serializationTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/throwsAdvice.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/withDependencyChecking.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/adapter/withBPPContext.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/adapter/withoutBPPContext.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/autoproxy/advisorAutoProxyCreator.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/autoproxy/advisorAutoProxyCreatorWithCommonInterceptors.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/autoproxy/beanNameAutoProxyCreatorInitTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/autoproxy/beanNameAutoProxyCreatorTests.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/autoproxy/customTargetSource.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/framework/autoproxy/optimizedAutoProxyCreator.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/scope/scopedList.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/scope/scopedMap.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/scope/scopedOverride.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/scope/scopedTestBean.xml</config>
|
||||
<config>src/test/java/org/springframework/aop/target/commonsPoolTests.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/config/test-properties.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/beanEvents.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/beanEventsImported.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/beanNameGeneration.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/child.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/classNotFound.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/collectionMerging.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/complexFactoryCircle.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/constructorOverrides.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/default-autowire.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/default-lazy-init.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/defaultLifecycleMethods.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/delegationOverrides.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-carg-autowire.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-carg-inner.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-carg.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-dependsOn-inner.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-dependsOn.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-prop-autowireByName.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-prop-autowireByType.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-prop-inner.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-prop-inTheMiddle.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependencies-prop.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/dependenciesMaterializeThis.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/factoryCircle.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/ignoreDefaultLifecycleMethods.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/invalid-factory.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/local-collections-using-XSD.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/no-such-factory-method.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/overloadOverrides.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/overrides.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/parent.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/qualifierAnnotationTests.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/recursiveImport.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/reftypes.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/resource.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/resourceImport.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/satisfiedAllDependencyCheck.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/satisfiedObjectDependencyCheck.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/satisfiedSimpleDependencyCheck.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/schemaValidated.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/shortcutTests.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/test.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/unsatisfiedAllDependencyCheckMissingObjects.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/unsatisfiedObjectDependencyCheck.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/unsatisfiedSimpleDependencyCheck.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/validateWithDtd.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/validateWithXsd.xml</config>
|
||||
<config>src/test/java/org/springframework/beans/factory/xml/withMeta.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.beans.factory.xml.support;
|
||||
|
||||
import org.springframework.aop.config.AbstractInterceptorDrivenBeanDefinitionDecorator;
|
||||
import org.springframework.aop.interceptor.DebugInterceptor;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.TestBean;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import test.interceptor.NopInterceptor;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class TestNamespaceHandler extends NamespaceHandlerSupport {
|
||||
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("testBean", new TestBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("person", new PersonDefinitionParser());
|
||||
|
||||
registerBeanDefinitionDecorator("set", new PropertyModifyingBeanDefinitionDecorator());
|
||||
registerBeanDefinitionDecorator("debug", new DebugBeanDefinitionDecorator());
|
||||
registerBeanDefinitionDecorator("nop", new NopInterceptorBeanDefinitionDecorator());
|
||||
registerBeanDefinitionDecoratorForAttribute("object-name", new ObjectNameBeanDefinitionDecorator());
|
||||
}
|
||||
|
||||
private static class TestBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
RootBeanDefinition definition = new RootBeanDefinition();
|
||||
definition.setBeanClass(TestBean.class);
|
||||
|
||||
MutablePropertyValues mpvs = new MutablePropertyValues();
|
||||
mpvs.addPropertyValue("name", element.getAttribute("name"));
|
||||
mpvs.addPropertyValue("age", element.getAttribute("age"));
|
||||
definition.setPropertyValues(mpvs);
|
||||
|
||||
parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), definition);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class PersonDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
protected Class getBeanClass(Element element) {
|
||||
return TestBean.class;
|
||||
}
|
||||
|
||||
protected void doParse(Element element, BeanDefinitionBuilder builder) {
|
||||
builder.addPropertyValue("name", element.getAttribute("name"));
|
||||
builder.addPropertyValue("age", element.getAttribute("age"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PropertyModifyingBeanDefinitionDecorator implements BeanDefinitionDecorator {
|
||||
|
||||
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
Element element = (Element) node;
|
||||
BeanDefinition def = definition.getBeanDefinition();
|
||||
|
||||
MutablePropertyValues mpvs = (def.getPropertyValues() == null) ? new MutablePropertyValues() : def.getPropertyValues();
|
||||
mpvs.addPropertyValue("name", element.getAttribute("name"));
|
||||
mpvs.addPropertyValue("age", element.getAttribute("age"));
|
||||
|
||||
((AbstractBeanDefinition) def).setPropertyValues(mpvs);
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
|
||||
private static class DebugBeanDefinitionDecorator extends AbstractInterceptorDrivenBeanDefinitionDecorator {
|
||||
|
||||
protected BeanDefinition createInterceptorDefinition(Node node) {
|
||||
return new RootBeanDefinition(DebugInterceptor.class);
|
||||
}
|
||||
}
|
||||
|
||||
private static class NopInterceptorBeanDefinitionDecorator extends AbstractInterceptorDrivenBeanDefinitionDecorator {
|
||||
|
||||
protected BeanDefinition createInterceptorDefinition(Node node) {
|
||||
return new RootBeanDefinition(NopInterceptor.class);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ObjectNameBeanDefinitionDecorator implements BeanDefinitionDecorator {
|
||||
|
||||
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
Attr objectNameAttribute = (Attr) node;
|
||||
definition.getBeanDefinition().setAttribute("objectName", objectNameAttribute.getValue());
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
http\://www.springframework.org/schema/test=java.lang.String
|
||||
|
|
@ -1 +0,0 @@
|
|||
http\://www.springframework.org/schema/test=com.myapp.Foo
|
||||
Loading…
Reference in New Issue