From 7a0d9c7533ebfcbc7dbefd37e49bfa9c1402deca Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Fri, 19 Dec 2008 22:33:26 +0000 Subject: [PATCH] moved ApplicationContext-dependent .beans.factory.xml.* tests from .testsuite -> .context --- ...MethodWrappedByCglibProxyTests-context.xml | 4 +- .../LookupMethodWrappedByCglibProxyTests.java | 30 ++-- .../xml/QualifierAnnotationTests-context.xml | 0 .../factory/xml/QualifierAnnotationTests.java | 9 +- .../CustomNamespaceHandlerTests-context.xml | 2 +- .../support/CustomNamespaceHandlerTests.java | 122 ++++++++++++++- .../CustomNamespaceHandlerTests.properties | 0 .../support/CustomNamespaceHandlerTests.xsd | 0 org.springframework.testsuite/.springBeans | 148 ------------------ .../xml/support/TestNamespaceHandler.java | 120 -------------- .../factory/xml/support/invalid.properties | 1 - .../xml/support/nonExistent.properties | 1 - 12 files changed, 143 insertions(+), 294 deletions(-) rename org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/overloadOverrides.xml => org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml (87%) rename {org.springframework.testsuite => org.springframework.context}/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java (82%) rename org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/qualifierAnnotationTests.xml => org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml (100%) rename {org.springframework.testsuite => org.springframework.context}/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java (95%) rename org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.xml => org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml (95%) rename {org.springframework.testsuite => org.springframework.context}/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java (52%) rename org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.properties => org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.properties (100%) rename org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/spring-test.xsd => org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.xsd (100%) delete mode 100644 org.springframework.testsuite/.springBeans delete mode 100644 org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/TestNamespaceHandler.java delete mode 100644 org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/invalid.properties delete mode 100644 org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/nonExistent.properties diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/overloadOverrides.xml b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml similarity index 87% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/overloadOverrides.xml rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml index 4f2212256c..017af48520 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/overloadOverrides.xml +++ b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml @@ -7,12 +7,12 @@ Not yet in use: illustration of possible approach. --> + class="org.springframework.beans.factory.xml.OverloadLookup"> + class="org.springframework.beans.factory.xml.OverloadLookup"> diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java similarity index 82% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java index 65f8330927..ceb416775f 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java +++ b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java @@ -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"; + } +} + diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/qualifierAnnotationTests.xml b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/qualifierAnnotationTests.xml rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java similarity index 95% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java index 37fbba6c26..db75fb0849 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java +++ b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java @@ -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 diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.xml b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml similarity index 95% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.xml rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml index fdd268c8cd..723437cb21 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.xml +++ b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml @@ -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"> diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java similarity index 52% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java index 1bf54f8d1a..94b181e9f9 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java +++ b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java @@ -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; + } + } +} + diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.properties b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.properties similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/customNamespace.properties rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.properties diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/spring-test.xsd b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.xsd similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/spring-test.xsd rename to org.springframework.context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.xsd diff --git a/org.springframework.testsuite/.springBeans b/org.springframework.testsuite/.springBeans deleted file mode 100644 index 16e931784c..0000000000 --- a/org.springframework.testsuite/.springBeans +++ /dev/null @@ -1,148 +0,0 @@ - - - 1 - - - - - - - src/test/java/org/springframework/aop/aspectj/advice-precedence-tests.xml - src/test/java/org/springframework/aop/aspectj/after-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/afterReturning-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/afterThrowing-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/ambiguous-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/args-mismatch.xml - src/test/java/org/springframework/aop/aspectj/around-advice-circular-tests.xml - src/test/java/org/springframework/aop/aspectj/around-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/aspectj.xml - src/test/java/org/springframework/aop/aspectj/bean-name-pointcut-atAspect-tests.xml - src/test/java/org/springframework/aop/aspectj/bean-name-pointcut-tests.xml - src/test/java/org/springframework/aop/aspectj/before-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/declare-parents-tests.xml - src/test/java/org/springframework/aop/aspectj/implicit-jp-argument-matching-atAspectJ-tests.xml - src/test/java/org/springframework/aop/aspectj/implicit-jp-argument-matching-tests.xml - src/test/java/org/springframework/aop/aspectj/overloaded-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/proceedTests.xml - src/test/java/org/springframework/aop/aspectj/property-dependent-aspect-property-after-aspect-test.xml - src/test/java/org/springframework/aop/aspectj/property-dependent-aspect-property-before-aspect-test.xml - src/test/java/org/springframework/aop/aspectj/property-dependent-atAspectJ-aspect-property-after-aspect-test.xml - src/test/java/org/springframework/aop/aspectj/property-dependent-atAspectJ-aspect-property-before-aspect-test.xml - src/test/java/org/springframework/aop/aspectj/targetPointcutSelectionTests.xml - src/test/java/org/springframework/aop/aspectj/this-and-target-selectionOnly-pointcuts-atAspectJ-tests.xml - src/test/java/org/springframework/aop/aspectj/this-and-target-selectionOnly-pointcuts-tests.xml - src/test/java/org/springframework/aop/aspectj/topsy-turvy-aspect.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/afterThrowingAdviceTests.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/annotationPointcut.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/around-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/aspect-implementing-interface-tests.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/aspects.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsPlusAdvisor.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsWithAbstractBean.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsWithCGLIB.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/aspectsWithOrdering.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/ataspectj-around-advice-tests.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/lazy.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/pertarget.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/perthis.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/retryAspect.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/twoAdviceAspect.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/twoAdviceAspectPrototype.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/usesInclude.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/usesJoinPointAspect.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/aspectj.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/springAop.xml - src/test/java/org/springframework/aop/aspectj/autoproxy/spr3064/annotationbinding-spr3064.xml - src/test/java/org/springframework/aop/aspectj/generic/afterReturningGenericTypeMatchingTests-context.xml - src/test/java/org/springframework/aop/aspectj/generic/genericBridgeMethodMatchingTests-classProxy-context.xml - src/test/java/org/springframework/aop/aspectj/generic/genericBridgeMethodMatchingTests-context.xml - src/test/java/org/springframework/aop/aspectj/generic/genericParameterMatchingTests-context.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerAdviceTypeOKTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerArgNamesErrorTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerArgNamesOKTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerProxyTargetClassTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerReturningOKTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerScopeTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerTests.xml - src/test/java/org/springframework/aop/config/aopNamespaceHandlerThrowingOKTests.xml - src/test/java/org/springframework/aop/config/prototypeProxy.xml - src/test/java/org/springframework/aop/framework/frozenProxyFactoryBean.xml - src/test/java/org/springframework/aop/framework/innerBeanTarget.xml - src/test/java/org/springframework/aop/framework/invalidProxyFactory.xml - src/test/java/org/springframework/aop/framework/prototypeTests.xml - src/test/java/org/springframework/aop/framework/proxyFactoryBeanAutowiringTests.xml - src/test/java/org/springframework/aop/framework/proxyFactoryDoubleTargetSourceTests.xml - src/test/java/org/springframework/aop/framework/proxyFactoryTargetSourceNotLastTests.xml - src/test/java/org/springframework/aop/framework/proxyFactoryTargetSourceTests.xml - src/test/java/org/springframework/aop/framework/proxyFactoryTests.xml - src/test/java/org/springframework/aop/framework/serializationTests.xml - src/test/java/org/springframework/aop/framework/throwsAdvice.xml - src/test/java/org/springframework/aop/framework/withDependencyChecking.xml - src/test/java/org/springframework/aop/framework/adapter/withBPPContext.xml - src/test/java/org/springframework/aop/framework/adapter/withoutBPPContext.xml - src/test/java/org/springframework/aop/framework/autoproxy/advisorAutoProxyCreator.xml - src/test/java/org/springframework/aop/framework/autoproxy/advisorAutoProxyCreatorWithCommonInterceptors.xml - src/test/java/org/springframework/aop/framework/autoproxy/beanNameAutoProxyCreatorInitTests.xml - src/test/java/org/springframework/aop/framework/autoproxy/beanNameAutoProxyCreatorTests.xml - src/test/java/org/springframework/aop/framework/autoproxy/customTargetSource.xml - src/test/java/org/springframework/aop/framework/autoproxy/optimizedAutoProxyCreator.xml - src/test/java/org/springframework/aop/scope/scopedList.xml - src/test/java/org/springframework/aop/scope/scopedMap.xml - src/test/java/org/springframework/aop/scope/scopedOverride.xml - src/test/java/org/springframework/aop/scope/scopedTestBean.xml - src/test/java/org/springframework/aop/target/commonsPoolTests.xml - src/test/java/org/springframework/beans/factory/config/test-properties.xml - src/test/java/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml - src/test/java/org/springframework/beans/factory/xml/beanEvents.xml - src/test/java/org/springframework/beans/factory/xml/beanEventsImported.xml - src/test/java/org/springframework/beans/factory/xml/beanNameGeneration.xml - src/test/java/org/springframework/beans/factory/xml/child.xml - src/test/java/org/springframework/beans/factory/xml/classNotFound.xml - src/test/java/org/springframework/beans/factory/xml/collectionMerging.xml - src/test/java/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml - src/test/java/org/springframework/beans/factory/xml/complexFactoryCircle.xml - src/test/java/org/springframework/beans/factory/xml/constructorOverrides.xml - src/test/java/org/springframework/beans/factory/xml/default-autowire.xml - src/test/java/org/springframework/beans/factory/xml/default-lazy-init.xml - src/test/java/org/springframework/beans/factory/xml/defaultLifecycleMethods.xml - src/test/java/org/springframework/beans/factory/xml/delegationOverrides.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-carg-autowire.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-carg-inner.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-carg.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-dependsOn-inner.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-dependsOn.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-prop-autowireByName.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-prop-autowireByType.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-prop-inner.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-prop-inTheMiddle.xml - src/test/java/org/springframework/beans/factory/xml/dependencies-prop.xml - src/test/java/org/springframework/beans/factory/xml/dependenciesMaterializeThis.xml - src/test/java/org/springframework/beans/factory/xml/factoryCircle.xml - src/test/java/org/springframework/beans/factory/xml/ignoreDefaultLifecycleMethods.xml - src/test/java/org/springframework/beans/factory/xml/invalid-factory.xml - src/test/java/org/springframework/beans/factory/xml/local-collections-using-XSD.xml - src/test/java/org/springframework/beans/factory/xml/no-such-factory-method.xml - src/test/java/org/springframework/beans/factory/xml/overloadOverrides.xml - src/test/java/org/springframework/beans/factory/xml/overrides.xml - src/test/java/org/springframework/beans/factory/xml/parent.xml - src/test/java/org/springframework/beans/factory/xml/qualifierAnnotationTests.xml - src/test/java/org/springframework/beans/factory/xml/recursiveImport.xml - src/test/java/org/springframework/beans/factory/xml/reftypes.xml - src/test/java/org/springframework/beans/factory/xml/resource.xml - src/test/java/org/springframework/beans/factory/xml/resourceImport.xml - src/test/java/org/springframework/beans/factory/xml/satisfiedAllDependencyCheck.xml - src/test/java/org/springframework/beans/factory/xml/satisfiedObjectDependencyCheck.xml - src/test/java/org/springframework/beans/factory/xml/satisfiedSimpleDependencyCheck.xml - src/test/java/org/springframework/beans/factory/xml/schemaValidated.xml - src/test/java/org/springframework/beans/factory/xml/shortcutTests.xml - src/test/java/org/springframework/beans/factory/xml/test.xml - src/test/java/org/springframework/beans/factory/xml/unsatisfiedAllDependencyCheckMissingObjects.xml - src/test/java/org/springframework/beans/factory/xml/unsatisfiedObjectDependencyCheck.xml - src/test/java/org/springframework/beans/factory/xml/unsatisfiedSimpleDependencyCheck.xml - src/test/java/org/springframework/beans/factory/xml/validateWithDtd.xml - src/test/java/org/springframework/beans/factory/xml/validateWithXsd.xml - src/test/java/org/springframework/beans/factory/xml/withMeta.xml - - - - diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/TestNamespaceHandler.java b/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/TestNamespaceHandler.java deleted file mode 100644 index 5233810b12..0000000000 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/TestNamespaceHandler.java +++ /dev/null @@ -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; - } - } -} diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/invalid.properties b/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/invalid.properties deleted file mode 100644 index f0c6c392ba..0000000000 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/invalid.properties +++ /dev/null @@ -1 +0,0 @@ -http\://www.springframework.org/schema/test=java.lang.String \ No newline at end of file diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/nonExistent.properties b/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/nonExistent.properties deleted file mode 100644 index 0944d907a3..0000000000 --- a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/support/nonExistent.properties +++ /dev/null @@ -1 +0,0 @@ -http\://www.springframework.org/schema/test=com.myapp.Foo \ No newline at end of file