From 42b5d6dd7edda6121bd87852805471ea53074985 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 3 Jan 2013 00:43:48 -0800 Subject: [PATCH] Remove duplicate test classes Prior to this commit many test utility classes and sample beans were duplicated across projects. This was previously necessary due to the fact that dependent test sources were not shared during a gradle build. Since the introduction of the 'test-source-set-dependencies' gradle plugin this is no longer the case. This commit attempts to remove as much duplicate code as possible, co-locating test utilities and beans in the most suitable project. For example, test beans are now located in the 'spring-beans' project. Some of the duplicated code had started to drift apart when modifications made in one project where not ported to others. All changes have now been consolidated and when necessary existing tests have been refactored to account for the differences. Conflicts: spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java --- .../AspectJExpressionPointcutTests.java | 28 +- .../BeanNamePointcutMatchingTests.java | 4 +- ...hodInvocationProceedingJoinPointTests.java | 6 +- .../TigerAspectJExpressionPointcutTests.java | 6 +- .../aspectj/TypePatternClassFilterTests.java | 16 +- .../AbstractAspectJAdvisorFactoryTests.java | 10 +- .../annotation/ArgumentBindingTests.java | 6 +- .../AspectJPointcutAdvisorTests.java | 4 +- .../annotation/AspectProxyFactoryTests.java | 8 +- .../AspectJNamespaceHandlerTests.java | 7 +- .../AopNamespaceHandlerEventTests-context.xml | 2 +- .../config/AopNamespaceHandlerEventTests.java | 11 +- ...PointcutErrorTests-pointcutDuplication.xml | 2 +- ...dlerPointcutErrorTests-pointcutMissing.xml | 2 +- ...AopNamespaceHandlerPointcutErrorTests.java | 4 +- .../aop/config/TopLevelAopTagTests.java | 4 +- .../aop/framework/AopProxyUtilsTests.java | 6 +- .../framework/IntroductionBenchmarkTests.java | 6 +- .../aop/framework/MethodInvocationTests.java | 4 +- .../aop/framework/PrototypeTargetTests.java | 4 +- .../aop/framework/ProxyFactoryTests.java | 29 +- .../adapter/ThrowsAdviceInterceptorTests.java | 16 +- .../ConcurrencyThrottleInterceptorTests.java | 14 +- .../ExposeBeanNameAdvisorsTests.java | 6 +- ...poseInvocationInterceptorTests-context.xml | 12 +- .../ExposeInvocationInterceptorTests.java | 9 +- .../aop/scope/ScopedProxyAutowireTests.java | 4 +- .../AbstractRegexpMethodPointcutTests.java | 11 +- .../aop/support/AopUtilsTests.java | 12 +- .../aop/support/ClassFiltersTests.java | 6 +- .../aop/support/ClassUtilsTests.java | 4 +- .../aop/support/ComposablePointcutTests.java | 4 +- .../aop/support/ControlFlowPointcutTests.java | 11 +- ...elegatingIntroductionInterceptorTests.java | 25 +- .../aop/support/MethodMatchersTests.java | 15 +- .../support/NameMatchMethodPointcutTests.java | 16 +- .../aop/support/PointcutsTests.java | 4 +- ...ointcutAdvisorIntegrationTests-context.xml | 22 +- ...MethodPointcutAdvisorIntegrationTests.java | 16 +- ...monsPoolTargetSourceProxyTests-context.xml | 2 +- .../CommonsPoolTargetSourceProxyTests.java | 7 +- .../HotSwappableTargetSourceTests-context.xml | 11 +- .../target/HotSwappableTargetSourceTests.java | 14 +- ...LazyInitTargetSourceTests-customTarget.xml | 2 +- .../LazyInitTargetSourceTests-singleton.xml | 2 +- .../aop/target/LazyInitTargetSourceTests.java | 7 +- .../PrototypeBasedTargetSourceTests.java | 12 +- .../PrototypeTargetSourceTests-context.xml | 16 +- .../target/PrototypeTargetSourceTests.java | 7 +- .../ThreadLocalTargetSourceTests-context.xml | 33 +- .../target/ThreadLocalTargetSourceTests.java | 9 +- .../advice/CountingAfterReturningAdvice.java | 2 +- .../aop/advice}/CountingBeforeAdvice.java | 2 +- .../tests/aop}/advice/MethodCounter.java | 2 +- .../tests/aop}/advice/MyThrowsHandler.java | 2 +- .../advice/TimestampIntroductionAdvisor.java | 4 +- .../aop}/interceptor/NopInterceptor.java | 2 +- .../SerializableNopInterceptor.java | 2 +- .../TimestampIntroductionInterceptor.java | 7 +- .../tests/sample}/beans/Person.java | 12 +- .../sample}/beans/SerializablePerson.java | 2 +- .../tests/sample}/beans/subpkg/DeepBean.java | 2 +- .../src/test/java/test/aop/MethodCounter.java | 70 -- .../test/java/test/aop/NopInterceptor.java | 58 -- .../test/aop/SerializableNopInterceptor.java | 50 - .../src/test/java/test/beans/Colour.java | 36 - .../test/java/test/beans/DerivedTestBean.java | 90 -- .../test/java/test/beans/INestedTestBean.java | 23 - .../src/test/java/test/beans/IOther.java | 24 - .../src/test/java/test/beans/ITestBean.java | 69 -- .../test/java/test/beans/NestedTestBean.java | 61 -- .../java/test/beans/SerializablePerson.java | 70 -- .../src/test/java/test/beans/TestBean.java | 431 -------- .../CollectingReaderEventListener.java | 97 -- .../test/util/SerializationTestUtils.java | 100 -- .../src/test/java/test/util/TimeStamped.java | 34 - .../org/springframework/beans/Colour.java | 36 - .../beans/DerivedTestBean.java | 86 -- .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 60 -- .../org/springframework/beans/TestBean.java | 437 -------- .../aspectj/AbstractBeanConfigurerTests.java | 4 +- .../aspectj/beanConfigurerTests-beans.xml | 2 +- .../cache/aspectj/AbstractAnnotationTest.java | 596 ----------- ...nTest.java => AspectJAnnotationTests.java} | 35 +- .../cache/config/DefaultCacheableService.java | 27 +- .../CallCountingTransactionManager.java | 59 -- .../TransactionAspectTests-context.xml | 2 +- .../aspectj/TransactionAspectTests.java | 4 +- .../ComponentBeanDefinitionParserTest.java | 5 +- .../springframework/beans/BeanUtilsTests.java | 8 +- .../beans/BeanWrapperEnumTests.java | 6 +- .../beans/BeanWrapperGenericsTests.java | 10 +- .../beans/BeanWrapperTests.java | 12 +- .../CachedIntrospectionResultsTests.java | 6 +- .../beans/ExtendedBeanInfoTests.java | 4 +- .../factory/BeanFactoryUtilsTests-leaf.xml | 2 +- .../factory/BeanFactoryUtilsTests-middle.xml | 11 +- .../factory/BeanFactoryUtilsTests-root.xml | 10 +- .../beans/factory/BeanFactoryUtilsTests.java | 12 +- .../factory/ConcurrentBeanFactoryTests.java | 7 +- .../DefaultListableBeanFactoryTests.java | 60 +- .../beans/factory/FactoryBeanTests.java | 4 +- .../factory/SharedBeanRegistryTests.java | 6 +- .../beans/factory/access/beans1.xml | 0 .../beans/factory/access/beans2.xml | 0 ...wiredAnnotationBeanPostProcessorTests.java | 10 +- .../CustomAutowireConfigurerTests.java | 4 +- ...njectAnnotationBeanPostProcessorTests.java | 10 +- .../config/CustomEditorConfigurerTests.java | 4 +- ...ieldRetrievingFactoryBeanTests-context.xml | 2 +- .../FieldRetrievingFactoryBeanTests.java | 8 +- ...ObjectFactoryCreatingFactoryBeanTests.java | 4 +- .../config/PropertiesFactoryBeanTests.java | 4 +- .../PropertyPathFactoryBeanTests-context.xml | 14 +- .../config/PropertyPathFactoryBeanTests.java | 8 +- .../PropertyPlaceholderConfigurerTests.java | 4 +- .../PropertyResourceConfigurerTests.java | 8 +- .../config/SimpleScopeTests-context.xml | 2 +- .../factory/config/SimpleScopeTests.java | 6 +- .../CustomProblemReporterTests-context.xml | 8 +- .../parsing/CustomProblemReporterTests.java | 6 +- .../support/BeanDefinitionBuilderTests.java | 4 +- .../factory/support/BeanDefinitionTests.java | 4 +- .../support/BeanFactoryGenericsTests.java | 13 +- ...DefinitionMetadataEqualsHashCodeTests.java | 4 +- .../PropertiesBeanDefinitionReaderTests.java | 4 +- .../factory/support/genericBeanTests.xml | 6 +- .../wiring/BeanConfigurerSupportTests.java | 4 +- .../factory/xml/AbstractBeanFactoryTests.java | 39 +- .../xml/AbstractListableBeanFactoryTests.java | 8 +- .../xml/AutowireWithExclusionTests.java | 4 +- .../factory/xml/CollectionMergingTests.java | 4 +- .../xml/CollectionsWithDefaultTypesTests.java | 4 +- .../xml/ConstructorDependenciesBean.java | 7 +- .../beans/factory/xml/CountingFactory.java | 4 +- .../beans/factory/xml/DummyReferencer.java | 6 +- ...uplicateBeanIdTests-multiLevel-context.xml | 4 +- ...DuplicateBeanIdTests-sameLevel-context.xml | 4 +- .../factory/xml/DuplicateBeanIdTests.java | 4 +- .../factory/xml/EventPublicationTests.java | 3 +- .../beans/factory/xml/FactoryMethodTests.java | 4 +- .../beans/factory/xml/FactoryMethods.java | 5 +- .../beans/factory/xml/InstanceFactory.java | 4 +- ...edBeansElementAttributeRecursionTests.java | 4 +- .../factory/xml/SchemaValidationTests.java | 4 +- ...impleConstructorNamespaceHandlerTests.java | 6 +- .../SimplePropertyNamespaceHandlerTests.java | 6 +- .../beans/factory/xml/TestBeanCreator.java | 4 +- .../xml/UtilNamespaceHandlerTests.java | 7 +- .../factory/xml/XmlBeanCollectionTests.java | 98 +- .../xml/XmlBeanDefinitionReaderTests.java | 4 +- .../xml/XmlListableBeanFactoryTests.java | 10 +- .../propertyeditors/CustomEditorTests.java | 16 +- .../beans/support/PagedListHolderTests.java | 11 +- .../beans}/CollectingReaderEventListener.java | 2 +- .../tests/sample}/beans/BooleanTestBean.java | 2 +- .../tests/sample}/beans/Colour.java | 2 +- .../tests/sample}/beans/CountingTestBean.java | 6 +- .../tests/sample}/beans/CustomEnum.java | 2 +- .../sample/beans}/DependenciesBean.java | 4 +- .../tests/sample}/beans/DerivedTestBean.java | 2 +- .../tests/sample}/beans/DummyBean.java | 2 +- .../tests/sample}/beans/DummyFactory.java | 3 +- .../tests/sample}/beans/GenericBean.java | 17 +- .../sample}/beans/GenericIntegerBean.java | 2 +- .../beans/GenericSetOfIntegerBean.java | 2 +- .../tests/sample/beans}/HasMap.java | 24 +- .../tests/sample}/beans/INestedTestBean.java | 2 +- .../tests/sample}/beans/IOther.java | 2 +- .../tests/sample}/beans/ITestBean.java | 8 +- .../tests/sample}/beans/IndexedTestBean.java | 2 +- .../tests/sample}/beans/LifecycleBean.java | 2 +- .../sample/beans}/MustBeInitialized.java | 4 +- .../tests/sample}/beans/NestedTestBean.java | 2 +- .../tests/sample}/beans/NumberTestBean.java | 2 +- .../beans/PackageLevelVisibleBean.java | 2 +- .../tests/sample}/beans/Pet.java | 2 +- .../tests/sample}/beans/SideEffectBean.java | 2 +- .../tests/sample}/beans/TestBean.java | 48 +- .../sample}/beans/factory/DummyFactory.java | 20 +- .../tests/sample/beans/package-info.java | 4 + .../util/SerializationTestUtils.java | 65 -- .../src/test/java/test/beans/Colour.java | 36 - .../src/test/java/test/beans/CustomEnum.java | 30 - .../test/java/test/beans/INestedTestBean.java | 23 - .../src/test/java/test/beans/ITestBean.java | 71 -- .../src/test/java/test/beans/TestBean.java | 457 --------- .../java/test/util/TestResourceUtils.java | 46 - .../support/multiConstructorArgs.properties | 4 +- .../support/refConstructorArg.properties | 6 +- .../support/simpleConstructorArg.properties | 4 +- ...tAttributeRecursionTests-merge-context.xml | 2 +- .../autowire-constructor-with-exclusion.xml | 4 +- .../factory/xml/autowire-with-exclusion.xml | 4 +- .../factory/xml/autowire-with-inclusion.xml | 4 +- .../xml/autowire-with-selective-inclusion.xml | 4 +- .../beans/factory/xml/beanEvents.xml | 8 +- .../beans/factory/xml/collectionMerging.xml | 28 +- .../beans/factory/xml/collections.xml | 78 +- .../xml/collectionsWithDefaultTypes.xml | 4 +- .../beans/factory/xml/factory-methods.xml | 4 +- .../beans/factory/xml/schemaValidated.xml | 10 +- ...simpleConstructorNamespaceHandlerTests.xml | 22 +- ...tructorNamespaceHandlerTestsWithErrors.xml | 2 +- .../simplePropertyNamespaceHandlerTests.xml | 10 +- ...ropertyNamespaceHandlerTestsWithErrors.xml | 4 +- .../beans/factory/xml/test.xml | 32 +- .../beans/factory/xml/testUtilNamespace.xml | 18 +- .../beans/factory/xml/validateWithDtd.xml | 2 +- .../beans/factory/xml/validateWithXsd.xml | 2 +- .../beans/factory/xml/withMeta.xml | 6 +- .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 457 --------- .../scheduling/TestMethodInvokingTask.java | 52 - .../scheduling/quartz/QuartzSupportTests.java | 4 +- .../aop/aspectj/AfterAdviceBindingTests.java | 6 +- .../aop/aspectj/AfterAdviceBindingTests.xml | 2 +- .../AfterReturningAdviceBindingTests.java | 6 +- .../AfterReturningAdviceBindingTests.xml | 4 +- .../AfterThrowingAdviceBindingTests.java | 4 +- .../AfterThrowingAdviceBindingTests.xml | 2 +- .../aop/aspectj/AroundAdviceBindingTests.java | 6 +- .../aop/aspectj/AroundAdviceBindingTests.xml | 2 +- .../aop/aspectj/AroundAdviceCircularTests.xml | 4 +- .../AspectAndAdvicePrecedenceTests.java | 4 +- .../AspectAndAdvicePrecedenceTests.xml | 2 +- ...AspectJExpressionPointcutAdvisorTests.java | 4 +- .../AspectJExpressionPointcutAdvisorTests.xml | 4 +- .../BeanNamePointcutAtAspectTests.java | 6 +- .../aspectj/BeanNamePointcutAtAspectTests.xml | 10 +- .../aop/aspectj/BeanNamePointcutTests.java | 4 +- .../aop/aspectj/BeanNamePointcutTests.xml | 12 +- .../aop/aspectj/BeforeAdviceBindingTests.java | 6 +- .../aop/aspectj/BeforeAdviceBindingTests.xml | 2 +- .../aop/aspectj/DeclareParentsTests.java | 4 +- .../aop/aspectj/DeclareParentsTests.xml | 6 +- ...licitJPArgumentMatchingAtAspectJTests.java | 6 +- ...plicitJPArgumentMatchingAtAspectJTests.xml | 2 +- .../ImplicitJPArgumentMatchingTests.xml | 4 +- .../OverloadedAdviceTests-ambiguous.xml | 2 +- .../aop/aspectj/OverloadedAdviceTests.xml | 2 +- ...pectImplementingInterfaceTests-context.xml | 2 +- .../AspectImplementingInterfaceTests.java | 4 +- ...xyCreatorAndLazyInitTargetSourceTests.java | 6 +- .../AspectJAutoProxyCreatorTests-aspects.xml | 4 +- ...toProxyCreatorTests-aspectsPlusAdvisor.xml | 6 +- ...xyCreatorTests-aspectsWithAbstractBean.xml | 2 +- ...oProxyCreatorTests-aspectsWithOrdering.xml | 2 +- ...AspectJAutoProxyCreatorTests-pertarget.xml | 4 +- .../AspectJAutoProxyCreatorTests-perthis.xml | 2 +- ...JAutoProxyCreatorTests-twoAdviceAspect.xml | 2 +- ...yCreatorTests-twoAdviceAspectPrototype.xml | 2 +- ...pectJAutoProxyCreatorTests-usesInclude.xml | 2 +- ...oProxyCreatorTests-usesJoinPointAspect.xml | 2 +- .../AspectJAutoProxyCreatorTests.java | 11 +- .../AtAspectJAfterThrowingTests-context.xml | 2 +- .../AtAspectJAfterThrowingTests.java | 6 +- .../benchmark/BenchmarkTests-aspectj.xml | 2 +- .../benchmark/BenchmarkTests-springAop.xml | 2 +- .../autoproxy/benchmark/BenchmarkTests.java | 4 +- ...fterReturningGenericTypeMatchingTests.java | 6 +- ...pNamespaceHandlerAdviceTypeTests-error.xml | 6 +- .../AopNamespaceHandlerAdviceTypeTests-ok.xml | 6 +- ...AopNamespaceHandlerArgNamesTests-error.xml | 6 +- .../AopNamespaceHandlerArgNamesTests-ok.xml | 6 +- ...ceHandlerProxyTargetClassTests-context.xml | 6 +- ...NamespaceHandlerProxyTargetClassTests.java | 4 +- ...opNamespaceHandlerReturningTests-error.xml | 6 +- .../AopNamespaceHandlerReturningTests-ok.xml | 6 +- .../AopNamespaceHandlerTests-context.xml | 6 +- .../aop/config/AopNamespaceHandlerTests.java | 14 +- ...AopNamespaceHandlerThrowingTests-error.xml | 6 +- .../AopNamespaceHandlerThrowingTests-ok.xml | 6 +- .../config/PrototypeProxyTests-context.xml | 10 +- .../aop/framework/AbstractAopProxyTests.java | 47 +- .../aop/framework/CglibProxyTests.java | 21 +- .../aop/framework/JdkDynamicProxyTests.java | 8 +- .../ProxyFactoryBeanTests-autowiring.xml | 4 +- .../ProxyFactoryBeanTests-context.xml | 66 +- ...xyFactoryBeanTests-double-targetsource.xml | 10 +- .../ProxyFactoryBeanTests-frozen.xml | 24 +- ...roxyFactoryBeanTests-inner-bean-target.xml | 23 +- .../ProxyFactoryBeanTests-invalid.xml | 4 +- ...yFactoryBeanTests-notlast-targetsource.xml | 6 +- .../ProxyFactoryBeanTests-prototype.xml | 6 +- .../ProxyFactoryBeanTests-serialization.xml | 20 +- .../ProxyFactoryBeanTests-targetsource.xml | 34 +- .../ProxyFactoryBeanTests-throws-advice.xml | 20 +- .../aop/framework/ProxyFactoryBeanTests.java | 20 +- ...visorAdapterRegistrationTests-with-bpp.xml | 4 +- ...orAdapterRegistrationTests-without-bpp.xml | 4 +- .../AdvisorAdapterRegistrationTests.java | 4 +- ...oProxyCreatorTests-common-interceptors.xml | 6 +- ...oProxyCreatorTests-custom-targetsource.xml | 16 +- ...AdvisorAutoProxyCreatorTests-optimized.xml | 4 +- ...toProxyCreatorTests-quick-targetsource.xml | 10 +- .../AdvisorAutoProxyCreatorTests.java | 26 +- .../autoproxy/AutoProxyCreatorTests.java | 10 +- ...nNameAutoProxyCreatorInitTests-context.xml | 2 +- .../BeanNameAutoProxyCreatorInitTests.java | 4 +- .../BeanNameAutoProxyCreatorTests-context.xml | 26 +- .../BeanNameAutoProxyCreatorTests.java | 19 +- .../aop/scope/ScopedProxyTests-list.xml | 2 +- .../aop/scope/ScopedProxyTests-override.xml | 2 +- .../aop/scope/ScopedProxyTests-testbean.xml | 2 +- .../aop/scope/ScopedProxyTests.java | 8 +- .../CommonsPoolTargetSourceTests-context.xml | 8 +- .../target/CommonsPoolTargetSourceTests.java | 8 +- .../org/springframework/beans/Colour.java | 36 - .../beans/DerivedTestBean.java | 90 -- .../beans/FieldAccessBean.java | 44 - .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 146 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/Person.java | 36 - .../beans/SerializablePerson.java | 70 -- .../factory/AbstractBeanFactoryTests.java | 329 ------ .../AbstractListableBeanFactoryTests.java | 84 -- .../beans/factory/LifecycleBean.java | 164 --- .../SingletonBeanFactoryLocatorTests.java | 182 ---- .../beans/factory/access/TestBean.java | 75 -- .../beans/factory/access/ref1.xml | 28 - .../CollectingReaderEventListener.java | 89 -- .../beans/factory/xml/DependenciesBean.java | 77 -- ...MethodWrappedByCglibProxyTests-context.xml | 2 +- .../LookupMethodWrappedByCglibProxyTests.java | 4 +- ...aceHandlerWithExpressionLanguageTests.java | 4 +- .../factory/xml/XmlBeanFactoryTestTypes.java | 10 +- .../xml/XmlBeanFactoryTests-autowire.xml | 12 +- .../factory/xml/XmlBeanFactoryTests-child.xml | 6 +- .../xml/XmlBeanFactoryTests-collections.xml | 74 +- ...lBeanFactoryTests-complexFactoryCircle.xml | 8 +- .../XmlBeanFactoryTests-constructorArg.xml | 12 +- ...lBeanFactoryTests-constructorOverrides.xml | 2 +- .../XmlBeanFactoryTests-defaultAutowire.xml | 8 +- .../XmlBeanFactoryTests-defaultLazyInit.xml | 2 +- ...mlBeanFactoryTests-delegationOverrides.xml | 4 +- .../xml/XmlBeanFactoryTests-factoryCircle.xml | 2 +- .../xml/XmlBeanFactoryTests-initializers.xml | 2 +- .../xml/XmlBeanFactoryTests-invalid.xml | 13 +- ...toryTests-invalidOverridesNoSuchMethod.xml | 2 +- ...nFactoryTests-localCollectionsUsingXsd.xml | 2 +- .../xml/XmlBeanFactoryTests-overrides.xml | 16 +- .../xml/XmlBeanFactoryTests-parent.xml | 6 +- .../xml/XmlBeanFactoryTests-reftypes.xml | 72 +- .../xml/XmlBeanFactoryTests-resource.xml | 2 +- .../XmlBeanFactoryTests-resourceImport.xml | 2 +- ...lBeanFactoryTests-satisfiedAllDepCheck.xml | 4 +- ...anFactoryTests-satisfiedObjectDepCheck.xml | 4 +- ...anFactoryTests-satisfiedSimpleDepCheck.xml | 2 +- ...toryTests-testWithDuplicateNameInAlias.xml | 4 +- ...eanFactoryTests-testWithDuplicateNames.xml | 4 +- ...s-unsatisfiedAllDepCheckMissingObjects.xml | 2 +- ...ts-unsatisfiedAllDepCheckMissingSimple.xml | 4 +- ...FactoryTests-unsatisfiedObjectDepCheck.xml | 2 +- ...FactoryTests-unsatisfiedSimpleDepCheck.xml | 2 +- .../factory/xml/XmlBeanFactoryTests.java | 15 +- .../CustomNamespaceHandlerTests-context.xml | 8 +- .../support/CustomNamespaceHandlerTests.java | 25 +- .../AbstractApplicationContextTests.java | 8 +- .../context/LifecycleContextBean.java | 4 +- ...ndiBeanFactoryLocatorTests-collections.xml | 74 +- ...textJndiBeanFactoryLocatorTests-parent.xml | 6 +- .../ContextJndiBeanFactoryLocatorTests.java | 4 +- .../AbstractCircularImportDetectionTests.java | 4 +- .../AnnotationProcessorPerformanceTests.java | 6 +- .../ClassPathBeanDefinitionScannerTests.java | 4 +- ...PathFactoryBeanDefinitionScannerTests.java | 6 +- ...ommonAnnotationBeanPostProcessorTests.java | 12 +- ...mponentScanAnnotationIntegrationTests.java | 4 +- .../ComponentScanParserScopedProxyTests.java | 4 +- .../ConfigurationClassAndBFPPTests.java | 4 +- ...nClassPostConstructAndAutowiringTests.java | 4 +- .../ConfigurationClassPostProcessorTests.java | 4 +- .../FooServiceDependentConverter.java | 8 +- .../NestedConfigurationClassTests.java | 4 +- .../PropertySourceAnnotationTests.java | 4 +- .../componentscan/level1/Level1Config.java | 4 +- .../componentscan/level2/Level2Config.java | 4 +- .../AutowiredConfigurationTests.java | 6 +- .../BeanMethodQualificationTests.java | 4 +- ...figurationClassAspectIntegrationTests.java | 8 +- .../ConfigurationClassProcessingTests.java | 6 +- ...assWithPlaceholderConfigurerBeanTests.java | 6 +- .../ConfigurationMetaAnnotationTests.java | 4 +- .../ImportAnnotationDetectionTests.java | 4 +- ...ortNonXmlResourceConfig-context.properties | 2 +- .../configuration/ImportResourceTests.java | 6 +- .../annotation/configuration/ImportTests.java | 6 +- .../configuration/ImportXmlConfig-context.xml | 2 +- .../ImportXmlWithAopNamespace-context.xml | 2 +- ...tedConfigurationClassEnhancementTests.java | 4 +- .../configuration/ScopingTests.java | 6 +- .../annotation4/FactoryMethodComponent.java | 4 +- .../context/annotation4/SimpleBean.java | 4 +- .../annotation6/ConfigForScanning.java | 2 +- .../event/ApplicationContextEventTests.java | 4 +- .../EventPublicationInterceptorTests.java | 6 +- .../ApplicationContextExpressionTests.java | 4 +- .../EnvironmentAccessorIntegrationTests.java | 4 +- .../BeanFactoryPostProcessorTests.java | 4 +- ...athXmlApplicationContextTests-resource.xml | 2 +- ...ApplicationContextTests-resourceImport.xml | 2 +- .../ClassPathXmlApplicationContextTests.java | 4 +- .../ConversionServiceFactoryBeanTests.java | 4 +- ...rtyResourceConfigurerIntegrationTests.java | 4 +- ...ertySourcesPlaceholderConfigurerTests.java | 4 +- .../support/SimpleThreadScopeTest.java | 4 +- ...ticApplicationContextMulticasterTests.java | 4 +- .../StaticApplicationContextTests.java | 4 +- .../support/StaticMessageSourceTests.java | 6 +- .../context/support/conversionService.xml | 2 +- ...onversionServiceWithResourceOverriding.xml | 2 +- .../context/support/testBeans.properties | 20 +- .../config/JeeNamespaceHandlerEventTests.java | 4 +- .../ejb/config/JeeNamespaceHandlerTests.java | 6 +- .../ejb/config/jeeNamespaceHandlerTests.xml | 14 +- .../jmx/export/MBeanExporterTests.java | 7 +- .../AbstractMetadataAssemblerTests.java | 5 +- .../export/propertyPlaceholderConfigurer.xml | 2 +- .../jndi/JndiObjectFactoryBeanTests.java | 12 +- .../jndi/JndiPropertySourceTests.java | 4 +- .../jndi/SimpleNamingContextTests.java | 6 +- .../mock/env/MockPropertySource.java | 104 -- .../mock/jndi/ExpectedLookupTemplate.java | 82 -- .../mock/jndi/SimpleNamingContextBuilder.java | 237 ----- .../mock/jndi/package-info.java | 10 - .../scheduling/timer/TimerSupportTests.java | 4 +- .../scripting/ContextScriptBean.java | 4 +- .../scripting/TestBeanAwareMessenger.java | 4 +- .../scripting/bsh/BshScriptFactoryTests.java | 4 +- .../scripting/bsh/MessengerImpl.bsh | 2 +- .../scripting/bsh/bsh-with-xsd.xml | 2 +- .../groovy/GroovyScriptFactoryTests.java | 2 +- .../scripting/groovy/ScriptBean.groovy | 2 +- .../groovy/groovy-multiple-properties.xml | 2 +- ...tFactoryTests-beanNameAutoProxyCreator.xml | 2 +- ...sedJRubyScriptFactoryTests-factoryBean.xml | 2 +- .../jruby/AdvisedJRubyScriptFactoryTests.java | 5 +- .../jruby/JRubyScriptFactoryTests.java | 2 +- .../scripting/jruby/jruby-with-xsd.xml | 2 +- .../context}/SimpleMapScope.java | 3 +- .../context}/TestMethodInvokingTask.java | 2 +- .../mock/jndi/ExpectedLookupTemplate.java | 2 +- .../mock/jndi/SimpleNamingContext.java | 4 +- .../mock/jndi/SimpleNamingContextBuilder.java | 2 +- .../tests/mock/jndi/package-info.java | 23 +- .../sample}/beans/BeanWithObjectProperty.java | 2 +- .../tests/sample}/beans/Employee.java | 4 +- .../tests/sample}/beans/FactoryMethods.java | 2 +- .../tests/sample}/beans/FieldAccessBean.java | 2 +- .../sample}/beans/ResourceTestBean.java | 2 +- .../org/springframework/ui/ModelMapTests.java | 4 +- .../util/SerializationTestUtils.java | 65 -- .../DataBinderFieldAccessTests.java | 6 +- .../validation/DataBinderTests.java | 36 +- .../DefaultMessageCodesResolverTests.java | 16 +- .../validation/ValidationUtilsTests.java | 4 +- .../BeanValidationPostProcessorTests.java | 4 +- .../advice/CountingAfterReturningAdvice.java | 36 - .../test/advice/CountingBeforeAdvice.java | 36 - .../test/java/test/advice/MethodCounter.java | 70 -- .../src/test/java/test/beans/Colour.java | 37 - .../src/test/java/test/beans/CustomScope.java | 74 -- .../java/test/beans/DependsOnTestBean.java | 36 - .../test/java/test/beans/INestedTestBean.java | 22 - .../src/test/java/test/beans/IOther.java | 22 - .../src/test/java/test/beans/ITestBean.java | 62 -- .../test/java/test/beans/IndexedTestBean.java | 143 --- .../test/java/test/beans/NestedTestBean.java | 64 -- .../test/java/test/beans/SideEffectBean.java | 41 - .../src/test/java/test/beans/TestBean.java | 436 -------- ...paceHandlerWithExpressionLanguageTests.xml | 4 +- .../support/simpleThreadScopeTests.xml | 18 +- .../core/type/AnnotationMetadataTests.java | 4 +- .../type}/TestAutowired.java | 2 +- .../type}/TestQualifier.java | 2 +- .../tests}/TestResourceUtils.java | 4 +- .../springframework/tests}/TimeStamped.java | 2 +- .../util/SerializationTestUtils.java | 60 +- .../org/springframework/beans/Colour.java | 36 - .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 457 --------- .../jdbc/core/RowMapperTests.java | 4 +- .../BeanPropertySqlParameterSourceTests.java | 4 +- .../JdbcBeanDefinitionReaderTests.java | 6 +- .../org/springframework/beans/Colour.java | 36 - .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 457 --------- .../jms/config/JmsNamespaceHandlerTests.java | 4 +- .../jms/config/jmsNamespaceHandlerTests.xml | 6 +- .../jms/remoting/JmsInvokerTests.java | 6 +- .../CallCountingTransactionManager.java | 63 -- .../web/DelegatingServletInputStream.java | 68 -- .../web/DelegatingServletOutputStream.java | 74 -- .../mock/web/HeaderValueHolder.java | 96 -- .../mock/web/MockFilterChain.java | 184 ---- .../mock/web/MockFilterConfig.java | 108 -- .../mock/web/MockHttpServletRequest.java | 964 ------------------ .../mock/web/MockHttpServletResponse.java | 641 ------------ .../mock/web/MockHttpSession.java | 278 ----- .../mock/web/MockRequestDispatcher.java | 95 -- .../mock/web/MockServletConfig.java | 107 -- .../mock/web/MockServletContext.java | 516 ---------- .../mock/web/PassThroughFilterChain.java | 86 -- .../org/springframework/beans/Colour.java | 36 - .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 457 --------- .../beans/factory/config/SimpleMapScope.java | 88 -- .../mock/jndi/ExpectedLookupTemplate.java | 82 -- .../mock/jndi/SimpleNamingContext.java | 381 ------- .../mock/jndi/SimpleNamingContextBuilder.java | 237 ----- .../HibernateJtaTransactionTests.java | 4 +- .../hibernate3/HibernateTemplateTests.java | 4 +- .../LocalSessionFactoryBeanTests.java | 10 +- .../orm/hibernate3/support/LobTypeTests.java | 4 +- .../orm/jdo/JdoTransactionManagerTests.java | 6 +- .../orm/jpa/domain/ContextualPerson.java | 4 +- .../orm/jpa/domain/Person.java | 4 +- .../orm/jpa/domain/persistence-multi.xml | 2 +- .../PersistenceXmlParsingTests.java | 4 +- .../support/PersistenceInjectionTests.java | 6 +- .../transaction/MockJtaTransaction.java | 67 -- .../util/SerializationTestUtils.java | 97 -- .../beans/factory/xml/child.xml | 6 +- .../beans/factory/xml/test.xml | 32 +- .../org/springframework/beans/Colour.java | 37 - .../org/springframework/beans/Employee.java | 39 - .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 146 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 455 --------- ...stractSpr3350SingleSpringContextTests.java | 4 +- ...ingleSpringContextTests-context.properties | 2 +- ...pr3350SingleSpringContextTests-context.xml | 2 +- ...AndInheritedLoaderTests-context.properties | 2 +- ...dingPropertiesAndInheritedLoaderTests.java | 4 +- ...xtendingPropertiesTests-context.properties | 2 +- ...ithPropertiesExtendingPropertiesTests.java | 4 +- ...ionalJUnit38SpringContextTests-context.xml | 4 +- ...ransactionalJUnit38SpringContextTests.java | 6 +- ...tionalJUnit4SpringContextTests-context.xml | 4 +- ...TransactionalJUnit4SpringContextTests.java | 6 +- ...ltContextLoaderClassSpringRunnerTests.java | 4 +- ...gJUnit4ClassRunnerAppCtxTests-context1.xml | 2 +- ...gJUnit4ClassRunnerAppCtxTests-context2.xml | 2 +- ...erizedDependencyInjectionTests-context.xml | 6 +- ...ParameterizedDependencyInjectionTests.java | 6 +- ...4ClassRunnerAppCtxTests-context.properties | 2 +- ...sedSpringJUnit4ClassRunnerAppCtxTests.java | 4 +- ...ngJUnit4ClassRunnerAppCtxTests-context.xml | 4 +- .../SpringJUnit4ClassRunnerAppCtxTests.java | 6 +- ...ingDefaultConfigClassesInheritedTests.java | 4 +- .../DefaultConfigClassesBaseTests.java | 4 +- .../DefaultConfigClassesInheritedTests.java | 4 +- ...ingDefaultConfigClassesInheritedTests.java | 4 +- ...ltLoaderDefaultConfigClassesBaseTests.java | 4 +- ...derDefaultConfigClassesInheritedTests.java | 4 +- ...tLoaderExplicitConfigClassesBaseTests.java | 4 +- ...erExplicitConfigClassesInheritedTests.java | 4 +- .../ExplicitConfigClassesBaseTests.java | 4 +- .../ExplicitConfigClassesInheritedTests.java | 4 +- .../annotation/PojoAndStringConfig.java | 6 +- .../DefaultProfileAnnotationConfigTests.java | 6 +- .../annotation/DefaultProfileConfig.java | 4 +- .../profile/annotation/DevProfileConfig.java | 4 +- .../DefaultProfileAnnotationConfigTests.java | 6 +- .../importresource/DefaultProfileConfig.java | 4 +- .../junit4/profile/importresource/import.xml | 2 +- .../DefaultProfileXmlConfigTests-context.xml | 4 +- .../xml/DefaultProfileXmlConfigTests.java | 6 +- ...DefaultLocationsInheritedTests-context.xml | 2 +- .../DefaultLocationsBaseTests-context.xml | 2 +- .../spr3896/DefaultLocationsBaseTests.java | 4 +- ...DefaultLocationsInheritedTests-context.xml | 2 +- .../DefaultLocationsInheritedTests.java | 4 +- .../spr3896/ExplicitLocationsBaseTests.java | 4 +- .../ExplicitLocationsInheritedTests.java | 4 +- ...ransactionalAnnotatedConfigClassTests.java | 4 +- ...edConfigClassWithAtConfigurationTests.java | 4 +- ...figClassesWithoutAtConfigurationTests.java | 4 +- ...aTransactionManagementConfigurerTests.java | 6 +- .../spr9645/LookUpNonexistentTxMgrTests.java | 6 +- .../LookUpTxMgrByTypeAndDefaultNameTests.java | 6 +- .../LookUpTxMgrByTypeAndNameTests.java | 6 +- ...grByTypeAndQualifierAtClassLevelTests.java | 6 +- ...rByTypeAndQualifierAtMethodLevelTests.java | 6 +- .../spr9645/LookUpTxMgrByTypeTests.java | 6 +- ...TransactionalTestNGSpringContextTests.java | 6 +- ...tionalTestNGSpringContextTests-context.xml | 4 +- ...TransactionalTestNGSpringContextTests.java | 6 +- .../RequestAndSessionScopedBeansWacTests.java | 4 +- ...tAndSessionScopedBeansWacTests-context.xml | 4 +- .../org/springframework/beans/Colour.java | 36 - .../beans/DerivedTestBean.java | 90 -- .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 457 --------- .../CollectingReaderEventListener.java | 91 -- .../mock/jndi/SimpleNamingContext.java | 381 ------- .../CallCountingTransactionManager.java | 3 +- .../transaction/MockJtaTransaction.java | 2 +- .../CallCountingTransactionManager.java | 63 -- .../JndiJtaTransactionManagerTests.java | 4 +- .../JtaTransactionManagerTests.java | 3 +- .../TxNamespaceHandlerEventTests.java | 4 +- .../transaction/TxNamespaceHandlerTests.java | 5 +- ...tationTransactionAttributeSourceTests.java | 4 +- ...AnnotationTransactionInterceptorTests.java | 4 +- ...ationTransactionNamespaceHandlerTests.java | 4 +- .../EnableTransactionManagementTests.java | 4 +- ...tationTransactionNamespaceHandlerTests.xml | 2 +- .../config/AnnotationDrivenTests.java | 4 +- .../TransactionManagerConfiguration.java | 4 +- .../annotationDrivenProxyTargetClassTests.xml | 4 +- .../AbstractTransactionAspectTests.java | 6 +- .../BeanFactoryTransactionTests.java | 10 +- .../interceptor/ImplementsNoInterfaces.java | 4 +- .../noTransactionAttributeSource.xml | 5 +- .../interceptor/transactionalBeanFactory.xml | 12 +- .../WebSphereUowTransactionManagerTests.java | 4 +- ...aTransactionManagerSerializationTests.java | 4 +- .../transaction/txNamespaceHandlerTests.xml | 4 +- .../util/SerializationTestUtils.java | 97 -- .../beans/BeanWithObjectProperty.java | 35 - .../org/springframework/beans/Colour.java | 36 - .../beans/DerivedTestBean.java | 90 -- .../beans/FieldAccessBean.java | 44 - .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/Person.java | 36 - .../beans/SerializablePerson.java | 70 -- .../org/springframework/beans/TestBean.java | 495 --------- .../beans/factory/DummyFactory.java | 179 ---- .../AbstractHttpRequestFactoryTestCase.java | 3 +- .../http/client/FreePortScanner.java | 99 -- .../remoting/caucho/CauchoRemotingTests.java | 6 +- .../httpinvoker/HttpInvokerTests.java | 6 +- .../tests/web}/FreePortScanner.java | 2 +- .../util/SerializationTestUtils.java | 97 -- .../web/bind/EscapedErrorsTests.java | 4 +- .../bind/ServletRequestDataBinderTests.java | 6 +- .../support/WebRequestDataBinderTests.java | 39 +- .../client/RestTemplateIntegrationTests.java | 4 +- .../RequestAndSessionScopedBeanTests.java | 4 +- .../context/request/RequestScopeTests.java | 6 +- .../request/RequestScopedProxyTests.java | 10 +- .../context/request/SessionScopeTests.java | 6 +- .../WebApplicationContextScopeTests.java | 4 +- .../SpringBeanAutowiringSupportTests.java | 6 +- .../jsf/DelegatingVariableResolverTests.java | 4 +- .../ModelAttributeMethodProcessorTests.java | 4 +- .../SessionAttributesHandlerTests.java | 4 +- .../web/context/request/requestScopeTests.xml | 18 +- .../request/requestScopedProxyTests.xml | 20 +- .../web/context/request/sessionScopeTests.xml | 4 +- .../org/springframework/beans/Colour.java | 36 - .../beans/DerivedTestBean.java | 90 -- .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../org/springframework/beans/TestBean.java | 457 --------- .../factory/AbstractBeanFactoryTests.java | 329 ------ .../AbstractListableBeanFactoryTests.java | 84 -- .../beans/factory/DummyFactory.java | 179 ---- .../beans/factory/LifecycleBean.java | 164 --- .../beans/factory/MustBeInitialized.java | 47 - .../AbstractApplicationContextTests.java | 160 --- .../context/LifecycleContextBean.java | 2 +- .../web/DelegatingServletOutputStream.java | 74 -- .../mock/web/HeaderValueHolder.java | 96 -- .../mock/web/MockHttpServletResponse.java | 641 ------------ .../mock/web/MockHttpSession.java | 278 ----- .../mock/web/MockMultipartFile.java | 139 --- .../mock/web/MockRequestDispatcher.java | 95 -- .../mock/web/MockServletContext.java | 516 ---------- .../mock/web/portlet/MockPortletSession.java | 5 +- .../ComplexPortletApplicationContext.java | 5 +- .../web/portlet/DispatcherPortletTests.java | 4 +- .../SimplePortletApplicationContext.java | 4 +- .../bind/PortletRequestDataBinderTests.java | 6 +- ...AbstractXmlWebApplicationContextTests.java | 4 +- .../PortletApplicationContextScopeTests.java | 14 +- .../context/WEB-INF/applicationContext.xml | 6 +- .../context/WEB-INF/contextInclude.xml | 2 +- .../portlet/context/WEB-INF/test-servlet.xml | 16 +- .../XmlPortletApplicationContextTests.java | 4 +- .../portlet/mvc/CommandControllerTests.java | 6 +- .../Portlet20AnnotationControllerTests.java | 8 +- .../PortletAnnotationControllerTests.java | 8 +- .../web/portlet/util/PortletUtilsTests.java | 6 +- .../beans/BeanWithObjectProperty.java | 35 - .../org/springframework/beans/Colour.java | 36 - .../beans/DerivedTestBean.java | 90 -- .../springframework/beans/GenericBean.java | 247 ----- .../beans/INestedTestBean.java | 23 - .../org/springframework/beans/IOther.java | 24 - .../org/springframework/beans/ITestBean.java | 71 -- .../beans/IndexedTestBean.java | 145 --- .../springframework/beans/NestedTestBean.java | 61 -- .../java/org/springframework/beans/Pet.java | 54 - .../org/springframework/beans/TestBean.java | 457 --------- .../beans/factory/DummyFactory.java | 179 ---- .../beans/factory/LifecycleBean.java | 164 --- .../beans/factory/MustBeInitialized.java | 47 - .../context/LifecycleContextBean.java | 2 +- .../ui/jasperreports/PersonBean.java | 64 -- .../ui/jasperreports/ProductBean.java | 64 -- .../util/SerializationTestUtils.java | 65 -- .../AbstractApplicationContextTests.java | 166 --- .../web/context/AbstractBeanFactoryTests.java | 337 ------ .../AbstractListableBeanFactoryTests.java | 71 -- .../web/context/ContextLoaderTests.java | 6 +- .../ResourceBundleMessageSourceTests.java | 281 ----- .../ContextLoaderTests-acc-context.xml | 2 +- .../context/WEB-INF/applicationContext.xml | 6 +- .../web/context/WEB-INF/context-addition.xml | 14 +- .../web/context/WEB-INF/contextInclude.xml | 2 +- .../web/context/WEB-INF/sessionContext.xml | 4 +- .../web/context/WEB-INF/test-servlet.xml | 16 +- .../web/context/WEB-INF/testNamespace.xml | 4 +- .../XmlWebApplicationContextTests.java | 5 +- .../support/ServletContextSupportTests.java | 4 +- .../servlet/ComplexWebApplicationContext.java | 4 +- .../web/servlet/DispatcherServletTests.java | 4 +- .../servlet/SimpleWebApplicationContext.java | 4 +- ...MvcConfigurationSupportExtensionTests.java | 4 +- .../mvc/CancellableFormControllerTests.java | 4 +- .../servlet/mvc/CommandControllerTests.java | 4 +- .../web/servlet/mvc/FormControllerTests.java | 6 +- .../mvc/WizardFormControllerTests.java | 4 +- .../ServletAnnotationControllerTests.java | 12 +- ...ExtendedServletRequestDataBinderTests.java | 4 +- ...ResolverMethodReturnValueHandlerTests.java | 4 +- ...MappingHandlerAdapterIntegrationTests.java | 4 +- .../RequestPartIntegrationTests.java | 4 +- ...vetModelAttributeMethodProcessorTests.java | 4 +- ...nnotationControllerHandlerMethodTests.java | 12 +- .../MultiActionControllerTests.java | 4 +- .../DefaultHandlerExceptionResolverTests.java | 4 +- .../RedirectAttributesModelMapTests.java | 4 +- .../web/servlet/tags/BindTagTests.java | 8 +- .../tags/form/AbstractFormTagTests.java | 4 +- .../web/servlet/tags/form/ButtonTagTests.java | 4 +- .../servlet/tags/form/CheckboxTagTests.java | 8 +- .../servlet/tags/form/CheckboxesTagTests.java | 8 +- .../web/servlet/tags/form/ErrorsTagTests.java | 4 +- .../tags/form/HiddenInputTagTests.java | 4 +- .../web/servlet/tags/form/InputTagTests.java | 4 +- .../web/servlet/tags/form/LabelTagTests.java | 4 +- .../servlet/tags/form/OptionTagEnumTests.java | 6 +- .../web/servlet/tags/form/OptionTagTests.java | 6 +- .../servlet/tags/form/OptionsTagTests.java | 4 +- .../tags/form/RadioButtonTagTests.java | 6 +- .../tags/form/RadioButtonsTagTests.java | 8 +- .../web/servlet/tags/form/SelectTagTests.java | 6 +- .../tags/form/TestBeanWithRealCountry.java | 4 +- .../servlet/tags/form/TextareaTagTests.java | 4 +- .../web/servlet/view/RedirectViewTests.java | 4 +- .../web/servlet/view/ViewResolverTests.java | 4 +- .../view/freemarker/FreeMarkerMacroTests.java | 4 +- .../view/velocity/VelocityMacroTests.java | 4 +- .../view/velocity/VelocityRenderTests.java | 4 +- .../web/context/WEB-INF/sessionContext.xml | 4 +- ...ceHandlerScopeIntegrationTests-context.xml | 8 +- ...NamespaceHandlerScopeIntegrationTests.java | 14 +- ...toProxyCreatorIntegrationTests-context.xml | 32 +- ...visorAutoProxyCreatorIntegrationTests.java | 59 +- ...ansactionalAnnotationIntegrationTests.java | 18 +- .../CallCountingTransactionManager.java | 65 -- ...TransactionManagementIntegrationTests.java | 4 +- .../test/advice/CountingBeforeAdvice.java | 36 - src/test/java/test/beans/Colour.java | 36 - src/test/java/test/beans/INestedTestBean.java | 23 - src/test/java/test/beans/IOther.java | 24 - src/test/java/test/beans/ITestBean.java | 71 -- src/test/java/test/beans/IndexedTestBean.java | 145 --- src/test/java/test/beans/NestedTestBean.java | 61 -- src/test/java/test/beans/Pet.java | 54 - src/test/java/test/beans/TestBean.java | 457 --------- .../java/test/interceptor/NopInterceptor.java | 59 -- .../SerializableNopInterceptor.java | 48 - .../test/util/SerializationTestUtils.java | 100 -- 813 files changed, 2233 insertions(+), 27852 deletions(-) rename {src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/advice/CountingAfterReturningAdvice.java (95%) rename spring-aop/src/test/java/{test/aop => org/springframework/tests/aop/advice}/CountingBeforeAdvice.java (95%) rename {src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/advice/MethodCounter.java (97%) rename {spring-context/src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/advice/MyThrowsHandler.java (93%) rename {spring-context/src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/advice/TimestampIntroductionAdvisor.java (89%) rename {spring-context/src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/interceptor/NopInterceptor.java (96%) rename {spring-context/src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/interceptor/SerializableNopInterceptor.java (95%) rename {spring-context/src/test/java/test => spring-aop/src/test/java/org/springframework/tests/aop}/interceptor/TimestampIntroductionInterceptor.java (89%) rename {spring-webmvc/src/test/java/org/springframework => spring-aop/src/test/java/org/springframework/tests/sample}/beans/Person.java (82%) rename {spring-webmvc/src/test/java/org/springframework => spring-aop/src/test/java/org/springframework/tests/sample}/beans/SerializablePerson.java (96%) rename spring-aop/src/test/java/{test => org/springframework/tests/sample}/beans/subpkg/DeepBean.java (94%) delete mode 100644 spring-aop/src/test/java/test/aop/MethodCounter.java delete mode 100644 spring-aop/src/test/java/test/aop/NopInterceptor.java delete mode 100644 spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java delete mode 100644 spring-aop/src/test/java/test/beans/Colour.java delete mode 100644 spring-aop/src/test/java/test/beans/DerivedTestBean.java delete mode 100644 spring-aop/src/test/java/test/beans/INestedTestBean.java delete mode 100644 spring-aop/src/test/java/test/beans/IOther.java delete mode 100644 spring-aop/src/test/java/test/beans/ITestBean.java delete mode 100644 spring-aop/src/test/java/test/beans/NestedTestBean.java delete mode 100644 spring-aop/src/test/java/test/beans/SerializablePerson.java delete mode 100644 spring-aop/src/test/java/test/beans/TestBean.java delete mode 100644 spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java delete mode 100644 spring-aop/src/test/java/test/util/SerializationTestUtils.java delete mode 100644 spring-aop/src/test/java/test/util/TimeStamped.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-aspects/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java rename spring-aspects/src/test/java/org/springframework/cache/aspectj/{AspectJAnnotationTest.java => AspectJAnnotationTests.java} (56%) delete mode 100644 spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java rename {spring-context => spring-beans}/src/test/java/org/springframework/beans/factory/access/beans1.xml (100%) rename {spring-context => spring-beans}/src/test/java/org/springframework/beans/factory/access/beans2.xml (100%) rename spring-beans/src/test/java/org/springframework/{beans/factory/xml => tests/beans}/CollectingReaderEventListener.java (98%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/BooleanTestBean.java (95%) rename {spring-context-support/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/Colour.java (95%) rename {spring-aop/src/test/java/test => spring-beans/src/test/java/org/springframework/tests/sample}/beans/CountingTestBean.java (94%) rename {spring-webmvc/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/CustomEnum.java (94%) rename spring-beans/src/test/java/org/springframework/{beans/factory/xml => tests/sample/beans}/DependenciesBean.java (95%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/DerivedTestBean.java (97%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/DummyBean.java (96%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/DummyFactory.java (97%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/GenericBean.java (95%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/GenericIntegerBean.java (93%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/GenericSetOfIntegerBean.java (93%) rename {spring-context/src/test/java/org/springframework/beans/factory => spring-beans/src/test/java/org/springframework/tests/sample/beans}/HasMap.java (75%) rename {spring-aspects/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/INestedTestBean.java (93%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/IOther.java (93%) rename {spring-web/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/ITestBean.java (90%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/IndexedTestBean.java (98%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/LifecycleBean.java (99%) rename {spring-context/src/test/java/org/springframework/beans/factory => spring-beans/src/test/java/org/springframework/tests/sample/beans}/MustBeInitialized.java (92%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/NestedTestBean.java (96%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/NumberTestBean.java (98%) rename spring-beans/src/test/java/{test => org/springframework/tests/sample}/beans/PackageLevelVisibleBean.java (94%) rename {spring-test/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/Pet.java (96%) rename {spring-aop/src/test/java/test => spring-beans/src/test/java/org/springframework/tests/sample}/beans/SideEffectBean.java (95%) rename {spring-context/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/TestBean.java (89%) rename {spring-context/src/test/java/org/springframework => spring-beans/src/test/java/org/springframework/tests/sample}/beans/factory/DummyFactory.java (87%) create mode 100644 spring-beans/src/test/java/org/springframework/tests/sample/beans/package-info.java delete mode 100644 spring-beans/src/test/java/org/springframework/util/SerializationTestUtils.java delete mode 100644 spring-beans/src/test/java/test/beans/Colour.java delete mode 100644 spring-beans/src/test/java/test/beans/CustomEnum.java delete mode 100644 spring-beans/src/test/java/test/beans/INestedTestBean.java delete mode 100644 spring-beans/src/test/java/test/beans/ITestBean.java delete mode 100644 spring-beans/src/test/java/test/beans/TestBean.java delete mode 100644 spring-beans/src/test/java/test/util/TestResourceUtils.java delete mode 100644 spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-context-support/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-context-support/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-context-support/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/Person.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/SerializablePerson.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/access/ref1.xml delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java delete mode 100644 spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java delete mode 100644 spring-context/src/test/java/org/springframework/mock/env/MockPropertySource.java delete mode 100644 spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java delete mode 100644 spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java delete mode 100644 spring-context/src/test/java/org/springframework/mock/jndi/package-info.java rename spring-context/src/test/java/org/springframework/{beans/factory/config => tests/context}/SimpleMapScope.java (95%) rename spring-context/src/test/java/org/springframework/{scheduling => tests/context}/TestMethodInvokingTask.java (96%) rename {spring-tx/src/test/java/org/springframework => spring-context/src/test/java/org/springframework/tests}/mock/jndi/ExpectedLookupTemplate.java (98%) rename spring-context/src/test/java/org/springframework/{ => tests}/mock/jndi/SimpleNamingContext.java (98%) rename {spring-tx/src/test/java/org/springframework => spring-context/src/test/java/org/springframework/tests}/mock/jndi/SimpleNamingContextBuilder.java (99%) rename spring-aop/src/test/java/test/beans/Person.java => spring-context/src/test/java/org/springframework/tests/mock/jndi/package-info.java (62%) rename spring-context/src/test/java/org/springframework/{ => tests/sample}/beans/BeanWithObjectProperty.java (94%) rename spring-context/src/test/java/{test => org/springframework/tests/sample}/beans/Employee.java (89%) rename spring-context/src/test/java/{test => org/springframework/tests/sample}/beans/FactoryMethods.java (95%) rename {spring-webmvc/src/test/java/org/springframework => spring-context/src/test/java/org/springframework/tests/sample}/beans/FieldAccessBean.java (94%) rename spring-context/src/test/java/org/springframework/{ => tests/sample}/beans/ResourceTestBean.java (97%) delete mode 100644 spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java delete mode 100644 spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java delete mode 100644 spring-context/src/test/java/test/advice/CountingBeforeAdvice.java delete mode 100644 spring-context/src/test/java/test/advice/MethodCounter.java delete mode 100644 spring-context/src/test/java/test/beans/Colour.java delete mode 100644 spring-context/src/test/java/test/beans/CustomScope.java delete mode 100644 spring-context/src/test/java/test/beans/DependsOnTestBean.java delete mode 100644 spring-context/src/test/java/test/beans/INestedTestBean.java delete mode 100644 spring-context/src/test/java/test/beans/IOther.java delete mode 100644 spring-context/src/test/java/test/beans/ITestBean.java delete mode 100644 spring-context/src/test/java/test/beans/IndexedTestBean.java delete mode 100644 spring-context/src/test/java/test/beans/NestedTestBean.java delete mode 100644 spring-context/src/test/java/test/beans/SideEffectBean.java delete mode 100644 spring-context/src/test/java/test/beans/TestBean.java rename spring-core/src/test/java/org/springframework/{beans/factory/annotation => core/type}/TestAutowired.java (95%) rename spring-core/src/test/java/org/springframework/{beans/factory/annotation => core/type}/TestQualifier.java (95%) rename {spring-aop/src/test/java/test/util => spring-core/src/test/java/org/springframework/tests}/TestResourceUtils.java (91%) rename {spring-context/src/test/java/test/util => spring-core/src/test/java/org/springframework/tests}/TimeStamped.java (96%) delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-jdbc/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-jms/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-jms/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletInputStream.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/HeaderValueHolder.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockFilterChain.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockFilterConfig.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpSession.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockRequestDispatcher.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockServletConfig.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockServletContext.java delete mode 100644 spring-orm-hibernate4/src/test/java/org/springframework/mock/web/PassThroughFilterChain.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-orm/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java delete mode 100644 spring-orm/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java delete mode 100644 spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java delete mode 100644 spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java delete mode 100644 spring-orm/src/test/java/org/springframework/transaction/MockJtaTransaction.java delete mode 100644 spring-orm/src/test/java/org/springframework/util/SerializationTestUtils.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/Employee.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-test/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java delete mode 100644 spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java rename {spring-test/src/test/java/org/springframework/test => spring-tx/src/test/java/org/springframework/tests}/transaction/CallCountingTransactionManager.java (97%) rename spring-tx/src/test/java/org/springframework/{ => tests}/transaction/MockJtaTransaction.java (96%) delete mode 100644 spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java delete mode 100644 spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/Person.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/SerializablePerson.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java delete mode 100644 spring-web/src/test/java/org/springframework/http/client/FreePortScanner.java rename {spring-webmvc/src/test/java/org/springframework/http/client => spring-web/src/test/java/org/springframework/tests/web}/FreePortScanner.java (98%) delete mode 100644 spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/HeaderValueHolder.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpSession.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockRequestDispatcher.java delete mode 100644 spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockServletContext.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/Colour.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/INestedTestBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/IOther.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/ITestBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/IndexedTestBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/NestedTestBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/Pet.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/TestBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/factory/DummyFactory.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/factory/LifecycleBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/beans/factory/MustBeInitialized.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/ui/jasperreports/PersonBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/ui/jasperreports/ProductBean.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/util/SerializationTestUtils.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/web/context/AbstractApplicationContextTests.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java delete mode 100644 spring-webmvc/src/test/java/org/springframework/web/context/ResourceBundleMessageSourceTests.java delete mode 100644 src/test/java/org/springframework/transaction/CallCountingTransactionManager.java delete mode 100644 src/test/java/test/advice/CountingBeforeAdvice.java delete mode 100644 src/test/java/test/beans/Colour.java delete mode 100644 src/test/java/test/beans/INestedTestBean.java delete mode 100644 src/test/java/test/beans/IOther.java delete mode 100644 src/test/java/test/beans/ITestBean.java delete mode 100644 src/test/java/test/beans/IndexedTestBean.java delete mode 100644 src/test/java/test/beans/NestedTestBean.java delete mode 100644 src/test/java/test/beans/Pet.java delete mode 100644 src/test/java/test/beans/TestBean.java delete mode 100644 src/test/java/test/interceptor/NopInterceptor.java delete mode 100644 src/test/java/test/interceptor/SerializableNopInterceptor.java delete mode 100644 src/test/java/test/util/SerializationTestUtils.java diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java index cf96bf3f06b..429350b00d8 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -33,10 +33,10 @@ import org.springframework.aop.Pointcut; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.support.DefaultPointcutAdvisor; -import test.beans.IOther; -import test.beans.ITestBean; -import test.beans.TestBean; -import test.beans.subpkg.DeepBean; +import org.springframework.tests.sample.beans.IOther; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.subpkg.DeepBean; /** * @author Rob Harrop @@ -66,7 +66,7 @@ public final class AspectJExpressionPointcutTests { @Test public void testMatchExplicit() { - String expression = "execution(int test.beans.TestBean.getAge())"; + String expression = "execution(int org.springframework.tests.sample.beans.TestBean.getAge())"; Pointcut pointcut = getPointcut(expression); ClassFilter classFilter = pointcut.getClassFilter(); @@ -128,8 +128,8 @@ public final class AspectJExpressionPointcutTests { * @throws SecurityException */ private void testThisOrTarget(String which) throws SecurityException, NoSuchMethodException { - String matchesTestBean = which + "(test.beans.TestBean)"; - String matchesIOther = which + "(test.beans.IOther)"; + String matchesTestBean = which + "(org.springframework.tests.sample.beans.TestBean)"; + String matchesIOther = which + "(org.springframework.tests.sample.beans.IOther)"; AspectJExpressionPointcut testBeanPc = new AspectJExpressionPointcut(); testBeanPc.setExpression(matchesTestBean); @@ -156,7 +156,7 @@ public final class AspectJExpressionPointcutTests { } private void testWithinPackage(boolean matchSubpackages) throws SecurityException, NoSuchMethodException { - String withinBeansPackage = "within(test.beans."; + String withinBeansPackage = "within(org.springframework.tests.sample.beans."; // Subpackages are matched by ** if (matchSubpackages) { withinBeansPackage += "."; @@ -214,7 +214,7 @@ public final class AspectJExpressionPointcutTests { @Test public void testMatchWithArgs() throws Exception { - String expression = "execution(void test.beans.TestBean.setSomeNumber(Number)) && args(Double)"; + String expression = "execution(void org.springframework.tests.sample.beans.TestBean.setSomeNumber(Number)) && args(Double)"; Pointcut pointcut = getPointcut(expression); ClassFilter classFilter = pointcut.getClassFilter(); @@ -235,7 +235,7 @@ public final class AspectJExpressionPointcutTests { @Test public void testSimpleAdvice() { - String expression = "execution(int test.beans.TestBean.getAge())"; + String expression = "execution(int org.springframework.tests.sample.beans.TestBean.getAge())"; CallCountingInterceptor interceptor = new CallCountingInterceptor(); @@ -254,7 +254,7 @@ public final class AspectJExpressionPointcutTests { @Test public void testDynamicMatchingProxy() { - String expression = "execution(void test.beans.TestBean.setSomeNumber(Number)) && args(Double)"; + String expression = "execution(void org.springframework.tests.sample.beans.TestBean.setSomeNumber(Number)) && args(Double)"; CallCountingInterceptor interceptor = new CallCountingInterceptor(); @@ -273,7 +273,7 @@ public final class AspectJExpressionPointcutTests { @Test public void testInvalidExpression() { - String expression = "execution(void test.beans.TestBean.setSomeNumber(Number) && args(Double)"; + String expression = "execution(void org.springframework.tests.sample.beans.TestBean.setSomeNumber(Number) && args(Double)"; try { getPointcut(expression).getClassFilter(); // call to getClassFilter forces resolution @@ -315,7 +315,7 @@ public final class AspectJExpressionPointcutTests { @Test public void testWithUnsupportedPointcutPrimitive() throws Exception { - String expression = "call(int test.beans.TestBean.getAge())"; + String expression = "call(int org.springframework.tests.sample.beans.TestBean.getAge())"; try { getPointcut(expression).getClassFilter(); // call to getClassFilter forces resolution... diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java index ac6dc31a2a2..057ad77309f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.*; import org.junit.Test; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Tests for matching of bean() pointcut designator. diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java index 8c84e801b8d..551756eea73 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,8 +28,8 @@ import org.aspectj.lang.reflect.SourceLocation; import org.aspectj.runtime.reflect.Factory; import static org.junit.Assert.*; import org.junit.Test; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.aop.MethodBeforeAdvice; import org.springframework.aop.framework.AopContext; diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java index b8c336b0fbb..13635c2c6d1 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,7 +29,7 @@ import org.junit.Test; import test.annotation.EmptySpringAnnotation; import test.annotation.transaction.Tx; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** @@ -70,7 +70,7 @@ public final class TigerAspectJExpressionPointcutTests { @Test public void testMatchGenericArgument() { - String expression = "execution(* set*(java.util.List) )"; + String expression = "execution(* set*(java.util.List) )"; AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(expression); diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java index fea874179e0..0275360441b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,11 +22,11 @@ import org.junit.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import test.beans.CountingTestBean; -import test.beans.IOther; -import test.beans.ITestBean; -import test.beans.TestBean; -import test.beans.subpkg.DeepBean; +import org.springframework.tests.sample.beans.CountingTestBean; +import org.springframework.tests.sample.beans.IOther; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.subpkg.DeepBean; /** * Unit tests for the {@link TypePatternClassFilter} class. @@ -45,7 +45,7 @@ public final class TypePatternClassFilterTests { @Test public void testValidPatternMatching() { - TypePatternClassFilter tpcf = new TypePatternClassFilter("test.beans.*"); + TypePatternClassFilter tpcf = new TypePatternClassFilter("org.springframework.tests.sample.beans.*"); assertTrue("Must match: in package", tpcf.matches(TestBean.class)); assertTrue("Must match: in package", tpcf.matches(ITestBean.class)); assertTrue("Must match: in package", tpcf.matches(IOther.class)); @@ -56,7 +56,7 @@ public final class TypePatternClassFilterTests { @Test public void testSubclassMatching() { - TypePatternClassFilter tpcf = new TypePatternClassFilter("test.beans.ITestBean+"); + TypePatternClassFilter tpcf = new TypePatternClassFilter("org.springframework.tests.sample.beans.ITestBean+"); assertTrue("Must match: in package", tpcf.matches(TestBean.class)); assertTrue("Must match: in package", tpcf.matches(ITestBean.class)); assertTrue("Must match: in package", tpcf.matches(CountingTestBean.class)); diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java index ae3ac04918e..273869e8a0a 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -58,8 +58,8 @@ import test.aop.DefaultLockable; import test.aop.Lockable; import test.aop.PerTargetAspect; import test.aop.TwoAdviceAspect; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Abstract tests for AspectJAdvisorFactory. @@ -650,7 +650,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests { } - @Aspect("pertypewithin(test.beans.IOther+)") + @Aspect("pertypewithin(org.springframework.tests.sample.beans.IOther+)") public static class PerTypeWithinAspect { public int count; @@ -979,7 +979,7 @@ abstract class AbstractMakeModifiable { @Aspect class MakeITestBeanModifiable extends AbstractMakeModifiable { - @DeclareParents(value = "test.beans.ITestBean+", + @DeclareParents(value = "org.springframework.tests.sample.beans.ITestBean+", defaultImpl=ModifiableImpl.class) public static MutableModifable mixin; diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java index d15b0a11cab..66d5e0f739e 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,8 +29,8 @@ import org.aspectj.lang.annotation.Pointcut; import org.junit.Test; import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Adrian Colyer diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java index 88beb1455a5..966d289eb13 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,7 +25,7 @@ import org.springframework.aop.aspectj.AspectJExpressionPointcutTests; import org.springframework.aop.framework.AopConfigException; import test.aop.PerTargetAspect; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java index 93aebbfa673..16d6f0e9e79 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,14 +16,16 @@ package org.springframework.aop.aspectj.annotation; +import static org.junit.Assert.assertEquals; + import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; -import static org.junit.Assert.*; import org.junit.Ignore; import org.junit.Test; +import org.springframework.util.SerializationTestUtils; + import test.aop.PerThisAspect; -import test.util.SerializationTestUtils; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java index 6b7d3ff0965..f1ff305aad4 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.aop.aspectj.autoproxy; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -30,8 +30,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.factory.xml.XmlReaderContext; - -import test.parsing.CollectingReaderEventListener; +import org.springframework.tests.beans.CollectingReaderEventListener; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml index 939493b2eb0..984f5ada7b8 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml @@ -20,7 +20,7 @@ - + diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java index 0d86588b8c9..fec13dbbed1 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,8 +16,10 @@ package org.springframework.aop.config; -import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.HashSet; import java.util.Set; @@ -32,8 +34,7 @@ import org.springframework.beans.factory.parsing.CompositeComponentDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; - -import test.parsing.CollectingReaderEventListener; +import org.springframework.tests.beans.CollectingReaderEventListener; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutDuplication.xml b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutDuplication.xml index 472b91f7183..cd01ffd5326 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutDuplication.xml +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutDuplication.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutMissing.xml b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutMissing.xml index 7654895ccee..850fbc15d1b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutMissing.xml +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests-pointcutMissing.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java index 19ea1742c0b..7320dd553cc 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.aop.config; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; diff --git a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java index 3dbd38f98c6..9e0b3d14ebb 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.aop.config; import static org.junit.Assert.assertTrue; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java index dca823663df..e2abdda7993 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,8 +27,8 @@ import java.util.List; import org.junit.Test; import org.springframework.aop.SpringProxy; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java index 03b971fed02..eaaf2d8d42b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,8 +20,8 @@ import org.junit.Test; import org.springframework.aop.support.DelegatingIntroductionInterceptor; import org.springframework.util.StopWatch; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Benchmarks for introductions. diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java index 4e815534441..139ef6c415e 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java index 7f5a4bc4376..d9d43527dec 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.aop.framework; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java index ddf48d28d82..7f856028885 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,28 +16,33 @@ package org.springframework.aop.framework; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import javax.accessibility.Accessible; -import javax.swing.*; +import javax.swing.JFrame; +import javax.swing.RootPaneContainer; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; import org.junit.Ignore; import org.junit.Test; -import test.aop.CountingBeforeAdvice; -import test.aop.NopInterceptor; -import test.beans.IOther; -import test.beans.ITestBean; -import test.beans.TestBean; -import test.util.TimeStamped; - import org.springframework.aop.Advisor; import org.springframework.aop.interceptor.DebugInterceptor; import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.DefaultIntroductionAdvisor; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.aop.support.DelegatingIntroductionInterceptor; +import org.springframework.tests.TimeStamped; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.IOther; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Also tests AdvisedSupport and ProxyCreatorSupport superclasses. @@ -190,7 +195,7 @@ public final class ProxyFactoryTests { TestBeanSubclass raw = new TestBeanSubclass(); ProxyFactory factory = new ProxyFactory(raw); //System.out.println("Proxied interfaces are " + StringUtils.arrayToDelimitedString(factory.getProxiedInterfaces(), ",")); - assertEquals("Found correct number of interfaces", 3, factory.getProxiedInterfaces().length); + assertEquals("Found correct number of interfaces", 5, factory.getProxiedInterfaces().length); ITestBean tb = (ITestBean) factory.getProxy(); assertThat("Picked up secondary interface", tb, instanceOf(IOther.class)); diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java index fe72f963255..633705f0686 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,21 +16,23 @@ package org.springframework.aop.framework.adapter; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.Method; import java.rmi.RemoteException; + import javax.transaction.TransactionRolledbackException; import org.aopalliance.intercept.MethodInvocation; -import static org.junit.Assert.*; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import org.junit.Test; -import test.aop.MethodCounter; - import org.springframework.aop.ThrowsAdvice; +import org.springframework.tests.aop.advice.MethodCounter; + /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java index 964fac9efaf..db2751f5137 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,19 +16,17 @@ package org.springframework.aop.interceptor; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; - import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; - -import test.beans.DerivedTestBean; -import test.beans.ITestBean; -import test.beans.TestBean; -import test.util.SerializationTestUtils; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; /** * @author Juergen Hoeller diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java index 170f5b34bc5..3b0bd31e530 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,8 +22,8 @@ import org.junit.Test; import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.factory.NamedBean; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests-context.xml b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests-context.xml index bea92760ce6..5f00163fb55 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests-context.xml +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests-context.xml @@ -5,8 +5,8 @@ Tests for throws advice. --> - - + + @@ -14,8 +14,8 @@ INSTANCE - - + + @@ -25,5 +25,5 @@ exposeInvocation,countingBeforeAdvice,nopInterceptor - - + + diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java index 632c5bad07d..5405d09831b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,16 +18,15 @@ package org.springframework.aop.interceptor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; - -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Non-XML tests are in AbstractAopProxyTests diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java index ccbe9502bfa..84c4decb198 100644 --- a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.aop.scope; import static org.junit.Assert.assertSame; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java index b230ed72605..03cf0b719e3 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2013 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,15 +16,16 @@ package org.springframework.aop.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.IOException; import org.junit.Before; import org.junit.Test; - -import test.beans.TestBean; -import test.util.SerializationTestUtils; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java index 505697408c9..01be11617ea 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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.aop.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import java.lang.reflect.Method; @@ -26,10 +28,10 @@ import org.springframework.aop.MethodMatcher; import org.springframework.aop.Pointcut; import org.springframework.aop.interceptor.ExposeInvocationInterceptor; import org.springframework.aop.target.EmptyTargetSource; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; -import test.aop.NopInterceptor; -import test.beans.TestBean; -import test.util.SerializationTestUtils; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java index 42992fb57c2..51f18dde21f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,8 +22,8 @@ import org.junit.Test; import org.springframework.aop.ClassFilter; import org.springframework.core.NestedRuntimeException; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java index 1c250e966da..35828d28e0b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.aop.support; import junit.framework.TestCase; import org.springframework.aop.framework.ProxyFactory; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.ClassUtils; /** diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java index 2ca2acd665e..513885ed21f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import org.springframework.aop.MethodMatcher; import org.springframework.aop.Pointcut; import org.springframework.core.NestedRuntimeException; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java index 6288f7674af..be21c52d2aa 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,15 +16,16 @@ package org.springframework.aop.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import org.junit.Test; import org.springframework.aop.Pointcut; import org.springframework.aop.framework.ProxyFactory; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.aop.NopInterceptor; -import test.beans.ITestBean; -import test.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java index 1b7c8d60b36..1872a457f9a 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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.aop.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -27,16 +29,15 @@ import org.junit.Test; import org.springframework.aop.IntroductionAdvisor; import org.springframework.aop.IntroductionInterceptor; import org.springframework.aop.framework.ProxyFactory; - -import test.aop.SerializableNopInterceptor; -import test.beans.INestedTestBean; -import test.beans.ITestBean; -import test.beans.NestedTestBean; -import test.beans.Person; -import test.beans.SerializablePerson; -import test.beans.TestBean; -import test.util.SerializationTestUtils; -import test.util.TimeStamped; +import org.springframework.tests.TimeStamped; +import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; +import org.springframework.tests.sample.beans.INestedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.NestedTestBean; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.SerializablePerson; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java index 5b3ceb039b8..8f06791335c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,17 +16,18 @@ package org.springframework.aop.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import java.lang.reflect.Method; import org.junit.Test; import org.springframework.aop.MethodMatcher; - -import test.beans.IOther; -import test.beans.ITestBean; -import test.beans.TestBean; -import test.util.SerializationTestUtils; +import org.springframework.tests.sample.beans.IOther; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; /** * @author Juergen Hoeller diff --git a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java index 8b89281e763..5edde823dbc 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,18 +16,20 @@ package org.springframework.aop.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.SerializablePerson; +import org.springframework.util.SerializationTestUtils; -import test.aop.NopInterceptor; -import test.aop.SerializableNopInterceptor; -import test.beans.Person; -import test.beans.SerializablePerson; -import test.util.SerializationTestUtils; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java index 1ed7cd8430a..b24dccc2c9d 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import org.junit.Test; import org.springframework.aop.ClassFilter; import org.springframework.aop.Pointcut; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests-context.xml b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests-context.xml index 1e3ae07f26a..cbd660d7fe9 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests-context.xml +++ b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests-context.xml @@ -4,12 +4,12 @@ - + custom 666 - + @@ -21,19 +21,19 @@ - test.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean - settersAdvisor + settersAdvisor - test.beans.Person + org.springframework.tests.sample.beans.Person - + serializableSettersAdvised - settersAdvisor + settersAdvisor @@ -48,11 +48,11 @@ - test.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean true - - settersAndAbsquatulateAdvisor + + settersAndAbsquatulateAdvisor - + diff --git a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java index b55f2bb9f90..4a3d04cbd8f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,20 +17,20 @@ package org.springframework.aop.support; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.aop.framework.Advised; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; -import test.aop.NopInterceptor; -import test.aop.SerializableNopInterceptor; -import test.beans.ITestBean; -import test.beans.Person; -import test.beans.TestBean; -import test.util.SerializationTestUtils; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests-context.xml b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests-context.xml index 75be80560ee..07e9e4d3d95 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests-context.xml +++ b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests-context.xml @@ -3,7 +3,7 @@ - + diff --git a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java index e70d2c7baa3..af6b44c0ca1 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,15 +17,14 @@ package org.springframework.aop.target; import static org.junit.Assert.assertTrue; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; - -import test.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests-context.xml b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests-context.xml index 04cc623d30b..33f30be78c1 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests-context.xml +++ b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests-context.xml @@ -4,15 +4,15 @@ - + 10 - + 20 - - @@ -23,5 +23,4 @@ - - \ No newline at end of file + diff --git a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java index cb897b602f1..a4bb0c2554b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.aop.target; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.After; import org.junit.Before; @@ -30,12 +30,12 @@ import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.SerializablePerson; +import org.springframework.tests.sample.beans.SideEffectBean; +import org.springframework.util.SerializationTestUtils; -import test.aop.SerializableNopInterceptor; -import test.beans.Person; -import test.beans.SerializablePerson; -import test.beans.SideEffectBean; -import test.util.SerializationTestUtils; /** diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-customTarget.xml b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-customTarget.xml index 9bfe5dfd960..f633c66d5b2 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-customTarget.xml +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-customTarget.xml @@ -3,7 +3,7 @@ - + 10 diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-singleton.xml b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-singleton.xml index 74b1fe0ec22..10ef6a35aef 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-singleton.xml +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-singleton.xml @@ -3,7 +3,7 @@ - + 10 diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java index 57cedd275bc..b5bb4a1751c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.aop.target; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.Set; @@ -27,8 +27,7 @@ import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; - -import test.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; /** * @author Juergen Hoeller diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java index ea2eef2ae13..91e1d087f59 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,17 +16,17 @@ package org.springframework.aop.target; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.junit.Test; import org.springframework.aop.TargetSource; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; - -import test.beans.SerializablePerson; -import test.beans.TestBean; -import test.util.SerializationTestUtils; +import org.springframework.tests.sample.beans.SerializablePerson; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.util.SerializationTestUtils; /** * Unit tests relating to the abstract {@link AbstractPrototypeBasedTargetSource} diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests-context.xml b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests-context.xml index b271b1f5565..961269efde2 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests-context.xml +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests-context.xml @@ -4,22 +4,22 @@ - + 10 - - + + 10 - + prototypeTest - - - + + + - debugInterceptor,test + debugInterceptor,test @@ -20,7 +20,7 @@ getStatsMixin - + @@ -33,23 +33,22 @@ - - + + Rod - - + + Kerry - - + + test - + - - \ No newline at end of file + diff --git a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java index 1a6d5be3e30..b8976f1958a 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,16 +19,15 @@ package org.springframework.aop.target; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; - -import test.beans.ITestBean; -import test.beans.SideEffectBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.SideEffectBean; /** diff --git a/src/test/java/test/advice/CountingAfterReturningAdvice.java b/spring-aop/src/test/java/org/springframework/tests/aop/advice/CountingAfterReturningAdvice.java similarity index 95% rename from src/test/java/test/advice/CountingAfterReturningAdvice.java rename to spring-aop/src/test/java/org/springframework/tests/aop/advice/CountingAfterReturningAdvice.java index a8a3a01e3a3..5b206516af9 100644 --- a/src/test/java/test/advice/CountingAfterReturningAdvice.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/advice/CountingAfterReturningAdvice.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.advice; +package org.springframework.tests.aop.advice; import java.lang.reflect.Method; diff --git a/spring-aop/src/test/java/test/aop/CountingBeforeAdvice.java b/spring-aop/src/test/java/org/springframework/tests/aop/advice/CountingBeforeAdvice.java similarity index 95% rename from spring-aop/src/test/java/test/aop/CountingBeforeAdvice.java rename to spring-aop/src/test/java/org/springframework/tests/aop/advice/CountingBeforeAdvice.java index 91a49faa0fe..2e34d50262c 100644 --- a/spring-aop/src/test/java/test/aop/CountingBeforeAdvice.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/advice/CountingBeforeAdvice.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.aop; +package org.springframework.tests.aop.advice; import java.lang.reflect.Method; diff --git a/src/test/java/test/advice/MethodCounter.java b/spring-aop/src/test/java/org/springframework/tests/aop/advice/MethodCounter.java similarity index 97% rename from src/test/java/test/advice/MethodCounter.java rename to spring-aop/src/test/java/org/springframework/tests/aop/advice/MethodCounter.java index e0e45d6f142..931b0ec6681 100644 --- a/src/test/java/test/advice/MethodCounter.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/advice/MethodCounter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.advice; +package org.springframework.tests.aop.advice; import java.io.Serializable; import java.lang.reflect.Method; diff --git a/spring-context/src/test/java/test/advice/MyThrowsHandler.java b/spring-aop/src/test/java/org/springframework/tests/aop/advice/MyThrowsHandler.java similarity index 93% rename from spring-context/src/test/java/test/advice/MyThrowsHandler.java rename to spring-aop/src/test/java/org/springframework/tests/aop/advice/MyThrowsHandler.java index abe79f9dc32..96edd1280cd 100644 --- a/spring-context/src/test/java/test/advice/MyThrowsHandler.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/advice/MyThrowsHandler.java @@ -1,7 +1,7 @@ /** * */ -package test.advice; +package org.springframework.tests.aop.advice; import java.io.IOException; import java.lang.reflect.Method; diff --git a/spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java b/spring-aop/src/test/java/org/springframework/tests/aop/advice/TimestampIntroductionAdvisor.java similarity index 89% rename from spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java rename to spring-aop/src/test/java/org/springframework/tests/aop/advice/TimestampIntroductionAdvisor.java index bdcb2f2c9e4..0fa9d4b4da9 100644 --- a/spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/advice/TimestampIntroductionAdvisor.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package test.advice; +package org.springframework.tests.aop.advice; import org.springframework.aop.support.DelegatingIntroductionInterceptor; import org.springframework.aop.support.DefaultIntroductionAdvisor; +import org.springframework.tests.aop.interceptor.TimestampIntroductionInterceptor; -import test.interceptor.TimestampIntroductionInterceptor; /** * diff --git a/spring-context/src/test/java/test/interceptor/NopInterceptor.java b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/NopInterceptor.java similarity index 96% rename from spring-context/src/test/java/test/interceptor/NopInterceptor.java rename to spring-aop/src/test/java/org/springframework/tests/aop/interceptor/NopInterceptor.java index b1cdf832a4a..d152719261c 100644 --- a/spring-context/src/test/java/test/interceptor/NopInterceptor.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/NopInterceptor.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package test.interceptor; +package org.springframework.tests.aop.interceptor; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; diff --git a/spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/SerializableNopInterceptor.java similarity index 95% rename from spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java rename to spring-aop/src/test/java/org/springframework/tests/aop/interceptor/SerializableNopInterceptor.java index d8d179f7e43..8c72878c9df 100644 --- a/spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/SerializableNopInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.interceptor; +package org.springframework.tests.aop.interceptor; import java.io.Serializable; diff --git a/spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java similarity index 89% rename from spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java rename to spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java index eb9789edb37..de4dfecff6b 100644 --- a/spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java @@ -14,15 +14,14 @@ * limitations under the License. */ -package test.interceptor; +package org.springframework.tests.aop.interceptor; import org.springframework.aop.support.DelegatingIntroductionInterceptor; - -import test.util.TimeStamped; +import org.springframework.tests.TimeStamped; @SuppressWarnings("serial") public class TimestampIntroductionInterceptor extends DelegatingIntroductionInterceptor - implements TimeStamped { + implements TimeStamped { private long ts; diff --git a/spring-webmvc/src/test/java/org/springframework/beans/Person.java b/spring-aop/src/test/java/org/springframework/tests/sample/beans/Person.java similarity index 82% rename from spring-webmvc/src/test/java/org/springframework/beans/Person.java rename to spring-aop/src/test/java/org/springframework/tests/sample/beans/Person.java index 7c66f4b451b..38e0903e2e6 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/Person.java +++ b/spring-aop/src/test/java/org/springframework/tests/sample/beans/Person.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; /** * @@ -23,14 +23,16 @@ package org.springframework.beans; public interface Person { String getName(); + void setName(String name); + int getAge(); + void setAge(int i); /** - * Test for non-property method matching. - * If the parameter is a Throwable, it will be thrown rather than - * returned. + * Test for non-property method matching. If the parameter is a Throwable, it will be + * thrown rather than returned. */ Object echo(Object o) throws Throwable; -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/SerializablePerson.java b/spring-aop/src/test/java/org/springframework/tests/sample/beans/SerializablePerson.java similarity index 96% rename from spring-webmvc/src/test/java/org/springframework/beans/SerializablePerson.java rename to spring-aop/src/test/java/org/springframework/tests/sample/beans/SerializablePerson.java index dbe365f4937..2730d50c8ec 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/SerializablePerson.java +++ b/spring-aop/src/test/java/org/springframework/tests/sample/beans/SerializablePerson.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; import java.io.Serializable; diff --git a/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java b/spring-aop/src/test/java/org/springframework/tests/sample/beans/subpkg/DeepBean.java similarity index 94% rename from spring-aop/src/test/java/test/beans/subpkg/DeepBean.java rename to spring-aop/src/test/java/org/springframework/tests/sample/beans/subpkg/DeepBean.java index b18646f4d02..45546b4cfde 100644 --- a/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java +++ b/spring-aop/src/test/java/org/springframework/tests/sample/beans/subpkg/DeepBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans.subpkg; +package org.springframework.tests.sample.beans.subpkg; import org.springframework.aop.aspectj.AspectJExpressionPointcutTests; diff --git a/spring-aop/src/test/java/test/aop/MethodCounter.java b/spring-aop/src/test/java/test/aop/MethodCounter.java deleted file mode 100644 index ae673bd168d..00000000000 --- a/spring-aop/src/test/java/test/aop/MethodCounter.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2012 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 test.aop; - -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.HashMap; - -/** - * Abstract superclass for counting advices etc. - * - * @author Rod Johnson - * @author Chris Beams - */ -@SuppressWarnings("serial") -public class MethodCounter implements Serializable { - - /** Method name --> count, does not understand overloading */ - private HashMap map = new HashMap(); - - private int allCount; - - protected void count(Method m) { - count(m.getName()); - } - - protected void count(String methodName) { - Integer i = map.get(methodName); - i = (i != null) ? new Integer(i.intValue() + 1) : new Integer(1); - map.put(methodName, i); - ++allCount; - } - - public int getCalls(String methodName) { - Integer i = map.get(methodName); - return (i != null ? i.intValue() : 0); - } - - public int getCalls() { - return allCount; - } - - /** - * A bit simplistic: just wants the same class. - * Doesn't worry about counts. - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object other) { - return (other != null && other.getClass() == this.getClass()); - } - - public int hashCode() { - return getClass().hashCode(); - } - -} diff --git a/spring-aop/src/test/java/test/aop/NopInterceptor.java b/spring-aop/src/test/java/test/aop/NopInterceptor.java deleted file mode 100644 index 20b9ece08fd..00000000000 --- a/spring-aop/src/test/java/test/aop/NopInterceptor.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2002-2012 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 test.aop; - -import org.aopalliance.intercept.MethodInterceptor; -import org.aopalliance.intercept.MethodInvocation; - -/** - * Trivial interceptor that can be introduced in a chain to display it. - * - * @author Rod Johnson - */ -public class NopInterceptor implements MethodInterceptor { - - private int count; - - /** - * @see org.aopalliance.intercept.MethodInterceptor#invoke(MethodInvocation) - */ - @Override - public Object invoke(MethodInvocation invocation) throws Throwable { - increment(); - return invocation.proceed(); - } - - public int getCount() { - return this.count; - } - - protected void increment() { - ++count; - } - - public boolean equals(Object other) { - if (!(other instanceof NopInterceptor)) { - return false; - } - if (this == other) { - return true; - } - return this.count == ((NopInterceptor) other).count; - } - -} diff --git a/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java b/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java deleted file mode 100644 index 064df39ab52..00000000000 --- a/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2002-2012 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 test.aop; - -import java.io.Serializable; - - - -/** - * Subclass of NopInterceptor that is serializable and - * can be used to test proxy serialization. - * - * @author Rod Johnson - * @author Chris Beams - */ -@SuppressWarnings("serial") -public class SerializableNopInterceptor extends NopInterceptor implements Serializable { - - /** - * We must override this field and the related methods as - * otherwise count won't be serialized from the non-serializable - * NopInterceptor superclass. - */ - private int count; - - @Override - public int getCount() { - return this.count; - } - - @Override - protected void increment() { - ++count; - } - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/beans/Colour.java b/spring-aop/src/test/java/test/beans/Colour.java deleted file mode 100644 index 8793fd3f94b..00000000000 --- a/spring-aop/src/test/java/test/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2007 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 test.beans; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/beans/DerivedTestBean.java b/spring-aop/src/test/java/test/beans/DerivedTestBean.java deleted file mode 100644 index 225ae1a300d..00000000000 --- a/spring-aop/src/test/java/test/beans/DerivedTestBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - @Override - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - @Override - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - @Override - public void destroy() { - this.destroyed = true; - } - - @Override - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-aop/src/test/java/test/beans/INestedTestBean.java b/spring-aop/src/test/java/test/beans/INestedTestBean.java deleted file mode 100644 index 56c9d829ee3..00000000000 --- a/spring-aop/src/test/java/test/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/beans/IOther.java b/spring-aop/src/test/java/test/beans/IOther.java deleted file mode 100644 index f3c6263261e..00000000000 --- a/spring-aop/src/test/java/test/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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 test.beans; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/beans/ITestBean.java b/spring-aop/src/test/java/test/beans/ITestBean.java deleted file mode 100644 index 74f371b0547..00000000000 --- a/spring-aop/src/test/java/test/beans/ITestBean.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2002-2007 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 test.beans; - -import java.io.IOException; - -/** - * Interface used for {@link test.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/beans/NestedTestBean.java b/spring-aop/src/test/java/test/beans/NestedTestBean.java deleted file mode 100644 index edc145ad7d2..00000000000 --- a/spring-aop/src/test/java/test/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/beans/SerializablePerson.java b/spring-aop/src/test/java/test/beans/SerializablePerson.java deleted file mode 100644 index 3aa60f1fdc0..00000000000 --- a/spring-aop/src/test/java/test/beans/SerializablePerson.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.Serializable; - -import org.springframework.util.ObjectUtils; - -/** - * Serializable implementation of the Person interface. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class SerializablePerson implements Person, Serializable { - - private String name; - private int age; - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public Object echo(Object o) throws Throwable { - if (o instanceof Throwable) { - throw (Throwable) o; - } - return o; - } - - public boolean equals(Object other) { - if (!(other instanceof SerializablePerson)) { - return false; - } - SerializablePerson p = (SerializablePerson) other; - return p.age == age && ObjectUtils.nullSafeEquals(name, p.name); - } - -} diff --git a/spring-aop/src/test/java/test/beans/TestBean.java b/spring-aop/src/test/java/test/beans/TestBean.java deleted file mode 100644 index 3f50f93836c..00000000000 --- a/spring-aop/src/test/java/test/beans/TestBean.java +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java b/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java deleted file mode 100644 index 5aa69c1fa89..00000000000 --- a/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2002-2012 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 test.parsing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.springframework.beans.factory.parsing.AliasDefinition; -import org.springframework.beans.factory.parsing.ComponentDefinition; -import org.springframework.beans.factory.parsing.DefaultsDefinition; -import org.springframework.beans.factory.parsing.ImportDefinition; -import org.springframework.beans.factory.parsing.ReaderEventListener; - -/** - * @author Rob Harrop - * @author Juergen Hoeller - * @author Chris Beams - */ -public class CollectingReaderEventListener implements ReaderEventListener { - - private final List defaults = new LinkedList(); - - private final Map componentDefinitions = new LinkedHashMap(8); - - private final Map aliasMap = new LinkedHashMap(8); - - private final List imports = new LinkedList(); - - - @Override - public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { - this.defaults.add(defaultsDefinition); - } - - public List getDefaults() { - return Collections.unmodifiableList(this.defaults); - } - - @Override - public void componentRegistered(ComponentDefinition componentDefinition) { - this.componentDefinitions.put(componentDefinition.getName(), componentDefinition); - } - - public ComponentDefinition getComponentDefinition(String name) { - return (ComponentDefinition) this.componentDefinitions.get(name); - } - - public ComponentDefinition[] getComponentDefinitions() { - Collection collection = this.componentDefinitions.values(); - return collection.toArray(new ComponentDefinition[collection.size()]); - } - - @Override - @SuppressWarnings("unchecked") - public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); - if(aliases == null) { - aliases = new ArrayList(); - this.aliasMap.put(aliasDefinition.getBeanName(), aliases); - } - aliases.add(aliasDefinition); - } - - public List getAliases(String beanName) { - List aliases = (List) this.aliasMap.get(beanName); - return aliases == null ? null : Collections.unmodifiableList(aliases); - } - - @Override - public void importProcessed(ImportDefinition importDefinition) { - this.imports.add(importDefinition); - } - - public List getImports() { - return Collections.unmodifiableList(this.imports); - } - -} diff --git a/spring-aop/src/test/java/test/util/SerializationTestUtils.java b/spring-aop/src/test/java/test/util/SerializationTestUtils.java deleted file mode 100644 index e9bc9fee04a..00000000000 --- a/spring-aop/src/test/java/test/util/SerializationTestUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2002-2012 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 test.util; - -import java.awt.*; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; - -import static org.junit.Assert.*; -import org.junit.Test; -import test.beans.TestBean; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * Contains {@link org.junit.Test} methods to test itself. - * - * @author Rod Johnson - * @author Chris Beams - */ -public final class SerializationTestUtils { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - return o2; - } - - - @Test(expected=NotSerializableException.class) - public void testWithNonSerializableObject() throws IOException { - TestBean o = new TestBean(); - assertFalse(o instanceof Serializable); - assertFalse(isSerializable(o)); - - testSerialization(o); - } - - @Test - public void testWithSerializableObject() throws Exception { - int x = 5; - int y = 10; - Point p = new Point(x, y); - assertTrue(p instanceof Serializable); - - testSerialization(p); - - assertTrue(isSerializable(p)); - - Point p2 = (Point) serializeAndDeserialize(p); - assertNotSame(p, p2); - assertEquals(x, (int) p2.getX()); - assertEquals(y, (int) p2.getY()); - } - -} diff --git a/spring-aop/src/test/java/test/util/TimeStamped.java b/spring-aop/src/test/java/test/util/TimeStamped.java deleted file mode 100644 index 4fedb8998b0..00000000000 --- a/spring-aop/src/test/java/test/util/TimeStamped.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2002-2012 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 test.util; - -/** - * This interface can be implemented by cacheable objects or cache entries, - * to enable the freshness of objects to be checked. - * - * @author Rod Johnson - */ -public interface TimeStamped { - - /** - * Return the timestamp for this object. - * @return long the timestamp for this object, - * as returned by System.currentTimeMillis() - */ - long getTimeStamp(); - -} diff --git a/spring-aspects/src/test/java/org/springframework/beans/Colour.java b/spring-aspects/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index a992a2ebfc6..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java deleted file mode 100644 index a10846ba95a..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-aspects/src/test/java/org/springframework/beans/IOther.java b/spring-aspects/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java b/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index 478999c05da..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index d7af36ed641..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 88b450b9171..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-aspects/src/test/java/org/springframework/beans/TestBean.java b/spring-aspects/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index ac8e5ea4857..00000000000 --- a/spring-aspects/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public String[] getStringArray() { - return stringArray; - } - - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see org.springframework.beans.ITestBean#exceptional(Throwable) - */ - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see org.springframework.beans.ITestBean#returnsThis() - */ - public Object returnsThis() { - return this; - } - - /** - * @see org.springframework.beans.IOther#absquatulate() - */ - public void absquatulate() { - } - - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java index 73f37a8f9eb..6ff04cf7b87 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import junit.framework.TestCase; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.UnsatisfiedDependencyException; import org.springframework.beans.factory.annotation.Autowire; diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml index 89aa3964eae..bd6439bb546 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml @@ -37,7 +37,7 @@ autowire-candidate="false"/> - + diff --git a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java deleted file mode 100644 index 3771a21b9f7..00000000000 --- a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Copyright 2002-2012 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.cache.aspectj; - -import static org.junit.Assert.*; - -import java.util.Collection; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.cache.Cache; -import org.springframework.cache.CacheManager; -import org.springframework.cache.config.AnnotatedClassCacheableService; -import org.springframework.cache.config.CacheableService; -import org.springframework.context.ApplicationContext; - -/** - * Abstract annotation test (containing several reusable methods). - * - * @author Costin Leau - * @author Chris Beams - */ -public abstract class AbstractAnnotationTest { - - protected ApplicationContext ctx; - - protected CacheableService cs; - - protected CacheableService ccs; - - protected CacheManager cm; - - /** @return a refreshed application context */ - protected abstract ApplicationContext getApplicationContext(); - - @Before - public void setup() { - ctx = getApplicationContext(); - cs = ctx.getBean("service", CacheableService.class); - ccs = ctx.getBean("classService", CacheableService.class); - cm = ctx.getBean(CacheManager.class); - Collection cn = cm.getCacheNames(); - assertTrue(cn.contains("default")); - } - - public void testCacheable(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - Object r3 = service.cache(o1); - - assertSame(r1, r2); - assertSame(r1, r3); - } - - public void testEvict(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - - assertSame(r1, r2); - service.invalidate(o1); - Object r3 = service.cache(o1); - Object r4 = service.cache(o1); - assertNotSame(r1, r3); - assertSame(r3, r4); - } - - public void testEvictEarly(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - - assertSame(r1, r2); - try { - service.evictEarly(o1); - } catch (RuntimeException ex) { - // expected - } - - Object r3 = service.cache(o1); - Object r4 = service.cache(o1); - assertNotSame(r1, r3); - assertSame(r3, r4); - } - - public void testEvictException(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - - assertSame(r1, r2); - try { - service.evictWithException(o1); - } catch (RuntimeException ex) { - // expected - } - // exception occurred, eviction skipped, data should still be in the cache - Object r3 = service.cache(o1); - assertSame(r1, r3); - } - - public void testEvictWKey(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - - assertSame(r1, r2); - service.evict(o1, null); - Object r3 = service.cache(o1); - Object r4 = service.cache(o1); - assertNotSame(r1, r3); - assertSame(r3, r4); - } - - public void testEvictWKeyEarly(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - - assertSame(r1, r2); - - try { - service.invalidateEarly(o1, null); - } catch (Exception ex) { - // expected - } - Object r3 = service.cache(o1); - Object r4 = service.cache(o1); - assertNotSame(r1, r3); - assertSame(r3, r4); - } - - public void testEvictAll(CacheableService service) throws Exception { - Object o1 = new Object(); - - Object r1 = service.cache(o1); - Object r2 = service.cache(o1); - - Object o2 = new Object(); - Object r10 = service.cache(o2); - - assertSame(r1, r2); - assertNotSame(r1, r10); - service.evictAll(new Object()); - Cache cache = cm.getCache("default"); - assertNull(cache.get(o1)); - assertNull(cache.get(o2)); - - Object r3 = service.cache(o1); - Object r4 = service.cache(o1); - assertNotSame(r1, r3); - assertSame(r3, r4); - } - - public void testConditionalExpression(CacheableService service) throws Exception { - Object r1 = service.conditional(4); - Object r2 = service.conditional(4); - - assertNotSame(r1, r2); - - Object r3 = service.conditional(3); - Object r4 = service.conditional(3); - - assertSame(r3, r4); - } - - public void testKeyExpression(CacheableService service) throws Exception { - Object r1 = service.key(5, 1); - Object r2 = service.key(5, 2); - - assertSame(r1, r2); - - Object r3 = service.key(1, 5); - Object r4 = service.key(2, 5); - - assertNotSame(r3, r4); - } - - public void testNullValue(CacheableService service) throws Exception { - Object key = new Object(); - assertNull(service.nullValue(key)); - int nr = service.nullInvocations().intValue(); - assertNull(service.nullValue(key)); - assertEquals(nr, service.nullInvocations().intValue()); - assertNull(service.nullValue(new Object())); - assertEquals(nr + 1, service.nullInvocations().intValue()); - } - - public void testMethodName(CacheableService service, String keyName) throws Exception { - Object key = new Object(); - Object r1 = service.name(key); - assertSame(r1, service.name(key)); - Cache cache = cm.getCache("default"); - // assert the method name is used - assertNotNull(cache.get(keyName)); - } - - public void testCheckedThrowable(CacheableService service) throws Exception { - String arg = UUID.randomUUID().toString(); - try { - service.throwChecked(arg); - fail("Excepted exception"); - } catch (Exception ex) { - assertEquals(arg, ex.getMessage()); - } - } - - public void testUncheckedThrowable(CacheableService service) throws Exception { - try { - service.throwUnchecked(Long.valueOf(1)); - fail("Excepted exception"); - } catch (RuntimeException ex) { - assertTrue("Excepted different exception type and got " + ex.getClass(), - ex instanceof UnsupportedOperationException); - // expected - } - } - - public void testNullArg(CacheableService service) { - Object r1 = service.cache(null); - assertSame(r1, service.cache(null)); - } - - public void testCacheUpdate(CacheableService service) { - Object o = new Object(); - Cache cache = cm.getCache("default"); - assertNull(cache.get(o)); - Object r1 = service.update(o); - assertSame(r1, cache.get(o).get()); - - o = new Object(); - assertNull(cache.get(o)); - Object r2 = service.update(o); - assertSame(r2, cache.get(o).get()); - } - - public void testConditionalCacheUpdate(CacheableService service) { - Integer one = Integer.valueOf(1); - Integer three = Integer.valueOf(3); - - Cache cache = cm.getCache("default"); - assertEquals(one, Integer.valueOf(service.conditionalUpdate(one).toString())); - assertNull(cache.get(one)); - - assertEquals(three, Integer.valueOf(service.conditionalUpdate(three).toString())); - assertEquals(three, Integer.valueOf(cache.get(three).get().toString())); - } - - public void testMultiCache(CacheableService service) { - Object o1 = new Object(); - Object o2 = new Object(); - - Cache primary = cm.getCache("primary"); - Cache secondary = cm.getCache("secondary"); - - assertNull(primary.get(o1)); - assertNull(secondary.get(o1)); - Object r1 = service.multiCache(o1); - assertSame(r1, primary.get(o1).get()); - assertSame(r1, secondary.get(o1).get()); - - Object r2 = service.multiCache(o1); - Object r3 = service.multiCache(o1); - - assertSame(r1, r2); - assertSame(r1, r3); - - assertNull(primary.get(o2)); - assertNull(secondary.get(o2)); - Object r4 = service.multiCache(o2); - assertSame(r4, primary.get(o2).get()); - assertSame(r4, secondary.get(o2).get()); - } - - public void testMultiEvict(CacheableService service) { - Object o1 = new Object(); - - Object r1 = service.multiCache(o1); - Object r2 = service.multiCache(o1); - - Cache primary = cm.getCache("primary"); - Cache secondary = cm.getCache("secondary"); - - assertSame(r1, r2); - assertSame(r1, primary.get(o1).get()); - assertSame(r1, secondary.get(o1).get()); - - service.multiEvict(o1); - assertNull(primary.get(o1)); - assertNull(secondary.get(o1)); - - Object r3 = service.multiCache(o1); - Object r4 = service.multiCache(o1); - assertNotSame(r1, r3); - assertSame(r3, r4); - - assertSame(r3, primary.get(o1).get()); - assertSame(r4, secondary.get(o1).get()); - } - - public void testMultiPut(CacheableService service) { - Object o = Integer.valueOf(1); - - Cache primary = cm.getCache("primary"); - Cache secondary = cm.getCache("secondary"); - - assertNull(primary.get(o)); - assertNull(secondary.get(o)); - Object r1 = service.multiUpdate(o); - assertSame(r1, primary.get(o).get()); - assertSame(r1, secondary.get(o).get()); - - o = Integer.valueOf(2); - assertNull(primary.get(o)); - assertNull(secondary.get(o)); - Object r2 = service.multiUpdate(o); - assertSame(r2, primary.get(o).get()); - assertSame(r2, secondary.get(o).get()); - } - - public void testMultiCacheAndEvict(CacheableService service) { - String methodName = "multiCacheAndEvict"; - - Cache primary = cm.getCache("primary"); - Cache secondary = cm.getCache("secondary"); - Object key = Integer.valueOf(1); - - secondary.put(key, key); - - assertNull(secondary.get(methodName)); - assertSame(key, secondary.get(key).get()); - - Object r1 = service.multiCacheAndEvict(key); - assertSame(r1, service.multiCacheAndEvict(key)); - - // assert the method name is used - assertSame(r1, primary.get(methodName).get()); - assertNull(secondary.get(methodName)); - assertNull(secondary.get(key)); - } - - public void testMultiConditionalCacheAndEvict(CacheableService service) { - Cache primary = cm.getCache("primary"); - Cache secondary = cm.getCache("secondary"); - Object key = Integer.valueOf(1); - - secondary.put(key, key); - - assertNull(primary.get(key)); - assertSame(key, secondary.get(key).get()); - - Object r1 = service.multiConditionalCacheAndEvict(key); - Object r3 = service.multiConditionalCacheAndEvict(key); - - assertTrue(!r1.equals(r3)); - assertNull(primary.get(key)); - - Object key2 = Integer.valueOf(3); - Object r2 = service.multiConditionalCacheAndEvict(key2); - assertSame(r2, service.multiConditionalCacheAndEvict(key2)); - - // assert the method name is used - assertSame(r2, primary.get(key2).get()); - assertNull(secondary.get(key2)); - } - - @Test - public void testCacheable() throws Exception { - testCacheable(cs); - } - - @Test - public void testInvalidate() throws Exception { - testEvict(cs); - } - - @Test - public void testEarlyInvalidate() throws Exception { - testEvictEarly(cs); - } - - @Test - public void testEvictWithException() throws Exception { - testEvictException(cs); - } - - @Test - public void testEvictAll() throws Exception { - testEvictAll(cs); - } - - @Test - public void testInvalidateWithKey() throws Exception { - testEvictWKey(cs); - } - - @Test - public void testEarlyInvalidateWithKey() throws Exception { - testEvictWKeyEarly(cs); - } - - @Test - public void testConditionalExpression() throws Exception { - testConditionalExpression(cs); - } - - @Test - public void testKeyExpression() throws Exception { - testKeyExpression(cs); - } - - @Test - public void testClassCacheCacheable() throws Exception { - testCacheable(ccs); - } - - @Test - public void testClassCacheInvalidate() throws Exception { - testEvict(ccs); - } - - @Test - public void testClassEarlyInvalidate() throws Exception { - testEvictEarly(ccs); - } - - @Test - public void testClassEvictAll() throws Exception { - testEvictAll(ccs); - } - - @Test - public void testClassEvictWithException() throws Exception { - testEvictException(ccs); - } - - @Test - public void testClassCacheInvalidateWKey() throws Exception { - testEvictWKey(ccs); - } - - @Test - public void testClassEarlyInvalidateWithKey() throws Exception { - testEvictWKeyEarly(ccs); - } - - @Test - public void testNullValue() throws Exception { - testNullValue(cs); - } - - @Test - public void testClassNullValue() throws Exception { - Object key = new Object(); - assertNull(ccs.nullValue(key)); - int nr = ccs.nullInvocations().intValue(); - assertNull(ccs.nullValue(key)); - assertEquals(nr, ccs.nullInvocations().intValue()); - assertNull(ccs.nullValue(new Object())); - // the check method is also cached - assertEquals(nr, ccs.nullInvocations().intValue()); - assertEquals(nr + 1, AnnotatedClassCacheableService.nullInvocations.intValue()); - } - - @Test - public void testMethodName() throws Exception { - testMethodName(cs, "name"); - } - - @Test - public void testClassMethodName() throws Exception { - testMethodName(ccs, "namedefault"); - } - - @Test - public void testNullArg() throws Exception { - testNullArg(cs); - } - - @Test - public void testClassNullArg() throws Exception { - testNullArg(ccs); - } - - @Test - public void testCheckedException() throws Exception { - testCheckedThrowable(cs); - } - - @Test - public void testClassCheckedException() throws Exception { - testCheckedThrowable(ccs); - } - - @Test - public void testUncheckedException() throws Exception { - testUncheckedThrowable(cs); - } - - @Test - public void testClassUncheckedException() throws Exception { - testUncheckedThrowable(ccs); - } - - @Test - public void testUpdate() { - testCacheUpdate(cs); - } - - @Test - public void testClassUpdate() { - testCacheUpdate(ccs); - } - - @Test - public void testConditionalUpdate() { - testConditionalCacheUpdate(cs); - } - - @Test - public void testClassConditionalUpdate() { - testConditionalCacheUpdate(ccs); - } - - @Test - public void testMultiCache() { - testMultiCache(cs); - } - - @Test - public void testClassMultiCache() { - testMultiCache(ccs); - } - - @Test - public void testMultiEvict() { - testMultiEvict(cs); - } - - @Test - public void testClassMultiEvict() { - testMultiEvict(ccs); - } - - @Test - public void testMultiPut() { - testMultiPut(cs); - } - - @Test - public void testClassMultiPut() { - testMultiPut(ccs); - } - - @Test - public void testMultiCacheAndEvict() { - testMultiCacheAndEvict(cs); - } - - @Test - public void testClassMultiCacheAndEvict() { - testMultiCacheAndEvict(ccs); - } - - @Test - public void testMultiConditionalCacheAndEvict() { - testMultiConditionalCacheAndEvict(cs); - } - - @Test - public void testClassMultiConditionalCacheAndEvict() { - testMultiConditionalCacheAndEvict(ccs); - } -} \ No newline at end of file diff --git a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTests.java similarity index 56% rename from spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java rename to spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTests.java index df237674754..43af45e80df 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java +++ b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTests.java @@ -16,8 +16,15 @@ package org.springframework.cache.aspectj; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; + import org.junit.Assert; import org.junit.Test; +import org.springframework.cache.Cache; +import org.springframework.cache.config.AbstractAnnotationTests; +import org.springframework.cache.config.CacheableService; import org.springframework.context.ApplicationContext; import org.springframework.context.support.GenericXmlApplicationContext; @@ -25,7 +32,7 @@ import org.springframework.context.support.GenericXmlApplicationContext; /** * @author Costin Leau */ -public class AspectJAnnotationTest extends AbstractAnnotationTest { +public class AspectJAnnotationTests extends AbstractAnnotationTests { @Override @@ -38,4 +45,30 @@ public class AspectJAnnotationTest extends AbstractAnnotationTest { AnnotationCacheAspect aspect = ctx.getBean("org.springframework.cache.config.internalCacheAspect", AnnotationCacheAspect.class); Assert.assertSame(ctx.getBean("keyGenerator"), aspect.getKeyGenerator()); } + + public void testMultiEvict(CacheableService service) { + Object o1 = new Object(); + + Object r1 = service.multiCache(o1); + Object r2 = service.multiCache(o1); + + Cache primary = cm.getCache("primary"); + Cache secondary = cm.getCache("secondary"); + + assertSame(r1, r2); + assertSame(r1, primary.get(o1).get()); + assertSame(r1, secondary.get(o1).get()); + + service.multiEvict(o1); + assertNull(primary.get(o1)); + assertNull(secondary.get(o1)); + + Object r3 = service.multiCache(o1); + Object r4 = service.multiCache(o1); + assertNotSame(r1, r3); + assertSame(r3, r4); + + assertSame(r3, primary.get(o1).get()); + assertSame(r4, secondary.get(o1).get()); + } } diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java index 95edbcd9d64..6d83d91c02d 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java +++ b/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -33,83 +33,100 @@ public class DefaultCacheableService implements CacheableService { private final AtomicLong counter = new AtomicLong(); private final AtomicLong nullInvocations = new AtomicLong(); + @Override @Cacheable("default") public Long cache(Object arg1) { return counter.getAndIncrement(); } + @Override @CacheEvict("default") public void invalidate(Object arg1) { } + @Override @CacheEvict("default") public void evictWithException(Object arg1) { throw new RuntimeException("exception thrown - evict should NOT occur"); } + @Override @CacheEvict(value = "default", allEntries = true) public void evictAll(Object arg1) { } + @Override @CacheEvict(value = "default", beforeInvocation = true) public void evictEarly(Object arg1) { throw new RuntimeException("exception thrown - evict should still occur"); } + @Override @CacheEvict(value = "default", key = "#p0") public void evict(Object arg1, Object arg2) { } + @Override @CacheEvict(value = "default", key = "#p0", beforeInvocation = true) public void invalidateEarly(Object arg1, Object arg2) { throw new RuntimeException("exception thrown - evict should still occur"); } + @Override @Cacheable(value = "default", condition = "#classField == 3") public Long conditional(int classField) { return counter.getAndIncrement(); } + @Override @Cacheable(value = "default", key = "#p0") public Long key(Object arg1, Object arg2) { return counter.getAndIncrement(); } + @Override @Cacheable(value = "default", key = "#root.methodName") public Long name(Object arg1) { return counter.getAndIncrement(); } + @Override @Cacheable(value = "default", key = "#root.methodName + #root.method.name + #root.targetClass + #root.target") public Long rootVars(Object arg1) { return counter.getAndIncrement(); } + @Override @CachePut("default") public Long update(Object arg1) { return counter.getAndIncrement(); } + @Override @CachePut(value = "default", condition = "#arg.equals(3)") public Long conditionalUpdate(Object arg) { return Long.valueOf(arg.toString()); } + @Override @Cacheable("default") public Long nullValue(Object arg1) { nullInvocations.incrementAndGet(); return null; } + @Override public Number nullInvocations() { return nullInvocations.get(); } + @Override @Cacheable("default") public Long throwChecked(Object arg1) throws Exception { throw new Exception(arg1.toString()); } + @Override @Cacheable("default") public Long throwUnchecked(Object arg1) { throw new UnsupportedOperationException(arg1.toString()); @@ -117,28 +134,34 @@ public class DefaultCacheableService implements CacheableService { // multi annotations + @Override @Caching(cacheable = { @Cacheable("primary"), @Cacheable("secondary") }) public Long multiCache(Object arg1) { return counter.getAndIncrement(); } + @Override +//FIXME @Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") }) @Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0") }) public Long multiEvict(Object arg1) { return counter.getAndIncrement(); } + @Override @Caching(cacheable = { @Cacheable(value = "primary", key = "#root.methodName") }, evict = { @CacheEvict("secondary") }) public Long multiCacheAndEvict(Object arg1) { return counter.getAndIncrement(); } + @Override @Caching(cacheable = { @Cacheable(value = "primary", condition = "#p0 == 3") }, evict = { @CacheEvict("secondary") }) public Long multiConditionalCacheAndEvict(Object arg1) { return counter.getAndIncrement(); } + @Override @Caching(put = { @CachePut("primary"), @CachePut("secondary") }) public Long multiUpdate(Object arg1) { return Long.valueOf(arg1.toString()); } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java deleted file mode 100644 index 969cf90a8fb..00000000000 --- a/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2002-2012 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.transaction; - -import org.springframework.transaction.support.AbstractPlatformTransactionManager; -import org.springframework.transaction.support.DefaultTransactionStatus; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -@SuppressWarnings("serial") -public class CallCountingTransactionManager extends AbstractPlatformTransactionManager { - - public TransactionDefinition lastDefinition; - public int begun; - public int commits; - public int rollbacks; - public int inflight; - - protected Object doGetTransaction() { - return new Object(); - } - - protected void doBegin(Object transaction, TransactionDefinition definition) { - this.lastDefinition = definition; - ++begun; - ++inflight; - } - - protected void doCommit(DefaultTransactionStatus status) { - ++commits; - --inflight; - } - - protected void doRollback(DefaultTransactionStatus status) { - ++rollbacks; - --inflight; - } - - public void clear() { - begun = commits = rollbacks = inflight = 0; - } - -} diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests-context.xml b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests-context.xml index 6af0f02db37..0d08cdcb56f 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests-context.xml +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests-context.xml @@ -3,7 +3,7 @@ - + diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java index be562b2585b..70892e39493 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import java.lang.reflect.Method; import junit.framework.AssertionFailedError; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAttribute; diff --git a/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java b/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java index a7a38f2c480..97e77c5740f 100644 --- a/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java +++ b/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -37,8 +37,7 @@ public class ComponentBeanDefinitionParserTest { @BeforeClass public static void setUpBeforeClass() throws Exception { bf = new DefaultListableBeanFactory(); - new XmlBeanDefinitionReader(bf).loadBeanDefinitions( - new ClassPathResource("com/foo/component-config.xml")); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("com/foo/component-config.xml")); } @AfterClass diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java index f49f63182cf..9d53409e73f 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,10 +29,10 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceEditor; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.DerivedTestBean; -import test.beans.ITestBean; -import test.beans.TestBean; /** * Unit tests for {@link BeanUtils}. diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java index 3946cccb25e..8c7d8da1e89 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,8 +17,8 @@ package org.springframework.beans; import org.junit.Test; -import test.beans.CustomEnum; -import test.beans.GenericBean; +import org.springframework.tests.sample.beans.CustomEnum; +import org.springframework.tests.sample.beans.GenericBean; import static org.junit.Assert.*; diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java index a1752458c42..3d310bdc686 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,15 +30,15 @@ import java.util.Set; import static org.junit.Assert.*; import org.junit.Test; -import test.beans.GenericBean; -import test.beans.GenericIntegerBean; -import test.beans.GenericSetOfIntegerBean; -import test.beans.TestBean; import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; +import org.springframework.tests.sample.beans.GenericBean; +import org.springframework.tests.sample.beans.GenericIntegerBean; +import org.springframework.tests.sample.beans.GenericSetOfIntegerBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java index 29e282c0a27..9d4e022a64a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -51,6 +51,11 @@ import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.beans.support.DerivedFromProtectedBaseBean; import org.springframework.tests.Assume; import org.springframework.tests.TestGroup; +import org.springframework.tests.sample.beans.BooleanTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.NumberTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.support.DefaultConversionService; @@ -58,11 +63,6 @@ import org.springframework.core.convert.support.GenericConversionService; import org.springframework.util.StopWatch; import org.springframework.util.StringUtils; -import test.beans.BooleanTestBean; -import test.beans.ITestBean; -import test.beans.IndexedTestBean; -import test.beans.NumberTestBean; -import test.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-beans/src/test/java/org/springframework/beans/CachedIntrospectionResultsTests.java b/spring-beans/src/test/java/org/springframework/beans/CachedIntrospectionResultsTests.java index 4675d22dbff..a4fe92acc96 100644 --- a/spring-beans/src/test/java/org/springframework/beans/CachedIntrospectionResultsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/CachedIntrospectionResultsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,9 +22,9 @@ import java.beans.PropertyDescriptor; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; -import test.beans.TestBean; import org.springframework.core.OverridingClassLoader; +import org.springframework.tests.sample.beans.TestBean; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; @@ -44,7 +44,7 @@ public final class CachedIntrospectionResultsTests { assertTrue(CachedIntrospectionResults.classCache.containsKey(TestBean.class)); ClassLoader child = new OverridingClassLoader(getClass().getClassLoader()); - Class tbClass = child.loadClass("test.beans.TestBean"); + Class tbClass = child.loadClass("org.springframework.tests.sample.beans.TestBean"); assertFalse(CachedIntrospectionResults.classCache.containsKey(tbClass)); CachedIntrospectionResults.acceptClassLoader(child); bw = new BeanWrapperImpl(tbClass); diff --git a/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java b/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java index 44062a9107b..aaf6e56092d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,9 +27,9 @@ import java.lang.reflect.Method; import org.junit.Test; import org.springframework.core.JdkVersion; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.ClassUtils; -import test.beans.TestBean; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.lessThan; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-leaf.xml b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-leaf.xml index bf756e1bbc5..71586ad8d36 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-leaf.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-leaf.xml @@ -3,7 +3,7 @@ - + custom 25 diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-middle.xml b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-middle.xml index 2d124050745..c5fa5b28581 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-middle.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-middle.xml @@ -4,17 +4,16 @@ - + custom 666 - + - + + + - - - \ No newline at end of file diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-root.xml b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-root.xml index ff33aa02125..28f8d652776 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-root.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests-root.xml @@ -6,19 +6,19 @@ - + - + - + custom 25 - + - + false diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java index d05f7ba577d..553f9cef46d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.beans.factory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.Arrays; import java.util.List; @@ -33,12 +33,12 @@ import org.springframework.beans.factory.support.StaticListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.cglib.proxy.NoOp; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.util.ObjectUtils; -import test.beans.DummyFactory; -import test.beans.ITestBean; -import test.beans.IndexedTestBean; -import test.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java index 96eeb3b01f8..5ec91dddeee 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,6 @@ package org.springframework.beans.factory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import static test.util.TestResourceUtils.qualifiedResource; import java.text.DateFormat; import java.text.ParseException; @@ -39,6 +38,10 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.core.io.Resource; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; + +import static org.springframework.tests.TestResourceUtils.qualifiedResource; /** * @author Guillaume Poirier diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java index 0e474fadaed..acf9f65a05a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,6 +16,17 @@ package org.springframework.beans.factory; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.Closeable; import java.lang.reflect.Field; import java.net.MalformedURLException; @@ -32,19 +43,13 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; + import javax.security.auth.Subject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Ignore; import org.junit.Test; -import test.beans.DerivedTestBean; -import test.beans.DummyFactory; -import test.beans.ITestBean; -import test.beans.LifecycleBean; -import test.beans.NestedTestBean; -import test.beans.TestBean; - import org.springframework.beans.BeansException; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.NotWritablePropertyException; @@ -70,21 +75,25 @@ import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.xml.ConstructorDependenciesBean; -import org.springframework.beans.factory.xml.DependenciesBean; import org.springframework.beans.propertyeditors.CustomNumberEditor; -import org.springframework.tests.Assume; -import org.springframework.tests.TestGroup; import org.springframework.core.MethodParameter; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.core.convert.support.GenericConversionService; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; +import org.springframework.tests.sample.beans.DependenciesBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.LifecycleBean; +import org.springframework.tests.sample.beans.NestedTestBean; +import org.springframework.tests.sample.beans.SideEffectBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.util.StopWatch; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - /** * Tests properties population and autowire behavior. * @@ -2600,29 +2609,6 @@ public class DefaultListableBeanFactoryTests { } } - /** - * Bean that changes state on a business invocation, so that - * we can check whether it's been invoked - * @author Rod Johnson - */ - private static class SideEffectBean { - - private int count; - - public void setCount(int count) { - this.count = count; - } - - public int getCount() { - return this.count; - } - - public void doWork() { - ++count; - } - - } - private static class KnowsIfInstantiated { private static boolean instantiated; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java index bccb33a9781..62c85b60b2b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.beans.factory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java index c5f365f7997..e422accf4b7 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,9 +23,9 @@ import java.util.Arrays; import org.junit.Test; import org.springframework.beans.BeansException; import org.springframework.beans.factory.support.DefaultSingletonBeanRegistry; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.DerivedTestBean; -import test.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/beans1.xml b/spring-beans/src/test/java/org/springframework/beans/factory/access/beans1.xml similarity index 100% rename from spring-context/src/test/java/org/springframework/beans/factory/access/beans1.xml rename to spring-beans/src/test/java/org/springframework/beans/factory/access/beans1.xml diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/beans2.xml b/spring-beans/src/test/java/org/springframework/beans/factory/access/beans2.xml similarity index 100% rename from spring-context/src/test/java/org/springframework/beans/factory/access/beans2.xml rename to spring-beans/src/test/java/org/springframework/beans/factory/access/beans2.xml diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java index 5acfcca8b6f..7181f0b8a12 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -43,12 +43,12 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.NestedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.SerializationTestUtils; -import test.beans.ITestBean; -import test.beans.IndexedTestBean; -import test.beans.NestedTestBean; -import test.beans.TestBean; /** * Unit tests for {@link AutowiredAnnotationBeanPostProcessor}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java index f9295e4ee61..4fbb7b8cb1d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.beans.factory.annotation; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.config.BeanDefinitionHolder; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java index 4cfba96615d..a18a25e05ae 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,10 +24,6 @@ import javax.inject.Named; import javax.inject.Provider; import org.junit.Test; -import test.beans.ITestBean; -import test.beans.IndexedTestBean; -import test.beans.NestedTestBean; -import test.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanFactory; @@ -38,6 +34,10 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.NestedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.SerializationTestUtils; import static org.junit.Assert.*; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java index c5c49d9b3bd..252ee0ddb80 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,6 @@ import java.util.Map; import static org.junit.Assert.*; import org.junit.Test; -import test.beans.TestBean; import org.springframework.beans.FatalBeanException; import org.springframework.beans.MutablePropertyValues; @@ -36,6 +35,7 @@ import org.springframework.beans.PropertyEditorRegistry; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.tests.sample.beans.TestBean; /** * Unit tests for {@link CustomEditorConfigurer}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests-context.xml b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests-context.xml index b9c8625b2f8..2e2d9fd435f 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests-context.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests-context.xml @@ -3,7 +3,7 @@ - + diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java index d5569c3fd3c..66226340aa4 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.beans.factory.config; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.sql.Connection; @@ -25,8 +25,8 @@ import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * Unit tests for {@link FieldRetrievingFactoryBean}. @@ -119,7 +119,7 @@ public final class FieldRetrievingFactoryBeanTests { @Test public void testWithConstantOnClassWithPackageLevelVisibility() throws Exception { FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean(); - fr.setBeanName("test.beans.PackageLevelVisibleBean.CONSTANT"); + fr.setBeanName("org.springframework.tests.sample.beans.PackageLevelVisibleBean.CONSTANT"); fr.afterPropertiesSet(); assertEquals("Wuby", fr.getObject()); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java index a7faf0cc085..dc56161776d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.Date; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java index 409e3f8325d..cc43afb4da0 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.beans.factory.config; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.Properties; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests-context.xml b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests-context.xml index b33b3c9c65a..490aab87909 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests-context.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests-context.xml @@ -3,19 +3,19 @@ - + 10 - + 11 - + 98 - + 99 @@ -23,7 +23,7 @@ - + 12 @@ -46,10 +46,10 @@ tb spouse - test.beans.TestBean + org.springframework.tests.sample.beans.TestBean - + diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java index 6ec0c706e64..ce21ee90954 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,15 +20,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.ITestBean; -import test.beans.TestBean; /** * Unit tests for {@link PropertyPathFactoryBean}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurerTests.java index c0c65711bc2..63e49fb18bf 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 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. @@ -36,8 +36,8 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java index ab67af35a3a..1212913cb1b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.Collections; import java.util.HashMap; @@ -48,9 +48,9 @@ import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.ManagedSet; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.IndexedTestBean; -import test.beans.TestBean; /** * Unit tests for various {@link PropertyResourceConfigurer} implementations including: diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests-context.xml b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests-context.xml index f6f4f4a0a23..1c1978456ca 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests-context.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests-context.xml @@ -5,6 +5,6 @@ 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"> - + diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java index 861cafa68d2..0a561dd3360 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.beans.factory.config; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.LinkedList; import java.util.List; @@ -28,8 +28,8 @@ import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * Simple test to illustrate and verify scope usage. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests-context.xml b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests-context.xml index d0c52278445..c2cc486e9da 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests-context.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests-context.xml @@ -6,7 +6,7 @@ - + @@ -14,9 +14,9 @@ - + - + @@ -26,5 +26,5 @@ - + \ No newline at end of file diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java index 82a35dc064f..20bdd506544 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.beans.factory.parsing; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static org.springframework.tests.TestResourceUtils.qualifiedResource; import java.util.ArrayList; import java.util.List; @@ -27,8 +27,8 @@ import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java index 365ae6b9581..48bd97d15b1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,8 +21,8 @@ import java.util.Arrays; import junit.framework.TestCase; import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java index c761254fdae..11aed3fa64c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,8 +20,8 @@ import junit.framework.TestCase; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java index b3516282d43..1afd0c52810 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -45,10 +45,13 @@ import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.UrlResource; -import test.beans.GenericBean; -import test.beans.GenericIntegerBean; -import test.beans.GenericSetOfIntegerBean; -import test.beans.TestBean; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; +import org.springframework.tests.sample.beans.GenericBean; +import org.springframework.tests.sample.beans.GenericIntegerBean; +import org.springframework.tests.sample.beans.GenericSetOfIntegerBean; +import org.springframework.tests.sample.beans.TestBean; + /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/DefinitionMetadataEqualsHashCodeTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/DefinitionMetadataEqualsHashCodeTests.java index 2e4025d304a..f9f1beba04a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/DefinitionMetadataEqualsHashCodeTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/DefinitionMetadataEqualsHashCodeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,8 +20,8 @@ import junit.framework.TestCase; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.RuntimeBeanReference; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java index 51e8dd70122..d62e43d0601 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,8 +18,8 @@ package org.springframework.beans.factory.support; import junit.framework.TestCase; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/genericBeanTests.xml b/spring-beans/src/test/java/org/springframework/beans/factory/support/genericBeanTests.xml index 6c9d11f210a..3e9a6577b55 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/genericBeanTests.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/genericBeanTests.xml @@ -3,7 +3,7 @@ - + @@ -43,7 +43,7 @@ autowire="constructor"> - + @@ -53,7 +53,7 @@ - + diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java index ded4bb5eaef..625e8c7085e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,8 +24,8 @@ import junit.framework.TestCase; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rick Evans diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java index 490d0a7e1bf..4510487801a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,13 +27,13 @@ import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanIsNotAFactoryException; import org.springframework.beans.factory.BeanNotOfRequiredTypeException; -import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.tests.sample.beans.LifecycleBean; +import org.springframework.tests.sample.beans.MustBeInitialized; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; -import test.beans.DummyFactory; -import test.beans.LifecycleBean; -import test.beans.TestBean; /** * Subclasses must implement setUp() to initialize bean factory @@ -336,32 +336,3 @@ public abstract class AbstractBeanFactoryTests extends TestCase { } } - - -/** - * Simple test of BeanFactory initialization - * @author Rod Johnson - * @since 12.03.2003 - */ -class MustBeInitialized implements InitializingBean { - - private boolean inited; - - /** - * @see InitializingBean#afterPropertiesSet() - */ - @Override - public void afterPropertiesSet() throws Exception { - this.inited = true; - } - - /** - * Dummy business method that will fail unless the factory - * managed the bean's lifecycle correctly - */ - public void businessMethod() { - if (!this.inited) - throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object"); - } - -} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java index 6a04c540743..4c1ac580bb9 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,8 +19,8 @@ package org.springframework.beans.factory.xml; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.ListableBeanFactory; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rod Johnson @@ -51,13 +51,13 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto public void assertTestBeanCount(int count) { String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false); - assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + + assertTrue("We should have " + count + " beans for class org.springframework.tests.sample.beans.TestBean, not " + defNames.length, defNames.length == count); int countIncludingFactoryBeans = count + 2; String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true); assertTrue("We should have " + countIncludingFactoryBeans + - " beans for class org.springframework.beans.TestBean, not " + names.length, + " beans for class org.springframework.tests.sample.beans.TestBean, not " + names.length, names.length == countIncludingFactoryBeans); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java index 9cc414ee651..ae6232f40ff 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,8 +23,8 @@ import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java index 72de2d65d11..a9294e05fd1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,8 +27,8 @@ import junit.framework.TestCase; import org.springframework.beans.factory.support.BeanDefinitionReader; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * Unit and integration tests for the collection merging support. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java index f57b78d2591..3a88ab9fa8f 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import java.util.Map; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java index 6a31f91e1a3..082fc418b0e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,8 +18,9 @@ package org.springframework.beans.factory.xml; import java.io.Serializable; -import test.beans.IndexedTestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.TestBean; + /** * Simple bean used to check constructor dependency checking. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java index 75bcc94d84b..7b02d0bed29 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,8 +17,8 @@ package org.springframework.beans.factory.xml; import org.springframework.beans.factory.FactoryBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java index d1449fdb0b7..a0d4f722e15 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,8 +17,8 @@ package org.springframework.beans.factory.xml; -import test.beans.DummyFactory; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-multiLevel-context.xml b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-multiLevel-context.xml index b897d98858a..8e53cee2934 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-multiLevel-context.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-multiLevel-context.xml @@ -4,12 +4,12 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> - + - + diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-sameLevel-context.xml b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-sameLevel-context.xml index e8bf2b4469a..12a2fb08602 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-sameLevel-context.xml +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests-sameLevel-context.xml @@ -4,12 +4,12 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> - + - + diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java index 58c392ddcaa..bd92b0c3916 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,8 +23,8 @@ import static org.junit.Assert.fail; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java index 62f4e654b65..ff691358a44 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,6 +30,7 @@ import org.springframework.beans.factory.parsing.ImportDefinition; import org.springframework.beans.factory.parsing.PassThroughSourceExtractor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.beans.CollectingReaderEventListener; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java index 696ab6c0afe..0d67448bc05 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -23,12 +23,12 @@ import java.util.Properties; import static org.junit.Assert.*; import org.junit.Test; -import test.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java index 1623cf3ac52..a5ef87cb1f6 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,8 @@ package org.springframework.beans.factory.xml; import java.util.Collections; import java.util.List; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; + /** * Test class for Spring's ability to create objects using static diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java index 25ab86c6416..6c8872054e1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.beans.factory.xml; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Test class for Spring's ability to create objects using diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java index a6feaedcec6..5b9ddc18e66 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import org.junit.Test; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * Tests for propagating enclosing beans element defaults to nested beans elements. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java index 8344d0b5298..17552b1d591 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2013 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. @@ -22,8 +22,8 @@ import org.xml.sax.SAXParseException; import org.springframework.beans.BeansException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java index f9416028884..601afa44fbe 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,9 +22,9 @@ import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.DummyBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.DummyBean; -import test.beans.TestBean; /** * @author Costin Leau diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java index badce0656bd..45e89564e72 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,9 +22,9 @@ import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.ITestBean; -import test.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java index 438a4b7e9e3..849da031cc3 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.beans.factory.xml; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Test class for Spring's ability to create diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java index d042952a88e..3bb04d4c593 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,6 @@ import java.util.TreeMap; import java.util.Arrays; import junit.framework.TestCase; -import test.beans.CustomEnum; -import test.beans.TestBean; import org.springframework.beans.factory.config.FieldRetrievingFactoryBean; import org.springframework.beans.factory.config.PropertiesFactoryBean; @@ -34,6 +32,9 @@ import org.springframework.beans.factory.parsing.ComponentDefinition; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.beans.CollectingReaderEventListener; +import org.springframework.tests.sample.beans.CustomEnum; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java index 18f616eb14d..6960653ea6e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,6 @@ import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.HashSet; -import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -34,7 +33,6 @@ import java.util.Properties; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; -import java.util.concurrent.CopyOnWriteArraySet; import org.junit.Test; import org.springframework.beans.factory.BeanCreationException; @@ -44,8 +42,9 @@ import org.springframework.beans.factory.config.MapFactoryBean; import org.springframework.beans.factory.config.SetFactoryBean; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.HasMap; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * Tests for collections in XML bean definitions. @@ -452,94 +451,3 @@ public class XmlBeanCollectionTests { } } } - - -/** - * Bean exposing a map. Used for bean factory tests. - * - * @author Rod Johnson - * @since 05.06.2003 - */ -class HasMap { - - private Map map; - - private IdentityHashMap identityMap; - - private Set set; - - private CopyOnWriteArraySet concurrentSet; - - private Properties props; - - private Object[] objectArray; - - private Class[] classArray; - - private Integer[] intArray; - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public IdentityHashMap getIdentityMap() { - return identityMap; - } - - public void setIdentityMap(IdentityHashMap identityMap) { - this.identityMap = identityMap; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public CopyOnWriteArraySet getConcurrentSet() { - return concurrentSet; - } - - public void setConcurrentSet(CopyOnWriteArraySet concurrentSet) { - this.concurrentSet = concurrentSet; - } - - public Properties getProps() { - return props; - } - - public void setProps(Properties props) { - this.props = props; - } - - public Object[] getObjectArray() { - return objectArray; - } - - public void setObjectArray(Object[] objectArray) { - this.objectArray = objectArray; - } - - public Class[] getClassArray() { - return classArray; - } - - public void setClassArray(Class[] classArray) { - this.classArray = classArray; - } - - public Integer[] getIntegerArray() { - return intArray; - } - - public void setIntegerArray(Integer[] is) { - intArray = is; - } - -} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java index 76baf7366fe..c5da99f0e4c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,8 +28,8 @@ import org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.TestBean; /** * @author Rick Evans diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java index 5b6e88a1555..2fd60f7a0e0 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,11 +28,11 @@ import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.LifecycleBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; -import test.beans.DummyFactory; -import test.beans.ITestBean; -import test.beans.LifecycleBean; -import test.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java index ca477008cd2..d2052916203 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -44,12 +44,12 @@ import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeansException; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; +import org.springframework.tests.sample.beans.BooleanTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.NumberTestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.beans.BooleanTestBean; -import test.beans.ITestBean; -import test.beans.IndexedTestBean; -import test.beans.NumberTestBean; -import test.beans.TestBean; /** * Unit tests for the various PropertyEditors in Spring. @@ -592,9 +592,9 @@ public class CustomEditorTests { @Test public void testClassEditorWithArray() { PropertyEditor classEditor = new ClassEditor(); - classEditor.setAsText("test.beans.TestBean[]"); + classEditor.setAsText("org.springframework.tests.sample.beans.TestBean[]"); assertEquals(TestBean[].class, classEditor.getValue()); - assertEquals("test.beans.TestBean[]", classEditor.getAsText()); + assertEquals("org.springframework.tests.sample.beans.TestBean[]", classEditor.getAsText()); } /* diff --git a/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java b/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java index ef036076581..14c28820268 100644 --- a/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,11 +16,18 @@ package org.springframework.beans.support; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.List; + import junit.framework.TestCase; -import test.beans.TestBean; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; +import org.springframework.tests.sample.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java b/spring-beans/src/test/java/org/springframework/tests/beans/CollectingReaderEventListener.java similarity index 98% rename from spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java rename to spring-beans/src/test/java/org/springframework/tests/beans/CollectingReaderEventListener.java index 1924dac82e6..8779f9ed5ed 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java +++ b/spring-beans/src/test/java/org/springframework/tests/beans/CollectingReaderEventListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans.factory.xml; +package org.springframework.tests.beans; import java.util.ArrayList; import java.util.Collection; diff --git a/spring-beans/src/test/java/test/beans/BooleanTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/BooleanTestBean.java similarity index 95% rename from spring-beans/src/test/java/test/beans/BooleanTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/BooleanTestBean.java index 4ea2f67d3bb..92484b7d1aa 100644 --- a/spring-beans/src/test/java/test/beans/BooleanTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/BooleanTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** * @author Juergen Hoeller diff --git a/spring-context-support/src/test/java/org/springframework/beans/Colour.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/Colour.java similarity index 95% rename from spring-context-support/src/test/java/org/springframework/beans/Colour.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/Colour.java index a992a2ebfc6..a4a7d9740b4 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/Colour.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/Colour.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; import org.springframework.core.enums.ShortCodedLabeledEnum; diff --git a/spring-aop/src/test/java/test/beans/CountingTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/CountingTestBean.java similarity index 94% rename from spring-aop/src/test/java/test/beans/CountingTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/CountingTestBean.java index 50657647656..e5f6947de5a 100644 --- a/spring-aop/src/test/java/test/beans/CountingTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/CountingTestBean.java @@ -1,7 +1,3 @@ -/* - * $Id$ - */ - /* * Copyright 2002-2005 the original author or authors. * @@ -18,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** diff --git a/spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/CustomEnum.java similarity index 94% rename from spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/CustomEnum.java index 1e43492191b..66a863772ff 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/CustomEnum.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; /** * @author Juergen Hoeller diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DependenciesBean.java similarity index 95% rename from spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/DependenciesBean.java index 8bed2eeeab0..b17d1028cc5 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DependenciesBean.java @@ -14,13 +14,11 @@ * limitations under the License. */ -package org.springframework.beans.factory.xml; +package org.springframework.tests.sample.beans; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; -import test.beans.TestBean; - /** * Simple bean used to test dependency checking. * diff --git a/spring-beans/src/test/java/test/beans/DerivedTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DerivedTestBean.java similarity index 97% rename from spring-beans/src/test/java/test/beans/DerivedTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/DerivedTestBean.java index c0f63181aba..91416208a2b 100644 --- a/spring-beans/src/test/java/test/beans/DerivedTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DerivedTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import java.io.Serializable; diff --git a/spring-beans/src/test/java/test/beans/DummyBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DummyBean.java similarity index 96% rename from spring-beans/src/test/java/test/beans/DummyBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/DummyBean.java index a8428c7f780..cb5767eef59 100644 --- a/spring-beans/src/test/java/test/beans/DummyBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DummyBean.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** * @author Costin Leau diff --git a/spring-beans/src/test/java/test/beans/DummyFactory.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DummyFactory.java similarity index 97% rename from spring-beans/src/test/java/test/beans/DummyFactory.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/DummyFactory.java index 60f7966d9a0..dc08778c536 100644 --- a/spring-beans/src/test/java/test/beans/DummyFactory.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/DummyFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -24,6 +24,7 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.tests.sample.beans.TestBean; /** diff --git a/spring-beans/src/test/java/test/beans/GenericBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericBean.java similarity index 95% rename from spring-beans/src/test/java/test/beans/GenericBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericBean.java index 12ff808dc84..c192382a1b7 100644 --- a/spring-beans/src/test/java/test/beans/GenericBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2010 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import java.util.ArrayList; import java.util.Collection; @@ -37,6 +37,8 @@ public class GenericBean { private Set numberSet; + private Set testBeanSet; + private List resourceList; private List testBeanList; @@ -69,6 +71,7 @@ public class GenericBean { private List genericListProperty; + public GenericBean() { } @@ -121,6 +124,14 @@ public class GenericBean { this.numberSet = numberSet; } + public Set getTestBeanSet() { + return testBeanSet; + } + + public void setTestBeanSet(Set testBeanSet) { + this.testBeanSet = testBeanSet; + } + public List getResourceList() { return resourceList; } @@ -284,4 +295,4 @@ public class GenericBean { return new GenericBean(someFlag, collectionMap); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/GenericIntegerBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericIntegerBean.java similarity index 93% rename from spring-beans/src/test/java/test/beans/GenericIntegerBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericIntegerBean.java index 43b6465df08..b7465b1bfa1 100644 --- a/spring-beans/src/test/java/test/beans/GenericIntegerBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericIntegerBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** diff --git a/spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericSetOfIntegerBean.java similarity index 93% rename from spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericSetOfIntegerBean.java index 021c0cd1c16..a0fee60195d 100644 --- a/spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/GenericSetOfIntegerBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import java.util.Set; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/HasMap.java similarity index 75% rename from spring-context/src/test/java/org/springframework/beans/factory/HasMap.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/HasMap.java index 73fe70276e2..4639050b2a6 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/HasMap.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package org.springframework.beans.factory; +package org.springframework.tests.sample.beans; +import java.util.IdentityHashMap; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; /** * Bean exposing a map. Used for bean factory tests. @@ -40,6 +42,10 @@ public class HasMap { private Integer[] intArray; + private IdentityHashMap identityMap; + + private CopyOnWriteArraySet concurrentSet; + private HasMap() { } @@ -91,4 +97,20 @@ public class HasMap { intArray = is; } + public IdentityHashMap getIdentityMap() { + return identityMap; + } + + public void setIdentityMap(IdentityHashMap identityMap) { + this.identityMap = identityMap; + } + + public CopyOnWriteArraySet getConcurrentSet() { + return concurrentSet; + } + + public void setConcurrentSet(CopyOnWriteArraySet concurrentSet) { + this.concurrentSet = concurrentSet; + } + } diff --git a/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/INestedTestBean.java similarity index 93% rename from spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/INestedTestBean.java index e0ae5f20a3f..58c4b9d502d 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/INestedTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; public interface INestedTestBean { diff --git a/spring-beans/src/test/java/test/beans/IOther.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/IOther.java similarity index 93% rename from spring-beans/src/test/java/test/beans/IOther.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/IOther.java index f3c6263261e..694f32d2759 100644 --- a/spring-beans/src/test/java/test/beans/IOther.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/IOther.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; public interface IOther { diff --git a/spring-web/src/test/java/org/springframework/beans/ITestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/ITestBean.java similarity index 90% rename from spring-web/src/test/java/org/springframework/beans/ITestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/ITestBean.java index 526c3dacfb5..b467348a93d 100644 --- a/spring-web/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/ITestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2007 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; import java.io.IOException; /** - * Interface used for {@link org.springframework.beans.TestBean}. + * Interface used for {@link org.springframework.tests.sample.beans.TestBean}. * *

Two methods are the same as on Person, but if this * extends person it breaks quite a few tests.. @@ -84,4 +84,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/IndexedTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/IndexedTestBean.java similarity index 98% rename from spring-beans/src/test/java/test/beans/IndexedTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/IndexedTestBean.java index bd2a72662f6..d319bbd0eda 100644 --- a/spring-beans/src/test/java/test/beans/IndexedTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/IndexedTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import java.util.ArrayList; import java.util.Collection; diff --git a/spring-beans/src/test/java/test/beans/LifecycleBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/LifecycleBean.java similarity index 99% rename from spring-beans/src/test/java/test/beans/LifecycleBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/LifecycleBean.java index cd1dcd6e5e0..1a81d10340a 100644 --- a/spring-beans/src/test/java/test/beans/LifecycleBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/LifecycleBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/MustBeInitialized.java similarity index 92% rename from spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/MustBeInitialized.java index 959861e6b47..cc83d69d833 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/MustBeInitialized.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package org.springframework.beans.factory; +package org.springframework.tests.sample.beans; + +import org.springframework.beans.factory.InitializingBean; /** * Simple test of BeanFactory initialization diff --git a/spring-beans/src/test/java/test/beans/NestedTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/NestedTestBean.java similarity index 96% rename from spring-beans/src/test/java/test/beans/NestedTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/NestedTestBean.java index edc145ad7d2..844c5ea6921 100644 --- a/spring-beans/src/test/java/test/beans/NestedTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/NestedTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** * Simple nested test bean used for testing bean factories, AOP framework etc. diff --git a/spring-beans/src/test/java/test/beans/NumberTestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/NumberTestBean.java similarity index 98% rename from spring-beans/src/test/java/test/beans/NumberTestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/NumberTestBean.java index cdd80bd27b2..489c9335091 100644 --- a/spring-beans/src/test/java/test/beans/NumberTestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/NumberTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/PackageLevelVisibleBean.java similarity index 94% rename from spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/PackageLevelVisibleBean.java index eeb4b7325db..142a5da2d26 100644 --- a/spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/PackageLevelVisibleBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** * @see org.springframework.beans.factory.config.FieldRetrievingFactoryBeanTests diff --git a/spring-test/src/test/java/org/springframework/beans/Pet.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/Pet.java similarity index 96% rename from spring-test/src/test/java/org/springframework/beans/Pet.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/Pet.java index eb78f612fb0..61563f0dd8a 100644 --- a/spring-test/src/test/java/org/springframework/beans/Pet.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/Pet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/test/beans/SideEffectBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/SideEffectBean.java similarity index 95% rename from spring-aop/src/test/java/test/beans/SideEffectBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/SideEffectBean.java index 621ecbc3a2c..9477a5e5488 100644 --- a/spring-aop/src/test/java/test/beans/SideEffectBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/SideEffectBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** * Bean that changes state on a business invocation, so that diff --git a/spring-context/src/test/java/org/springframework/beans/TestBean.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/TestBean.java similarity index 89% rename from spring-context/src/test/java/org/springframework/beans/TestBean.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/TestBean.java index c050b64856c..cb276da9cbd 100644 --- a/spring-context/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/TestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; import java.io.IOException; import java.util.ArrayList; @@ -58,7 +58,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private boolean jedi; - private ITestBean[] spouses; + protected ITestBean[] spouses; private String touchy; @@ -66,6 +66,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Integer[] someIntegerArray; + private Integer[][] nestedIntegerArray; + + private int[] someIntArray; + + private int[][] nestedIntArray; + private Date date = new Date(); private Float myFloat = new Float(0.0); @@ -257,6 +263,36 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt this.someIntegerArray = someIntegerArray; } + @Override + public Integer[][] getNestedIntegerArray() { + return nestedIntegerArray; + } + + @Override + public void setNestedIntegerArray(Integer[][] nestedIntegerArray) { + this.nestedIntegerArray = nestedIntegerArray; + } + + @Override + public int[] getSomeIntArray() { + return someIntArray; + } + + @Override + public void setSomeIntArray(int[] someIntArray) { + this.someIntArray = someIntArray; + } + + @Override + public int[][] getNestedIntArray() { + return nestedIntArray; + } + + @Override + public void setNestedIntArray(int[][] nestedIntArray) { + this.nestedIntArray = nestedIntArray; + } + public Date getDate() { return date; } @@ -382,7 +418,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt /** - * @see org.springframework.beans.ITestBean#exceptional(Throwable) + * @see org.springframework.tests.sample.beans.ITestBean#exceptional(Throwable) */ @Override public void exceptional(Throwable t) throws Throwable { @@ -396,7 +432,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt throw new IOException(); } /** - * @see org.springframework.beans.ITestBean#returnsThis() + * @see org.springframework.tests.sample.beans.ITestBean#returnsThis() */ @Override public Object returnsThis() { @@ -404,7 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt } /** - * @see org.springframework.beans.IOther#absquatulate() + * @see org.springframework.tests.sample.beans.IOther#absquatulate() */ @Override public void absquatulate() { @@ -454,4 +490,4 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt return this.name; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/factory/DummyFactory.java similarity index 87% rename from spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java rename to spring-beans/src/test/java/org/springframework/tests/sample/beans/factory/DummyFactory.java index f9c4f273826..b562f569fa0 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/factory/DummyFactory.java @@ -14,11 +14,18 @@ * limitations under the License. */ -package org.springframework.beans.factory; +package org.springframework.tests.sample.beans.factory; import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.beans.factory.BeanNameAware; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.tests.sample.beans.TestBean; + /** * Simple factory to allow testing of FactoryBean support in AbstractBeanFactory. @@ -29,6 +36,7 @@ import org.springframework.beans.factory.config.AutowireCapableBeanFactory; * factories get this lifecycle callback if they want. * * @author Rod Johnson + * @author Chris Beams * @since 10.03.2003 */ public class DummyFactory @@ -72,7 +80,7 @@ public class DummyFactory /** * Return if the bean managed by this factory is a singleton. - * @see org.springframework.beans.factory.FactoryBean#isSingleton() + * @see FactoryBean#isSingleton() */ @Override public boolean isSingleton() { @@ -146,7 +154,7 @@ public class DummyFactory /** * Return the managed object, supporting both singleton * and prototype mode. - * @see org.springframework.beans.factory.FactoryBean#getObject() + * @see FactoryBean#getObject() */ @Override public Object getObject() throws BeansException { @@ -164,7 +172,7 @@ public class DummyFactory } @Override - public Class getObjectType() { + public Class getObjectType() { return TestBean.class; } @@ -176,4 +184,4 @@ public class DummyFactory } } -} +} \ No newline at end of file diff --git a/spring-beans/src/test/java/org/springframework/tests/sample/beans/package-info.java b/spring-beans/src/test/java/org/springframework/tests/sample/beans/package-info.java new file mode 100644 index 00000000000..575bd1933f9 --- /dev/null +++ b/spring-beans/src/test/java/org/springframework/tests/sample/beans/package-info.java @@ -0,0 +1,4 @@ +/** + * General purpose sample beans that can be used with tests. + */ +package org.springframework.tests.sample.beans; diff --git a/spring-beans/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-beans/src/test/java/org/springframework/util/SerializationTestUtils.java deleted file mode 100644 index 9ae4f54ec24..00000000000 --- a/spring-beans/src/test/java/org/springframework/util/SerializationTestUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2002-2009 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.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * - * @author Rod Johnson - */ -public class SerializationTestUtils { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - return o2; - } - -} diff --git a/spring-beans/src/test/java/test/beans/Colour.java b/spring-beans/src/test/java/test/beans/Colour.java deleted file mode 100644 index 533d0df36e3..00000000000 --- a/spring-beans/src/test/java/test/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-beans/src/test/java/test/beans/CustomEnum.java b/spring-beans/src/test/java/test/beans/CustomEnum.java deleted file mode 100644 index d7404bc6786..00000000000 --- a/spring-beans/src/test/java/test/beans/CustomEnum.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2002-2007 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 test.beans; - -/** - * @author Juergen Hoeller - */ -public enum CustomEnum { - - VALUE_1, VALUE_2; - - public String toString() { - return "CustomEnum: " + name(); - } - -} \ No newline at end of file diff --git a/spring-beans/src/test/java/test/beans/INestedTestBean.java b/spring-beans/src/test/java/test/beans/INestedTestBean.java deleted file mode 100644 index 56c9d829ee3..00000000000 --- a/spring-beans/src/test/java/test/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-beans/src/test/java/test/beans/ITestBean.java b/spring-beans/src/test/java/test/beans/ITestBean.java deleted file mode 100644 index 9397b175503..00000000000 --- a/spring-beans/src/test/java/test/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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 test.beans; - -import java.io.IOException; - -/** - * Interface used for {@link test.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-beans/src/test/java/test/beans/TestBean.java b/spring-beans/src/test/java/test/beans/TestBean.java deleted file mode 100644 index 5b94f078b5d..00000000000 --- a/spring-beans/src/test/java/test/beans/TestBean.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-beans/src/test/java/test/util/TestResourceUtils.java b/spring-beans/src/test/java/test/util/TestResourceUtils.java deleted file mode 100644 index 4843151231b..00000000000 --- a/spring-beans/src/test/java/test/util/TestResourceUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2002-2012 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 test.util; - -import static java.lang.String.format; - -import org.springframework.core.io.ClassPathResource; - -/** - * Convenience utilities for common operations with test resources. - * - * @author Chris Beams - */ -public class TestResourceUtils { - - /** - * Loads a {@link ClassPathResource} qualified by the simple name of clazz, - * and relative to the package for clazz. - * - *

Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', - * this method will return a ClassPathResource representing com/foo/BarTests-context.xml - * - *

Intended for use loading context configuration XML files within JUnit tests. - * - * @param clazz - * @param resourceSuffix - */ - public static ClassPathResource qualifiedResource(Class clazz, String resourceSuffix) { - return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz); - } - -} diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/support/multiConstructorArgs.properties b/spring-beans/src/test/resources/org/springframework/beans/factory/support/multiConstructorArgs.properties index 5beaf6d5982..8d5f74fc31a 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/support/multiConstructorArgs.properties +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/support/multiConstructorArgs.properties @@ -1,3 +1,3 @@ -testBean.(class)=test.beans.TestBean +testBean.(class)=org.springframework.tests.sample.beans.TestBean testBean.$0=Rob Harrop -testBean.$1=23 \ No newline at end of file +testBean.$1=23 diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/support/refConstructorArg.properties b/spring-beans/src/test/resources/org/springframework/beans/factory/support/refConstructorArg.properties index c33326c8574..4d3723c7de8 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/support/refConstructorArg.properties +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/support/refConstructorArg.properties @@ -1,5 +1,5 @@ -sally.(class)=test.beans.TestBean +sally.(class)=org.springframework.tests.sample.beans.TestBean sally.name=Sally -rob.(class)=test.beans.TestBean -rob.$0(ref)=sally \ No newline at end of file +rob.(class)=org.springframework.tests.sample.beans.TestBean +rob.$0(ref)=sally diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/support/simpleConstructorArg.properties b/spring-beans/src/test/resources/org/springframework/beans/factory/support/simpleConstructorArg.properties index be6700e1423..d0f1eea3266 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/support/simpleConstructorArg.properties +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/support/simpleConstructorArg.properties @@ -1,2 +1,2 @@ -testBean.(class)=test.beans.TestBean -testBean.$0=Rob Harrop \ No newline at end of file +testBean.(class)=org.springframework.tests.sample.beans.TestBean +testBean.$0=Rob Harrop diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests-merge-context.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests-merge-context.xml index 12dbc607928..2edadb511eb 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests-merge-context.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests-merge-context.xml @@ -5,7 +5,7 @@ http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" default-merge="false"> - + alpha diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml index 6363230a06c..2fcb1179545 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml @@ -3,9 +3,9 @@ - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml index 3f32de8aee3..a2e966aab98 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml @@ -3,9 +3,9 @@ - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml index e32686f27f7..9b93a16810d 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" default-autowire-candidates=""> - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml index 2883bd2383a..089517cd427 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" default-autowire-candidates="props*,*ly"> - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/beanEvents.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/beanEvents.xml index 22168ca8c8c..7e262a0a0d4 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/beanEvents.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/beanEvents.xml @@ -10,22 +10,22 @@ - + - + - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml index a614172a897..d8fc1db88ea 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml @@ -3,7 +3,7 @@ - + Rob Harrop @@ -23,12 +23,12 @@ - + - + Rob Harrop @@ -47,14 +47,14 @@ - + - + @@ -76,7 +76,7 @@ - + @@ -84,7 +84,7 @@ - + Sall @@ -103,7 +103,7 @@ - + Rob Harrop @@ -123,12 +123,12 @@ - + - + Rob Harrop @@ -147,14 +147,14 @@ - + - + @@ -176,7 +176,7 @@ - + @@ -184,7 +184,7 @@ - + Sall diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml index 44bd0b92dc9..974ae6c3d9c 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> - + Jenny 30 @@ -11,8 +11,8 @@ - - + + Simple bean, without any collections. @@ -22,8 +22,8 @@ 27 - - + + Rod 32 @@ -34,8 +34,8 @@ - - + + Jenny 30 @@ -44,13 +44,13 @@ - + David 27 - + Rod 32 @@ -64,7 +64,7 @@ - + loner 26 @@ -74,7 +74,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -102,26 +102,26 @@ - + verbose - - + + - + - + - - + + @@ -131,7 +131,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -177,7 +177,7 @@ - + @@ -186,7 +186,7 @@ - + @@ -217,15 +217,15 @@ - - + + - + bar @@ -235,7 +235,7 @@ - + bar @@ -245,7 +245,7 @@ - + @@ -254,15 +254,15 @@ - + - - - + + + bar @@ -270,8 +270,8 @@ - - + + @@ -280,7 +280,7 @@ - + one @@ -288,8 +288,8 @@ - - + + java.lang.String @@ -297,8 +297,8 @@ - - + + 0 diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml index 7cd04cc145a..8a31ff86962 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - + 1 @@ -28,7 +28,7 @@ - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/factory-methods.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/factory-methods.xml index f97701759b6..4ff20b3d591 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/factory-methods.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/factory-methods.xml @@ -102,7 +102,7 @@ - + Juergen @@ -127,7 +127,7 @@ - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/schemaValidated.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/schemaValidated.xml index 33cbb8dd8d6..7802a4c935b 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/schemaValidated.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/schemaValidated.xml @@ -3,16 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> - + - + - + - - + + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTests.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTests.xml index f245c964dd0..d9616443011 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTests.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTests.xml @@ -5,43 +5,43 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + - + - + - + - + - + \ No newline at end of file diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTestsWithErrors.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTestsWithErrors.xml index 7c10f7a32f6..1773a1c9c61 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTestsWithErrors.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simpleConstructorNamespaceHandlerTestsWithErrors.xml @@ -4,7 +4,7 @@ xmlns:p="http://www.springframework.org/schema/c" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTests.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTests.xml index e44a8c961c5..8dd70708d3d 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTests.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTests.xml @@ -8,20 +8,20 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> - + - + - + - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTestsWithErrors.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTestsWithErrors.xml index d82595bac7a..384171fdc03 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTestsWithErrors.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerTestsWithErrors.xml @@ -8,10 +8,10 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> - + - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/test.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/test.xml index 9d1d1f7adb8..933e66b7d00 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/test.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/test.xml @@ -3,7 +3,7 @@ - + I have no properties and I'm happy without them. @@ -12,7 +12,7 @@ - + aliased @@ -20,17 +20,17 @@ - + aliased - + aliased - + @@ -40,7 +40,7 @@ - + Rod 31 @@ -52,29 +52,29 @@ - + Kerry 34 - + Kathy 28 - + typeMismatch 34x - + - true @@ -85,10 +85,10 @@ - + - + false @@ -113,14 +113,14 @@ - + listenerVeto 66 - + - + this is a ]]> diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/testUtilNamespace.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/testUtilNamespace.xml index 8426c5d95ee..25f20439fa2 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/testUtilNamespace.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/testUtilNamespace.xml @@ -17,7 +17,7 @@ name "/> - + @@ -26,13 +26,13 @@ - + - + @@ -67,7 +67,7 @@ Rob Harrop - + foo @@ -89,13 +89,13 @@ - + - + @@ -111,13 +111,13 @@ min - + - + @@ -147,7 +147,7 @@ - + diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithDtd.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithDtd.xml index fab962d4dde..3cca869dbff 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithDtd.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithDtd.xml @@ -9,5 +9,5 @@ This is a top level block comment - + \ No newline at end of file diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithXsd.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithXsd.xml index 324fb483ff4..20aa0f53740 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithXsd.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/validateWithXsd.xml @@ -7,5 +7,5 @@ This is a top level block comment the parser now --> - + \ No newline at end of file diff --git a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/withMeta.xml b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/withMeta.xml index 7cb0723a4c2..05c47afa53a 100644 --- a/spring-beans/src/test/resources/org/springframework/beans/factory/xml/withMeta.xml +++ b/spring-beans/src/test/resources/org/springframework/beans/factory/xml/withMeta.xml @@ -4,15 +4,15 @@ xmlns:spring="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - + - + - + diff --git a/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/beans/IOther.java b/spring-context-support/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-context-support/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java b/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index cdf5ef510dd..00000000000 --- a/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index ddb091770ee..00000000000 --- a/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/beans/TestBean.java b/spring-context-support/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index 6d71de75764..00000000000 --- a/spring-context-support/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see org.springframework.beans.ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see org.springframework.beans.ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see org.springframework.beans.IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java b/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java deleted file mode 100644 index a95a2408b54..00000000000 --- a/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2002-2005 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.scheduling; - -/** - * @author Juergen Hoeller - * @since 09.10.2004 - */ -public class TestMethodInvokingTask { - - public int counter = 0; - - private Object lock = new Object(); - - public void doSomething() { - this.counter++; - } - - public void doWait() { - this.counter++; - // wait until stop is called - synchronized (this.lock) { - try { - this.lock.wait(); - } - catch (InterruptedException e) { - // fall through - } - } - } - - public void stop() { - synchronized(this.lock) { - this.lock.notify(); - } - } - -} \ No newline at end of file diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java index dfe6d48aa70..5c0cc1c0e3c 100644 --- a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java +++ b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java @@ -51,7 +51,8 @@ import org.quartz.Trigger; import org.quartz.TriggerListener; import org.quartz.impl.SchedulerRepository; import org.quartz.spi.JobFactory; -import org.springframework.beans.TestBean; +import org.springframework.tests.context.TestMethodInvokingTask; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.RootBeanDefinition; @@ -63,7 +64,6 @@ import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.core.task.TaskExecutor; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.scheduling.TestMethodInvokingTask; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java index 0e9f634bd43..364d5415920 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import org.junit.Test; import org.springframework.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.xml index 9a55cc823e3..66d0e85228a 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.xml @@ -19,6 +19,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java index a2f1054e9e4..c04a54f8e64 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,8 +26,8 @@ import org.junit.Test; import org.springframework.aop.aspectj.AfterReturningAdviceBindingTestAspect.AfterReturningAdviceBindingCollaborator; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.xml index 197afbf0695..97c02b34523 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.xml @@ -18,7 +18,7 @@ + pointcut="execution(org.springframework.tests.sample.beans.ITestBean[] *(..))"/> @@ -30,6 +30,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java index e57c4df2172..07605079249 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify; import org.junit.Before; import org.junit.Test; import org.springframework.aop.aspectj.AfterThrowingAdviceBindingTestAspect.AfterThrowingAdviceBindingCollaborator; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.xml index 9152fe1853e..77dd0c36247 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.xml @@ -37,6 +37,6 @@ - + \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java index 67195904dc8..879e846b2bd 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,8 +26,8 @@ import org.junit.Test; import org.springframework.aop.aspectj.AroundAdviceBindingTestAspect.AroundAdviceBindingCollaborator; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.xml index 91ca7c6540c..2198e32f49c 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.xml @@ -17,6 +17,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceCircularTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceCircularTests.xml index 7f947101837..e00fa847a7d 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceCircularTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceCircularTests.xml @@ -17,11 +17,11 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java index 5b606689acd..585d1806950 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.junit.Before; import org.junit.Test; import org.springframework.aop.MethodBeforeAdvice; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.factory.BeanNameAware; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.Ordered; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.xml index 6dae894ae62..038614eccf4 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.xml @@ -85,6 +85,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java index b88de9c97db..2b363cab83b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.xml index 8a23b5ad4d5..9ec75d75aab 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.xml @@ -5,11 +5,11 @@ - + + value="execution(org.springframework.tests.sample.beans.ITestBean[] org.springframework.tests.sample.beans.ITestBean.*(..))"/> diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java index e43cc579883..4ab6a830646 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,8 +23,8 @@ import org.aspectj.lang.annotation.Before; import org.junit.Test; import org.springframework.aop.aspectj.annotation.AspectJProxyFactory; import org.springframework.aop.framework.Advised; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.xml index 987a8b852cf..b446755d57b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.xml @@ -6,10 +6,10 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> - - - - + + + + - \ No newline at end of file + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java index 53a81f6e5a7..7c225060489 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,7 +25,7 @@ import org.junit.Before; import org.junit.Test; import org.springframework.aop.MethodBeforeAdvice; import org.springframework.aop.framework.Advised; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.xml index 66ccb584951..42dafc3e90d 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.xml @@ -21,13 +21,13 @@ - + - + - + - + @@ -53,9 +53,9 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java index 4df2dc36337..94e6e43f8ab 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import org.junit.Test; import org.springframework.aop.aspectj.AdviceBindingTestAspect.AdviceBindingCollaborator; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.xml index d12031f34eb..4aac362c73e 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.xml @@ -26,7 +26,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java index 59a3136fdce..145617f07a4 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java @@ -22,8 +22,8 @@ import org.junit.Before; import org.junit.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.xml index d8b4887fe66..fc449b6943c 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.xml @@ -8,7 +8,7 @@ @@ -17,11 +17,11 @@ pointcut="execution(* set*(*)) and this(mixin)" arg-names="mixin" /> - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java index 0e7435362af..f9d810c6262 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** @@ -39,7 +39,7 @@ public final class ImplicitJPArgumentMatchingAtAspectJTests { @Aspect static class CounterAtAspectJAspect { - @Around(value="execution(* org.springframework.beans.TestBean.*(..)) and this(bean) and args(argument)", + @Around(value="execution(* org.springframework.tests.sample.beans.TestBean.*(..)) and this(bean) and args(argument)", argNames="bean,argument") public void increment(ProceedingJoinPoint pjp, TestBean bean, Object argument) throws Throwable { pjp.proceed(); diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.xml index 01bd862dd1b..c88962cd533 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.xml index 1c10ec952fe..6a4a56e7f01 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.xml @@ -8,12 +8,12 @@ + expression="execution(* org.springframework.tests.sample.beans.TestBean.*(..)) and this(bean) and args(argument)"/> - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests-ambiguous.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests-ambiguous.xml index 3268b8ccecc..f8ca001d0de 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests-ambiguous.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests-ambiguous.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.xml index 57f3f9dd4d7..94725cb5e31 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.xml @@ -16,6 +16,6 @@ - + \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests-context.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests-context.xml index 7d846604000..6490decb219 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests-context.xml @@ -13,7 +13,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java index 361809558b4..9b6a0b61740 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.*; import org.aspectj.lang.ProceedingJoinPoint; import org.junit.Test; import org.springframework.aop.framework.Advised; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java index f609c08b3e7..7ca3e87e15a 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,8 +19,8 @@ package org.springframework.aop.aspectj.autoproxy; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspects.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspects.xml index 3eedc35b006..da15419d113 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspects.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspects.xml @@ -23,11 +23,11 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsPlusAdvisor.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsPlusAdvisor.xml index 8a399d03618..2b23fab3029 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsPlusAdvisor.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsPlusAdvisor.xml @@ -9,17 +9,17 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithAbstractBean.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithAbstractBean.xml index c1c8376b305..88907c1b6c4 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithAbstractBean.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithAbstractBean.xml @@ -20,7 +20,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithOrdering.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithOrdering.xml index a299f40e300..53c2a50c662 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithOrdering.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-aspectsWithOrdering.xml @@ -17,7 +17,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-pertarget.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-pertarget.xml index e02baf027b8..efb221722a0 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-pertarget.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-pertarget.xml @@ -10,12 +10,12 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-perthis.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-perthis.xml index 408c5477395..25f545b5425 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-perthis.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-perthis.xml @@ -7,7 +7,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspect.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspect.xml index a916c5a1e51..e00377721c4 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspect.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspect.xml @@ -7,7 +7,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspectPrototype.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspectPrototype.xml index 047ef0daafe..9505a844d7f 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspectPrototype.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-twoAdviceAspectPrototype.xml @@ -8,7 +8,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesInclude.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesInclude.xml index c6da3d6ea83..16293b388e0 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesInclude.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesInclude.xml @@ -18,7 +18,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesJoinPointAspect.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesJoinPointAspect.xml index 44bc1872f6a..462d8bcdc65 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesJoinPointAspect.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests-usesJoinPointAspect.xml @@ -7,7 +7,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java index e26835163f3..2306641f0e5 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeFalse; import java.lang.reflect.Method; @@ -41,11 +40,11 @@ import org.springframework.aop.config.AopConfigUtils; import org.springframework.aop.framework.ProxyConfig; import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor; -import org.springframework.beans.INestedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.NestedTestBean; +import org.springframework.tests.sample.beans.INestedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.NestedTestBean; import org.springframework.beans.PropertyValue; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.config.MethodInvokingFactoryBean; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests-context.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests-context.xml index d585ce96211..b35902d133f 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests-context.xml @@ -6,7 +6,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java index 0c6b68d805f..b5c5b065d5f 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.*; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Aspect; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.aop.support.AopUtils; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -63,7 +63,7 @@ class ExceptionHandlingAspect { public IOException lastException; - @AfterThrowing(pointcut = "within(org.springframework.beans.ITestBean+)", throwing = "ex") + @AfterThrowing(pointcut = "within(org.springframework.tests.sample.beans.ITestBean+)", throwing = "ex") public void handleIOException(IOException ex) { handled++; lastException = ex; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-aspectj.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-aspectj.xml index 8b0975e8a93..759e4c89447 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-aspectj.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-aspectj.xml @@ -22,7 +22,7 @@ class="org.springframework.aop.aspectj.autoproxy.benchmark.TraceAspect" > - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-springAop.xml b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-springAop.xml index d6c4cccceec..453d22ccaf2 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-springAop.xml +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests-springAop.xml @@ -31,7 +31,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java index a988324a003..c750e8ae574 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -33,7 +33,7 @@ import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.aop.support.StaticMethodMatcherPointcut; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.util.StopWatch; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java index 24ce7bcf1fe..ea160ca1130 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,10 +26,10 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; -import test.beans.Employee; +import org.springframework.tests.sample.beans.Employee; /** * Tests ensuring that after-returning advice for generic parameters bound to diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-error.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-error.xml index 1761a3552e4..7abc4287b71 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-error.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-error.xml @@ -15,11 +15,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-ok.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-ok.xml index 68681cf9fbd..a68195265dc 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-ok.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests-ok.xml @@ -16,11 +16,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-error.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-error.xml index 2a83b2078a5..f2b1e064721 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-error.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-error.xml @@ -12,11 +12,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-ok.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-ok.xml index 88cad34d9aa..4e098059b53 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-ok.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests-ok.xml @@ -12,11 +12,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests-context.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests-context.xml index 38f9d7b6201..855bda381c5 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests-context.xml @@ -19,11 +19,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java index 417512a71ef..3632c978038 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2013 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 @@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.aop.framework.Advised; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; /** * @author Rob Harrop diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-error.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-error.xml index 1f84e8edac2..9df36d7a387 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-error.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-error.xml @@ -11,11 +11,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-ok.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-ok.xml index 3fe28a8663d..c9238290990 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-ok.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests-ok.xml @@ -11,11 +11,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests-context.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests-context.xml index 90ead2afe56..5fc378d78f6 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests-context.xml @@ -19,11 +19,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java index 09d3dacd844..4896d143b26 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,20 +16,20 @@ package org.springframework.aop.config; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.aspectj.lang.ProceedingJoinPoint; import org.junit.Before; import org.junit.Test; -import test.advice.CountingBeforeAdvice; - import org.springframework.aop.Advisor; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; - -import static org.junit.Assert.*; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Unit tests for aop namespace. diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-error.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-error.xml index 73ed03922c3..1ddb6b9a005 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-error.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-error.xml @@ -11,11 +11,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-ok.xml b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-ok.xml index 85080527360..051d281260e 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-ok.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests-ok.xml @@ -11,11 +11,11 @@ - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/config/PrototypeProxyTests-context.xml b/spring-context/src/test/java/org/springframework/aop/config/PrototypeProxyTests-context.xml index 0ca26dd9534..b1327c8bdb1 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/PrototypeProxyTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/config/PrototypeProxyTests-context.xml @@ -5,22 +5,22 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> - + - + - + - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java index 51b63bd7d6c..9fd4e9fa07c 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,6 +16,14 @@ package org.springframework.aop.framework; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.Method; @@ -29,25 +37,13 @@ import java.util.List; import java.util.Map; import junit.framework.TestCase; + import org.aopalliance.aop.Advice; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.After; import org.junit.Before; import org.junit.Test; -import test.advice.CountingAfterReturningAdvice; -import test.advice.CountingBeforeAdvice; -import test.advice.MethodCounter; -import test.advice.MyThrowsHandler; -import test.interceptor.NopInterceptor; -import test.interceptor.SerializableNopInterceptor; -import test.interceptor.TimestampIntroductionInterceptor; -import test.mixin.LockMixin; -import test.mixin.LockMixinAdvisor; -import test.mixin.Lockable; -import test.mixin.LockedException; -import test.util.TimeStamped; - import org.springframework.aop.Advisor; import org.springframework.aop.AfterReturningAdvice; import org.springframework.aop.DynamicIntroductionAdvice; @@ -66,15 +62,26 @@ import org.springframework.aop.support.Pointcuts; import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor; import org.springframework.aop.target.HotSwappableTargetSource; import org.springframework.aop.target.SingletonTargetSource; -import org.springframework.beans.IOther; -import org.springframework.beans.ITestBean; -import org.springframework.beans.Person; -import org.springframework.beans.SerializablePerson; -import org.springframework.beans.TestBean; +import org.springframework.tests.TimeStamped; +import org.springframework.tests.aop.advice.CountingAfterReturningAdvice; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.aop.advice.MethodCounter; +import org.springframework.tests.aop.advice.MyThrowsHandler; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; +import org.springframework.tests.aop.interceptor.TimestampIntroductionInterceptor; +import org.springframework.tests.sample.beans.IOther; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.SerializablePerson; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.SerializationTestUtils; import org.springframework.util.StopWatch; -import static org.junit.Assert.*; +import test.mixin.LockMixin; +import test.mixin.LockMixinAdvisor; +import test.mixin.Lockable; +import test.mixin.LockedException; /** * @author Rod Johnson diff --git a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java index d600115868a..9b423759f79 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,30 +17,31 @@ package org.springframework.aop.framework; import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.Serializable; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; - import org.junit.Test; - -import org.springframework.cglib.core.CodeGenerationException; - import org.springframework.aop.ClassFilter; import org.springframework.aop.MethodMatcher; import org.springframework.aop.Pointcut; import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.DefaultPointcutAdvisor; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.cglib.core.CodeGenerationException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextException; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; -import test.advice.CountingBeforeAdvice; -import test.interceptor.NopInterceptor; import test.mixin.LockMixinAdvisor; /** diff --git a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java index 911e4d51542..77101f6cc90 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,9 +27,9 @@ import org.aopalliance.intercept.MethodInvocation; import org.springframework.aop.interceptor.ExposeInvocationInterceptor; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.IOther; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.IOther; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @since 13.03.2003 diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-autowiring.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-autowiring.xml index 27e7988a7a7..3cda6a7921a 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-autowiring.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-autowiring.xml @@ -3,12 +3,12 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-context.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-context.xml index 8c0a313a7c3..7675fe6e0e4 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-context.xml @@ -4,19 +4,19 @@ - + custom 666 - + - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean - debugInterceptor + debugInterceptor - + - org.springframework.beans.ITestBean - + org.springframework.tests.sample.beans.ITestBean + global*,test - + - + - org.springframework.beans.ITestBean - + org.springframework.tests.sample.beans.ITestBean + false test - + - org.springframework.beans.ITestBean - + org.springframework.tests.sample.beans.ITestBean + false test - + true @@ -74,7 +74,7 @@ testCircleTarget1 - + custom 666 @@ -85,18 +85,18 @@ testCircleTarget2 - + custom 666 - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean pointcutForVoid test - + - + org.springframework.context.ApplicationListener debugInterceptor,global*,target2 @@ -137,10 +137,10 @@ - + - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean false @@ -155,7 +155,7 @@ - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean test.mixin.Lockable diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-double-targetsource.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-double-targetsource.xml index 795cea64182..dde1f91017d 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-double-targetsource.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-double-targetsource.xml @@ -10,13 +10,13 @@ - + Eve - + Adam @@ -27,12 +27,12 @@ - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean countingBeforeAdvice,adamTargetSource @@ -42,7 +42,7 @@ - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean adam diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-frozen.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-frozen.xml index 45a4c2707b7..d0f5a89896c 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-frozen.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-frozen.xml @@ -4,25 +4,25 @@ - + custom 666 - + + - - + - - - org.springframework.beans.ITestBean - - - debugInterceptor + > + org.springframework.tests.sample.beans.ITestBean + + + debugInterceptor true true - + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-inner-bean-target.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-inner-bean-target.xml index 92faa57c4fc..e59244c49cb 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-inner-bean-target.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-inner-bean-target.xml @@ -9,31 +9,30 @@ - + - + + > - + innerBeanTarget - + nopInterceptor - - - - - - - \ No newline at end of file + + + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-invalid.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-invalid.xml index de65fec0fe1..fd46c5552fd 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-invalid.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-invalid.xml @@ -5,7 +5,7 @@ - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean @@ -14,7 +14,7 @@ Must have target after *. --> - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean global* diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-notlast-targetsource.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-notlast-targetsource.xml index 92ef595c55c..47cd14f94d4 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-notlast-targetsource.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-notlast-targetsource.xml @@ -9,12 +9,12 @@ - + Adam - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean adam,countingBeforeAdvice diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-prototype.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-prototype.xml index f437df5edf0..291385ce50a 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-prototype.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-prototype.xml @@ -7,15 +7,15 @@ - + 10 - + 10 - + debugInterceptor,test diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-serialization.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-serialization.xml index 4131b85d785..396bfada125 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-serialization.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-serialization.xml @@ -6,35 +6,35 @@ --> - + - + - serializableNopInterceptor - org.springframework.beans.Person + serializableNopInterceptor + org.springframework.tests.sample.beans.Person - + serializableSingleton - + serializablePrototype - serializableNopInterceptor,prototypeTarget - org.springframework.beans.Person + serializableNopInterceptor,prototypeTarget + org.springframework.tests.sample.beans.Person false nopInterceptor - + - + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-targetsource.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-targetsource.xml index 4e9ab797adc..07f2825c1fc 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-targetsource.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-targetsource.xml @@ -8,18 +8,18 @@ - + Adam - - + + - + - + - org.springframework.beans.ITestBean + class="org.springframework.aop.framework.ProxyFactoryBean"> + org.springframework.tests.sample.beans.ITestBean nopInterceptor,unsupportedInterceptor - - - + + + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-throws-advice.xml b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-throws-advice.xml index 1efb2ae3053..036dac321fa 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-throws-advice.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests-throws-advice.xml @@ -9,18 +9,18 @@ - - - - - - - - - + + + + + + + + + countingBeforeAdvice,nopInterceptor,throwsAdvice,target - + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java index b6e0f6853e8..f55c1a41b30 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -47,9 +47,6 @@ import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.DefaultIntroductionAdvisor; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.aop.support.DynamicMethodMatcherPointcut; -import org.springframework.beans.ITestBean; -import org.springframework.beans.Person; -import org.springframework.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.FactoryBean; @@ -60,16 +57,19 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationListener; import org.springframework.context.TestListener; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.TimeStamped; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.aop.advice.MyThrowsHandler; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.aop.interceptor.TimestampIntroductionInterceptor; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.SideEffectBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.SerializationTestUtils; -import test.advice.CountingBeforeAdvice; -import test.advice.MyThrowsHandler; -import test.beans.SideEffectBean; -import test.interceptor.NopInterceptor; -import test.interceptor.TimestampIntroductionInterceptor; import test.mixin.Lockable; import test.mixin.LockedException; -import test.util.TimeStamped; /** * @since 13.03.2003 diff --git a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-with-bpp.xml b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-with-bpp.xml index 0aa3b46d648..a58e040b67d 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-with-bpp.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-with-bpp.xml @@ -3,7 +3,7 @@ - + @@ -12,7 +12,7 @@ - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean simpleBeforeAdviceAdvisor,testBeanTarget diff --git a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-without-bpp.xml b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-without-bpp.xml index 36718003309..69bd476f3b2 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-without-bpp.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests-without-bpp.xml @@ -3,7 +3,7 @@ - + @@ -12,7 +12,7 @@ - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean simpleBeforeAdviceAdvisor,testBeanTarget diff --git a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java index 57e8de81126..e708c9f1791 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,7 +29,7 @@ import org.junit.Test; import org.springframework.aop.Advisor; import org.springframework.aop.BeforeAdvice; import org.springframework.aop.framework.Advised; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests-common-interceptors.xml b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests-common-interceptors.xml index 286f8c840dd..c64c7e6ef74 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests-common-interceptors.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests-common-interceptors.xml @@ -20,7 +20,7 @@ - + - + Rod - + Rod - + Rod diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java index 83598caf9b8..bf1fc8b5a78 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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.aop.framework.autoproxy; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.IOException; @@ -29,13 +31,13 @@ import org.springframework.aop.target.CommonsPoolTargetSource; import org.springframework.aop.target.LazyInitTargetSource; import org.springframework.aop.target.PrototypeTargetSource; import org.springframework.aop.target.ThreadLocalTargetSource; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.CountingTestBean; +import org.springframework.tests.sample.beans.ITestBean; -import test.advice.CountingBeforeAdvice; -import test.interceptor.NopInterceptor; import test.mixin.Lockable; /** @@ -204,18 +206,6 @@ public final class AdvisorAutoProxyCreatorTests { } - -class CountingTestBean extends TestBean { - - public static int count = 0; - - public CountingTestBean() { - count++; - } - -} - - class SelectivePrototypeTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator { @Override diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java index 4019d568d0c..d9a838ee2ab 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,11 +24,11 @@ import org.junit.Test; import org.springframework.aop.TargetSource; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; -import org.springframework.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.DummyFactory; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.support.RootBeanDefinition; diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests-context.xml b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests-context.xml index 53d945697e8..d53272f0d58 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests-context.xml @@ -24,6 +24,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests.java index 11805c6d5bb..49216292485 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorInitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import java.lang.reflect.Method; import org.junit.Test; import org.springframework.aop.MethodBeforeAdvice; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.ClassPathXmlApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml index 0f4b265b721..c9727ea856e 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml @@ -59,7 +59,7 @@ - + - + - + prototypePerson diff --git a/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java b/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java index c0a695c452c..5ec8db261f8 100644 --- a/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,15 +28,15 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.springframework.aop.framework.Advised; -import org.springframework.beans.Person; -import org.springframework.beans.SerializablePerson; +import org.springframework.tests.sample.beans.Person; +import org.springframework.tests.sample.beans.SerializablePerson; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.util.SerializationTestUtils; -import test.beans.SideEffectBean; +import org.springframework.tests.sample.beans.SideEffectBean; /** * Tests for pooling invoker interceptor. diff --git a/spring-context/src/test/java/org/springframework/beans/Colour.java b/spring-context/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index a992a2ebfc6..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java deleted file mode 100644 index c5360de5316..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - @Override - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - @Override - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - @Override - public void destroy() { - this.destroyed = true; - } - - @Override - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java b/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java deleted file mode 100644 index 61f911902c7..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java +++ /dev/null @@ -1,44 +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; - -/** - * @author Juergen Hoeller - * @since 07.03.2006 - */ -public class FieldAccessBean { - - public String name; - - protected int age; - - private TestBean spouse; - - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public TestBean getSpouse() { - return spouse; - } - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/IOther.java b/spring-context/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/ITestBean.java b/spring-context/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index cdf5ef510dd..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index 9f90cf15bb1..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList<>(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet<>(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap<>(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList<>(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/Person.java b/spring-context/src/test/java/org/springframework/beans/Person.java deleted file mode 100644 index 7c66f4b451b..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/Person.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * - * @author Rod Johnson - */ -public interface Person { - - String getName(); - void setName(String name); - int getAge(); - void setAge(int i); - - /** - * Test for non-property method matching. - * If the parameter is a Throwable, it will be thrown rather than - * returned. - */ - Object echo(Object o) throws Throwable; -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java b/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java deleted file mode 100644 index dbe365f4937..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.util.ObjectUtils; - -/** - * Serializable implementation of the Person interface. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class SerializablePerson implements Person, Serializable { - - private String name; - private int age; - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public Object echo(Object o) throws Throwable { - if (o instanceof Throwable) { - throw (Throwable) o; - } - return o; - } - - public boolean equals(Object other) { - if (!(other instanceof SerializablePerson)) { - return false; - } - SerializablePerson p = (SerializablePerson) other; - return p.age == age && ObjectUtils.nullSafeEquals(name, p.name); - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java deleted file mode 100644 index d6911ee72f5..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.beans.PropertyEditorSupport; -import java.util.StringTokenizer; - -import junit.framework.TestCase; - -import org.springframework.beans.BeansException; -import org.springframework.beans.PropertyBatchUpdateException; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; - -/** - * Subclasses must implement setUp() to initialize bean factory - * and any other variables they need. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractBeanFactoryTests extends TestCase { - - protected abstract BeanFactory getBeanFactory(); - - /** - * Roderick beans inherits from rod, overriding name only. - */ - public void testInheritance() { - assertTrue(getBeanFactory().containsBean("rod")); - assertTrue(getBeanFactory().containsBean("roderick")); - TestBean rod = (TestBean) getBeanFactory().getBean("rod"); - TestBean roderick = (TestBean) getBeanFactory().getBean("roderick"); - assertTrue("not == ", rod != roderick); - assertTrue("rod.name is Rod", rod.getName().equals("Rod")); - assertTrue("rod.age is 31", rod.getAge() == 31); - assertTrue("roderick.name is Roderick", roderick.getName().equals("Roderick")); - assertTrue("roderick.age was inherited", roderick.getAge() == rod.getAge()); - } - - public void testGetBeanWithNullArg() { - try { - getBeanFactory().getBean((String) null); - fail("Can't get null bean"); - } - catch (IllegalArgumentException ex) { - // OK - } - } - - /** - * Test that InitializingBean objects receive the afterPropertiesSet() callback - */ - public void testInitializingBeanCallback() { - MustBeInitialized mbi = (MustBeInitialized) getBeanFactory().getBean("mustBeInitialized"); - // The dummy business method will throw an exception if the - // afterPropertiesSet() callback wasn't invoked - mbi.businessMethod(); - } - - /** - * Test that InitializingBean/BeanFactoryAware/DisposableBean objects receive the - * afterPropertiesSet() callback before BeanFactoryAware callbacks - */ - public void testLifecycleCallbacks() { - LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle"); - assertEquals("lifecycle", lb.getBeanName()); - // The dummy business method will throw an exception if the - // necessary callbacks weren't invoked in the right order. - lb.businessMethod(); - assertTrue("Not destroyed", !lb.isDestroyed()); - } - - public void testFindsValidInstance() { - try { - Object o = getBeanFactory().getBean("rod"); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - TestBean rod = (TestBean) o; - assertTrue("rod.name is Rod", rod.getName().equals("Rod")); - assertTrue("rod.age is 31", rod.getAge() == 31); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testGetInstanceByMatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance with matching class"); - } - } - - public void testGetInstanceByNonmatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); - fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); - } - catch (BeanNotOfRequiredTypeException ex) { - // So far, so good - assertTrue("Exception has correct bean name", ex.getBeanName().equals("rod")); - assertTrue("Exception requiredType must be BeanFactory.class", ex.getRequiredType().equals(BeanFactory.class)); - assertTrue("Exception actualType as TestBean.class", TestBean.class.isAssignableFrom(ex.getActualType())); - assertTrue("Actual type is correct", ex.getActualType() == getBeanFactory().getBean("rod").getClass()); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testGetSharedInstanceByMatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance with matching class"); - } - } - - public void testGetSharedInstanceByMatchingClassNoCatch() { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - - public void testGetSharedInstanceByNonmatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); - fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); - } - catch (BeanNotOfRequiredTypeException ex) { - // So far, so good - assertTrue("Exception has correct bean name", ex.getBeanName().equals("rod")); - assertTrue("Exception requiredType must be BeanFactory.class", ex.getRequiredType().equals(BeanFactory.class)); - assertTrue("Exception actualType as TestBean.class", TestBean.class.isAssignableFrom(ex.getActualType())); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testSharedInstancesAreEqual() { - try { - Object o = getBeanFactory().getBean("rod"); - assertTrue("Rod bean1 is a TestBean", o instanceof TestBean); - Object o1 = getBeanFactory().getBean("rod"); - assertTrue("Rod bean2 is a TestBean", o1 instanceof TestBean); - assertTrue("Object equals applies", o == o1); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testPrototypeInstancesAreIndependent() { - TestBean tb1 = (TestBean) getBeanFactory().getBean("kathy"); - TestBean tb2 = (TestBean) getBeanFactory().getBean("kathy"); - assertTrue("ref equal DOES NOT apply", tb1 != tb2); - assertTrue("object equal true", tb1.equals(tb2)); - tb1.setAge(1); - tb2.setAge(2); - assertTrue("1 age independent = 1", tb1.getAge() == 1); - assertTrue("2 age independent = 2", tb2.getAge() == 2); - assertTrue("object equal now false", !tb1.equals(tb2)); - } - - public void testNotThere() { - assertFalse(getBeanFactory().containsBean("Mr Squiggle")); - try { - Object o = getBeanFactory().getBean("Mr Squiggle"); - fail("Can't find missing bean"); - } - catch (BeansException ex) { - //ex.printStackTrace(); - //fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testValidEmpty() { - try { - Object o = getBeanFactory().getBean("validEmpty"); - assertTrue("validEmpty bean is a TestBean", o instanceof TestBean); - TestBean ve = (TestBean) o; - assertTrue("Valid empty has defaults", ve.getName() == null && ve.getAge() == 0 && ve.getSpouse() == null); - } - catch (BeansException ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on valid empty"); - } - } - - public void xtestTypeMismatch() { - try { - Object o = getBeanFactory().getBean("typeMismatch"); - fail("Shouldn't succeed with type mismatch"); - } - catch (BeanCreationException wex) { - assertEquals("typeMismatch", wex.getBeanName()); - assertTrue(wex.getCause() instanceof PropertyBatchUpdateException); - PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause(); - // Further tests - assertTrue("Has one error ", ex.getExceptionCount() == 1); - assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null); - assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x")); - } - } - - public void testGrandparentDefinitionFoundInBeanFactory() throws Exception { - TestBean dad = (TestBean) getBeanFactory().getBean("father"); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testFactorySingleton() throws Exception { - assertTrue(getBeanFactory().isSingleton("&singletonFactory")); - assertTrue(getBeanFactory().isSingleton("singletonFactory")); - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); - assertTrue("Singleton from factory has correct name, not " + tb.getName(), tb.getName().equals(DummyFactory.SINGLETON_NAME)); - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - TestBean tb2 = (TestBean) getBeanFactory().getBean("singletonFactory"); - assertTrue("Singleton references ==", tb == tb2); - assertTrue("FactoryBean is BeanFactoryAware", factory.getBeanFactory() != null); - } - - public void testFactoryPrototype() throws Exception { - assertTrue(getBeanFactory().isSingleton("&prototypeFactory")); - assertFalse(getBeanFactory().isSingleton("prototypeFactory")); - TestBean tb = (TestBean) getBeanFactory().getBean("prototypeFactory"); - assertTrue(!tb.getName().equals(DummyFactory.SINGLETON_NAME)); - TestBean tb2 = (TestBean) getBeanFactory().getBean("prototypeFactory"); - assertTrue("Prototype references !=", tb != tb2); - } - - /** - * Check that we can get the factory bean itself. - * This is only possible if we're dealing with a factory - * @throws Exception - */ - public void testGetFactoryItself() throws Exception { - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - assertTrue(factory != null); - } - - /** - * Check that afterPropertiesSet gets called on factory - * @throws Exception - */ - public void testFactoryIsInitialized() throws Exception { - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); - } - - /** - * It should be illegal to dereference a normal bean - * as a factory - */ - public void testRejectsFactoryGetOnNormalBean() { - try { - getBeanFactory().getBean("&rod"); - fail("Shouldn't permit factory get on normal bean"); - } - catch (BeanIsNotAFactoryException ex) { - // Ok - } - } - - // TODO: refactor in AbstractBeanFactory (tests for AbstractBeanFactory) - // and rename this class - public void testAliasing() { - BeanFactory bf = getBeanFactory(); - if (!(bf instanceof ConfigurableBeanFactory)) { - return; - } - ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf; - - String alias = "rods alias"; - try { - cbf.getBean(alias); - fail("Shouldn't permit factory get on normal bean"); - } - catch (NoSuchBeanDefinitionException ex) { - // Ok - assertTrue(alias.equals(ex.getBeanName())); - } - - // Create alias - cbf.registerAlias("rod", alias); - Object rod = getBeanFactory().getBean("rod"); - Object aliasRod = getBeanFactory().getBean(alias); - assertTrue(rod == aliasRod); - } - - - public static class TestBeanEditor extends PropertyEditorSupport { - - @Override - public void setAsText(String text) { - TestBean tb = new TestBean(); - StringTokenizer st = new StringTokenizer(text, "_"); - tb.setName(st.nextToken()); - tb.setAge(Integer.parseInt(st.nextToken())); - setValue(tb); - } - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java deleted file mode 100644 index 855f23af396..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.TestBean; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFactoryTests { - - /** Subclasses must initialize this */ - protected ListableBeanFactory getListableBeanFactory() { - BeanFactory bf = getBeanFactory(); - if (!(bf instanceof ListableBeanFactory)) { - throw new IllegalStateException("ListableBeanFactory required"); - } - return (ListableBeanFactory) bf; - } - - /** - * Subclasses can override this. - */ - public void testCount() { - assertCount(13); - } - - protected final void assertCount(int count) { - String[] defnames = getListableBeanFactory().getBeanDefinitionNames(); - assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); - } - - public void assertTestBeanCount(int count) { - String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false); - assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + - defNames.length, defNames.length == count); - - int countIncludingFactoryBeans = count + 2; - String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true); - assertTrue("We should have " + countIncludingFactoryBeans + - " beans for class org.springframework.beans.TestBean, not " + names.length, - names.length == countIncludingFactoryBeans); - } - - public void testGetDefinitionsForNoSuchClass() { - String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class); - assertTrue("No string definitions", defnames.length == 0); - } - - /** - * Check that count refers to factory class, not bean class. (We don't know - * what type factories may return, and it may even change over time.) - */ - public void testGetCountForFactoryClass() { - assertTrue("Should have 2 factories, not " + - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - - assertTrue("Should have 2 factories, not " + - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - } - - public void testContainsBeanDefinition() { - assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); - assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java b/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java deleted file mode 100644 index 013a65a0e49..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; - -/** - * Simple test of BeanFactory initialization and lifecycle callbacks. - * - * @author Rod Johnson - * @author Colin Sampaleanu - * @since 12.03.2003 - */ -public class LifecycleBean implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - - protected boolean initMethodDeclared = false; - - protected String beanName; - - protected BeanFactory owningFactory; - - protected boolean postProcessedBeforeInit; - - protected boolean inited; - - protected boolean initedViaDeclaredInitMethod; - - protected boolean postProcessedAfterInit; - - protected boolean destroyed; - - - public void setInitMethodDeclared(boolean initMethodDeclared) { - this.initMethodDeclared = initMethodDeclared; - } - - public boolean isInitMethodDeclared() { - return initMethodDeclared; - } - - @Override - public void setBeanName(String name) { - this.beanName = name; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.owningFactory = beanFactory; - } - - public void postProcessBeforeInit() { - if (this.inited || this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called postProcessBeforeInit after afterPropertiesSet"); - } - if (this.postProcessedBeforeInit) { - throw new RuntimeException("Factory called postProcessBeforeInit twice"); - } - this.postProcessedBeforeInit = true; - } - - @Override - public void afterPropertiesSet() { - if (this.owningFactory == null) { - throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean"); - } - if (!this.postProcessedBeforeInit) { - throw new RuntimeException("Factory didn't call postProcessBeforeInit before afterPropertiesSet on lifecycle bean"); - } - if (this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory initialized via declared init method before initializing via afterPropertiesSet"); - } - if (this.inited) { - throw new RuntimeException("Factory called afterPropertiesSet twice"); - } - this.inited = true; - } - - public void declaredInitMethod() { - if (!this.inited) { - throw new RuntimeException("Factory didn't call afterPropertiesSet before declared init method"); - } - - if (this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called declared init method twice"); - } - this.initedViaDeclaredInitMethod = true; - } - - public void postProcessAfterInit() { - if (!this.inited) { - throw new RuntimeException("Factory called postProcessAfterInit before afterPropertiesSet"); - } - if (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called postProcessAfterInit before calling declared init method"); - } - if (this.postProcessedAfterInit) { - throw new RuntimeException("Factory called postProcessAfterInit twice"); - } - this.postProcessedAfterInit = true; - } - - /** - * Dummy business method that will fail unless the factory - * managed the bean's lifecycle correctly - */ - public void businessMethod() { - if (!this.inited || (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) || - !this.postProcessedAfterInit) { - throw new RuntimeException("Factory didn't initialize lifecycle object correctly"); - } - } - - @Override - public void destroy() { - if (this.destroyed) { - throw new IllegalStateException("Already destroyed"); - } - this.destroyed = true; - } - - public boolean isDestroyed() { - return destroyed; - } - - - public static class PostProcessor implements BeanPostProcessor { - - @Override - public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException { - if (bean instanceof LifecycleBean) { - ((LifecycleBean) bean).postProcessBeforeInit(); - } - return bean; - } - - @Override - public Object postProcessAfterInitialization(Object bean, String name) throws BeansException { - if (bean instanceof LifecycleBean) { - ((LifecycleBean) bean).postProcessAfterInit(); - } - return bean; - } - } - -} \ No newline at end of file diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java b/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java deleted file mode 100644 index 4b4d6980564..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2002-2012 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.access; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.util.ClassUtils; - -/** - * @author Colin Sampaleanu - * @author Chris Beams - */ -public class SingletonBeanFactoryLocatorTests { - - @Test - public void testBasicFunctionality() { - SingletonBeanFactoryLocator facLoc = new SingletonBeanFactoryLocator( - "classpath*:" + ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); - - basicFunctionalityTest(facLoc); - } - - /** - * Worker method so subclass can use it too. - */ - protected void basicFunctionalityTest(SingletonBeanFactoryLocator facLoc) { - BeanFactoryReference bfr = facLoc.useBeanFactory("a.qualified.name.of.some.sort"); - BeanFactory fac = bfr.getFactory(); - BeanFactoryReference bfr2 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr2.getFactory(); - // verify that the same instance is returned - TestBean tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("beans1.bean1")); - tb.setName("was beans1.bean1"); - BeanFactoryReference bfr3 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr3.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - BeanFactoryReference bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias"); - fac = bfr4.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - // Now verify that we can call release in any order. - // Unfortunately this doesn't validate complete release after the last one. - bfr2.release(); - bfr3.release(); - bfr.release(); - bfr4.release(); - } - - /** - * This test can run multiple times, but due to static keyed lookup of the locators, - * 2nd and subsequent calls will actuall get back same locator instance. This is not - * an issue really, since the contained beanfactories will still be loaded and released. - */ - @Test - public void testGetInstance() { - // Try with and without 'classpath*:' prefix, and with 'classpath:' prefix. - BeanFactoryLocator facLoc = SingletonBeanFactoryLocator.getInstance( - ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); - getInstanceTest1(facLoc); - - facLoc = SingletonBeanFactoryLocator.getInstance( - "classpath*:/" + ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); - getInstanceTest2(facLoc); - - // This will actually get another locator instance, as the key is the resource name. - facLoc = SingletonBeanFactoryLocator.getInstance( - "classpath:" + ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); - getInstanceTest3(facLoc); - - } - - /** - * Worker method so subclass can use it too - */ - protected void getInstanceTest1(BeanFactoryLocator facLoc) { - BeanFactoryReference bfr = facLoc.useBeanFactory("a.qualified.name.of.some.sort"); - BeanFactory fac = bfr.getFactory(); - BeanFactoryReference bfr2 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr2.getFactory(); - // verify that the same instance is returned - TestBean tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("beans1.bean1")); - tb.setName("was beans1.bean1"); - BeanFactoryReference bfr3 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr3.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - - BeanFactoryReference bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias"); - fac = bfr4.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - - bfr.release(); - bfr3.release(); - bfr2.release(); - bfr4.release(); - } - - /** - * Worker method so subclass can use it too - */ - protected void getInstanceTest2(BeanFactoryLocator facLoc) { - BeanFactoryReference bfr; - BeanFactory fac; - BeanFactoryReference bfr2; - TestBean tb; - BeanFactoryReference bfr3; - BeanFactoryReference bfr4; - bfr = facLoc.useBeanFactory("a.qualified.name.of.some.sort"); - fac = bfr.getFactory(); - bfr2 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr2.getFactory(); - // verify that the same instance is returned - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("beans1.bean1")); - tb.setName("was beans1.bean1"); - bfr3 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr3.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias"); - fac = bfr4.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - bfr.release(); - bfr2.release(); - bfr4.release(); - bfr3.release(); - } - - /** - * Worker method so subclass can use it too - */ - protected void getInstanceTest3(BeanFactoryLocator facLoc) { - BeanFactoryReference bfr; - BeanFactory fac; - BeanFactoryReference bfr2; - TestBean tb; - BeanFactoryReference bfr3; - BeanFactoryReference bfr4; - bfr = facLoc.useBeanFactory("a.qualified.name.of.some.sort"); - fac = bfr.getFactory(); - bfr2 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr2.getFactory(); - // verify that the same instance is returned - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("beans1.bean1")); - tb.setName("was beans1.bean1"); - bfr3 = facLoc.useBeanFactory("another.qualified.name"); - fac = bfr3.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias"); - fac = bfr4.getFactory(); - tb = (TestBean) fac.getBean("beans1.bean1"); - assertTrue(tb.getName().equals("was beans1.bean1")); - bfr4.release(); - bfr3.release(); - bfr2.release(); - bfr.release(); - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java b/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java deleted file mode 100644 index f54299a03f9..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2002-2012 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.access; - -import java.util.List; - -/** - * Scrap bean for use in tests. - * - * @author Colin Sampaleanu - */ -public class TestBean { - - private String name; - - private List list; - - private Object objRef; - - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return Returns the list. - */ - public List getList() { - return list; - } - - /** - * @param list The list to set. - */ - public void setList(List list) { - this.list = list; - } - - /** - * @return Returns the object. - */ - public Object getObjRef() { - return objRef; - } - - /** - * @param object The object to set. - */ - public void setObjRef(Object object) { - this.objRef = object; - } -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/ref1.xml b/spring-context/src/test/java/org/springframework/beans/factory/access/ref1.xml deleted file mode 100644 index 2dde7a31b37..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/access/ref1.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java deleted file mode 100644 index d42adc1daf3..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2002-2012 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.parsing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * @author Rob Harrop - * @author Juergen Hoeller - */ -public class CollectingReaderEventListener implements ReaderEventListener { - - private final List defaults = new LinkedList(); - - private final Map componentDefinitions = new LinkedHashMap<>(8); - - private final Map> aliasMap = new LinkedHashMap<>(8); - - private final List imports = new LinkedList(); - - - @Override - public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { - this.defaults.add(defaultsDefinition); - } - - public List getDefaults() { - return Collections.unmodifiableList(this.defaults); - } - - @Override - public void componentRegistered(ComponentDefinition componentDefinition) { - this.componentDefinitions.put(componentDefinition.getName(), componentDefinition); - } - - public ComponentDefinition getComponentDefinition(String name) { - return this.componentDefinitions.get(name); - } - - public ComponentDefinition[] getComponentDefinitions() { - Collection collection = this.componentDefinitions.values(); - return collection.toArray(new ComponentDefinition[collection.size()]); - } - - @Override - public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = this.aliasMap.get(aliasDefinition.getBeanName()); - if(aliases == null) { - aliases = new ArrayList(); - this.aliasMap.put(aliasDefinition.getBeanName(), aliases); - } - aliases.add(aliasDefinition); - } - - public List getAliases(String beanName) { - List aliases = this.aliasMap.get(beanName); - return aliases == null ? null : Collections.unmodifiableList(aliases); - } - - @Override - public void importProcessed(ImportDefinition importDefinition) { - this.imports.add(importDefinition); - } - - public List getImports() { - return Collections.unmodifiableList(this.imports); - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java deleted file mode 100644 index 28c3bffa8f4..00000000000 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; - -/** - * Simple bean used to test dependency checking. - * - * Note: would be defined within {@link XmlBeanFactoryTestTypes}, but must be a public type - * in order to satisfy test dependencies. - * - * @author Rod Johnson - * @author Chris Beams - * @since 04.09.2003 - */ -public final class DependenciesBean implements BeanFactoryAware { - - private int age; - - private String name; - - private TestBean spouse; - - private BeanFactory beanFactory; - - - public void setAge(int age) { - this.age = age; - } - - public int getAge() { - return age; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setSpouse(TestBean spouse) { - this.spouse = spouse; - } - - public TestBean getSpouse() { - return spouse; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - -} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml index 017af485203..9eaf910d083 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests-context.xml @@ -22,7 +22,7 @@ interceptor - + Jenny 30 diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java index ed9fbbde83b..96e2ab404a9 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.springframework.aop.interceptor.DebugInterceptor; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java index b1e6c818f0d..c21ee9078fb 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.beans.factory.xml; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java index 98f04505649..6f68b6bf600 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,14 +27,14 @@ import java.util.Set; import javax.sql.DataSource; import org.springframework.beans.BeansException; -import org.springframework.beans.ITestBean; -import org.springframework.beans.IndexedTestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.DummyFactory; +import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.support.MethodReplacer; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-autowire.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-autowire.xml index 4fcad300bab..43510574bae 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-autowire.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-autowire.xml @@ -3,22 +3,22 @@ - - - - @@ -38,12 +38,12 @@ - - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-child.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-child.xml index 654e76e7fb5..fc90f7905c7 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-child.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-child.xml @@ -8,13 +8,13 @@ - override - override @@ -42,7 +42,7 @@ - + myname diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-collections.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-collections.xml index 9a735571d89..7729dbc7882 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-collections.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-collections.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - + Jenny 30 @@ -11,8 +11,8 @@ - - + + Simple bean, without any collections. @@ -22,8 +22,8 @@ 27 - - + + Rod 32 @@ -34,8 +34,8 @@ - - + + Jenny 30 @@ -44,12 +44,12 @@ - + David 27 - + Rod 32 @@ -63,7 +63,7 @@ - + loner 26 @@ -73,8 +73,8 @@ - - + + @@ -84,7 +84,7 @@ - + @@ -97,26 +97,26 @@ - + verbose - - + + - + - + - - + + @@ -126,7 +126,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -198,8 +198,8 @@ - - + + @@ -207,7 +207,7 @@ - + bar @@ -217,15 +217,15 @@ - + - - - + + + bar @@ -233,8 +233,8 @@ - - + + @@ -243,7 +243,7 @@ - + one @@ -251,8 +251,8 @@ - - + + java.lang.String @@ -260,8 +260,8 @@ - - + + 0 diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-complexFactoryCircle.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-complexFactoryCircle.xml index 85eb3620b0f..8370424f739 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-complexFactoryCircle.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-complexFactoryCircle.xml @@ -11,16 +11,16 @@ - + - + - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml index bc4f87d63a4..d500c48881e 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml @@ -13,7 +13,7 @@ - + @@ -117,7 +117,7 @@ - + Kerry1 @@ -126,7 +126,7 @@ - + Kerry2 @@ -135,7 +135,7 @@ - + /test @@ -187,13 +187,13 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorOverrides.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorOverrides.xml index ea061046ce3..d703fddd21f 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorOverrides.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorOverrides.xml @@ -18,7 +18,7 @@ - Jenny 30 diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultAutowire.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultAutowire.xml index 0094234b090..3815538559d 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultAutowire.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultAutowire.xml @@ -3,19 +3,19 @@ - + - + - + - + Kerry diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultLazyInit.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultLazyInit.xml index 5021766b1c0..3451c1b37c0 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultLazyInit.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-defaultLazyInit.xml @@ -15,6 +15,6 @@ destroy-method="customDestroy" /> - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-delegationOverrides.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-delegationOverrides.xml index feb3bea4994..10ae8ae09fb 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-delegationOverrides.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-delegationOverrides.xml @@ -58,7 +58,7 @@ - Jenny 30 @@ -68,7 +68,7 @@ - Simple bean, without any collections. diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-factoryCircle.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-factoryCircle.xml index f94371ee0c7..86da8d595d4 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-factoryCircle.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-factoryCircle.xml @@ -3,7 +3,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-initializers.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-initializers.xml index 1a6eb553328..06281490175 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-initializers.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-initializers.xml @@ -11,7 +11,7 @@ - - - - + + + Jenny 30 @@ -12,9 +12,8 @@ - + - - - \ No newline at end of file + + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-invalidOverridesNoSuchMethod.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-invalidOverridesNoSuchMethod.xml index e8b85a509af..cd232df3c00 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-invalidOverridesNoSuchMethod.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-invalidOverridesNoSuchMethod.xml @@ -11,7 +11,7 @@ - + Jenny 30 diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-localCollectionsUsingXsd.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-localCollectionsUsingXsd.xml index da6d7405eb3..2e49f71a540 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-localCollectionsUsingXsd.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-localCollectionsUsingXsd.xml @@ -12,7 +12,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-overrides.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-overrides.xml index bf0849bc98c..0a92c7426d0 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-overrides.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-overrides.xml @@ -35,32 +35,32 @@ - + Jenny 30 - + - + Jenny 30 - + - + - + Simple bean, without any collections. @@ -71,12 +71,12 @@ 27 - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-parent.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-parent.xml index 98f23096735..f575bcb44a9 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-parent.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-parent.xml @@ -3,7 +3,7 @@ - + parent 1 @@ -13,11 +13,11 @@ 1 - + parent 2 - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-reftypes.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-reftypes.xml index c8adc19bb3d..f8e32809066 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-reftypes.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-reftypes.xml @@ -1,102 +1,102 @@ - - + + Jenny 30 - - + + - - + + Andrew 36 - + - - + + Georgia 33 - + - + - + - + - + - + - + - + - + - + outer 0 - + hasInner 5 - + inner1 6 - + inner2 7 - - + + inner5 6 @@ -105,7 +105,7 @@ - + inner3 8 @@ -120,32 +120,32 @@ - + - + inner1 6 - + hasInner 5 - + inner1 6 - + inner2 7 - - + + inner5 6 @@ -153,11 +153,11 @@ - + - + inner3 8 @@ -173,9 +173,9 @@ - + - + inner1 6 diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resource.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resource.xml index 3386242887d..9eb0813411a 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resource.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resource.xml @@ -5,7 +5,7 @@ - + classpath:org/springframework/beans/factory/xml/test.properties diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resourceImport.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resourceImport.xml index e5515885eff..31fa7a16bab 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resourceImport.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-resourceImport.xml @@ -3,7 +3,7 @@ - + classpath:org/springframework/beans/factory/xml/test.properties diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedAllDepCheck.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedAllDepCheck.xml index 4b315b7582d..daa269998ee 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedAllDepCheck.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedAllDepCheck.xml @@ -3,14 +3,14 @@ - 33 Rod - diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedObjectDepCheck.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedObjectDepCheck.xml index 8c1d0d3f37c..65fbd833c9f 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedObjectDepCheck.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedObjectDepCheck.xml @@ -3,11 +3,11 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedSimpleDepCheck.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedSimpleDepCheck.xml index 92981195029..9088b962e0f 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedSimpleDepCheck.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-satisfiedSimpleDepCheck.xml @@ -3,7 +3,7 @@ - 33 Rod diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNameInAlias.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNameInAlias.xml index cc049ed23cd..393028d4f1f 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNameInAlias.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNameInAlias.xml @@ -3,8 +3,8 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNames.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNames.xml index e991af7167a..90de5444371 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNames.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-testWithDuplicateNames.xml @@ -3,8 +3,8 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingObjects.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingObjects.xml index 19faed79258..a771266aa9a 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingObjects.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingObjects.xml @@ -3,7 +3,7 @@ - 33 Rod diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingSimple.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingSimple.xml index df21ad72626..8cd2e725690 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingSimple.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedAllDepCheckMissingSimple.xml @@ -3,13 +3,13 @@ - tony --> - diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedObjectDepCheck.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedObjectDepCheck.xml index f18e9e77c29..a96c4d303d8 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedObjectDepCheck.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedObjectDepCheck.xml @@ -3,7 +3,7 @@ - diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedSimpleDepCheck.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedSimpleDepCheck.xml index 8463f132a12..4968b12b3a6 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedSimpleDepCheck.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests-unsatisfiedSimpleDepCheck.xml @@ -3,7 +3,7 @@ - diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java index 3eed0d7cfc1..b4e6a07538c 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -42,13 +42,8 @@ import org.junit.Test; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.support.AopUtils; import org.springframework.beans.BeansException; -import org.springframework.beans.DerivedTestBean; import org.springframework.beans.FatalBeanException; -import org.springframework.beans.ITestBean; -import org.springframework.beans.IndexedTestBean; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.ResourceTestBean; -import org.springframework.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCurrentlyInCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; @@ -56,7 +51,6 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanIsAbstractException; import org.springframework.beans.factory.CannotLoadBeanClassException; import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.DummyFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.UnsatisfiedDependencyException; @@ -69,6 +63,13 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.UrlResource; import org.springframework.core.io.support.EncodedResource; +import org.springframework.tests.sample.beans.DependenciesBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.ResourceTestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.util.FileCopyUtils; import org.springframework.util.SerializationTestUtils; import org.springframework.util.StopWatch; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml b/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml index 1fbd8330863..17c9c7e8f5b 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests-context.xml @@ -10,11 +10,11 @@ - + - + @@ -24,14 +24,14 @@ - + - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java index 7a52f76eda2..68accbae1d4 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,31 +16,27 @@ package org.springframework.beans.factory.xml.support; -import java.io.IOException; import static java.lang.String.format; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; -import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.InputSource; -import test.interceptor.NopInterceptor; - 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.BeanInstantiationException; -import org.springframework.beans.ITestBean; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; @@ -60,6 +56,13 @@ import org.springframework.context.ApplicationListener; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; /** * Unit tests for custom XML namespace handler implementations. diff --git a/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java index a7207435209..6f407fb24e0 100644 --- a/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,10 +18,10 @@ package org.springframework.context; import java.util.Locale; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.AbstractListableBeanFactoryTests; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.LifecycleBean; +import org.springframework.beans.factory.xml.AbstractListableBeanFactoryTests; +import org.springframework.tests.sample.beans.LifecycleBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson diff --git a/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java b/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java index 69fea0435db..96f39c3296a 100644 --- a/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java +++ b/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.context; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.LifecycleBean; +import org.springframework.tests.sample.beans.LifecycleBean; /** * Simple bean to test ApplicationContext lifecycle methods for beans diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-collections.xml b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-collections.xml index 30b7c590c89..81770ea423f 100644 --- a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-collections.xml +++ b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-collections.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - + Jenny 30 @@ -11,8 +11,8 @@ - - + + Simple bean, without any collections. @@ -22,8 +22,8 @@ 27 - - + + Rod 32 @@ -34,8 +34,8 @@ - - + + Jenny 30 @@ -44,12 +44,12 @@ - + David 27 - + Rod 32 @@ -63,7 +63,7 @@ - + loner 26 @@ -73,8 +73,8 @@ - - + + @@ -84,7 +84,7 @@ - + @@ -97,26 +97,26 @@ - + verbose - - + + - + - + - - + + @@ -126,7 +126,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -198,8 +198,8 @@ - - + + @@ -207,7 +207,7 @@ - + bar @@ -217,15 +217,15 @@ - + - - - + + + bar @@ -233,8 +233,8 @@ - - + + @@ -243,7 +243,7 @@ - + one @@ -251,8 +251,8 @@ - - + + java.lang.String @@ -260,8 +260,8 @@ - - + + 0 diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-parent.xml b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-parent.xml index 6f5675fffd6..99d732a1642 100644 --- a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-parent.xml +++ b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests-parent.xml @@ -3,7 +3,7 @@ - + parent 1 @@ -13,11 +13,11 @@ 1 - + parent 2 - + diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java index e87e6023780..8001716e485 100644 --- a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java +++ b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.access.BootstrapException; import org.springframework.context.ApplicationContext; -import org.springframework.mock.jndi.SimpleNamingContextBuilder; +import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder; /** * @author Colin Sampaleanu diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java index bfbc2c9ef65..e3ed03301f4 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ConfigurationClassParser; import org.springframework.context.annotation.Import; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java index d35b5396fd3..0a9cfdf655f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,8 +24,8 @@ import javax.annotation.Resource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Required; import org.springframework.beans.factory.config.RuntimeBeanReference; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java index 50b8cd20459..55d08669d09 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -25,7 +25,7 @@ import org.aspectj.lang.annotation.Aspect; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.BeanDefinition; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java index 1e4deb22f08..4475d87e4a8 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,10 +20,10 @@ import junit.framework.TestCase; import org.springframework.aop.scope.ScopedObject; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.TestBean; +import org.springframework.tests.context.SimpleMapScope; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.config.SimpleMapScope; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.annotation4.DependencyBean; import org.springframework.context.annotation4.FactoryMethodComponent; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java index 62aa1411a3a..331a2f0af2a 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,10 +25,11 @@ import javax.ejb.EJB; import org.junit.Test; import org.springframework.beans.BeansException; -import org.springframework.beans.INestedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.NestedTestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.mock.jndi.ExpectedLookupTemplate; +import org.springframework.tests.sample.beans.INestedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.NestedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -41,7 +42,6 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; import org.springframework.jndi.support.SimpleJndiBeanFactory; -import org.springframework.mock.jndi.ExpectedLookupTemplate; import org.springframework.util.SerializationTestUtils; import static org.junit.Assert.*; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java index 7b461584a0a..f6d90975c2d 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -31,12 +31,12 @@ import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.CustomAutowireConfigurer; import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.SimpleMapScope; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.ComponentScanParserTests.CustomAnnotationAutowiredBean; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.tests.context.SimpleMapScope; import org.springframework.util.SerializationTestUtils; import example.scannable.CustomComponent; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java index 4cbfd9b34e7..31a87271caf 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -23,8 +23,8 @@ import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.FatalBeanException; -import org.springframework.beans.factory.config.SimpleMapScope; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.tests.context.SimpleMapScope; import org.springframework.util.SerializationTestUtils; /** diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassAndBFPPTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassAndBFPPTests.java index ee826eb33a0..b35fc045745 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassAndBFPPTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassAndBFPPTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import static org.junit.Assert.assertThat; import org.junit.Test; import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostConstructAndAutowiringTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostConstructAndAutowiringTests.java index eb288746fd2..6972adada9a 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostConstructAndAutowiringTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostConstructAndAutowiringTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import static org.junit.Assert.assertThat; import javax.annotation.PostConstruct; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; /** diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java index d52a9db656f..815c487294d 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.context.annotation; import static org.junit.Assert.*; import org.junit.Test; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.support.ChildBeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java b/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java index c01fc14cec5..eab6f37b7fe 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import org.springframework.core.convert.converter.Converter; /** * @author Juergen Hoeller */ -public class FooServiceDependentConverter implements Converter { +public class FooServiceDependentConverter implements Converter { private FooService fooService; @@ -32,8 +32,8 @@ public class FooServiceDependentConverter implements Converter - + diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml index 44fc77e3b5e..1b95433a63e 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java index b23695db3ba..e895a207c3a 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,7 +30,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.util.ClassUtils; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Unit tests cornering the bug exposed in SPR-6779. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java index 49007b8a348..52aaaac7e91 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,8 +27,8 @@ import org.junit.After; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import test.beans.ITestBean; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.aop.scope.ScopedObject; import org.springframework.beans.factory.ObjectFactory; diff --git a/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java b/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java index 125c77c6363..6c59cf85228 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java +++ b/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.context.annotation4; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/spring-context/src/test/java/org/springframework/context/annotation4/SimpleBean.java b/spring-context/src/test/java/org/springframework/context/annotation4/SimpleBean.java index b2cc55fec21..fcfe98d94ad 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation4/SimpleBean.java +++ b/spring-context/src/test/java/org/springframework/context/annotation4/SimpleBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.context.annotation4; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.annotation.Bean; /** diff --git a/spring-context/src/test/java/org/springframework/context/annotation6/ConfigForScanning.java b/spring-context/src/test/java/org/springframework/context/annotation6/ConfigForScanning.java index 8dbb67f34ae..42098c96e79 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation6/ConfigForScanning.java +++ b/spring-context/src/test/java/org/springframework/context/annotation6/ConfigForScanning.java @@ -3,7 +3,7 @@ package org.springframework.context.annotation6; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; @Configuration public class ConfigForScanning { diff --git a/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java b/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java index 56233a73730..d124bac8306 100644 --- a/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,7 +29,7 @@ import static org.mockito.Mockito.verify; import org.junit.Test; import org.springframework.aop.framework.ProxyFactory; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.ApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java index 592337551c2..1a0e064b757 100644 --- a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,9 +23,9 @@ import org.junit.Before; import org.junit.Test; import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.BeansException; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEventPublisher; diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index 3384916c081..17176f9dcd6 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFactory; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java index 4dda9faf6c6..152cf5d758d 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.GenericApplicationContext; import org.springframework.mock.env.MockPropertySource; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** diff --git a/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java index 8c39e53d32e..152ecfb6ecd 100644 --- a/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.*; import org.junit.Test; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; diff --git a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resource.xml b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resource.xml index e339891102f..6c959877127 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resource.xml +++ b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resource.xml @@ -5,7 +5,7 @@ - + classpath:org/springframework/beans/factory/xml/test.properties diff --git a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resourceImport.xml b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resourceImport.xml index 717148bc4c2..232374bd0ed 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resourceImport.xml +++ b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests-resourceImport.xml @@ -3,7 +3,7 @@ - + test.properties diff --git a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java index 38939c7fcb5..7ff83e35eae 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,7 +30,7 @@ import java.util.Map; import org.junit.Test; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ResourceTestBean; +import org.springframework.tests.sample.beans.ResourceTestBean; import org.springframework.beans.TypeMismatchException; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanFactoryUtils; diff --git a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java index 49fda87dab2..676ff05a305 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import java.util.Set; import org.junit.Test; -import org.springframework.beans.ResourceTestBean; +import org.springframework.tests.sample.beans.ResourceTestBean; import org.springframework.context.ApplicationContext; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.TypeDescriptor; diff --git a/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java index 39482f71cfc..24185526d6c 100644 --- a/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import java.io.FileNotFoundException; import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; diff --git a/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java b/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java index 3e640d91457..078b1169790 100644 --- a/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -36,7 +36,7 @@ import org.springframework.core.io.Resource; import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockPropertySource; -import test.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Unit tests for {@link PropertySourcesPlaceholderConfigurer}. diff --git a/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java b/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java index e03b30eaa68..887c6fc1cc1 100644 --- a/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java +++ b/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java index 39651c9370f..b1f9d24ecd6 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import java.util.Locale; import java.util.Map; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader; import org.springframework.context.ACATester; import org.springframework.context.AbstractApplicationContextTests; diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java index acddae3ff11..bba7f776685 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import java.util.Locale; import java.util.Map; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader; import org.springframework.context.ACATester; import org.springframework.context.AbstractApplicationContextTests; diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java index 8a94e8326e4..908f5652c12 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -203,9 +203,9 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests { Map m = new HashMap(); m.put("name", "Roderick"); - parent.registerPrototype("rod", org.springframework.beans.TestBean.class, new MutablePropertyValues(m)); + parent.registerPrototype("rod", org.springframework.tests.sample.beans.TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); - parent.registerPrototype("father", org.springframework.beans.TestBean.class, new MutablePropertyValues(m)); + parent.registerPrototype("father", org.springframework.tests.sample.beans.TestBean.class, new MutablePropertyValues(m)); parent.refresh(); parent.addApplicationListener(parentListener); diff --git a/spring-context/src/test/java/org/springframework/context/support/conversionService.xml b/spring-context/src/test/java/org/springframework/context/support/conversionService.xml index 57c2b5c8af0..bcfae1cdb55 100644 --- a/spring-context/src/test/java/org/springframework/context/support/conversionService.xml +++ b/spring-context/src/test/java/org/springframework/context/support/conversionService.xml @@ -5,7 +5,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/context/support/conversionServiceWithResourceOverriding.xml b/spring-context/src/test/java/org/springframework/context/support/conversionServiceWithResourceOverriding.xml index 5e407ee0be0..5ddcbab67d4 100644 --- a/spring-context/src/test/java/org/springframework/context/support/conversionServiceWithResourceOverriding.xml +++ b/spring-context/src/test/java/org/springframework/context/support/conversionServiceWithResourceOverriding.xml @@ -9,7 +9,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/context/support/testBeans.properties b/spring-context/src/test/java/org/springframework/context/support/testBeans.properties index 1eab846bc5e..6b9c028005b 100644 --- a/spring-context/src/test/java/org/springframework/context/support/testBeans.properties +++ b/spring-context/src/test/java/org/springframework/context/support/testBeans.properties @@ -1,42 +1,42 @@ # this must only be used for ApplicationContexts, some classes are only appropriate for application contexts -rod.(class)=org.springframework.beans.TestBean +rod.(class)=org.springframework.tests.sample.beans.TestBean rod.name=Rod rod.age=31 roderick.(parent)=rod roderick.name=Roderick -kerry.(class)=org.springframework.beans.TestBean +kerry.(class)=org.springframework.tests.sample.beans.TestBean kerry.name=Kerry kerry.age=34 kerry.spouse(ref)=rod -kathy.(class)=org.springframework.beans.TestBean +kathy.(class)=org.springframework.tests.sample.beans.TestBean kathy.(singleton)=false -typeMismatch.(class)=org.springframework.beans.TestBean +typeMismatch.(class)=org.springframework.tests.sample.beans.TestBean typeMismatch.name=typeMismatch typeMismatch.age=34x typeMismatch.spouse(ref)=rod typeMismatch.(singleton)=false -validEmpty.(class)=org.springframework.beans.TestBean +validEmpty.(class)=org.springframework.tests.sample.beans.TestBean -listenerVeto.(class)=org.springframework.beans.TestBean +listenerVeto.(class)=org.springframework.tests.sample.beans.TestBean typeMismatch.name=typeMismatch typeMismatch.age=34x typeMismatch.spouse(ref)=rod -singletonFactory.(class)=org.springframework.beans.factory.DummyFactory +singletonFactory.(class)=org.springframework.tests.sample.beans.factory.DummyFactory singletonFactory.singleton=true -prototypeFactory.(class)=org.springframework.beans.factory.DummyFactory +prototypeFactory.(class)=org.springframework.tests.sample.beans.factory.DummyFactory prototypeFactory.singleton=false -mustBeInitialized.(class)=org.springframework.beans.factory.MustBeInitialized +mustBeInitialized.(class)=org.springframework.tests.sample.beans.MustBeInitialized lifecycle.(class)=org.springframework.context.LifecycleContextBean -lifecyclePostProcessor.(class)=org.springframework.beans.factory.LifecycleBean$PostProcessor +lifecyclePostProcessor.(class)=org.springframework.tests.sample.beans.LifecycleBean$PostProcessor diff --git a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerEventTests.java b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerEventTests.java index d8c1aa13902..4eea7e81555 100644 --- a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerEventTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2013 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. @@ -21,11 +21,11 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.parsing.BeanComponentDefinition; -import org.springframework.beans.factory.parsing.CollectingReaderEventListener; import org.springframework.beans.factory.parsing.ComponentDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.beans.CollectingReaderEventListener; /** * @author Torsten Juergeleit diff --git a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java index 1afb7000f3c..c2430271b43 100644 --- a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.RuntimeBeanReference; @@ -125,7 +125,7 @@ public class JeeNamespaceHandlerTests { assertPropertyValue(beanDefinition, "lookupHomeOnStartup", "true"); assertPropertyValue(beanDefinition, "resourceRef", "true"); assertPropertyValue(beanDefinition, "jndiEnvironment", "foo=bar"); - assertPropertyValue(beanDefinition, "homeInterface", "org.springframework.beans.ITestBean"); + assertPropertyValue(beanDefinition, "homeInterface", "org.springframework.tests.sample.beans.ITestBean"); assertPropertyValue(beanDefinition, "refreshHomeOnConnectFailure", "true"); assertPropertyValue(beanDefinition, "cacheSessionBean", "true"); } diff --git a/spring-context/src/test/java/org/springframework/ejb/config/jeeNamespaceHandlerTests.xml b/spring-context/src/test/java/org/springframework/ejb/config/jeeNamespaceHandlerTests.xml index 6d1a3ddf833..e8767251a95 100644 --- a/spring-context/src/test/java/org/springframework/ejb/config/jeeNamespaceHandlerTests.xml +++ b/spring-context/src/test/java/org/springframework/ejb/config/jeeNamespaceHandlerTests.xml @@ -41,11 +41,11 @@ + business-interface="org.springframework.tests.sample.beans.ITestBean"/> @@ -54,15 +54,15 @@ + business-interface="org.springframework.tests.sample.beans.ITestBean"/> foo=bar @@ -71,8 +71,8 @@ + business-interface="org.springframework.tests.sample.beans.ITestBean" lazy-init="true" /> + business-interface="org.springframework.tests.sample.beans.ITestBean" lazy-init="true" /> diff --git a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java index 26b0af991d0..2d7d9e26398 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -34,7 +34,6 @@ import javax.management.ObjectName; import javax.management.modelmbean.ModelMBeanInfo; import org.springframework.aop.framework.ProxyFactory; -import org.springframework.beans.TestBean; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -48,8 +47,8 @@ import org.springframework.jmx.export.assembler.SimpleReflectiveMBeanInfoAssembl import org.springframework.jmx.export.naming.SelfNaming; import org.springframework.jmx.support.ObjectNameManager; import org.springframework.jmx.support.RegistrationPolicy; - -import test.interceptor.NopInterceptor; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.TestBean; /** * Integration tests for the {@link MBeanExporter} class. diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java index 4c7c414d850..99cefe71583 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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 @@ -32,8 +32,7 @@ import org.springframework.jmx.JmxTestBean; import org.springframework.jmx.export.MBeanExporter; import org.springframework.jmx.export.metadata.JmxAttributeSource; import org.springframework.jmx.support.ObjectNameManager; - -import test.interceptor.NopInterceptor; +import org.springframework.tests.aop.interceptor.NopInterceptor; /** * @author Rob Harrop diff --git a/spring-context/src/test/java/org/springframework/jmx/export/propertyPlaceholderConfigurer.xml b/spring-context/src/test/java/org/springframework/jmx/export/propertyPlaceholderConfigurer.xml index b108c30e01d..79790d3963b 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/propertyPlaceholderConfigurer.xml +++ b/spring-context/src/test/java/org/springframework/jmx/export/propertyPlaceholderConfigurer.xml @@ -17,7 +17,7 @@ - + diff --git a/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java index a99ef772f01..4ad2255d2c4 100644 --- a/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,10 +26,10 @@ import javax.naming.Context; import javax.naming.NamingException; import org.junit.Test; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; -import org.springframework.mock.jndi.ExpectedLookupTemplate; +import org.springframework.tests.mock.jndi.ExpectedLookupTemplate; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rod Johnson @@ -378,7 +378,7 @@ public class JndiObjectFactoryBeanTests { fail("Should have thrown NamingException"); } catch (NamingException ex) { - assertTrue(ex.getMessage().indexOf("org.springframework.beans.DerivedTestBean") != -1); + assertTrue(ex.getMessage().indexOf("org.springframework.tests.sample.beans.DerivedTestBean") != -1); } } diff --git a/spring-context/src/test/java/org/springframework/jndi/JndiPropertySourceTests.java b/spring-context/src/test/java/org/springframework/jndi/JndiPropertySourceTests.java index 5148742ca42..ad6ac8871ab 100644 --- a/spring-context/src/test/java/org/springframework/jndi/JndiPropertySourceTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/JndiPropertySourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import javax.naming.Context; import javax.naming.NamingException; import org.junit.Test; -import org.springframework.mock.jndi.SimpleNamingContext; +import org.springframework.tests.mock.jndi.SimpleNamingContext; /** * Unit tests for {@link JndiPropertySource}. diff --git a/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java b/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java index 23bac25d536..917e8dc918f 100644 --- a/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -35,8 +35,8 @@ import javax.sql.DataSource; import org.junit.Test; -import org.springframework.mock.jndi.SimpleNamingContext; -import org.springframework.mock.jndi.SimpleNamingContextBuilder; +import org.springframework.tests.mock.jndi.SimpleNamingContext; +import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder; import static org.junit.Assert.*; diff --git a/spring-context/src/test/java/org/springframework/mock/env/MockPropertySource.java b/spring-context/src/test/java/org/springframework/mock/env/MockPropertySource.java deleted file mode 100644 index 2783f244b18..00000000000 --- a/spring-context/src/test/java/org/springframework/mock/env/MockPropertySource.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.env; - -import java.util.Properties; - -import org.springframework.core.env.PropertiesPropertySource; -import org.springframework.core.env.PropertySource; - -/** - * Simple {@link PropertySource} implementation for use in testing. Accepts - * a user-provided {@link Properties} object, or if omitted during construction, - * the implementation will initialize its own. - * - * The {@link #setProperty} and {@link #withProperty} methods are exposed for - * convenience, for example: - *
- * {@code
- *   PropertySource source = new MockPropertySource().withProperty("foo", "bar");
- * }
- * 
- * - * @author Chris Beams - * @since 3.1 - * @see org.springframework.mock.env.MockEnvironment - */ -public class MockPropertySource extends PropertiesPropertySource { - - /** - * {@value} is the default name for {@link MockPropertySource} instances not - * otherwise given an explicit name. - * @see #MockPropertySource() - * @see #MockPropertySource(String) - */ - public static final String MOCK_PROPERTIES_PROPERTY_SOURCE_NAME = "mockProperties"; - - /** - * Create a new {@code MockPropertySource} named {@value #MOCK_PROPERTIES_PROPERTY_SOURCE_NAME} - * that will maintain its own internal {@link Properties} instance. - */ - public MockPropertySource() { - this(new Properties()); - } - - /** - * Create a new {@code MockPropertySource} with the given name that will - * maintain its own internal {@link Properties} instance. - * @param name the {@linkplain #getName() name} of the property source - */ - public MockPropertySource(String name) { - this(name, new Properties()); - } - - /** - * Create a new {@code MockPropertySource} named {@value #MOCK_PROPERTIES_PROPERTY_SOURCE_NAME} - * and backed by the given {@link Properties} object. - * @param properties the properties to use - */ - public MockPropertySource(Properties properties) { - this(MOCK_PROPERTIES_PROPERTY_SOURCE_NAME, properties); - } - - /** - * Create a new {@code MockPropertySource} with the given name and backed by the given - * {@link Properties} object - * @param name the {@linkplain #getName() name} of the property source - * @param properties the properties to use - */ - public MockPropertySource(String name, Properties properties) { - super(name, properties); - } - - /** - * Set the given property on the underlying {@link Properties} object. - */ - public void setProperty(String name, Object value) { - this.source.put(name, value); - } - - /** - * Convenient synonym for {@link #setProperty} that returns the current instance. - * Useful for method chaining and fluent-style use. - * @return this {@link MockPropertySource} instance - */ - public MockPropertySource withProperty(String name, Object value) { - this.setProperty(name, value); - return this; - } - -} diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java deleted file mode 100644 index 71736866063..00000000000 --- a/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.jndi; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.naming.NamingException; - -import org.springframework.jndi.JndiTemplate; - -/** - * Simple extension of the JndiTemplate class that always returns - * a given object. Very useful for testing. Effectively a mock object. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public class ExpectedLookupTemplate extends JndiTemplate { - - private final Map jndiObjects = new ConcurrentHashMap(); - - - /** - * Construct a new JndiTemplate that will always return given objects - * for given names. To be populated through {@code addObject} calls. - * @see #addObject(String, Object) - */ - public ExpectedLookupTemplate() { - } - - /** - * Construct a new JndiTemplate that will always return the - * given object, but honour only requests for the given name. - * @param name the name the client is expected to look up - * @param object the object that will be returned - */ - public ExpectedLookupTemplate(String name, Object object) { - addObject(name, object); - } - - - /** - * Add the given object to the list of JNDI objects that this - * template will expose. - * @param name the name the client is expected to look up - * @param object the object that will be returned - */ - public void addObject(String name, Object object) { - this.jndiObjects.put(name, object); - } - - - /** - * If the name is the expected name specified in the constructor, - * return the object provided in the constructor. If the name is - * unexpected, a respective NamingException gets thrown. - */ - @Override - public Object lookup(String name) throws NamingException { - Object object = this.jndiObjects.get(name); - if (object == null) { - throw new NamingException("Unexpected JNDI name '" + name + "': expecting " + this.jndiObjects.keySet()); - } - return object; - } - -} diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java deleted file mode 100644 index 883db7bfd3f..00000000000 --- a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.jndi; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.InitialContextFactoryBuilder; -import javax.naming.spi.NamingManager; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.util.ClassUtils; - -/** - * Simple implementation of a JNDI naming context builder. - * - *

Mainly targeted at test environments, where each test case can - * configure JNDI appropriately, so that {@code new InitialContext()} - * will expose the required objects. Also usable for standalone applications, - * e.g. for binding a JDBC DataSource to a well-known JNDI location, to be - * able to use traditional J2EE data access code outside of a J2EE container. - * - *

There are various choices for DataSource implementations: - *

    - *
  • SingleConnectionDataSource (using the same Connection for all getConnection calls); - *
  • DriverManagerDataSource (creating a new Connection on each getConnection call); - *
  • Apache's Jakarta Commons DBCP offers BasicDataSource (a real pool). - *
- * - *

Typical usage in bootstrap code: - * - *

- * SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
- * DataSource ds = new DriverManagerDataSource(...);
- * builder.bind("java:comp/env/jdbc/myds", ds);
- * builder.activate();
- * - * Note that it's impossible to activate multiple builders within the same JVM, - * due to JNDI restrictions. Thus to configure a fresh builder repeatedly, use - * the following code to get a reference to either an already activated builder - * or a newly activated one: - * - *
- * SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
- * DataSource ds = new DriverManagerDataSource(...);
- * builder.bind("java:comp/env/jdbc/myds", ds);
- * - * Note that you should not call {@code activate()} on a builder from - * this factory method, as there will already be an activated one in any case. - * - *

An instance of this class is only necessary at setup time. - * An application does not need to keep a reference to it after activation. - * - * @author Juergen Hoeller - * @author Rod Johnson - * @see #emptyActivatedContextBuilder() - * @see #bind(String, Object) - * @see #activate() - * @see SimpleNamingContext - * @see org.springframework.jdbc.datasource.SingleConnectionDataSource - * @see org.springframework.jdbc.datasource.DriverManagerDataSource - * @see org.apache.commons.dbcp.BasicDataSource - */ -public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder { - - /** An instance of this class bound to JNDI */ - private static volatile SimpleNamingContextBuilder activated; - - private static boolean initialized = false; - - private static final Object initializationLock = new Object(); - - - /** - * Checks if a SimpleNamingContextBuilder is active. - * @return the current SimpleNamingContextBuilder instance, - * or {@code null} if none - */ - public static SimpleNamingContextBuilder getCurrentContextBuilder() { - return activated; - } - - /** - * If no SimpleNamingContextBuilder is already configuring JNDI, - * create and activate one. Otherwise take the existing activate - * SimpleNamingContextBuilder, clear it and return it. - *

This is mainly intended for test suites that want to - * reinitialize JNDI bindings from scratch repeatedly. - * @return an empty SimpleNamingContextBuilder that can be used - * to control JNDI bindings - */ - public static SimpleNamingContextBuilder emptyActivatedContextBuilder() throws NamingException { - if (activated != null) { - // Clear already activated context builder. - activated.clear(); - } - else { - // Create and activate new context builder. - SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); - // The activate() call will cause an assignment to the activated variable. - builder.activate(); - } - return activated; - } - - - private final Log logger = LogFactory.getLog(getClass()); - - private final Hashtable boundObjects = new Hashtable(); - - - /** - * Register the context builder by registering it with the JNDI NamingManager. - * Note that once this has been done, {@code new InitialContext()} will always - * return a context from this factory. Use the {@code emptyActivatedContextBuilder()} - * static method to get an empty context (for example, in test methods). - * @throws IllegalStateException if there's already a naming context builder - * registered with the JNDI NamingManager - */ - public void activate() throws IllegalStateException, NamingException { - logger.info("Activating simple JNDI environment"); - synchronized (initializationLock) { - if (!initialized) { - if (NamingManager.hasInitialContextFactoryBuilder()) { - throw new IllegalStateException( - "Cannot activate SimpleNamingContextBuilder: there is already a JNDI provider registered. " + - "Note that JNDI is a JVM-wide service, shared at the JVM system class loader level, " + - "with no reset option. As a consequence, a JNDI provider must only be registered once per JVM."); - } - NamingManager.setInitialContextFactoryBuilder(this); - initialized = true; - } - } - activated = this; - } - - /** - * Temporarily deactivate this context builder. It will remain registered with - * the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory - * (if configured) instead of exposing its own bound objects. - *

Call {@code activate()} again in order to expose this context builder's own - * bound objects again. Such activate/deactivate sequences can be applied any number - * of times (e.g. within a larger integration test suite running in the same VM). - * @see #activate() - */ - public void deactivate() { - logger.info("Deactivating simple JNDI environment"); - activated = null; - } - - /** - * Clear all bindings in this context builder, while keeping it active. - */ - public void clear() { - this.boundObjects.clear(); - } - - /** - * Bind the given object under the given name, for all naming contexts - * that this context builder will generate. - * @param name the JNDI name of the object (e.g. "java:comp/env/jdbc/myds") - * @param obj the object to bind (e.g. a DataSource implementation) - */ - public void bind(String name, Object obj) { - if (logger.isInfoEnabled()) { - logger.info("Static JNDI binding: [" + name + "] = [" + obj + "]"); - } - this.boundObjects.put(name, obj); - } - - - /** - * Simple InitialContextFactoryBuilder implementation, - * creating a new SimpleNamingContext instance. - * @see SimpleNamingContext - */ - @Override - public InitialContextFactory createInitialContextFactory(Hashtable environment) { - if (activated == null && environment != null) { - Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY); - if (icf != null) { - Class icfClass = null; - if (icf instanceof Class) { - icfClass = (Class) icf; - } - else if (icf instanceof String) { - icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader()); - } - else { - throw new IllegalArgumentException("Invalid value type for environment key [" + - Context.INITIAL_CONTEXT_FACTORY + "]: " + icf.getClass().getName()); - } - if (!InitialContextFactory.class.isAssignableFrom(icfClass)) { - throw new IllegalArgumentException( - "Specified class does not implement [" + InitialContextFactory.class.getName() + "]: " + icf); - } - try { - return (InitialContextFactory) icfClass.newInstance(); - } - catch (Throwable ex) { - IllegalStateException ise = - new IllegalStateException("Cannot instantiate specified InitialContextFactory: " + icf); - ise.initCause(ex); - throw ise; - } - } - } - - // Default case... - return new InitialContextFactory() { - @Override - @SuppressWarnings("unchecked") - public Context getInitialContext(Hashtable environment) { - return new SimpleNamingContext("", boundObjects, (Hashtable) environment); - } - }; - } - -} diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/package-info.java b/spring-context/src/test/java/org/springframework/mock/jndi/package-info.java deleted file mode 100644 index 9c268b0f676..00000000000 --- a/spring-context/src/test/java/org/springframework/mock/jndi/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/* - * The simplest implementation of the JNDI SPI that could possibly work. - * - *

Useful for setting up a simple JNDI environment for test suites - * or standalone applications. If e.g. JDBC DataSources get bound to the - * same JNDI names as within a J2EE container, both application code and - * configuration can me reused without changes. - */ - -package org.springframework.mock.jndi; diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java index e0945fab1de..3beaf36b84a 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import java.util.TimerTask; import junit.framework.TestCase; -import org.springframework.scheduling.TestMethodInvokingTask; +import org.springframework.tests.context.TestMethodInvokingTask; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/scripting/ContextScriptBean.java b/spring-context/src/test/java/org/springframework/scripting/ContextScriptBean.java index 052209d92f8..8c9a0ae2b87 100644 --- a/spring-context/src/test/java/org/springframework/scripting/ContextScriptBean.java +++ b/spring-context/src/test/java/org/springframework/scripting/ContextScriptBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.scripting; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContext; /** diff --git a/spring-context/src/test/java/org/springframework/scripting/TestBeanAwareMessenger.java b/spring-context/src/test/java/org/springframework/scripting/TestBeanAwareMessenger.java index ddc139475cc..7ea2ee25901 100644 --- a/spring-context/src/test/java/org/springframework/scripting/TestBeanAwareMessenger.java +++ b/spring-context/src/test/java/org/springframework/scripting/TestBeanAwareMessenger.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.scripting; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java index 8add303ba8d..05601840108 100644 --- a/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import junit.framework.TestCase; import org.springframework.aop.support.AopUtils; import org.springframework.aop.target.dynamic.Refreshable; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationEvent; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/scripting/bsh/MessengerImpl.bsh b/spring-context/src/test/java/org/springframework/scripting/bsh/MessengerImpl.bsh index 62bfe8b7bf3..72a1e6a39c4 100644 --- a/spring-context/src/test/java/org/springframework/scripting/bsh/MessengerImpl.bsh +++ b/spring-context/src/test/java/org/springframework/scripting/bsh/MessengerImpl.bsh @@ -1,4 +1,4 @@ -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.scripting.TestBeanAwareMessenger; public class MyMessenger implements TestBeanAwareMessenger { diff --git a/spring-context/src/test/java/org/springframework/scripting/bsh/bsh-with-xsd.xml b/spring-context/src/test/java/org/springframework/scripting/bsh/bsh-with-xsd.xml index 5908749d75c..116a7d6ab44 100644 --- a/spring-context/src/test/java/org/springframework/scripting/bsh/bsh-with-xsd.xml +++ b/spring-context/src/test/java/org/springframework/scripting/bsh/bsh-with-xsd.xml @@ -36,7 +36,7 @@ autowire="byName" init-method="init" destroy-method="destroy"> - + diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java index 86214124a8e..e472a7064ee 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java @@ -36,7 +36,7 @@ import org.junit.Ignore; import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.aop.target.dynamic.Refreshable; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.UnsatisfiedDependencyException; diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/ScriptBean.groovy b/spring-context/src/test/java/org/springframework/scripting/groovy/ScriptBean.groovy index d1b82bfece9..0b0116d2e10 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/ScriptBean.groovy +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/ScriptBean.groovy @@ -1,4 +1,4 @@ -import org.springframework.beans.TestBean +import org.springframework.tests.sample.beans.TestBean import org.springframework.context.ApplicationContext import org.springframework.context.ApplicationContextAware import org.springframework.scripting.ContextScriptBean diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/groovy-multiple-properties.xml b/spring-context/src/test/java/org/springframework/scripting/groovy/groovy-multiple-properties.xml index 58ce5e022aa..eaad85d1f8c 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/groovy-multiple-properties.xml +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/groovy-multiple-properties.xml @@ -19,6 +19,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-beanNameAutoProxyCreator.xml b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-beanNameAutoProxyCreator.xml index a8afa2447f8..1516ac2dbc4 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-beanNameAutoProxyCreator.xml +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-beanNameAutoProxyCreator.xml @@ -16,6 +16,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-factoryBean.xml b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-factoryBean.xml index 3744ad4ea62..2cd55ee7df6 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-factoryBean.xml +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests-factoryBean.xml @@ -16,6 +16,6 @@ - + diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java index a3791761801..0e29267700c 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2013 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. @@ -25,10 +25,9 @@ import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.scripting.Messenger; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; import org.springframework.util.MBeanTestUtils; -import test.advice.CountingBeforeAdvice; - /** * @author Rob Harrop * @author Chris Beams diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java index dd338997f0f..8071e6309e7 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java @@ -22,7 +22,7 @@ import junit.framework.TestCase; import org.springframework.aop.support.AopUtils; import org.springframework.aop.target.dynamic.Refreshable; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/jruby-with-xsd.xml b/spring-context/src/test/java/org/springframework/scripting/jruby/jruby-with-xsd.xml index 13f5d3c9aa0..5df3894c087 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/jruby-with-xsd.xml +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/jruby-with-xsd.xml @@ -28,7 +28,7 @@ autowire="byName"> - + diff --git a/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java b/spring-context/src/test/java/org/springframework/tests/context/SimpleMapScope.java similarity index 95% rename from spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java rename to spring-context/src/test/java/org/springframework/tests/context/SimpleMapScope.java index 71b565f900c..9b63bfc3332 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java +++ b/spring-context/src/test/java/org/springframework/tests/context/SimpleMapScope.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans.factory.config; +package org.springframework.tests.context; import java.io.Serializable; import java.util.HashMap; @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import org.springframework.beans.factory.ObjectFactory; +import org.springframework.beans.factory.config.Scope; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java b/spring-context/src/test/java/org/springframework/tests/context/TestMethodInvokingTask.java similarity index 96% rename from spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java rename to spring-context/src/test/java/org/springframework/tests/context/TestMethodInvokingTask.java index a95a2408b54..118feabbc33 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java +++ b/spring-context/src/test/java/org/springframework/tests/context/TestMethodInvokingTask.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.scheduling; +package org.springframework.tests.context; /** * @author Juergen Hoeller diff --git a/spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-context/src/test/java/org/springframework/tests/mock/jndi/ExpectedLookupTemplate.java similarity index 98% rename from spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java rename to spring-context/src/test/java/org/springframework/tests/mock/jndi/ExpectedLookupTemplate.java index 71736866063..a4e8932e26d 100644 --- a/spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java +++ b/spring-context/src/test/java/org/springframework/tests/mock/jndi/ExpectedLookupTemplate.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.mock.jndi; +package org.springframework.tests.mock.jndi; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-context/src/test/java/org/springframework/tests/mock/jndi/SimpleNamingContext.java similarity index 98% rename from spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java rename to spring-context/src/test/java/org/springframework/tests/mock/jndi/SimpleNamingContext.java index 4e1641b2cd8..bdad96e32d0 100644 --- a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ b/spring-context/src/test/java/org/springframework/tests/mock/jndi/SimpleNamingContext.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.mock.jndi; +package org.springframework.tests.mock.jndi; import java.util.HashMap; import java.util.Hashtable; @@ -149,7 +149,7 @@ public class SimpleNamingContext implements Context { * Note: Not intended for direct use by applications * if setting up a JVM-level JNDI environment. * Use SimpleNamingContextBuilder to set up JNDI bindings then. - * @see org.springframework.mock.jndi.SimpleNamingContextBuilder#bind + * @see org.springframework.tests.mock.jndi.SimpleNamingContextBuilder#bind */ @Override public void bind(String name, Object obj) { diff --git a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-context/src/test/java/org/springframework/tests/mock/jndi/SimpleNamingContextBuilder.java similarity index 99% rename from spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java rename to spring-context/src/test/java/org/springframework/tests/mock/jndi/SimpleNamingContextBuilder.java index 883db7bfd3f..3d1452ac29f 100644 --- a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ b/spring-context/src/test/java/org/springframework/tests/mock/jndi/SimpleNamingContextBuilder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.mock.jndi; +package org.springframework.tests.mock.jndi; import java.util.Hashtable; diff --git a/spring-aop/src/test/java/test/beans/Person.java b/spring-context/src/test/java/org/springframework/tests/mock/jndi/package-info.java similarity index 62% rename from spring-aop/src/test/java/test/beans/Person.java rename to spring-context/src/test/java/org/springframework/tests/mock/jndi/package-info.java index 974d7d9b772..8847baab541 100644 --- a/spring-aop/src/test/java/test/beans/Person.java +++ b/spring-context/src/test/java/org/springframework/tests/mock/jndi/package-info.java @@ -14,23 +14,12 @@ * limitations under the License. */ -package test.beans; - /** + * The simplest implementation of the JNDI SPI that could possibly work. * - * @author Rod Johnson + *

Useful for setting up a simple JNDI environment for test suites + * or standalone applications. If e.g. JDBC DataSources get bound to the + * same JNDI names as within a J2EE container, both application code and + * configuration can me reused without changes. */ -public interface Person { - - String getName(); - void setName(String name); - int getAge(); - void setAge(int i); - - /** - * Test for non-property method matching. - * If the parameter is a Throwable, it will be thrown rather than - * returned. - */ - Object echo(Object o) throws Throwable; -} \ No newline at end of file +package org.springframework.tests.mock.jndi; diff --git a/spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java b/spring-context/src/test/java/org/springframework/tests/sample/beans/BeanWithObjectProperty.java similarity index 94% rename from spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java rename to spring-context/src/test/java/org/springframework/tests/sample/beans/BeanWithObjectProperty.java index bb5e71f5cd0..4448962d49c 100644 --- a/spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java +++ b/spring-context/src/test/java/org/springframework/tests/sample/beans/BeanWithObjectProperty.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/test/beans/Employee.java b/spring-context/src/test/java/org/springframework/tests/sample/beans/Employee.java similarity index 89% rename from spring-context/src/test/java/test/beans/Employee.java rename to spring-context/src/test/java/org/springframework/tests/sample/beans/Employee.java index 537a5a88335..7bed71f394b 100644 --- a/spring-context/src/test/java/test/beans/Employee.java +++ b/spring-context/src/test/java/org/springframework/tests/sample/beans/Employee.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; public class Employee extends TestBean { diff --git a/spring-context/src/test/java/test/beans/FactoryMethods.java b/spring-context/src/test/java/org/springframework/tests/sample/beans/FactoryMethods.java similarity index 95% rename from spring-context/src/test/java/test/beans/FactoryMethods.java rename to spring-context/src/test/java/org/springframework/tests/sample/beans/FactoryMethods.java index 8e0f55ce777..a98548867aa 100644 --- a/spring-context/src/test/java/test/beans/FactoryMethods.java +++ b/spring-context/src/test/java/org/springframework/tests/sample/beans/FactoryMethods.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package test.beans; +package org.springframework.tests.sample.beans; /** * Test class for Spring's ability to create objects using static diff --git a/spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java b/spring-context/src/test/java/org/springframework/tests/sample/beans/FieldAccessBean.java similarity index 94% rename from spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java rename to spring-context/src/test/java/org/springframework/tests/sample/beans/FieldAccessBean.java index 61f911902c7..a250f329cbd 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java +++ b/spring-context/src/test/java/org/springframework/tests/sample/beans/FieldAccessBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/beans/ResourceTestBean.java b/spring-context/src/test/java/org/springframework/tests/sample/beans/ResourceTestBean.java similarity index 97% rename from spring-context/src/test/java/org/springframework/beans/ResourceTestBean.java rename to spring-context/src/test/java/org/springframework/tests/sample/beans/ResourceTestBean.java index 0831e05c584..a5b1eef734e 100644 --- a/spring-context/src/test/java/org/springframework/beans/ResourceTestBean.java +++ b/spring-context/src/test/java/org/springframework/tests/sample/beans/ResourceTestBean.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans; +package org.springframework.tests.sample.beans; import java.io.InputStream; import java.util.Map; diff --git a/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java b/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java index 09a8c6aaa8d..7b159f3b3a0 100644 --- a/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java +++ b/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -32,7 +32,7 @@ import java.util.Map; import org.junit.Test; import org.springframework.aop.framework.ProxyFactory; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; diff --git a/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java deleted file mode 100644 index b20121d864c..00000000000 --- a/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2002-2012 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.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * - * @author Rod Johnson - */ -public class SerializationTestUtils { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - return o2; - } - -} diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java index e64219c59ca..bf2031ba53a 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,11 +21,11 @@ import java.util.Map; import junit.framework.TestCase; -import org.springframework.beans.FieldAccessBean; +import org.springframework.tests.sample.beans.FieldAccessBean; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.NotWritablePropertyException; import org.springframework.beans.PropertyValue; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java index 9107bb3a59d..515a1013b02 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -37,16 +37,16 @@ import java.util.TreeSet; import junit.framework.TestCase; -import org.springframework.beans.BeanWithObjectProperty; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.BeanWithObjectProperty; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; import org.springframework.beans.InvalidPropertyException; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.NotWritablePropertyException; import org.springframework.beans.NullValueInNestedPathException; -import org.springframework.beans.SerializablePerson; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.SerializablePerson; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.CustomCollectionEditor; import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.context.i18n.LocaleContextHolder; @@ -1196,8 +1196,8 @@ public class DataBinderTests extends TestCase { pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); binder.bind(pvs); - assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName()); - assertEquals("listtest2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName()); + assertEquals("listtest1", ((TestBean)tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); + assertEquals("listtest2", ((TestBean)tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); } @@ -1221,8 +1221,8 @@ public class DataBinderTests extends TestCase { pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); binder.bind(pvs); - assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName()); - assertEquals("test2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName()); + assertEquals("listtest1", ((TestBean)tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); + assertEquals("test2", ((TestBean)tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); } @@ -1246,8 +1246,8 @@ public class DataBinderTests extends TestCase { pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); binder.bind(pvs); - assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName()); - assertEquals("test2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName()); + assertEquals("listtest1", ((TestBean)tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); + assertEquals("test2", ((TestBean)tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); } @@ -1282,7 +1282,7 @@ public class DataBinderTests extends TestCase { assertEquals("NOT_ROD.tb.array", errors.getFieldError("array[0]").getCodes()[1]); assertEquals("NOT_ROD.array[0]", errors.getFieldError("array[0]").getCodes()[2]); assertEquals("NOT_ROD.array", errors.getFieldError("array[0]").getCodes()[3]); - assertEquals("NOT_ROD.org.springframework.beans.DerivedTestBean", errors.getFieldError("array[0]").getCodes()[4]); + assertEquals("NOT_ROD.org.springframework.tests.sample.beans.DerivedTestBean", errors.getFieldError("array[0]").getCodes()[4]); assertEquals("NOT_ROD", errors.getFieldError("array[0]").getCodes()[5]); assertEquals("arraya", errors.getFieldValue("array[0]")); @@ -1292,7 +1292,7 @@ public class DataBinderTests extends TestCase { assertEquals("NOT_ROD.tb.map", errors.getFieldError("map[key1]").getCodes()[1]); assertEquals("NOT_ROD.map[key1]", errors.getFieldError("map[key1]").getCodes()[2]); assertEquals("NOT_ROD.map", errors.getFieldError("map[key1]").getCodes()[3]); - assertEquals("NOT_ROD.org.springframework.beans.TestBean", errors.getFieldError("map[key1]").getCodes()[4]); + assertEquals("NOT_ROD.org.springframework.tests.sample.beans.TestBean", errors.getFieldError("map[key1]").getCodes()[4]); assertEquals("NOT_ROD", errors.getFieldError("map[key1]").getCodes()[5]); assertEquals(1, errors.getFieldErrorCount("map[key0]")); @@ -1330,7 +1330,7 @@ public class DataBinderTests extends TestCase { assertEquals("NOT_NULL.map", errors.getFieldError("map[key0]").getCodes()[3]); // This next code is only generated because of the registered editor, using the // registered type of the editor as guess for the content type of the collection. - assertEquals("NOT_NULL.org.springframework.beans.TestBean", errors.getFieldError("map[key0]").getCodes()[4]); + assertEquals("NOT_NULL.org.springframework.tests.sample.beans.TestBean", errors.getFieldError("map[key0]").getCodes()[4]); assertEquals("NOT_NULL", errors.getFieldError("map[key0]").getCodes()[5]); } @@ -1360,7 +1360,7 @@ public class DataBinderTests extends TestCase { assertEquals("NOT_NULL.map", errors.getFieldError("map[key0]").getCodes()[3]); // This next code is only generated because of the registered editor, using the // registered type of the editor as guess for the content type of the collection. - assertEquals("NOT_NULL.org.springframework.beans.TestBean", errors.getFieldError("map[key0]").getCodes()[4]); + assertEquals("NOT_NULL.org.springframework.tests.sample.beans.TestBean", errors.getFieldError("map[key0]").getCodes()[4]); assertEquals("NOT_NULL", errors.getFieldError("map[key0]").getCodes()[5]); } @@ -1392,7 +1392,7 @@ public class DataBinderTests extends TestCase { assertEquals("NOT_ROD.tb.array", errors.getFieldError("array[0]").getCodes()[1]); assertEquals("NOT_ROD.array[0]", errors.getFieldError("array[0]").getCodes()[2]); assertEquals("NOT_ROD.array", errors.getFieldError("array[0]").getCodes()[3]); - assertEquals("NOT_ROD.org.springframework.beans.DerivedTestBean", errors.getFieldError("array[0]").getCodes()[4]); + assertEquals("NOT_ROD.org.springframework.tests.sample.beans.DerivedTestBean", errors.getFieldError("array[0]").getCodes()[4]); assertEquals("NOT_ROD", errors.getFieldError("array[0]").getCodes()[5]); assertEquals("arraya", errors.getFieldValue("array[0]")); } diff --git a/spring-context/src/test/java/org/springframework/validation/DefaultMessageCodesResolverTests.java b/spring-context/src/test/java/org/springframework/validation/DefaultMessageCodesResolverTests.java index d5e094a2e1f..947677717ce 100644 --- a/spring-context/src/test/java/org/springframework/validation/DefaultMessageCodesResolverTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DefaultMessageCodesResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.DefaultMessageCodesResolver.Format; /** @@ -48,7 +48,7 @@ public class DefaultMessageCodesResolverTests { assertThat(codes, is(equalTo(new String[] { "errorCode.objectName.field", "errorCode.field", - "errorCode.org.springframework.beans.TestBean", + "errorCode.org.springframework.tests.sample.beans.TestBean", "errorCode" }))); } @@ -64,7 +64,7 @@ public class DefaultMessageCodesResolverTests { "errorCode.a.b[3].c.d", "errorCode.a.b.c.d", "errorCode.d", - "errorCode.org.springframework.beans.TestBean", + "errorCode.org.springframework.tests.sample.beans.TestBean", "errorCode" }))); } @@ -85,7 +85,7 @@ public class DefaultMessageCodesResolverTests { assertThat(codes, is(equalTo(new String[] { "prefix.errorCode.objectName.field", "prefix.errorCode.field", - "prefix.errorCode.org.springframework.beans.TestBean", + "prefix.errorCode.org.springframework.tests.sample.beans.TestBean", "prefix.errorCode" }))); } @@ -97,7 +97,7 @@ public class DefaultMessageCodesResolverTests { assertThat(codes, is(equalTo(new String[] { "errorCode.objectName.field", "errorCode.field", - "errorCode.org.springframework.beans.TestBean", + "errorCode.org.springframework.tests.sample.beans.TestBean", "errorCode" }))); } @@ -108,7 +108,7 @@ public class DefaultMessageCodesResolverTests { assertThat(codes, is(equalTo(new String[] { "errorCode.objectName.field[", "errorCode.field[", - "errorCode.org.springframework.beans.TestBean", + "errorCode.org.springframework.tests.sample.beans.TestBean", "errorCode" }))); } @@ -139,7 +139,7 @@ public class DefaultMessageCodesResolverTests { assertThat(codes, is(equalTo(new String[] { "objectName.field.errorCode", "field.errorCode", - "org.springframework.beans.TestBean.errorCode", + "org.springframework.tests.sample.beans.TestBean.errorCode", "errorCode" }))); } diff --git a/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java b/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java index 1c7fe2c708e..83a36cf9558 100644 --- a/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java +++ b/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.validation; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Unit tests for {@link ValidationUtils}. diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java index b98fb420072..6d831328c18 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import javax.validation.constraints.Size; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor; diff --git a/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java b/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java deleted file mode 100644 index a8a3a01e3a3..00000000000 --- a/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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 test.advice; - -import java.lang.reflect.Method; - -import org.springframework.aop.AfterReturningAdvice; - -/** - * Simple before advice example that we can use for counting checks. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class CountingAfterReturningAdvice extends MethodCounter implements AfterReturningAdvice { - - @Override - public void afterReturning(Object o, Method m, Object[] args, Object target) throws Throwable { - count(m); - } - -} \ No newline at end of file diff --git a/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java b/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java deleted file mode 100644 index 5aa37b61e14..00000000000 --- a/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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 test.advice; - -import java.lang.reflect.Method; - -import org.springframework.aop.MethodBeforeAdvice; - -/** - * Simple before advice example that we can use for counting checks. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice { - - @Override - public void before(Method m, Object[] args, Object target) throws Throwable { - count(m); - } - -} diff --git a/spring-context/src/test/java/test/advice/MethodCounter.java b/spring-context/src/test/java/test/advice/MethodCounter.java deleted file mode 100644 index e0e45d6f142..00000000000 --- a/spring-context/src/test/java/test/advice/MethodCounter.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2012 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 test.advice; - -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.HashMap; - -/** - * Abstract superclass for counting advices etc. - * - * @author Rod Johnson - * @author Chris Beams - */ -@SuppressWarnings("serial") -public class MethodCounter implements Serializable { - - /** Method name --> count, does not understand overloading */ - private HashMap map = new HashMap(); - - private int allCount; - - protected void count(Method m) { - count(m.getName()); - } - - protected void count(String methodName) { - Integer i = map.get(methodName); - i = (i != null) ? new Integer(i.intValue() + 1) : new Integer(1); - map.put(methodName, i); - ++allCount; - } - - public int getCalls(String methodName) { - Integer i = map.get(methodName); - return (i != null ? i.intValue() : 0); - } - - public int getCalls() { - return allCount; - } - - /** - * A bit simplistic: just wants the same class. - * Doesn't worry about counts. - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object other) { - return (other != null && other.getClass() == this.getClass()); - } - - public int hashCode() { - return getClass().hashCode(); - } - -} diff --git a/spring-context/src/test/java/test/beans/Colour.java b/spring-context/src/test/java/test/beans/Colour.java deleted file mode 100644 index 193531bcbd0..00000000000 --- a/spring-context/src/test/java/test/beans/Colour.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - * 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 test.beans; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings({ "serial", "deprecation" }) -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - - public static final Colour BLUE = new Colour(1, "BLUE"); - - public static final Colour GREEN = new Colour(2, "GREEN"); - - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } -} diff --git a/spring-context/src/test/java/test/beans/CustomScope.java b/spring-context/src/test/java/test/beans/CustomScope.java deleted file mode 100644 index 32de2322644..00000000000 --- a/spring-context/src/test/java/test/beans/CustomScope.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.factory.ObjectFactory; -import org.springframework.beans.factory.config.Scope; - -/** - * Simple scope implementation which creates object based on a flag. - * - * @author Costin Leau - * @author Chris Beams - */ -public class CustomScope implements Scope { - - public boolean createNewScope = true; - - private Map beans = new HashMap(); - - @Override - public Object get(String name, ObjectFactory objectFactory) { - if (createNewScope) { - beans.clear(); - // reset the flag back - createNewScope = false; - } - - Object bean = beans.get(name); - // if a new object is requested or none exists under the current - // name, create one - if (bean == null) { - beans.put(name, objectFactory.getObject()); - } - - return beans.get(name); - } - - @Override - public String getConversationId() { - return null; - } - - @Override - public void registerDestructionCallback(String name, Runnable callback) { - // do nothing - } - - @Override - public Object remove(String name) { - return beans.remove(name); - } - - @Override - public Object resolveContextualObject(String key) { - return null; - } - -} diff --git a/spring-context/src/test/java/test/beans/DependsOnTestBean.java b/spring-context/src/test/java/test/beans/DependsOnTestBean.java deleted file mode 100644 index d784bae712d..00000000000 --- a/spring-context/src/test/java/test/beans/DependsOnTestBean.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - * 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 test.beans; - -public class DependsOnTestBean { - - public TestBean tb; - - private int state; - - public void setTestBean(TestBean tb) { - this.tb = tb; - } - - public int getState() { - return state; - } - - public TestBean getTestBean() { - return tb; - } - -} diff --git a/spring-context/src/test/java/test/beans/INestedTestBean.java b/spring-context/src/test/java/test/beans/INestedTestBean.java deleted file mode 100644 index 4cdf0cfc5cc..00000000000 --- a/spring-context/src/test/java/test/beans/INestedTestBean.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - * 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 test.beans; - -public interface INestedTestBean { - - String getCompany(); - -} diff --git a/spring-context/src/test/java/test/beans/IOther.java b/spring-context/src/test/java/test/beans/IOther.java deleted file mode 100644 index cfd81f2bad3..00000000000 --- a/spring-context/src/test/java/test/beans/IOther.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - * 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 test.beans; - -public interface IOther { - - void absquatulate(); - -} diff --git a/spring-context/src/test/java/test/beans/ITestBean.java b/spring-context/src/test/java/test/beans/ITestBean.java deleted file mode 100644 index 242d5e38503..00000000000 --- a/spring-context/src/test/java/test/beans/ITestBean.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.IOException; - - -/** - * Interface used for test beans. Two methods are the same as on Person, but if this extends - * person it breaks quite a few tests - * - * @author Rod Johnson - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - /** - * t null no error. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; -} diff --git a/spring-context/src/test/java/test/beans/IndexedTestBean.java b/spring-context/src/test/java/test/beans/IndexedTestBean.java deleted file mode 100644 index 8cef5b23217..00000000000 --- a/spring-context/src/test/java/test/beans/IndexedTestBean.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - * 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 test.beans; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] { tb0, tb1 }; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} diff --git a/spring-context/src/test/java/test/beans/NestedTestBean.java b/spring-context/src/test/java/test/beans/NestedTestBean.java deleted file mode 100644 index 0546fdadebb..00000000000 --- a/spring-context/src/test/java/test/beans/NestedTestBean.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = ((company != null) ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - @Override - public int hashCode() { - return this.company.hashCode(); - } - - @Override - public String toString() { - return "NestedTestBean: " + this.company; - } - -} diff --git a/spring-context/src/test/java/test/beans/SideEffectBean.java b/spring-context/src/test/java/test/beans/SideEffectBean.java deleted file mode 100644 index 52b78737175..00000000000 --- a/spring-context/src/test/java/test/beans/SideEffectBean.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -/** - * Bean that changes state on a business invocation, so that - * we can check whether it's been invoked - * - * @author Rod Johnson - */ -public class SideEffectBean { - - private int count; - - public void setCount(int count) { - this.count = count; - } - - public int getCount() { - return this.count; - } - - public void doWork() { - ++count; - } - -} \ No newline at end of file diff --git a/spring-context/src/test/java/test/beans/TestBean.java b/spring-context/src/test/java/test/beans/TestBean.java deleted file mode 100644 index 4b98eab870e..00000000000 --- a/spring-context/src/test/java/test/beans/TestBean.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; - -import org.springframework.util.ObjectUtils; - -import java.io.IOException; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - - -/** - * Simple test bean used for testing bean factories, AOP framework etc. - * - * @author Rod Johnson - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean spouse; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouse = spouse; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouse = spouse; - this.someProperties = someProperties; - } - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return spouse; - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouse = spouse; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public String[] getStringArray() { - return stringArray; - } - - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setDoctor(INestedTestBean bean) { - doctor = bean; - } - - public void setLawyer(INestedTestBean bean) { - lawyer = bean; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - /** - * @see ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - - /** - * @see ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - - if ((other == null) || !(other instanceof TestBean)) { - return false; - } - - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && (this.age == tb2.age)); - } - - @Override - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if ((this.name != null) && (other instanceof TestBean)) { - return this.name.compareTo(((TestBean) other).getName()); - } - - return 1; - } - - @Override - public String toString() { - String s = "name=" + name + "; age=" + age + "; touchy=" + touchy; - s += "; spouse={" + ((spouse != null) ? spouse.getName() : null) + "}"; - return s; - } - -} diff --git a/spring-context/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerWithExpressionLanguageTests.xml b/spring-context/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerWithExpressionLanguageTests.xml index 1067cbc26cb..3982b48c7cf 100644 --- a/spring-context/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerWithExpressionLanguageTests.xml +++ b/spring-context/src/test/resources/org/springframework/beans/factory/xml/simplePropertyNamespaceHandlerWithExpressionLanguageTests.xml @@ -4,8 +4,8 @@ xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + diff --git a/spring-context/src/test/resources/org/springframework/context/support/simpleThreadScopeTests.xml b/spring-context/src/test/resources/org/springframework/context/support/simpleThreadScopeTests.xml index 2b71bd30014..efb31d0297b 100644 --- a/spring-context/src/test/resources/org/springframework/context/support/simpleThreadScopeTests.xml +++ b/spring-context/src/test/resources/org/springframework/context/support/simpleThreadScopeTests.xml @@ -14,34 +14,34 @@ - + - override - override @@ -42,7 +42,7 @@ - + myname diff --git a/spring-orm/src/test/resources/org/springframework/beans/factory/xml/test.xml b/spring-orm/src/test/resources/org/springframework/beans/factory/xml/test.xml index e67e3101362..933e66b7d00 100644 --- a/spring-orm/src/test/resources/org/springframework/beans/factory/xml/test.xml +++ b/spring-orm/src/test/resources/org/springframework/beans/factory/xml/test.xml @@ -3,7 +3,7 @@ - + I have no properties and I'm happy without them. @@ -12,7 +12,7 @@ - + aliased @@ -20,17 +20,17 @@ - + aliased - + aliased - + @@ -40,7 +40,7 @@ - + Rod 31 @@ -52,29 +52,29 @@ - + Kerry 34 - + Kathy 28 - + typeMismatch 34x - + - true @@ -85,10 +85,10 @@ - + - + false @@ -113,14 +113,14 @@ - + listenerVeto 66 - + - + this is a ]]> diff --git a/spring-test/src/test/java/org/springframework/beans/Colour.java b/spring-test/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index 194e0037973..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings({ "serial", "deprecation" }) -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - - private Colour(int code, String label) { - super(code, label); - } - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/beans/Employee.java b/spring-test/src/test/java/org/springframework/beans/Employee.java deleted file mode 100644 index 9289e451370..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/Employee.java +++ /dev/null @@ -1,39 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public class Employee extends TestBean { - - private String co; - - /** - * Constructor for Employee. - */ - public Employee() { - super(); - } - - public String getCompany() { - return co; - } - - public void setCompany(String co) { - this.co = co; - } - -} diff --git a/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/beans/IOther.java b/spring-test/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/beans/ITestBean.java b/spring-test/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index cdf5ef510dd..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index cd1724f2645..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,146 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -@SuppressWarnings("rawtypes") -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - @SuppressWarnings("unchecked") - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] { tb0, tb1 }; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/beans/TestBean.java b/spring-test/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index 3ce93f7c439..00000000000 --- a/spring-test/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -@SuppressWarnings("rawtypes") -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] { spouse }; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] { spouse }; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] { spouse }; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - /** - * @see ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - - /** - * @see ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java index 06c94aa4417..ba8c81c2945 100644 --- a/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; diff --git a/spring-test/src/test/java/org/springframework/test/PropertiesBasedSpr3350SingleSpringContextTests-context.properties b/spring-test/src/test/java/org/springframework/test/PropertiesBasedSpr3350SingleSpringContextTests-context.properties index 307a4e93df2..7b96503a3fe 100644 --- a/spring-test/src/test/java/org/springframework/test/PropertiesBasedSpr3350SingleSpringContextTests-context.properties +++ b/spring-test/src/test/java/org/springframework/test/PropertiesBasedSpr3350SingleSpringContextTests-context.properties @@ -1,2 +1,2 @@ -cat.(class)=org.springframework.beans.Pet +cat.(class)=org.springframework.tests.sample.beans.Pet cat.$0=Garfield diff --git a/spring-test/src/test/java/org/springframework/test/XmlBasedSpr3350SingleSpringContextTests-context.xml b/spring-test/src/test/java/org/springframework/test/XmlBasedSpr3350SingleSpringContextTests-context.xml index 72360454848..b1939de12fd 100644 --- a/spring-test/src/test/java/org/springframework/test/XmlBasedSpr3350SingleSpringContextTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/XmlBasedSpr3350SingleSpringContextTests-context.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests-context.properties b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests-context.properties index 1efbb6201e0..45d36076bba 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests-context.properties +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests-context.properties @@ -1,4 +1,4 @@ -dog.(class)=org.springframework.beans.Pet +dog.(class)=org.springframework.tests.sample.beans.Pet dog.$0=Fido testString2.(class)=java.lang.String diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java index eb6f44f176a..3a976747ea7 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextLoader; diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests-context.properties b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests-context.properties index 1efbb6201e0..45d36076bba 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests-context.properties +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests-context.properties @@ -1,4 +1,4 @@ -dog.(class)=org.springframework.beans.Pet +dog.(class)=org.springframework.tests.sample.beans.Pet dog.$0=Fido testString2.(class)=java.lang.String diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java index 81f51d459a9..77f079aec24 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextLoader; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests-context.xml index acdab7073c1..9f2fdef412d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests-context.xml @@ -3,13 +3,13 @@ xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - + - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java index 147679ed5f1..735f96a01f6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,8 +23,8 @@ import javax.sql.DataSource; import org.junit.internal.runners.JUnit38ClassRunner; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests-context.xml index a219470ce63..a91178410a2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests-context.xml @@ -8,13 +8,13 @@ - + - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java index bab1df5ff8d..c88aed37d12 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,8 +29,8 @@ import javax.sql.DataSource; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java index 0c068820875..3ee77974a0e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.model.InitializationError; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.support.GenericPropertiesContextLoader; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context1.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context1.xml index 2f6eda6962f..b40fed69ca8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context1.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context1.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context2.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context2.xml index cb75b8accd4..f6a90a62eac 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context2.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests-context2.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests-context.xml index 62206fde4a8..67590a6b584 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests-context.xml @@ -2,19 +2,19 @@ - + - + - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java index ed2f58de118..bf07919721b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ParameterizedDependencyInjectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2013 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. @@ -31,8 +31,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests-context.properties b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests-context.properties index 0e62ef734fc..6df81585fb4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests-context.properties +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests-context.properties @@ -1,4 +1,4 @@ -cat.(class)=org.springframework.beans.Pet +cat.(class)=org.springframework.tests.sample.beans.Pet cat.$0=Garfield testString.(class)=java.lang.String diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java index d41dbb50269..b5d74839f68 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import java.util.Properties; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml index dffdb30f99b..704b3478733 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml @@ -2,13 +2,13 @@ - + - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java index 399f6a61030..4973d7c68de 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,8 +29,8 @@ import javax.inject.Named; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.BeansException; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java index 46dfd6725a6..a0c51ded527 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java index 469e35f8d9d..e8a440a230a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java index e426d1e7f3b..05c74a29eb7 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java index 9f29d9a54aa..7af6a541b45 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java index 278804817e4..00da19f130c 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java index 3cf8f064d0c..9b4793e462f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java index b54613b4910..6613a695b4a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java index c060ea4b555..a0f7668ae2f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java index a3d2ecee168..7da5e68bd01 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java index 54596ae6d29..cca20f48278 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java index 0208925227c..19eefe388ae 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,8 +16,8 @@ package org.springframework.test.context.junit4.annotation; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileAnnotationConfigTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileAnnotationConfigTests.java index cc26b849dbb..836dca41df5 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileAnnotationConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileAnnotationConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 the original author or authors. + * Copyright 2002-2013 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. @@ -22,8 +22,8 @@ import static org.junit.Assert.assertNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileConfig.java b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileConfig.java index 98cc3af1495..44b5675a89a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileConfig.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DefaultProfileConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.profile.annotation; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DevProfileConfig.java b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DevProfileConfig.java index 9fb695889ae..cafc8b6e475 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DevProfileConfig.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/annotation/DevProfileConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.profile.annotation; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileAnnotationConfigTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileAnnotationConfigTests.java index f6f2907f875..07a8d2d5ffc 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileAnnotationConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileAnnotationConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,8 +22,8 @@ import static org.junit.Assert.assertNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileConfig.java b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileConfig.java index a4af38435a4..818212dd3e1 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileConfig.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/DefaultProfileConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.profile.importresource; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/import.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/import.xml index 8427a674a3d..3861d0ec592 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/import.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/importresource/import.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests-context.xml index 1fc6d4ecfc9..0e672de0843 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests-context.xml @@ -2,12 +2,12 @@ - + - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests.java index f79a9b0aa5d..1ed4f5467a4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/profile/xml/DefaultProfileXmlConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 the original author or authors. + * Copyright 2002-2013 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. @@ -22,8 +22,8 @@ import static org.junit.Assert.assertNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests-context.xml index 55a4cff1e8a..7238260bd43 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/BeanOverridingDefaultLocationsInheritedTests-context.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests-context.xml index 2f6eda6962f..b40fed69ca8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests-context.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests.java index fb373a03479..7131201d438 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsBaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests-context.xml index cb75b8accd4..f6a90a62eac 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests-context.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests.java index 9896e35880b..1f488ec26c6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/DefaultLocationsInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsBaseTests.java index 1c9fbe91255..cd81b6becb8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsBaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsInheritedTests.java index 5c99fefa39f..b01764251c8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr3896/ExplicitLocationsInheritedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java index d8b7fcacf3f..54b55c8c440 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java index 373166d9b41..6e0f84f7339 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import static org.junit.Assert.assertSame; import javax.sql.DataSource; import org.junit.Before; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.DataSourceTransactionManager; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java index 3f6a054ecb0..622f0dfe682 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import static org.junit.Assert.assertNotSame; import javax.sql.DataSource; import org.junit.Before; -import org.springframework.beans.Employee; +import org.springframework.tests.sample.beans.Employee; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9604/LookUpTxMgrViaTransactionManagementConfigurerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9604/LookUpTxMgrViaTransactionManagementConfigurerTests.java index cd20e40f3f5..5dbba76acbd 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9604/LookUpTxMgrViaTransactionManagementConfigurerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9604/LookUpTxMgrViaTransactionManagementConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9604; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +26,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.TransactionManagementConfigurer; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpNonexistentTxMgrTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpNonexistentTxMgrTests.java index 72af7e7a7bc..78720a8f5ec 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpNonexistentTxMgrTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpNonexistentTxMgrTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9645; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; /** diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndDefaultNameTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndDefaultNameTests.java index 6f1525229fd..331342d4fcc 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndDefaultNameTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndDefaultNameTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9645; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +26,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndNameTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndNameTests.java index d8c070c5043..76a82b823c2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndNameTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndNameTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9645; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,7 +27,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; import org.springframework.test.context.transaction.TransactionConfiguration; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtClassLevelTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtClassLevelTests.java index bbc0951e4fc..8492b02d5a6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtClassLevelTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtClassLevelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9645; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +26,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtMethodLevelTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtMethodLevelTests.java index b9d6b4b6aef..363d47a9b27 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtMethodLevelTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeAndQualifierAtMethodLevelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9645; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +26,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeTests.java index b7a52aa961b..957533f9130 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9645/LookUpTxMgrByTypeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.test.context.junit4.spr9645; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +26,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.test.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java index 4cfb6b8abc4..f20e466410f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,8 +23,8 @@ import static org.testng.Assert.assertNotNull; import javax.sql.DataSource; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests-context.xml b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests-context.xml index 11e92153da0..a46a6da3d1f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests-context.xml +++ b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests-context.xml @@ -5,10 +5,10 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> - - + diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java index 0ad8862c2ed..ee25cb32e45 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import static org.testng.Assert.assertTrue; import javax.annotation.Resource; -import org.springframework.beans.Employee; -import org.springframework.beans.Pet; +import org.springframework.tests.sample.beans.Employee; +import org.springframework.tests.sample.beans.Pet; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-test/src/test/java/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests.java b/spring-test/src/test/java/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests.java index c07b25a9273..829d70ffec5 100644 --- a/spring-test/src/test/java/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import static org.junit.Assert.*; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpSession; diff --git a/spring-test/src/test/resources/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests-context.xml b/spring-test/src/test/resources/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests-context.xml index 0930460eeaa..7f2a6c5b232 100644 --- a/spring-test/src/test/resources/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests-context.xml +++ b/spring-test/src/test/resources/org/springframework/test/context/web/RequestAndSessionScopedBeansWacTests-context.xml @@ -2,10 +2,10 @@ - + - + diff --git a/spring-tx/src/test/java/org/springframework/beans/Colour.java b/spring-tx/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index a992a2ebfc6..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java deleted file mode 100644 index c5360de5316..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - @Override - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - @Override - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - @Override - public void destroy() { - this.destroyed = true; - } - - @Override - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-tx/src/test/java/org/springframework/beans/IOther.java b/spring-tx/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-tx/src/test/java/org/springframework/beans/ITestBean.java b/spring-tx/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index cdf5ef510dd..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index ddb091770ee..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-tx/src/test/java/org/springframework/beans/TestBean.java b/spring-tx/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index 6d71de75764..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see org.springframework.beans.ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see org.springframework.beans.ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see org.springframework.beans.IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java deleted file mode 100644 index c7066b5cc7f..00000000000 --- a/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2002-2012 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.parsing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.springframework.core.CollectionFactory; - -/** - * @author Rob Harrop - * @author Juergen Hoeller - */ -public class CollectingReaderEventListener implements ReaderEventListener { - - private final List defaults = new LinkedList(); - - private final Map componentDefinitions = new LinkedHashMap<>(8); - - private final Map aliasMap = new LinkedHashMap<>(8); - - private final List imports = new LinkedList(); - - - @Override - public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { - this.defaults.add(defaultsDefinition); - } - - public List getDefaults() { - return Collections.unmodifiableList(this.defaults); - } - - @Override - public void componentRegistered(ComponentDefinition componentDefinition) { - this.componentDefinitions.put(componentDefinition.getName(), componentDefinition); - } - - public ComponentDefinition getComponentDefinition(String name) { - return (ComponentDefinition) this.componentDefinitions.get(name); - } - - public ComponentDefinition[] getComponentDefinitions() { - Collection collection = this.componentDefinitions.values(); - return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]); - } - - @Override - public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); - if(aliases == null) { - aliases = new ArrayList(); - this.aliasMap.put(aliasDefinition.getBeanName(), aliases); - } - aliases.add(aliasDefinition); - } - - public List getAliases(String beanName) { - List aliases = (List) this.aliasMap.get(beanName); - return aliases == null ? null : Collections.unmodifiableList(aliases); - } - - @Override - public void importProcessed(ImportDefinition importDefinition) { - this.imports.add(importDefinition); - } - - public List getImports() { - return Collections.unmodifiableList(this.imports); - } - -} diff --git a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java deleted file mode 100644 index 4e1641b2cd8..00000000000 --- a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.jndi; - -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameNotFoundException; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.OperationNotSupportedException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.util.StringUtils; - -/** - * Simple implementation of a JNDI naming context. - * Only supports binding plain Objects to String names. - * Mainly for test environments, but also usable for standalone applications. - * - *

This class is not intended for direct usage by applications, although it - * can be used for example to override JndiTemplate's {@code createInitialContext} - * method in unit tests. Typically, SimpleNamingContextBuilder will be used to - * set up a JVM-level JNDI environment. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @see SimpleNamingContextBuilder - * @see org.springframework.jndi.JndiTemplate#createInitialContext - */ -public class SimpleNamingContext implements Context { - - private final Log logger = LogFactory.getLog(getClass()); - - private final String root; - - private final Hashtable boundObjects; - - private final Hashtable environment = new Hashtable(); - - - /** - * Create a new naming context. - */ - public SimpleNamingContext() { - this(""); - } - - /** - * Create a new naming context with the given naming root. - */ - public SimpleNamingContext(String root) { - this.root = root; - this.boundObjects = new Hashtable(); - } - - /** - * Create a new naming context with the given naming root, - * the given name/object map, and the JNDI environment entries. - */ - public SimpleNamingContext(String root, Hashtable boundObjects, Hashtable env) { - this.root = root; - this.boundObjects = boundObjects; - if (env != null) { - this.environment.putAll(env); - } - } - - - // Actual implementations of Context methods follow - - @Override - public NamingEnumeration list(String root) throws NamingException { - if (logger.isDebugEnabled()) { - logger.debug("Listing name/class pairs under [" + root + "]"); - } - return new NameClassPairEnumeration(this, root); - } - - @Override - public NamingEnumeration listBindings(String root) throws NamingException { - if (logger.isDebugEnabled()) { - logger.debug("Listing bindings under [" + root + "]"); - } - return new BindingEnumeration(this, root); - } - - /** - * Look up the object with the given name. - *

Note: Not intended for direct use by applications. - * Will be used by any standard InitialContext JNDI lookups. - * @throws javax.naming.NameNotFoundException if the object could not be found - */ - @Override - public Object lookup(String lookupName) throws NameNotFoundException { - String name = this.root + lookupName; - if (logger.isDebugEnabled()) { - logger.debug("Static JNDI lookup: [" + name + "]"); - } - if ("".equals(name)) { - return new SimpleNamingContext(this.root, this.boundObjects, this.environment); - } - Object found = this.boundObjects.get(name); - if (found == null) { - if (!name.endsWith("/")) { - name = name + "/"; - } - for (String boundName : this.boundObjects.keySet()) { - if (boundName.startsWith(name)) { - return new SimpleNamingContext(name, this.boundObjects, this.environment); - } - } - throw new NameNotFoundException( - "Name [" + this.root + lookupName + "] not bound; " + this.boundObjects.size() + " bindings: [" + - StringUtils.collectionToDelimitedString(this.boundObjects.keySet(), ",") + "]"); - } - return found; - } - - @Override - public Object lookupLink(String name) throws NameNotFoundException { - return lookup(name); - } - - /** - * Bind the given object to the given name. - * Note: Not intended for direct use by applications - * if setting up a JVM-level JNDI environment. - * Use SimpleNamingContextBuilder to set up JNDI bindings then. - * @see org.springframework.mock.jndi.SimpleNamingContextBuilder#bind - */ - @Override - public void bind(String name, Object obj) { - if (logger.isInfoEnabled()) { - logger.info("Static JNDI binding: [" + this.root + name + "] = [" + obj + "]"); - } - this.boundObjects.put(this.root + name, obj); - } - - @Override - public void unbind(String name) { - if (logger.isInfoEnabled()) { - logger.info("Static JNDI remove: [" + this.root + name + "]"); - } - this.boundObjects.remove(this.root + name); - } - - @Override - public void rebind(String name, Object obj) { - bind(name, obj); - } - - @Override - public void rename(String oldName, String newName) throws NameNotFoundException { - Object obj = lookup(oldName); - unbind(oldName); - bind(newName, obj); - } - - @Override - public Context createSubcontext(String name) { - String subcontextName = this.root + name; - if (!subcontextName.endsWith("/")) { - subcontextName += "/"; - } - Context subcontext = new SimpleNamingContext(subcontextName, this.boundObjects, this.environment); - bind(name, subcontext); - return subcontext; - } - - @Override - public void destroySubcontext(String name) { - unbind(name); - } - - @Override - public String composeName(String name, String prefix) { - return prefix + name; - } - - @Override - public Hashtable getEnvironment() { - return this.environment; - } - - @Override - public Object addToEnvironment(String propName, Object propVal) { - return this.environment.put(propName, propVal); - } - - @Override - public Object removeFromEnvironment(String propName) { - return this.environment.remove(propName); - } - - @Override - public void close() { - } - - - // Unsupported methods follow: no support for javax.naming.Name - - @Override - public NamingEnumeration list(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public NamingEnumeration listBindings(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public Object lookup(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public Object lookupLink(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public void bind(Name name, Object obj) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public void unbind(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public void rebind(Name name, Object obj) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public void rename(Name oldName, Name newName) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public Context createSubcontext(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public void destroySubcontext(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public String getNameInNamespace() throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public NameParser getNameParser(Name name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public NameParser getNameParser(String name) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - @Override - public Name composeName(Name name, Name prefix) throws NamingException { - throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); - } - - - private static abstract class AbstractNamingEnumeration implements NamingEnumeration { - - private Iterator iterator; - - private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException { - if (!"".equals(proot) && !proot.endsWith("/")) { - proot = proot + "/"; - } - String root = context.root + proot; - Map contents = new HashMap(); - for (String boundName : context.boundObjects.keySet()) { - if (boundName.startsWith(root)) { - int startIndex = root.length(); - int endIndex = boundName.indexOf('/', startIndex); - String strippedName = - (endIndex != -1 ? boundName.substring(startIndex, endIndex) : boundName.substring(startIndex)); - if (!contents.containsKey(strippedName)) { - try { - contents.put(strippedName, createObject(strippedName, context.lookup(proot + strippedName))); - } - catch (NameNotFoundException ex) { - // cannot happen - } - } - } - } - if (contents.size() == 0) { - throw new NamingException("Invalid root: [" + context.root + proot + "]"); - } - this.iterator = contents.values().iterator(); - } - - protected abstract T createObject(String strippedName, Object obj); - - @Override - public boolean hasMore() { - return this.iterator.hasNext(); - } - - @Override - public T next() { - return this.iterator.next(); - } - - @Override - public boolean hasMoreElements() { - return this.iterator.hasNext(); - } - - @Override - public T nextElement() { - return this.iterator.next(); - } - - @Override - public void close() { - } - } - - - private static class NameClassPairEnumeration extends AbstractNamingEnumeration { - - private NameClassPairEnumeration(SimpleNamingContext context, String root) throws NamingException { - super(context, root); - } - - @Override - protected NameClassPair createObject(String strippedName, Object obj) { - return new NameClassPair(strippedName, obj.getClass().getName()); - } - } - - - private static class BindingEnumeration extends AbstractNamingEnumeration { - - private BindingEnumeration(SimpleNamingContext context, String root) throws NamingException { - super(context, root); - } - - @Override - protected Binding createObject(String strippedName, Object obj) { - return new Binding(strippedName, obj); - } - } - -} diff --git a/spring-test/src/test/java/org/springframework/test/transaction/CallCountingTransactionManager.java b/spring-tx/src/test/java/org/springframework/tests/transaction/CallCountingTransactionManager.java similarity index 97% rename from spring-test/src/test/java/org/springframework/test/transaction/CallCountingTransactionManager.java rename to spring-tx/src/test/java/org/springframework/tests/transaction/CallCountingTransactionManager.java index 13f3b5d360d..d3852d4e34a 100644 --- a/spring-test/src/test/java/org/springframework/test/transaction/CallCountingTransactionManager.java +++ b/spring-tx/src/test/java/org/springframework/tests/transaction/CallCountingTransactionManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.test.transaction; +package org.springframework.tests.transaction; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.support.AbstractPlatformTransactionManager; @@ -33,7 +33,6 @@ public class CallCountingTransactionManager extends AbstractPlatformTransactionM public int rollbacks; public int inflight; - @Override protected Object doGetTransaction() { return new Object(); diff --git a/spring-tx/src/test/java/org/springframework/transaction/MockJtaTransaction.java b/spring-tx/src/test/java/org/springframework/tests/transaction/MockJtaTransaction.java similarity index 96% rename from spring-tx/src/test/java/org/springframework/transaction/MockJtaTransaction.java rename to spring-tx/src/test/java/org/springframework/tests/transaction/MockJtaTransaction.java index e2066af4d92..eb68f255173 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/MockJtaTransaction.java +++ b/spring-tx/src/test/java/org/springframework/tests/transaction/MockJtaTransaction.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.transaction; +package org.springframework.tests.transaction; import javax.transaction.Status; import javax.transaction.Synchronization; diff --git a/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java deleted file mode 100644 index b1862dd8937..00000000000 --- a/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2012 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.transaction; - -import org.springframework.transaction.support.AbstractPlatformTransactionManager; -import org.springframework.transaction.support.DefaultTransactionStatus; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -@SuppressWarnings("serial") -public class CallCountingTransactionManager extends AbstractPlatformTransactionManager { - - public TransactionDefinition lastDefinition; - public int begun; - public int commits; - public int rollbacks; - public int inflight; - - @Override - protected Object doGetTransaction() { - return new Object(); - } - - @Override - protected void doBegin(Object transaction, TransactionDefinition definition) { - this.lastDefinition = definition; - ++begun; - ++inflight; - } - - @Override - protected void doCommit(DefaultTransactionStatus status) { - ++commits; - --inflight; - } - - @Override - protected void doRollback(DefaultTransactionStatus status) { - ++rollbacks; - --inflight; - } - - public void clear() { - begun = commits = rollbacks = inflight = 0; - } - -} diff --git a/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java b/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java index 11566aeee71..04e937b7ecc 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import javax.transaction.UserTransaction; import junit.framework.TestCase; import org.easymock.MockControl; -import org.springframework.mock.jndi.ExpectedLookupTemplate; +import org.springframework.tests.mock.jndi.ExpectedLookupTemplate; import org.springframework.transaction.jta.JtaTransactionManager; import org.springframework.transaction.jta.UserTransactionAdapter; import org.springframework.transaction.support.TransactionCallbackWithoutResult; diff --git a/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java b/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java index 8bb61812009..c13ea6bc417 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,6 +30,7 @@ import junit.framework.TestCase; import org.easymock.MockControl; import org.springframework.dao.OptimisticLockingFailureException; +import org.springframework.tests.transaction.MockJtaTransaction; import org.springframework.transaction.jta.JtaTransactionManager; import org.springframework.transaction.support.DefaultTransactionDefinition; import org.springframework.transaction.support.TransactionCallbackWithoutResult; diff --git a/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerEventTests.java b/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerEventTests.java index 38c7e20d224..3f4286e51b9 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerEventTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,11 +19,11 @@ package org.springframework.transaction; import junit.framework.TestCase; import org.springframework.beans.factory.parsing.BeanComponentDefinition; -import org.springframework.beans.factory.parsing.CollectingReaderEventListener; import org.springframework.beans.factory.parsing.ComponentDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; +import org.springframework.tests.beans.CollectingReaderEventListener; /** * @author Torsten Juergeleit diff --git a/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java b/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java index 7808f43b991..813a905e079 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,8 @@ import java.lang.reflect.Method; import junit.framework.TestCase; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.transaction.interceptor.TransactionAttribute; diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java index 7caafe92c21..ad05997a079 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,7 +30,7 @@ import org.junit.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.interceptor.NoRollbackRuleAttribute; import org.springframework.transaction.interceptor.RollbackRuleAttribute; import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute; diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java index 21c5f5374fb..556cb599659 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.transaction.annotation; import junit.framework.TestCase; import org.springframework.aop.framework.ProxyFactory; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.interceptor.TransactionInterceptor; import org.springframework.transaction.support.TransactionSynchronizationManager; diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java index 0f0deca8663..92f1ed65142 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -31,7 +31,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.jmx.export.annotation.ManagedOperation; import org.springframework.jmx.export.annotation.ManagedResource; import org.springframework.stereotype.Service; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; /** * @author Rob Harrop diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java index 417859b43ec..5c11e26d5dd 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,7 +29,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Service; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.AnnotationTransactionNamespaceHandlerTests.TransactionalTestBean; diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/annotationTransactionNamespaceHandlerTests.xml b/spring-tx/src/test/java/org/springframework/transaction/annotation/annotationTransactionNamespaceHandlerTests.xml index d30fd87be1a..bd659fd8934 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/annotationTransactionNamespaceHandlerTests.xml +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/annotationTransactionNamespaceHandlerTests.xml @@ -11,7 +11,7 @@ - + diff --git a/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java b/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java index d6a79128d0f..ee458c0cf84 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import org.springframework.aop.support.AopUtils; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.SerializationTestUtils; diff --git a/spring-tx/src/test/java/org/springframework/transaction/config/TransactionManagerConfiguration.java b/spring-tx/src/test/java/org/springframework/transaction/config/TransactionManagerConfiguration.java index 11a649ad50d..965a0db01e0 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/config/TransactionManagerConfiguration.java +++ b/spring-tx/src/test/java/org/springframework/transaction/config/TransactionManagerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.transaction.config; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; /** diff --git a/spring-tx/src/test/java/org/springframework/transaction/config/annotationDrivenProxyTargetClassTests.xml b/spring-tx/src/test/java/org/springframework/transaction/config/annotationDrivenProxyTargetClassTests.xml index ea4f7189c83..a707e84fd36 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/config/annotationDrivenProxyTargetClassTests.xml +++ b/spring-tx/src/test/java/org/springframework/transaction/config/annotationDrivenProxyTargetClassTests.xml @@ -12,11 +12,11 @@ - + - + diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java index 7a818f701be..2b01ef4a916 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,8 +21,8 @@ import java.lang.reflect.Method; import junit.framework.TestCase; import org.easymock.MockControl; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.transaction.CannotCreateTransactionException; import org.springframework.transaction.MockCallbackPreferringTransactionManager; diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java index a34a228a456..1ff4a262f4e 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,14 +28,14 @@ import org.easymock.MockControl; import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.StaticMethodMatcherPointcut; import org.springframework.aop.target.HotSwappableTargetSource; -import org.springframework.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.beans.FatalBeanException; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; -import org.springframework.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionException; diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java index 302026a7aaa..79885dd3ee3 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.transaction.interceptor; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * Test for CGLIB proxying that implements no interfaces diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/noTransactionAttributeSource.xml b/spring-tx/src/test/java/org/springframework/transaction/interceptor/noTransactionAttributeSource.xml index 09c860fffd5..e9ef193b449 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/noTransactionAttributeSource.xml +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/noTransactionAttributeSource.xml @@ -4,11 +4,11 @@ - + custom 666 - + - + custom 666 @@ -22,16 +22,16 @@ - org.springframework.beans.ITestBean.s*=PROPAGATION_MANDATORY - org.springframework.beans.ITestBean.setAg*=PROPAGATION_REQUIRED - org.springframework.beans.ITestBean.set*= PROPAGATION_SUPPORTS , readOnly + org.springframework.tests.sample.beans.ITestBean.s*=PROPAGATION_MANDATORY + org.springframework.tests.sample.beans.ITestBean.setAg*=PROPAGATION_REQUIRED + org.springframework.tests.sample.beans.ITestBean.set*= PROPAGATION_SUPPORTS , readOnly - org.springframework.beans.ITestBean + org.springframework.tests.sample.beans.ITestBean diff --git a/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java b/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java index 12c70ed91c2..5630bd82197 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import junit.framework.TestCase; import org.easymock.MockControl; import org.springframework.dao.OptimisticLockingFailureException; -import org.springframework.mock.jndi.ExpectedLookupTemplate; +import org.springframework.tests.mock.jndi.ExpectedLookupTemplate; import org.springframework.transaction.IllegalTransactionStateException; import org.springframework.transaction.NestedTransactionNotSupportedException; import org.springframework.transaction.TransactionDefinition; diff --git a/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java b/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java index 99f791a5328..ff819d3ede5 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import javax.transaction.UserTransaction; import junit.framework.TestCase; -import org.springframework.mock.jndi.SimpleNamingContextBuilder; +import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder; import org.springframework.transaction.jta.JtaTransactionManager; import org.springframework.util.SerializationTestUtils; diff --git a/spring-tx/src/test/java/org/springframework/transaction/txNamespaceHandlerTests.xml b/spring-tx/src/test/java/org/springframework/transaction/txNamespaceHandlerTests.xml index 0a4b7e9f1c5..a8adf10c6df 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/txNamespaceHandlerTests.xml +++ b/spring-tx/src/test/java/org/springframework/transaction/txNamespaceHandlerTests.xml @@ -26,8 +26,8 @@ - + - + diff --git a/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java deleted file mode 100644 index dbe6421093e..00000000000 --- a/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * The Spring Framework is published under the terms - * of the Apache Software License. - */ - -package org.springframework.util; - -import java.awt.Point; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; - -import junit.framework.TestCase; - -import org.springframework.beans.TestBean; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * Extends TestCase only to test itself. - * - * @author Rod Johnson - */ -public class SerializationTestUtils extends TestCase { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - - return o2; - } - - public SerializationTestUtils(String s) { - super(s); - } - - public void testWithNonSerializableObject() throws IOException { - TestBean o = new TestBean(); - assertFalse(o instanceof Serializable); - - assertFalse(isSerializable(o)); - - try { - testSerialization(o); - fail(); - } - catch (NotSerializableException ex) { - // Ok - } - } - - public void testWithSerializableObject() throws Exception { - int x = 5; - int y = 10; - Point p = new Point(x, y); - assertTrue(p instanceof Serializable); - - testSerialization(p); - - assertTrue(isSerializable(p)); - - Point p2 = (Point) serializeAndDeserialize(p); - assertNotSame(p, p2); - assertEquals(x, (int) p2.getX()); - assertEquals(y, (int) p2.getY()); - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java b/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java deleted file mode 100644 index bb5e71f5cd0..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2002-2005 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; - -/** - * @author Juergen Hoeller - * @since 17.08.2004 - */ -public class BeanWithObjectProperty { - - private Object object; - - public Object getObject() { - return object; - } - - public void setObject(Object object) { - this.object = object; - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/Colour.java b/spring-web/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index a992a2ebfc6..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java deleted file mode 100644 index c5360de5316..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - @Override - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - @Override - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - @Override - public void destroy() { - this.destroyed = true; - } - - @Override - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java b/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java deleted file mode 100644 index 61f911902c7..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java +++ /dev/null @@ -1,44 +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; - -/** - * @author Juergen Hoeller - * @since 07.03.2006 - */ -public class FieldAccessBean { - - public String name; - - protected int age; - - private TestBean spouse; - - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public TestBean getSpouse() { - return spouse; - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/IOther.java b/spring-web/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index ddb091770ee..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/Person.java b/spring-web/src/test/java/org/springframework/beans/Person.java deleted file mode 100644 index 7c66f4b451b..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/Person.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * - * @author Rod Johnson - */ -public interface Person { - - String getName(); - void setName(String name); - int getAge(); - void setAge(int i); - - /** - * Test for non-property method matching. - * If the parameter is a Throwable, it will be thrown rather than - * returned. - */ - Object echo(Object o) throws Throwable; -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java b/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java deleted file mode 100644 index dbe365f4937..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.util.ObjectUtils; - -/** - * Serializable implementation of the Person interface. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class SerializablePerson implements Person, Serializable { - - private String name; - private int age; - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public Object echo(Object o) throws Throwable { - if (o instanceof Throwable) { - throw (Throwable) o; - } - return o; - } - - public boolean equals(Object other) { - if (!(other instanceof SerializablePerson)) { - return false; - } - SerializablePerson p = (SerializablePerson) other; - return p.age == age && ObjectUtils.nullSafeEquals(name, p.name); - } - -} diff --git a/spring-web/src/test/java/org/springframework/beans/TestBean.java b/spring-web/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index 1fc36aba374..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Integer[][] nestedIntegerArray; - - private int[] someIntArray; - - private int[][] nestedIntArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - public void setConcreteSpouse(TestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean getConcreteSpouse() { - return (spouses != null ? (TestBean) spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - @Override - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - @Override - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - @Override - public Integer[][] getNestedIntegerArray() { - return nestedIntegerArray; - } - - @Override - public void setNestedIntegerArray(Integer[][] nestedIntegerArray) { - this.nestedIntegerArray = nestedIntegerArray; - } - - @Override - public int[] getSomeIntArray() { - return someIntArray; - } - - @Override - public void setSomeIntArray(int[] someIntArray) { - this.someIntArray = someIntArray; - } - - @Override - public int[][] getNestedIntArray() { - return nestedIntArray; - } - - @Override - public void setNestedIntArray(int[][] nestedIntArray) { - this.nestedIntArray = nestedIntArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - - @Override - public Object returnsThis() { - return this; - } - - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java deleted file mode 100644 index 6fc7e36aa90..00000000000 --- a/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; - -/** - * Simple factory to allow testing of FactoryBean support in AbstractBeanFactory. - * Depending on whether its singleton property is set, it will return a singleton - * or a prototype instance. - * - *

Implements InitializingBean interface, so we can check that - * factories get this lifecycle callback if they want. - * - * @author Rod Johnson - * @since 10.03.2003 - */ -public class DummyFactory - implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - - public static final String SINGLETON_NAME = "Factory singleton"; - - private static boolean prototypeCreated; - - /** - * Clear static state. - */ - public static void reset() { - prototypeCreated = false; - } - - - /** - * Default is for factories to return a singleton instance. - */ - private boolean singleton = true; - - private String beanName; - - private AutowireCapableBeanFactory beanFactory; - - private boolean postProcessed; - - private boolean initialized; - - private TestBean testBean; - - private TestBean otherTestBean; - - - public DummyFactory() { - this.testBean = new TestBean(); - this.testBean.setName(SINGLETON_NAME); - this.testBean.setAge(25); - } - - /** - * Return if the bean managed by this factory is a singleton. - * @see FactoryBean#isSingleton() - */ - @Override - public boolean isSingleton() { - return this.singleton; - } - - /** - * Set if the bean managed by this factory is a singleton. - */ - public void setSingleton(boolean singleton) { - this.singleton = singleton; - } - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = (AutowireCapableBeanFactory) beanFactory; - this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName); - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - public void setOtherTestBean(TestBean otherTestBean) { - this.otherTestBean = otherTestBean; - this.testBean.setSpouse(otherTestBean); - } - - public TestBean getOtherTestBean() { - return otherTestBean; - } - - @Override - public void afterPropertiesSet() { - if (initialized) { - throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean"); - } - this.initialized = true; - } - - /** - * Was this initialized by invocation of the - * afterPropertiesSet() method from the InitializingBean interface? - */ - public boolean wasInitialized() { - return initialized; - } - - public static boolean wasPrototypeCreated() { - return prototypeCreated; - } - - - /** - * Return the managed object, supporting both singleton - * and prototype mode. - * @see FactoryBean#getObject() - */ - @Override - public Object getObject() throws BeansException { - if (isSingleton()) { - return this.testBean; - } - else { - TestBean prototype = new TestBean("prototype created at " + System.currentTimeMillis(), 11); - if (this.beanFactory != null) { - this.beanFactory.applyBeanPostProcessorsBeforeInitialization(prototype, this.beanName); - } - prototypeCreated = true; - return prototype; - } - } - - @Override - public Class getObjectType() { - return TestBean.class; - } - - - @Override - public void destroy() { - if (this.testBean != null) { - this.testBean.setName(null); - } - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java b/spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java index 2af35321ff6..3a3d4a68851 100644 --- a/spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java +++ b/spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -43,6 +43,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; +import org.springframework.tests.web.FreePortScanner; import org.springframework.util.FileCopyUtils; public abstract class AbstractHttpRequestFactoryTestCase { diff --git a/spring-web/src/test/java/org/springframework/http/client/FreePortScanner.java b/spring-web/src/test/java/org/springframework/http/client/FreePortScanner.java deleted file mode 100644 index 83add2ceaff..00000000000 --- a/spring-web/src/test/java/org/springframework/http/client/FreePortScanner.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2002-2012 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.http.client; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.util.Random; - -import org.springframework.util.Assert; - -/** - * Utility class that finds free BSD ports for use in testing scenario's. - * - * @author Ben Hale - * @author Arjen Poutsma - */ -public abstract class FreePortScanner { - - private static final int MIN_SAFE_PORT = 1024; - - private static final int MAX_PORT = 65535; - - private static final Random random = new Random(); - - /** - * Returns the number of a free port in the default range. - */ - public static int getFreePort() { - return getFreePort(MIN_SAFE_PORT, MAX_PORT); - } - - /** - * Returns the number of a free port in the given range. - */ - public static int getFreePort(int minPort, int maxPort) { - Assert.isTrue(minPort > 0, "'minPort' must be larger than 0"); - Assert.isTrue(maxPort > minPort, "'maxPort' must be larger than minPort"); - int portRange = maxPort - minPort; - int candidatePort; - int searchCounter = 0; - do { - if (++searchCounter > portRange) { - throw new IllegalStateException( - String.format("There were no ports available in the range %d to %d", minPort, maxPort)); - } - candidatePort = getRandomPort(minPort, portRange); - } - while (!isPortAvailable(candidatePort)); - - return candidatePort; - } - - private static int getRandomPort(int minPort, int portRange) { - return minPort + random.nextInt(portRange); - } - - private static boolean isPortAvailable(int port) { - ServerSocket serverSocket; - try { - serverSocket = new ServerSocket(); - } - catch (IOException ex) { - throw new IllegalStateException("Unable to create ServerSocket.", ex); - } - - try { - InetSocketAddress sa = new InetSocketAddress(port); - serverSocket.bind(sa); - return true; - } - catch (IOException ex) { - return false; - } - finally { - try { - serverSocket.close(); - } - catch (IOException ex) { - // ignore - } - } - } - -} diff --git a/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java b/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java index 6617a787d52..d26b34565f1 100644 --- a/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,8 +20,8 @@ import com.caucho.burlap.client.BurlapProxyFactory; import com.caucho.hessian.client.HessianProxyFactory; import junit.framework.TestCase; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.remoting.RemoteAccessException; /** diff --git a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java index 71c463177a5..b436e306ecd 100644 --- a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -35,8 +35,8 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.TestCase; import org.aopalliance.intercept.MethodInvocation; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; diff --git a/spring-webmvc/src/test/java/org/springframework/http/client/FreePortScanner.java b/spring-web/src/test/java/org/springframework/tests/web/FreePortScanner.java similarity index 98% rename from spring-webmvc/src/test/java/org/springframework/http/client/FreePortScanner.java rename to spring-web/src/test/java/org/springframework/tests/web/FreePortScanner.java index 83add2ceaff..9f5a3d9c339 100644 --- a/spring-webmvc/src/test/java/org/springframework/http/client/FreePortScanner.java +++ b/spring-web/src/test/java/org/springframework/tests/web/FreePortScanner.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.http.client; +package org.springframework.tests.web; import java.io.IOException; import java.net.InetSocketAddress; diff --git a/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java deleted file mode 100644 index dbe6421093e..00000000000 --- a/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * The Spring Framework is published under the terms - * of the Apache Software License. - */ - -package org.springframework.util; - -import java.awt.Point; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; - -import junit.framework.TestCase; - -import org.springframework.beans.TestBean; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * Extends TestCase only to test itself. - * - * @author Rod Johnson - */ -public class SerializationTestUtils extends TestCase { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - - return o2; - } - - public SerializationTestUtils(String s) { - super(s); - } - - public void testWithNonSerializableObject() throws IOException { - TestBean o = new TestBean(); - assertFalse(o instanceof Serializable); - - assertFalse(isSerializable(o)); - - try { - testSerialization(o); - fail(); - } - catch (NotSerializableException ex) { - // Ok - } - } - - public void testWithSerializableObject() throws Exception { - int x = 5; - int y = 10; - Point p = new Point(x, y); - assertTrue(p instanceof Serializable); - - testSerialization(p); - - assertTrue(isSerializable(p)); - - Point p2 = (Point) serializeAndDeserialize(p); - assertNotSame(p, p2); - assertEquals(x, (int) p2.getX()); - assertEquals(y, (int) p2.getY()); - } - -} \ No newline at end of file diff --git a/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java b/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java index 9f6a1df756f..25d63e8b3a9 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.web.bind; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.BindException; import org.springframework.validation.Errors; import org.springframework.validation.FieldError; diff --git a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestDataBinderTests.java b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestDataBinderTests.java index cf514b44b86..34340bd3e16 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestDataBinderTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestDataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,10 +24,10 @@ import java.util.HashMap; import java.util.Map; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.PropertyValue; import org.springframework.beans.PropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; /** diff --git a/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java b/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java index 3f194e9bd0f..b3e347fd5fb 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,10 +24,10 @@ import java.util.Map; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.PropertyValue; import org.springframework.beans.PropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockMultipartFile; import org.springframework.mock.web.test.MockMultipartHttpServletRequest; @@ -63,7 +63,7 @@ public class WebRequestDataBinderTests { @Test public void testBindingWithNestedObjectCreationThroughAutoGrow() throws Exception { - TestBean tb = new TestBean(); + TestBean tb = new TestBeanWithConcreteSpouse(); WebRequestDataBinder binder = new WebRequestDataBinder(tb, "person"); binder.setIgnoreUnknownFields(false); @@ -305,21 +305,30 @@ public class WebRequestDataBinderTests { public static class EnumHolder { - private MyEnum myEnum; + private MyEnum myEnum; - public MyEnum getMyEnum() { - return myEnum; - } + public MyEnum getMyEnum() { + return myEnum; + } - public void setMyEnum(MyEnum myEnum) { - this.myEnum = myEnum; - } - } + public void setMyEnum(MyEnum myEnum) { + this.myEnum = myEnum; + } + } + public enum MyEnum { + FOO, BAR + } - public enum MyEnum { + static class TestBeanWithConcreteSpouse extends TestBean { + public void setConcreteSpouse(TestBean spouse) { + this.spouses = new ITestBean[] {spouse}; + } + + public TestBean getConcreteSpouse() { + return (spouses != null ? (TestBean) spouses[0] : null); + } + } - FOO, BAR - } } diff --git a/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java b/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java index a02fcae95b9..ea09d9a3ddf 100644 --- a/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -62,8 +62,8 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.http.client.FreePortScanner; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.tests.web.FreePortScanner; import org.springframework.util.FileCopyUtils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; diff --git a/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java b/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java index 5c18203da6b..a4b7d6018ac 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletRequest; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-web/src/test/java/org/springframework/web/context/request/RequestScopeTests.java b/spring-web/src/test/java/org/springframework/web/context/request/RequestScopeTests.java index 3b12ab2dbaf..6f88b6a9482 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/RequestScopeTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/RequestScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,8 +18,8 @@ package org.springframework.web.context.request; import junit.framework.TestCase; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCurrentlyInCreationException; import org.springframework.beans.factory.FactoryBean; diff --git a/spring-web/src/test/java/org/springframework/web/context/request/RequestScopedProxyTests.java b/spring-web/src/test/java/org/springframework/web/context/request/RequestScopedProxyTests.java index 250e50c75c0..4a5703f34a0 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/RequestScopedProxyTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/RequestScopedProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,10 +21,10 @@ import org.junit.Before; import org.junit.Test; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.DummyFactory; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; +import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java b/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java index c6b0c656fae..4e540a7d202 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,8 +21,8 @@ import java.io.Serializable; import junit.framework.TestCase; import org.springframework.beans.BeansException; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/spring-web/src/test/java/org/springframework/web/context/request/WebApplicationContextScopeTests.java b/spring-web/src/test/java/org/springframework/web/context/request/WebApplicationContextScopeTests.java index 53e2e0a4583..5c2ef5823c0 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/WebApplicationContextScopeTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/WebApplicationContextScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import javax.servlet.ServletContextEvent; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockServletContext; diff --git a/spring-web/src/test/java/org/springframework/web/context/support/SpringBeanAutowiringSupportTests.java b/spring-web/src/test/java/org/springframework/web/context/support/SpringBeanAutowiringSupportTests.java index 1d383013423..8412e2b667c 100644 --- a/spring-web/src/test/java/org/springframework/web/context/support/SpringBeanAutowiringSupportTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/support/SpringBeanAutowiringSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,9 +18,9 @@ package org.springframework.web.context.support; import org.junit.Test; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.test.MockServletContext; diff --git a/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java b/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java index a2c27162a25..053a53150ac 100644 --- a/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import javax.faces.el.VariableResolver; import junit.framework.TestCase; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.StaticWebApplicationContext; diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java index 986df7e9fa5..170e8e2c9b8 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import java.lang.reflect.Method; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.MethodParameter; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.validation.BindException; diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java index a9699262e48..1da19343914 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import java.util.HashSet; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.SessionAttributes; diff --git a/spring-web/src/test/resources/org/springframework/web/context/request/requestScopeTests.xml b/spring-web/src/test/resources/org/springframework/web/context/request/requestScopeTests.xml index f2d06c527f4..3ed39dfd7aa 100644 --- a/spring-web/src/test/resources/org/springframework/web/context/request/requestScopeTests.xml +++ b/spring-web/src/test/resources/org/springframework/web/context/request/requestScopeTests.xml @@ -4,35 +4,35 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> - + - + - + - + - + - + - + - + - + diff --git a/spring-web/src/test/resources/org/springframework/web/context/request/requestScopedProxyTests.xml b/spring-web/src/test/resources/org/springframework/web/context/request/requestScopedProxyTests.xml index ee1313d4dc1..92759852b5b 100644 --- a/spring-web/src/test/resources/org/springframework/web/context/request/requestScopedProxyTests.xml +++ b/spring-web/src/test/resources/org/springframework/web/context/request/requestScopedProxyTests.xml @@ -5,47 +5,47 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> - + - + - + - + - + - + - + - + - + - + diff --git a/spring-web/src/test/resources/org/springframework/web/context/request/sessionScopeTests.xml b/spring-web/src/test/resources/org/springframework/web/context/request/sessionScopeTests.xml index e4f05b9abe5..e92f639f8ca 100644 --- a/spring-web/src/test/resources/org/springframework/web/context/request/sessionScopeTests.xml +++ b/spring-web/src/test/resources/org/springframework/web/context/request/sessionScopeTests.xml @@ -3,8 +3,8 @@ - + - + diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index a992a2ebfc6..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java deleted file mode 100644 index c5360de5316..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - @Override - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - @Override - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - @Override - public void destroy() { - this.destroyed = true; - } - - @Override - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index cdf5ef510dd..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index ddb091770ee..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index 6d71de75764..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see org.springframework.beans.ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see org.springframework.beans.ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see org.springframework.beans.IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java deleted file mode 100644 index d6911ee72f5..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.beans.PropertyEditorSupport; -import java.util.StringTokenizer; - -import junit.framework.TestCase; - -import org.springframework.beans.BeansException; -import org.springframework.beans.PropertyBatchUpdateException; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; - -/** - * Subclasses must implement setUp() to initialize bean factory - * and any other variables they need. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractBeanFactoryTests extends TestCase { - - protected abstract BeanFactory getBeanFactory(); - - /** - * Roderick beans inherits from rod, overriding name only. - */ - public void testInheritance() { - assertTrue(getBeanFactory().containsBean("rod")); - assertTrue(getBeanFactory().containsBean("roderick")); - TestBean rod = (TestBean) getBeanFactory().getBean("rod"); - TestBean roderick = (TestBean) getBeanFactory().getBean("roderick"); - assertTrue("not == ", rod != roderick); - assertTrue("rod.name is Rod", rod.getName().equals("Rod")); - assertTrue("rod.age is 31", rod.getAge() == 31); - assertTrue("roderick.name is Roderick", roderick.getName().equals("Roderick")); - assertTrue("roderick.age was inherited", roderick.getAge() == rod.getAge()); - } - - public void testGetBeanWithNullArg() { - try { - getBeanFactory().getBean((String) null); - fail("Can't get null bean"); - } - catch (IllegalArgumentException ex) { - // OK - } - } - - /** - * Test that InitializingBean objects receive the afterPropertiesSet() callback - */ - public void testInitializingBeanCallback() { - MustBeInitialized mbi = (MustBeInitialized) getBeanFactory().getBean("mustBeInitialized"); - // The dummy business method will throw an exception if the - // afterPropertiesSet() callback wasn't invoked - mbi.businessMethod(); - } - - /** - * Test that InitializingBean/BeanFactoryAware/DisposableBean objects receive the - * afterPropertiesSet() callback before BeanFactoryAware callbacks - */ - public void testLifecycleCallbacks() { - LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle"); - assertEquals("lifecycle", lb.getBeanName()); - // The dummy business method will throw an exception if the - // necessary callbacks weren't invoked in the right order. - lb.businessMethod(); - assertTrue("Not destroyed", !lb.isDestroyed()); - } - - public void testFindsValidInstance() { - try { - Object o = getBeanFactory().getBean("rod"); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - TestBean rod = (TestBean) o; - assertTrue("rod.name is Rod", rod.getName().equals("Rod")); - assertTrue("rod.age is 31", rod.getAge() == 31); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testGetInstanceByMatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance with matching class"); - } - } - - public void testGetInstanceByNonmatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); - fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); - } - catch (BeanNotOfRequiredTypeException ex) { - // So far, so good - assertTrue("Exception has correct bean name", ex.getBeanName().equals("rod")); - assertTrue("Exception requiredType must be BeanFactory.class", ex.getRequiredType().equals(BeanFactory.class)); - assertTrue("Exception actualType as TestBean.class", TestBean.class.isAssignableFrom(ex.getActualType())); - assertTrue("Actual type is correct", ex.getActualType() == getBeanFactory().getBean("rod").getClass()); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testGetSharedInstanceByMatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance with matching class"); - } - } - - public void testGetSharedInstanceByMatchingClassNoCatch() { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - - public void testGetSharedInstanceByNonmatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); - fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); - } - catch (BeanNotOfRequiredTypeException ex) { - // So far, so good - assertTrue("Exception has correct bean name", ex.getBeanName().equals("rod")); - assertTrue("Exception requiredType must be BeanFactory.class", ex.getRequiredType().equals(BeanFactory.class)); - assertTrue("Exception actualType as TestBean.class", TestBean.class.isAssignableFrom(ex.getActualType())); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testSharedInstancesAreEqual() { - try { - Object o = getBeanFactory().getBean("rod"); - assertTrue("Rod bean1 is a TestBean", o instanceof TestBean); - Object o1 = getBeanFactory().getBean("rod"); - assertTrue("Rod bean2 is a TestBean", o1 instanceof TestBean); - assertTrue("Object equals applies", o == o1); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testPrototypeInstancesAreIndependent() { - TestBean tb1 = (TestBean) getBeanFactory().getBean("kathy"); - TestBean tb2 = (TestBean) getBeanFactory().getBean("kathy"); - assertTrue("ref equal DOES NOT apply", tb1 != tb2); - assertTrue("object equal true", tb1.equals(tb2)); - tb1.setAge(1); - tb2.setAge(2); - assertTrue("1 age independent = 1", tb1.getAge() == 1); - assertTrue("2 age independent = 2", tb2.getAge() == 2); - assertTrue("object equal now false", !tb1.equals(tb2)); - } - - public void testNotThere() { - assertFalse(getBeanFactory().containsBean("Mr Squiggle")); - try { - Object o = getBeanFactory().getBean("Mr Squiggle"); - fail("Can't find missing bean"); - } - catch (BeansException ex) { - //ex.printStackTrace(); - //fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testValidEmpty() { - try { - Object o = getBeanFactory().getBean("validEmpty"); - assertTrue("validEmpty bean is a TestBean", o instanceof TestBean); - TestBean ve = (TestBean) o; - assertTrue("Valid empty has defaults", ve.getName() == null && ve.getAge() == 0 && ve.getSpouse() == null); - } - catch (BeansException ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on valid empty"); - } - } - - public void xtestTypeMismatch() { - try { - Object o = getBeanFactory().getBean("typeMismatch"); - fail("Shouldn't succeed with type mismatch"); - } - catch (BeanCreationException wex) { - assertEquals("typeMismatch", wex.getBeanName()); - assertTrue(wex.getCause() instanceof PropertyBatchUpdateException); - PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause(); - // Further tests - assertTrue("Has one error ", ex.getExceptionCount() == 1); - assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null); - assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x")); - } - } - - public void testGrandparentDefinitionFoundInBeanFactory() throws Exception { - TestBean dad = (TestBean) getBeanFactory().getBean("father"); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testFactorySingleton() throws Exception { - assertTrue(getBeanFactory().isSingleton("&singletonFactory")); - assertTrue(getBeanFactory().isSingleton("singletonFactory")); - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); - assertTrue("Singleton from factory has correct name, not " + tb.getName(), tb.getName().equals(DummyFactory.SINGLETON_NAME)); - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - TestBean tb2 = (TestBean) getBeanFactory().getBean("singletonFactory"); - assertTrue("Singleton references ==", tb == tb2); - assertTrue("FactoryBean is BeanFactoryAware", factory.getBeanFactory() != null); - } - - public void testFactoryPrototype() throws Exception { - assertTrue(getBeanFactory().isSingleton("&prototypeFactory")); - assertFalse(getBeanFactory().isSingleton("prototypeFactory")); - TestBean tb = (TestBean) getBeanFactory().getBean("prototypeFactory"); - assertTrue(!tb.getName().equals(DummyFactory.SINGLETON_NAME)); - TestBean tb2 = (TestBean) getBeanFactory().getBean("prototypeFactory"); - assertTrue("Prototype references !=", tb != tb2); - } - - /** - * Check that we can get the factory bean itself. - * This is only possible if we're dealing with a factory - * @throws Exception - */ - public void testGetFactoryItself() throws Exception { - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - assertTrue(factory != null); - } - - /** - * Check that afterPropertiesSet gets called on factory - * @throws Exception - */ - public void testFactoryIsInitialized() throws Exception { - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); - } - - /** - * It should be illegal to dereference a normal bean - * as a factory - */ - public void testRejectsFactoryGetOnNormalBean() { - try { - getBeanFactory().getBean("&rod"); - fail("Shouldn't permit factory get on normal bean"); - } - catch (BeanIsNotAFactoryException ex) { - // Ok - } - } - - // TODO: refactor in AbstractBeanFactory (tests for AbstractBeanFactory) - // and rename this class - public void testAliasing() { - BeanFactory bf = getBeanFactory(); - if (!(bf instanceof ConfigurableBeanFactory)) { - return; - } - ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf; - - String alias = "rods alias"; - try { - cbf.getBean(alias); - fail("Shouldn't permit factory get on normal bean"); - } - catch (NoSuchBeanDefinitionException ex) { - // Ok - assertTrue(alias.equals(ex.getBeanName())); - } - - // Create alias - cbf.registerAlias("rod", alias); - Object rod = getBeanFactory().getBean("rod"); - Object aliasRod = getBeanFactory().getBean(alias); - assertTrue(rod == aliasRod); - } - - - public static class TestBeanEditor extends PropertyEditorSupport { - - @Override - public void setAsText(String text) { - TestBean tb = new TestBean(); - StringTokenizer st = new StringTokenizer(text, "_"); - tb.setName(st.nextToken()); - tb.setAge(Integer.parseInt(st.nextToken())); - setValue(tb); - } - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java deleted file mode 100644 index 855f23af396..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.TestBean; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFactoryTests { - - /** Subclasses must initialize this */ - protected ListableBeanFactory getListableBeanFactory() { - BeanFactory bf = getBeanFactory(); - if (!(bf instanceof ListableBeanFactory)) { - throw new IllegalStateException("ListableBeanFactory required"); - } - return (ListableBeanFactory) bf; - } - - /** - * Subclasses can override this. - */ - public void testCount() { - assertCount(13); - } - - protected final void assertCount(int count) { - String[] defnames = getListableBeanFactory().getBeanDefinitionNames(); - assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); - } - - public void assertTestBeanCount(int count) { - String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false); - assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + - defNames.length, defNames.length == count); - - int countIncludingFactoryBeans = count + 2; - String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true); - assertTrue("We should have " + countIncludingFactoryBeans + - " beans for class org.springframework.beans.TestBean, not " + names.length, - names.length == countIncludingFactoryBeans); - } - - public void testGetDefinitionsForNoSuchClass() { - String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class); - assertTrue("No string definitions", defnames.length == 0); - } - - /** - * Check that count refers to factory class, not bean class. (We don't know - * what type factories may return, and it may even change over time.) - */ - public void testGetCountForFactoryClass() { - assertTrue("Should have 2 factories, not " + - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - - assertTrue("Should have 2 factories, not " + - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - } - - public void testContainsBeanDefinition() { - assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); - assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java deleted file mode 100644 index 6fc7e36aa90..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; - -/** - * Simple factory to allow testing of FactoryBean support in AbstractBeanFactory. - * Depending on whether its singleton property is set, it will return a singleton - * or a prototype instance. - * - *

Implements InitializingBean interface, so we can check that - * factories get this lifecycle callback if they want. - * - * @author Rod Johnson - * @since 10.03.2003 - */ -public class DummyFactory - implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - - public static final String SINGLETON_NAME = "Factory singleton"; - - private static boolean prototypeCreated; - - /** - * Clear static state. - */ - public static void reset() { - prototypeCreated = false; - } - - - /** - * Default is for factories to return a singleton instance. - */ - private boolean singleton = true; - - private String beanName; - - private AutowireCapableBeanFactory beanFactory; - - private boolean postProcessed; - - private boolean initialized; - - private TestBean testBean; - - private TestBean otherTestBean; - - - public DummyFactory() { - this.testBean = new TestBean(); - this.testBean.setName(SINGLETON_NAME); - this.testBean.setAge(25); - } - - /** - * Return if the bean managed by this factory is a singleton. - * @see FactoryBean#isSingleton() - */ - @Override - public boolean isSingleton() { - return this.singleton; - } - - /** - * Set if the bean managed by this factory is a singleton. - */ - public void setSingleton(boolean singleton) { - this.singleton = singleton; - } - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = (AutowireCapableBeanFactory) beanFactory; - this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName); - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - public void setOtherTestBean(TestBean otherTestBean) { - this.otherTestBean = otherTestBean; - this.testBean.setSpouse(otherTestBean); - } - - public TestBean getOtherTestBean() { - return otherTestBean; - } - - @Override - public void afterPropertiesSet() { - if (initialized) { - throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean"); - } - this.initialized = true; - } - - /** - * Was this initialized by invocation of the - * afterPropertiesSet() method from the InitializingBean interface? - */ - public boolean wasInitialized() { - return initialized; - } - - public static boolean wasPrototypeCreated() { - return prototypeCreated; - } - - - /** - * Return the managed object, supporting both singleton - * and prototype mode. - * @see FactoryBean#getObject() - */ - @Override - public Object getObject() throws BeansException { - if (isSingleton()) { - return this.testBean; - } - else { - TestBean prototype = new TestBean("prototype created at " + System.currentTimeMillis(), 11); - if (this.beanFactory != null) { - this.beanFactory.applyBeanPostProcessorsBeforeInitialization(prototype, this.beanName); - } - prototypeCreated = true; - return prototype; - } - } - - @Override - public Class getObjectType() { - return TestBean.class; - } - - - @Override - public void destroy() { - if (this.testBean != null) { - this.testBean.setName(null); - } - } - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java deleted file mode 100644 index 013a65a0e49..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; - -/** - * Simple test of BeanFactory initialization and lifecycle callbacks. - * - * @author Rod Johnson - * @author Colin Sampaleanu - * @since 12.03.2003 - */ -public class LifecycleBean implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - - protected boolean initMethodDeclared = false; - - protected String beanName; - - protected BeanFactory owningFactory; - - protected boolean postProcessedBeforeInit; - - protected boolean inited; - - protected boolean initedViaDeclaredInitMethod; - - protected boolean postProcessedAfterInit; - - protected boolean destroyed; - - - public void setInitMethodDeclared(boolean initMethodDeclared) { - this.initMethodDeclared = initMethodDeclared; - } - - public boolean isInitMethodDeclared() { - return initMethodDeclared; - } - - @Override - public void setBeanName(String name) { - this.beanName = name; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.owningFactory = beanFactory; - } - - public void postProcessBeforeInit() { - if (this.inited || this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called postProcessBeforeInit after afterPropertiesSet"); - } - if (this.postProcessedBeforeInit) { - throw new RuntimeException("Factory called postProcessBeforeInit twice"); - } - this.postProcessedBeforeInit = true; - } - - @Override - public void afterPropertiesSet() { - if (this.owningFactory == null) { - throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean"); - } - if (!this.postProcessedBeforeInit) { - throw new RuntimeException("Factory didn't call postProcessBeforeInit before afterPropertiesSet on lifecycle bean"); - } - if (this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory initialized via declared init method before initializing via afterPropertiesSet"); - } - if (this.inited) { - throw new RuntimeException("Factory called afterPropertiesSet twice"); - } - this.inited = true; - } - - public void declaredInitMethod() { - if (!this.inited) { - throw new RuntimeException("Factory didn't call afterPropertiesSet before declared init method"); - } - - if (this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called declared init method twice"); - } - this.initedViaDeclaredInitMethod = true; - } - - public void postProcessAfterInit() { - if (!this.inited) { - throw new RuntimeException("Factory called postProcessAfterInit before afterPropertiesSet"); - } - if (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called postProcessAfterInit before calling declared init method"); - } - if (this.postProcessedAfterInit) { - throw new RuntimeException("Factory called postProcessAfterInit twice"); - } - this.postProcessedAfterInit = true; - } - - /** - * Dummy business method that will fail unless the factory - * managed the bean's lifecycle correctly - */ - public void businessMethod() { - if (!this.inited || (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) || - !this.postProcessedAfterInit) { - throw new RuntimeException("Factory didn't initialize lifecycle object correctly"); - } - } - - @Override - public void destroy() { - if (this.destroyed) { - throw new IllegalStateException("Already destroyed"); - } - this.destroyed = true; - } - - public boolean isDestroyed() { - return destroyed; - } - - - public static class PostProcessor implements BeanPostProcessor { - - @Override - public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException { - if (bean instanceof LifecycleBean) { - ((LifecycleBean) bean).postProcessBeforeInit(); - } - return bean; - } - - @Override - public Object postProcessAfterInitialization(Object bean, String name) throws BeansException { - if (bean instanceof LifecycleBean) { - ((LifecycleBean) bean).postProcessAfterInit(); - } - return bean; - } - } - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java deleted file mode 100644 index b9a7925ad82..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.factory.InitializingBean; - -/** - * Simple test of BeanFactory initialization - * @author Rod Johnson - * @since 12.03.2003 - */ -public class MustBeInitialized implements InitializingBean { - - private boolean inited; - - /** - * @see InitializingBean#afterPropertiesSet() - */ - @Override - public void afterPropertiesSet() throws Exception { - this.inited = true; - } - - /** - * Dummy business method that will fail unless the factory - * managed the bean's lifecycle correctly - */ - public void businessMethod() { - if (!this.inited) - throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object"); - } - -} \ No newline at end of file diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java deleted file mode 100644 index a7207435209..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2002-2012 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.context; - -import java.util.Locale; - -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.AbstractListableBeanFactoryTests; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.LifecycleBean; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractApplicationContextTests extends AbstractListableBeanFactoryTests { - - /** Must be supplied as XML */ - public static final String TEST_NAMESPACE = "testNamespace"; - - protected ConfigurableApplicationContext applicationContext; - - /** Subclass must register this */ - protected TestListener listener = new TestListener(); - - protected TestListener parentListener = new TestListener(); - - @Override - protected void setUp() throws Exception { - this.applicationContext = createContext(); - } - - @Override - protected BeanFactory getBeanFactory() { - return applicationContext; - } - - protected ApplicationContext getApplicationContext() { - return applicationContext; - } - - /** - * Must register a TestListener. - * Must register standard beans. - * Parent must register rod with name Roderick - * and father with name Albert. - */ - protected abstract ConfigurableApplicationContext createContext() throws Exception; - - public void testContextAwareSingletonWasCalledBack() throws Exception { - ACATester aca = (ACATester) applicationContext.getBean("aca"); - assertTrue("has had context set", aca.getApplicationContext() == applicationContext); - Object aca2 = applicationContext.getBean("aca"); - assertTrue("Same instance", aca == aca2); - assertTrue("Says is singleton", applicationContext.isSingleton("aca")); - } - - public void testContextAwarePrototypeWasCalledBack() throws Exception { - ACATester aca = (ACATester) applicationContext.getBean("aca-prototype"); - assertTrue("has had context set", aca.getApplicationContext() == applicationContext); - Object aca2 = applicationContext.getBean("aca-prototype"); - assertTrue("NOT Same instance", aca != aca2); - assertTrue("Says is prototype", !applicationContext.isSingleton("aca-prototype")); - } - - public void testParentNonNull() { - assertTrue("parent isn't null", applicationContext.getParent() != null); - } - - public void testGrandparentNull() { - assertTrue("grandparent is null", applicationContext.getParent().getParent() == null); - } - - public void testOverrideWorked() throws Exception { - TestBean rod = (TestBean) applicationContext.getParent().getBean("rod"); - assertTrue("Parent's name differs", rod.getName().equals("Roderick")); - } - - public void testGrandparentDefinitionFound() throws Exception { - TestBean dad = (TestBean) applicationContext.getBean("father"); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testGrandparentTypedDefinitionFound() throws Exception { - TestBean dad = applicationContext.getBean("father", TestBean.class); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testCloseTriggersDestroy() { - LifecycleBean lb = (LifecycleBean) applicationContext.getBean("lifecycle"); - assertTrue("Not destroyed", !lb.isDestroyed()); - applicationContext.close(); - if (applicationContext.getParent() != null) { - ((ConfigurableApplicationContext) applicationContext.getParent()).close(); - } - assertTrue("Destroyed", lb.isDestroyed()); - applicationContext.close(); - if (applicationContext.getParent() != null) { - ((ConfigurableApplicationContext) applicationContext.getParent()).close(); - } - assertTrue("Destroyed", lb.isDestroyed()); - } - - public void testMessageSource() throws NoSuchMessageException { - assertEquals("message1", applicationContext.getMessage("code1", null, Locale.getDefault())); - assertEquals("message2", applicationContext.getMessage("code2", null, Locale.getDefault())); - - try { - applicationContext.getMessage("code0", null, Locale.getDefault()); - fail("looking for code0 should throw a NoSuchMessageException"); - } - catch (NoSuchMessageException ex) { - // that's how it should be - } - } - - public void testEvents() throws Exception { - listener.zeroCounter(); - parentListener.zeroCounter(); - assertTrue("0 events before publication", listener.getEventCount() == 0); - assertTrue("0 parent events before publication", parentListener.getEventCount() == 0); - this.applicationContext.publishEvent(new MyEvent(this)); - assertTrue("1 events after publication, not " + listener.getEventCount(), listener.getEventCount() == 1); - assertTrue("1 parent events after publication", parentListener.getEventCount() == 1); - } - - public void testBeanAutomaticallyHearsEvents() throws Exception { - //String[] listenerNames = ((ListableBeanFactory) applicationContext).getBeanDefinitionNames(ApplicationListener.class); - //assertTrue("listeners include beanThatListens", Arrays.asList(listenerNames).contains("beanThatListens")); - BeanThatListens b = (BeanThatListens) applicationContext.getBean("beanThatListens"); - b.zero(); - assertTrue("0 events before publication", b.getEventCount() == 0); - this.applicationContext.publishEvent(new MyEvent(this)); - assertTrue("1 events after publication, not " + b.getEventCount(), b.getEventCount() == 1); - } - - - @SuppressWarnings("serial") - public static class MyEvent extends ApplicationEvent { - - public MyEvent(Object source) { - super(source); - } - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java index 14acac1ceb9..37d4c9715fb 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java @@ -3,7 +3,7 @@ package org.springframework.context; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.LifecycleBean; +import org.springframework.tests.sample.beans.LifecycleBean; /** * Simple bean to test ApplicationContext lifecycle methods for beans diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java deleted file mode 100644 index d580974a608..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import java.io.IOException; -import java.io.OutputStream; -import javax.servlet.ServletOutputStream; - -import org.springframework.util.Assert; - -/** - * Delegating implementation of {@link javax.servlet.ServletOutputStream}. - * - *

Used by {@link MockHttpServletResponse}; typically not directly - * used for testing application controllers. - * - * @author Juergen Hoeller - * @since 1.0.2 - * @see MockHttpServletResponse - */ -public class DelegatingServletOutputStream extends ServletOutputStream { - - private final OutputStream targetStream; - - - /** - * Create a DelegatingServletOutputStream for the given target stream. - * @param targetStream the target stream (never {@code null}) - */ - public DelegatingServletOutputStream(OutputStream targetStream) { - Assert.notNull(targetStream, "Target OutputStream must not be null"); - this.targetStream = targetStream; - } - - /** - * Return the underlying target stream (never {@code null}). - */ - public final OutputStream getTargetStream() { - return this.targetStream; - } - - - @Override - public void write(int b) throws IOException { - this.targetStream.write(b); - } - - @Override - public void flush() throws IOException { - super.flush(); - this.targetStream.flush(); - } - - @Override - public void close() throws IOException { - super.close(); - this.targetStream.close(); - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/HeaderValueHolder.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/HeaderValueHolder.java deleted file mode 100644 index e8f5e91dfb6..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/HeaderValueHolder.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; - -/** - * Internal helper class that serves as value holder for request headers. - * - * @author Juergen Hoeller - * @author Rick Evans - * @since 2.0.1 - */ -class HeaderValueHolder { - - private final List values = new LinkedList(); - - - public void setValue(Object value) { - this.values.clear(); - this.values.add(value); - } - - public void addValue(Object value) { - this.values.add(value); - } - - public void addValues(Collection values) { - this.values.addAll(values); - } - - public void addValueArray(Object values) { - CollectionUtils.mergeArrayIntoCollection(values, this.values); - } - - public List getValues() { - return Collections.unmodifiableList(this.values); - } - - public List getStringValues() { - List stringList = new ArrayList(this.values.size()); - for (Object value : this.values) { - stringList.add(value.toString()); - } - return Collections.unmodifiableList(stringList); - } - - public Object getValue() { - return (!this.values.isEmpty() ? this.values.get(0) : null); - } - - public String getStringValue() { - return (!this.values.isEmpty() ? this.values.get(0).toString() : null); - } - - - /** - * Find a HeaderValueHolder by name, ignoring casing. - * @param headers the Map of header names to HeaderValueHolders - * @param name the name of the desired header - * @return the corresponding HeaderValueHolder, - * or {@code null} if none found - */ - public static HeaderValueHolder getByName(Map headers, String name) { - Assert.notNull(name, "Header name must not be null"); - for (String headerName : headers.keySet()) { - if (headerName.equalsIgnoreCase(name)) { - return headers.get(headerName); - } - } - return null; - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java deleted file mode 100644 index 5a2b7fd1aa8..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java +++ /dev/null @@ -1,641 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.util.Assert; -import org.springframework.util.LinkedCaseInsensitiveMap; -import org.springframework.web.util.WebUtils; - -/** - * Mock implementation of the {@link javax.servlet.http.HttpServletResponse} interface. - * - *

Compatible with Servlet 2.5 as well as Servlet 3.0. - * - * @author Juergen Hoeller - * @author Rod Johnson - * @since 1.0.2 - */ -public class MockHttpServletResponse implements HttpServletResponse { - - private static final String CHARSET_PREFIX = "charset="; - - private static final String CONTENT_TYPE_HEADER = "Content-Type"; - - private static final String CONTENT_LENGTH_HEADER = "Content-Length"; - - private static final String LOCATION_HEADER = "Location"; - - //--------------------------------------------------------------------- - // ServletResponse properties - //--------------------------------------------------------------------- - - private boolean outputStreamAccessAllowed = true; - - private boolean writerAccessAllowed = true; - - private String characterEncoding = WebUtils.DEFAULT_CHARACTER_ENCODING; - - private boolean charset = false; - - private final ByteArrayOutputStream content = new ByteArrayOutputStream(); - - private final ServletOutputStream outputStream = new ResponseServletOutputStream(this.content); - - private PrintWriter writer; - - private int contentLength = 0; - - private String contentType; - - private int bufferSize = 4096; - - private boolean committed; - - private Locale locale = Locale.getDefault(); - - - //--------------------------------------------------------------------- - // HttpServletResponse properties - //--------------------------------------------------------------------- - - private final List cookies = new ArrayList(); - - private final Map headers = new LinkedCaseInsensitiveMap(); - - private int status = HttpServletResponse.SC_OK; - - private String errorMessage; - - private String forwardedUrl; - - private final List includedUrls = new ArrayList(); - - - //--------------------------------------------------------------------- - // ServletResponse interface - //--------------------------------------------------------------------- - - /** - * Set whether {@link #getOutputStream()} access is allowed. - *

Default is {@code true}. - */ - public void setOutputStreamAccessAllowed(boolean outputStreamAccessAllowed) { - this.outputStreamAccessAllowed = outputStreamAccessAllowed; - } - - /** - * Return whether {@link #getOutputStream()} access is allowed. - */ - public boolean isOutputStreamAccessAllowed() { - return this.outputStreamAccessAllowed; - } - - /** - * Set whether {@link #getWriter()} access is allowed. - *

Default is {@code true}. - */ - public void setWriterAccessAllowed(boolean writerAccessAllowed) { - this.writerAccessAllowed = writerAccessAllowed; - } - - /** - * Return whether {@link #getOutputStream()} access is allowed. - */ - public boolean isWriterAccessAllowed() { - return this.writerAccessAllowed; - } - - @Override - public void setCharacterEncoding(String characterEncoding) { - this.characterEncoding = characterEncoding; - this.charset = true; - updateContentTypeHeader(); - } - - private void updateContentTypeHeader() { - if (this.contentType != null) { - StringBuilder sb = new StringBuilder(this.contentType); - if (this.contentType.toLowerCase().indexOf(CHARSET_PREFIX) == -1 && this.charset) { - sb.append(";").append(CHARSET_PREFIX).append(this.characterEncoding); - } - doAddHeaderValue(CONTENT_TYPE_HEADER, sb.toString(), true); - } - } - - @Override - public String getCharacterEncoding() { - return this.characterEncoding; - } - - @Override - public ServletOutputStream getOutputStream() { - if (!this.outputStreamAccessAllowed) { - throw new IllegalStateException("OutputStream access not allowed"); - } - return this.outputStream; - } - - @Override - public PrintWriter getWriter() throws UnsupportedEncodingException { - if (!this.writerAccessAllowed) { - throw new IllegalStateException("Writer access not allowed"); - } - if (this.writer == null) { - Writer targetWriter = (this.characterEncoding != null ? - new OutputStreamWriter(this.content, this.characterEncoding) : new OutputStreamWriter(this.content)); - this.writer = new ResponsePrintWriter(targetWriter); - } - return this.writer; - } - - public byte[] getContentAsByteArray() { - flushBuffer(); - return this.content.toByteArray(); - } - - public String getContentAsString() throws UnsupportedEncodingException { - flushBuffer(); - return (this.characterEncoding != null) ? - this.content.toString(this.characterEncoding) : this.content.toString(); - } - - @Override - public void setContentLength(int contentLength) { - this.contentLength = contentLength; - doAddHeaderValue(CONTENT_LENGTH_HEADER, contentLength, true); - } - - public int getContentLength() { - return this.contentLength; - } - - @Override - public void setContentType(String contentType) { - this.contentType = contentType; - if (contentType != null) { - int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); - if (charsetIndex != -1) { - String encoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length()); - this.characterEncoding = encoding; - this.charset = true; - } - updateContentTypeHeader(); - } - } - - @Override - public String getContentType() { - return this.contentType; - } - - @Override - public void setBufferSize(int bufferSize) { - this.bufferSize = bufferSize; - } - - @Override - public int getBufferSize() { - return this.bufferSize; - } - - @Override - public void flushBuffer() { - setCommitted(true); - } - - @Override - public void resetBuffer() { - if (isCommitted()) { - throw new IllegalStateException("Cannot reset buffer - response is already committed"); - } - this.content.reset(); - } - - private void setCommittedIfBufferSizeExceeded() { - int bufSize = getBufferSize(); - if (bufSize > 0 && this.content.size() > bufSize) { - setCommitted(true); - } - } - - public void setCommitted(boolean committed) { - this.committed = committed; - } - - @Override - public boolean isCommitted() { - return this.committed; - } - - @Override - public void reset() { - resetBuffer(); - this.characterEncoding = null; - this.contentLength = 0; - this.contentType = null; - this.locale = null; - this.cookies.clear(); - this.headers.clear(); - this.status = HttpServletResponse.SC_OK; - this.errorMessage = null; - } - - @Override - public void setLocale(Locale locale) { - this.locale = locale; - } - - @Override - public Locale getLocale() { - return this.locale; - } - - - //--------------------------------------------------------------------- - // HttpServletResponse interface - //--------------------------------------------------------------------- - - @Override - public void addCookie(Cookie cookie) { - Assert.notNull(cookie, "Cookie must not be null"); - this.cookies.add(cookie); - } - - public Cookie[] getCookies() { - return this.cookies.toArray(new Cookie[this.cookies.size()]); - } - - public Cookie getCookie(String name) { - Assert.notNull(name, "Cookie name must not be null"); - for (Cookie cookie : this.cookies) { - if (name.equals(cookie.getName())) { - return cookie; - } - } - return null; - } - - @Override - public boolean containsHeader(String name) { - return (HeaderValueHolder.getByName(this.headers, name) != null); - } - - /** - * Return the names of all specified headers as a Set of Strings. - *

As of Servlet 3.0, this method is also defined HttpServletResponse. - * @return the {@code Set} of header name {@code Strings}, or an empty {@code Set} if none - */ - public Set getHeaderNames() { - return this.headers.keySet(); - } - - /** - * Return the primary value for the given header as a String, if any. - * Will return the first value in case of multiple values. - *

As of Servlet 3.0, this method is also defined in HttpServletResponse. - * As of Spring 3.1, it returns a stringified value for Servlet 3.0 compatibility. - * Consider using {@link #getHeaderValue(String)} for raw Object access. - * @param name the name of the header - * @return the associated header value, or {@code null} if none - */ - public String getHeader(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - return (header != null ? header.getStringValue() : null); - } - - /** - * Return all values for the given header as a List of Strings. - *

As of Servlet 3.0, this method is also defined in HttpServletResponse. - * As of Spring 3.1, it returns a List of stringified values for Servlet 3.0 compatibility. - * Consider using {@link #getHeaderValues(String)} for raw Object access. - * @param name the name of the header - * @return the associated header values, or an empty List if none - */ - public List getHeaders(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - if (header != null) { - return header.getStringValues(); - } - else { - return Collections.emptyList(); - } - } - - /** - * Return the primary value for the given header, if any. - *

Will return the first value in case of multiple values. - * @param name the name of the header - * @return the associated header value, or {@code null} if none - */ - public Object getHeaderValue(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - return (header != null ? header.getValue() : null); - } - - /** - * Return all values for the given header as a List of value objects. - * @param name the name of the header - * @return the associated header values, or an empty List if none - */ - public List getHeaderValues(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - if (header != null) { - return header.getValues(); - } - else { - return Collections.emptyList(); - } - } - - /** - * The default implementation returns the given URL String as-is. - *

Can be overridden in subclasses, appending a session id or the like. - */ - @Override - public String encodeURL(String url) { - return url; - } - - /** - * The default implementation delegates to {@link #encodeURL}, - * returning the given URL String as-is. - *

Can be overridden in subclasses, appending a session id or the like - * in a redirect-specific fashion. For general URL encoding rules, - * override the common {@link #encodeURL} method instead, applying - * to redirect URLs as well as to general URLs. - */ - @Override - public String encodeRedirectURL(String url) { - return encodeURL(url); - } - - @Override - public String encodeUrl(String url) { - return encodeURL(url); - } - - @Override - public String encodeRedirectUrl(String url) { - return encodeRedirectURL(url); - } - - @Override - public void sendError(int status, String errorMessage) throws IOException { - if (isCommitted()) { - throw new IllegalStateException("Cannot set error status - response is already committed"); - } - this.status = status; - this.errorMessage = errorMessage; - setCommitted(true); - } - - @Override - public void sendError(int status) throws IOException { - if (isCommitted()) { - throw new IllegalStateException("Cannot set error status - response is already committed"); - } - this.status = status; - setCommitted(true); - } - - @Override - public void sendRedirect(String url) throws IOException { - if (isCommitted()) { - throw new IllegalStateException("Cannot send redirect - response is already committed"); - } - Assert.notNull(url, "Redirect URL must not be null"); - setHeader(LOCATION_HEADER, url); - setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); - setCommitted(true); - } - - public String getRedirectedUrl() { - return getHeader(LOCATION_HEADER); - } - - @Override - public void setDateHeader(String name, long value) { - setHeaderValue(name, value); - } - - @Override - public void addDateHeader(String name, long value) { - addHeaderValue(name, value); - } - - @Override - public void setHeader(String name, String value) { - setHeaderValue(name, value); - } - - @Override - public void addHeader(String name, String value) { - addHeaderValue(name, value); - } - - @Override - public void setIntHeader(String name, int value) { - setHeaderValue(name, value); - } - - @Override - public void addIntHeader(String name, int value) { - addHeaderValue(name, value); - } - - private void setHeaderValue(String name, Object value) { - if (setSpecialHeader(name, value)) { - return; - } - doAddHeaderValue(name, value, true); - } - - private void addHeaderValue(String name, Object value) { - if (setSpecialHeader(name, value)) { - return; - } - doAddHeaderValue(name, value, false); - } - - private boolean setSpecialHeader(String name, Object value) { - if (CONTENT_TYPE_HEADER.equalsIgnoreCase(name)) { - setContentType((String) value); - return true; - } - else if (CONTENT_LENGTH_HEADER.equalsIgnoreCase(name)) { - setContentLength(Integer.parseInt((String) value)); - return true; - } - else { - return false; - } - } - - private void doAddHeaderValue(String name, Object value, boolean replace) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - Assert.notNull(value, "Header value must not be null"); - if (header == null) { - header = new HeaderValueHolder(); - this.headers.put(name, header); - } - if (replace) { - header.setValue(value); - } - else { - header.addValue(value); - } - } - - @Override - public void setStatus(int status) { - this.status = status; - } - - @Override - public void setStatus(int status, String errorMessage) { - this.status = status; - this.errorMessage = errorMessage; - } - - public int getStatus() { - return this.status; - } - - public String getErrorMessage() { - return this.errorMessage; - } - - - //--------------------------------------------------------------------- - // Methods for MockRequestDispatcher - //--------------------------------------------------------------------- - - public void setForwardedUrl(String forwardedUrl) { - this.forwardedUrl = forwardedUrl; - } - - public String getForwardedUrl() { - return this.forwardedUrl; - } - - public void setIncludedUrl(String includedUrl) { - this.includedUrls.clear(); - if (includedUrl != null) { - this.includedUrls.add(includedUrl); - } - } - - public String getIncludedUrl() { - int count = this.includedUrls.size(); - if (count > 1) { - throw new IllegalStateException( - "More than 1 URL included - check getIncludedUrls instead: " + this.includedUrls); - } - return (count == 1 ? this.includedUrls.get(0) : null); - } - - public void addIncludedUrl(String includedUrl) { - Assert.notNull(includedUrl, "Included URL must not be null"); - this.includedUrls.add(includedUrl); - } - - public List getIncludedUrls() { - return this.includedUrls; - } - - - /** - * Inner class that adapts the ServletOutputStream to mark the - * response as committed once the buffer size is exceeded. - */ - private class ResponseServletOutputStream extends DelegatingServletOutputStream { - - public ResponseServletOutputStream(OutputStream out) { - super(out); - } - - @Override - public void write(int b) throws IOException { - super.write(b); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - @Override - public void flush() throws IOException { - super.flush(); - setCommitted(true); - } - } - - - /** - * Inner class that adapts the PrintWriter to mark the - * response as committed once the buffer size is exceeded. - */ - private class ResponsePrintWriter extends PrintWriter { - - public ResponsePrintWriter(Writer out) { - super(out, true); - } - - @Override - public void write(char buf[], int off, int len) { - super.write(buf, off, len); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - @Override - public void write(String s, int off, int len) { - super.write(s, off, len); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - @Override - public void write(int c) { - super.write(c); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - @Override - public void flush() { - super.flush(); - setCommitted(true); - } - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpSession.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpSession.java deleted file mode 100644 index 82a89b61a38..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpSession.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; -import javax.servlet.http.HttpSessionContext; - -import org.springframework.util.Assert; - -/** - * Mock implementation of the {@link javax.servlet.http.HttpSession} interface. - * - *

Compatible with Servlet 2.5 as well as Servlet 3.0. - * - *

Used for testing the web framework; also useful for testing application - * controllers. - * - * @author Juergen Hoeller - * @author Rod Johnson - * @author Mark Fisher - * @author Sam Brannen - * @since 1.0.2 - */ -@SuppressWarnings("deprecation") -public class MockHttpSession implements HttpSession { - - public static final String SESSION_COOKIE_NAME = "JSESSION"; - - private static int nextId = 1; - - private final String id; - - private final long creationTime = System.currentTimeMillis(); - - private int maxInactiveInterval; - - private long lastAccessedTime = System.currentTimeMillis(); - - private final ServletContext servletContext; - - private final Map attributes = new LinkedHashMap(); - - private boolean invalid = false; - - private boolean isNew = true; - - - /** - * Create a new MockHttpSession with a default {@link MockServletContext}. - * - * @see MockServletContext - */ - public MockHttpSession() { - this(null); - } - - /** - * Create a new MockHttpSession. - * - * @param servletContext the ServletContext that the session runs in - */ - public MockHttpSession(ServletContext servletContext) { - this(servletContext, null); - } - - /** - * Create a new MockHttpSession. - * - * @param servletContext the ServletContext that the session runs in - * @param id a unique identifier for this session - */ - public MockHttpSession(ServletContext servletContext, String id) { - this.servletContext = (servletContext != null ? servletContext : new MockServletContext()); - this.id = (id != null ? id : Integer.toString(nextId++)); - } - - @Override - public long getCreationTime() { - return this.creationTime; - } - - @Override - public String getId() { - return this.id; - } - - public void access() { - this.lastAccessedTime = System.currentTimeMillis(); - this.isNew = false; - } - - @Override - public long getLastAccessedTime() { - return this.lastAccessedTime; - } - - @Override - public ServletContext getServletContext() { - return this.servletContext; - } - - @Override - public void setMaxInactiveInterval(int interval) { - this.maxInactiveInterval = interval; - } - - @Override - public int getMaxInactiveInterval() { - return this.maxInactiveInterval; - } - - @Override - public HttpSessionContext getSessionContext() { - throw new UnsupportedOperationException("getSessionContext"); - } - - @Override - public Object getAttribute(String name) { - Assert.notNull(name, "Attribute name must not be null"); - return this.attributes.get(name); - } - - @Override - public Object getValue(String name) { - return getAttribute(name); - } - - @Override - public Enumeration getAttributeNames() { - return Collections.enumeration(this.attributes.keySet()); - } - - @Override - public String[] getValueNames() { - return this.attributes.keySet().toArray(new String[this.attributes.size()]); - } - - @Override - public void setAttribute(String name, Object value) { - Assert.notNull(name, "Attribute name must not be null"); - if (value != null) { - this.attributes.put(name, value); - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value)); - } - } - else { - removeAttribute(name); - } - } - - @Override - public void putValue(String name, Object value) { - setAttribute(name, value); - } - - @Override - public void removeAttribute(String name) { - Assert.notNull(name, "Attribute name must not be null"); - Object value = this.attributes.remove(name); - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); - } - } - - @Override - public void removeValue(String name) { - removeAttribute(name); - } - - /** - * Clear all of this session's attributes. - */ - public void clearAttributes() { - for (Iterator> it = this.attributes.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - String name = entry.getKey(); - Object value = entry.getValue(); - it.remove(); - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); - } - } - } - - /** - * Invalidates this session then unbinds any objects bound to it. - * - * @throws IllegalStateException if this method is called on an already invalidated session - */ - @Override - public void invalidate() { - if (this.invalid) { - throw new IllegalStateException("The session has already been invalidated"); - } - - // else - this.invalid = true; - clearAttributes(); - } - - public boolean isInvalid() { - return this.invalid; - } - - public void setNew(boolean value) { - this.isNew = value; - } - - @Override - public boolean isNew() { - return this.isNew; - } - - /** - * Serialize the attributes of this session into an object that can be - * turned into a byte array with standard Java serialization. - * - * @return a representation of this session's serialized state - */ - public Serializable serializeState() { - HashMap state = new HashMap(); - for (Iterator> it = this.attributes.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - String name = entry.getKey(); - Object value = entry.getValue(); - it.remove(); - if (value instanceof Serializable) { - state.put(name, (Serializable) value); - } - else { - // Not serializable... Servlet containers usually automatically - // unbind the attribute in this case. - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); - } - } - } - return state; - } - - /** - * Deserialize the attributes of this session from a state object created by - * {@link #serializeState()}. - * - * @param state a representation of this session's serialized state - */ - @SuppressWarnings("unchecked") - public void deserializeState(Serializable state) { - Assert.isTrue(state instanceof Map, "Serialized state needs to be of type [java.util.Map]"); - this.attributes.putAll((Map) state); - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java deleted file mode 100644 index 7d154808d3c..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import org.springframework.util.Assert; -import org.springframework.util.FileCopyUtils; -import org.springframework.web.multipart.MultipartFile; - -/** - * Mock implementation of the {@link org.springframework.web.multipart.MultipartFile} - * interface. - * - *

Useful in conjunction with a {@link MockMultipartHttpServletRequest} - * for testing application controllers that access multipart uploads. - * - * @author Juergen Hoeller - * @author Eric Crampton - * @since 2.0 - * @see MockMultipartHttpServletRequest - */ -public class MockMultipartFile implements MultipartFile { - - private final String name; - - private String originalFilename; - - private String contentType; - - private final byte[] content; - - - /** - * Create a new MockMultipartFile with the given content. - * @param name the name of the file - * @param content the content of the file - */ - public MockMultipartFile(String name, byte[] content) { - this(name, "", null, content); - } - - /** - * Create a new MockMultipartFile with the given content. - * @param name the name of the file - * @param contentStream the content of the file as stream - * @throws IOException if reading from the stream failed - */ - public MockMultipartFile(String name, InputStream contentStream) throws IOException { - this(name, "", null, FileCopyUtils.copyToByteArray(contentStream)); - } - - /** - * Create a new MockMultipartFile with the given content. - * @param name the name of the file - * @param originalFilename the original filename (as on the client's machine) - * @param contentType the content type (if known) - * @param content the content of the file - */ - public MockMultipartFile(String name, String originalFilename, String contentType, byte[] content) { - Assert.hasLength(name, "Name must not be null"); - this.name = name; - this.originalFilename = (originalFilename != null ? originalFilename : ""); - this.contentType = contentType; - this.content = (content != null ? content : new byte[0]); - } - - /** - * Create a new MockMultipartFile with the given content. - * @param name the name of the file - * @param originalFilename the original filename (as on the client's machine) - * @param contentType the content type (if known) - * @param contentStream the content of the file as stream - * @throws IOException if reading from the stream failed - */ - public MockMultipartFile(String name, String originalFilename, String contentType, InputStream contentStream) - throws IOException { - - this(name, originalFilename, contentType, FileCopyUtils.copyToByteArray(contentStream)); - } - - - @Override - public String getName() { - return this.name; - } - - @Override - public String getOriginalFilename() { - return this.originalFilename; - } - - @Override - public String getContentType() { - return this.contentType; - } - - @Override - public boolean isEmpty() { - return (this.content.length == 0); - } - - @Override - public long getSize() { - return this.content.length; - } - - @Override - public byte[] getBytes() throws IOException { - return this.content; - } - - @Override - public InputStream getInputStream() throws IOException { - return new ByteArrayInputStream(this.content); - } - - @Override - public void transferTo(File dest) throws IOException, IllegalStateException { - FileCopyUtils.copy(this.content, dest); - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockRequestDispatcher.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockRequestDispatcher.java deleted file mode 100644 index e43172c1982..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockRequestDispatcher.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.util.Assert; - -/** - * Mock implementation of the {@link javax.servlet.RequestDispatcher} interface. - * - *

Used for testing the web framework; typically not necessary for - * testing application controllers. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @author Sam Brannen - * @since 1.0.2 - */ -public class MockRequestDispatcher implements RequestDispatcher { - - private final Log logger = LogFactory.getLog(getClass()); - - private final String resource; - - - /** - * Create a new MockRequestDispatcher for the given resource. - * @param resource the server resource to dispatch to, located at a - * particular path or given by a particular name - */ - public MockRequestDispatcher(String resource) { - Assert.notNull(resource, "resource must not be null"); - this.resource = resource; - } - - - @Override - public void forward(ServletRequest request, ServletResponse response) { - Assert.notNull(request, "Request must not be null"); - Assert.notNull(response, "Response must not be null"); - if (response.isCommitted()) { - throw new IllegalStateException("Cannot perform forward - response is already committed"); - } - getMockHttpServletResponse(response).setForwardedUrl(this.resource); - if (logger.isDebugEnabled()) { - logger.debug("MockRequestDispatcher: forwarding to [" + this.resource + "]"); - } - } - - @Override - public void include(ServletRequest request, ServletResponse response) { - Assert.notNull(request, "Request must not be null"); - Assert.notNull(response, "Response must not be null"); - getMockHttpServletResponse(response).addIncludedUrl(this.resource); - if (logger.isDebugEnabled()) { - logger.debug("MockRequestDispatcher: including [" + this.resource + "]"); - } - } - - /** - * Obtain the underlying {@link MockHttpServletResponse}, unwrapping - * {@link HttpServletResponseWrapper} decorators if necessary. - */ - protected MockHttpServletResponse getMockHttpServletResponse(ServletResponse response) { - if (response instanceof MockHttpServletResponse) { - return (MockHttpServletResponse) response; - } - if (response instanceof HttpServletResponseWrapper) { - return getMockHttpServletResponse(((HttpServletResponseWrapper) response).getResponse()); - } - throw new IllegalArgumentException("MockRequestDispatcher requires MockHttpServletResponse"); - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockServletContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockServletContext.java deleted file mode 100644 index cf3e6e26c16..00000000000 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockServletContext.java +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright 2002-2012 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.mock.web; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import javax.activation.FileTypeMap; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; -import org.springframework.util.Assert; -import org.springframework.util.ClassUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.util.WebUtils; - -/** - * Mock implementation of the {@link javax.servlet.ServletContext} interface. - * - *

Compatible with Servlet 2.5 and partially with Servlet 3.0. Can be configured to - * expose a specific version through {@link #setMajorVersion}/{@link #setMinorVersion}; - * default is 2.5. Note that Servlet 3.0 support is limited: servlet, filter and listener - * registration methods are not supported; neither is cookie or JSP configuration. - * We generally do not recommend to unit-test your ServletContainerInitializers and - * WebApplicationInitializers which is where those registration methods would be used. - * - *

Used for testing the Spring web framework; only rarely necessary for testing - * application controllers. As long as application components don't explicitly - * access the {@code ServletContext}, {@code ClassPathXmlApplicationContext} or - * {@code FileSystemXmlApplicationContext} can be used to load the context files - * for testing, even for {@code DispatcherServlet} context definitions. - * - *

For setting up a full {@code WebApplicationContext} in a test environment, - * you can use {@code AnnotationConfigWebApplicationContext}, - * {@code XmlWebApplicationContext}, or {@code GenericWebApplicationContext}, - * passing in an appropriate {@code MockServletContext} instance. You might want - * to configure your {@code MockServletContext} with a {@code FileSystemResourceLoader} - * in that case to ensure that resource paths are interpreted as relative filesystem - * locations. - * - *

A common setup is to point your JVM working directory to the root of your - * web application directory, in combination with filesystem-based resource loading. - * This allows to load the context files as used in the web application, with - * relative paths getting interpreted correctly. Such a setup will work with both - * {@code FileSystemXmlApplicationContext} (which will load straight from the - * filesystem) and {@code XmlWebApplicationContext} with an underlying - * {@code MockServletContext} (as long as the {@code MockServletContext} has been - * configured with a {@code FileSystemResourceLoader}). - * - * @author Rod Johnson - * @author Juergen Hoeller - * @author Sam Brannen - * @since 1.0.2 - * @see #MockServletContext(org.springframework.core.io.ResourceLoader) - * @see org.springframework.web.context.support.AnnotationConfigWebApplicationContext - * @see org.springframework.web.context.support.XmlWebApplicationContext - * @see org.springframework.web.context.support.GenericWebApplicationContext - * @see org.springframework.context.support.ClassPathXmlApplicationContext - * @see org.springframework.context.support.FileSystemXmlApplicationContext - */ -public class MockServletContext implements ServletContext { - - /** Default Servlet name used by Tomcat, Jetty, JBoss, and GlassFish: {@value}. */ - private static final String COMMON_DEFAULT_SERVLET_NAME = "default"; - - private static final String TEMP_DIR_SYSTEM_PROPERTY = "java.io.tmpdir"; - - private final Log logger = LogFactory.getLog(getClass()); - - private final Map contexts = new HashMap(); - - private final Map initParameters = new LinkedHashMap(); - - private final Map attributes = new LinkedHashMap(); - - private final Set declaredRoles = new HashSet(); - - private final Map namedRequestDispatchers = new HashMap(); - - private final ResourceLoader resourceLoader; - - private final String resourceBasePath; - - private String contextPath = ""; - - private int majorVersion = 2; - - private int minorVersion = 5; - - private int effectiveMajorVersion = 2; - - private int effectiveMinorVersion = 5; - - private String servletContextName = "MockServletContext"; - - private String defaultServletName = COMMON_DEFAULT_SERVLET_NAME; - - - /** - * Create a new MockServletContext, using no base path and a - * DefaultResourceLoader (i.e. the classpath root as WAR root). - * @see org.springframework.core.io.DefaultResourceLoader - */ - public MockServletContext() { - this("", null); - } - - /** - * Create a new MockServletContext, using a DefaultResourceLoader. - * @param resourceBasePath the root directory of the WAR (should not end with a slash) - * @see org.springframework.core.io.DefaultResourceLoader - */ - public MockServletContext(String resourceBasePath) { - this(resourceBasePath, null); - } - - /** - * Create a new MockServletContext, using the specified ResourceLoader - * and no base path. - * @param resourceLoader the ResourceLoader to use (or null for the default) - */ - public MockServletContext(ResourceLoader resourceLoader) { - this("", resourceLoader); - } - - /** - * Create a new MockServletContext using the supplied resource base path and - * resource loader. - *

Registers a {@link MockRequestDispatcher} for the Servlet named - * {@value #COMMON_DEFAULT_SERVLET_NAME}. - * @param resourceBasePath the root directory of the WAR (should not end with a slash) - * @param resourceLoader the ResourceLoader to use (or null for the default) - * @see #registerNamedDispatcher - */ - public MockServletContext(String resourceBasePath, ResourceLoader resourceLoader) { - this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader()); - this.resourceBasePath = (resourceBasePath != null ? resourceBasePath : ""); - - // Use JVM temp dir as ServletContext temp dir. - String tempDir = System.getProperty(TEMP_DIR_SYSTEM_PROPERTY); - if (tempDir != null) { - this.attributes.put(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE, new File(tempDir)); - } - - registerNamedDispatcher(this.defaultServletName, new MockRequestDispatcher(this.defaultServletName)); - } - - /** - * Build a full resource location for the given path, - * prepending the resource base path of this MockServletContext. - * @param path the path as specified - * @return the full resource path - */ - protected String getResourceLocation(String path) { - if (!path.startsWith("/")) { - path = "/" + path; - } - return this.resourceBasePath + path; - } - - public void setContextPath(String contextPath) { - this.contextPath = (contextPath != null ? contextPath : ""); - } - - /* This is a Servlet API 2.5 method. */ - @Override - public String getContextPath() { - return this.contextPath; - } - - public void registerContext(String contextPath, ServletContext context) { - this.contexts.put(contextPath, context); - } - - @Override - public ServletContext getContext(String contextPath) { - if (this.contextPath.equals(contextPath)) { - return this; - } - return this.contexts.get(contextPath); - } - - public void setMajorVersion(int majorVersion) { - this.majorVersion = majorVersion; - } - - @Override - public int getMajorVersion() { - return this.majorVersion; - } - - public void setMinorVersion(int minorVersion) { - this.minorVersion = minorVersion; - } - - @Override - public int getMinorVersion() { - return this.minorVersion; - } - - public void setEffectiveMajorVersion(int effectiveMajorVersion) { - this.effectiveMajorVersion = effectiveMajorVersion; - } - - public int getEffectiveMajorVersion() { - return this.effectiveMajorVersion; - } - - public void setEffectiveMinorVersion(int effectiveMinorVersion) { - this.effectiveMinorVersion = effectiveMinorVersion; - } - - public int getEffectiveMinorVersion() { - return this.effectiveMinorVersion; - } - - @Override - public String getMimeType(String filePath) { - return MimeTypeResolver.getMimeType(filePath); - } - - @Override - public Set getResourcePaths(String path) { - String actualPath = (path.endsWith("/") ? path : path + "/"); - Resource resource = this.resourceLoader.getResource(getResourceLocation(actualPath)); - try { - File file = resource.getFile(); - String[] fileList = file.list(); - if (ObjectUtils.isEmpty(fileList)) { - return null; - } - Set resourcePaths = new LinkedHashSet(fileList.length); - for (String fileEntry : fileList) { - String resultPath = actualPath + fileEntry; - if (resource.createRelative(fileEntry).getFile().isDirectory()) { - resultPath += "/"; - } - resourcePaths.add(resultPath); - } - return resourcePaths; - } - catch (IOException ex) { - logger.warn("Couldn't get resource paths for " + resource, ex); - return null; - } - } - - @Override - public URL getResource(String path) throws MalformedURLException { - Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); - if (!resource.exists()) { - return null; - } - try { - return resource.getURL(); - } - catch (MalformedURLException ex) { - throw ex; - } - catch (IOException ex) { - logger.warn("Couldn't get URL for " + resource, ex); - return null; - } - } - - @Override - public InputStream getResourceAsStream(String path) { - Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); - if (!resource.exists()) { - return null; - } - try { - return resource.getInputStream(); - } - catch (IOException ex) { - logger.warn("Couldn't open InputStream for " + resource, ex); - return null; - } - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) { - if (!path.startsWith("/")) { - throw new IllegalArgumentException("RequestDispatcher path at ServletContext level must start with '/'"); - } - return new MockRequestDispatcher(path); - } - - @Override - public RequestDispatcher getNamedDispatcher(String path) { - return this.namedRequestDispatchers.get(path); - } - - /** - * Register a {@link RequestDispatcher} (typically a {@link MockRequestDispatcher}) - * that acts as a wrapper for the named Servlet. - * - * @param name the name of the wrapped Servlet - * @param requestDispatcher the dispatcher that wraps the named Servlet - * @see #getNamedDispatcher - * @see #unregisterNamedDispatcher - */ - public void registerNamedDispatcher(String name, RequestDispatcher requestDispatcher) { - Assert.notNull(name, "RequestDispatcher name must not be null"); - Assert.notNull(requestDispatcher, "RequestDispatcher must not be null"); - this.namedRequestDispatchers.put(name, requestDispatcher); - } - - /** - * Unregister the {@link RequestDispatcher} with the given name. - * - * @param name the name of the dispatcher to unregister - * @see #getNamedDispatcher - * @see #registerNamedDispatcher - */ - public void unregisterNamedDispatcher(String name) { - Assert.notNull(name, "RequestDispatcher name must not be null"); - this.namedRequestDispatchers.remove(name); - } - - /** - * Get the name of the default {@code Servlet}. - *

Defaults to {@value #COMMON_DEFAULT_SERVLET_NAME}. - * @see #setDefaultServletName - */ - public String getDefaultServletName() { - return this.defaultServletName; - } - - /** - * Set the name of the default {@code Servlet}. - *

Also {@link #unregisterNamedDispatcher unregisters} the current default - * {@link RequestDispatcher} and {@link #registerNamedDispatcher replaces} - * it with a {@link MockRequestDispatcher} for the provided - * {@code defaultServletName}. - * @param defaultServletName the name of the default {@code Servlet}; - * never {@code null} or empty - * @see #getDefaultServletName - */ - public void setDefaultServletName(String defaultServletName) { - Assert.hasText(defaultServletName, "defaultServletName must not be null or empty"); - unregisterNamedDispatcher(this.defaultServletName); - this.defaultServletName = defaultServletName; - registerNamedDispatcher(this.defaultServletName, new MockRequestDispatcher(this.defaultServletName)); - } - - @Override - public Servlet getServlet(String name) { - return null; - } - - @Override - public Enumeration getServlets() { - return Collections.enumeration(new HashSet()); - } - - @Override - public Enumeration getServletNames() { - return Collections.enumeration(new HashSet()); - } - - @Override - public void log(String message) { - logger.info(message); - } - - @Override - public void log(Exception ex, String message) { - logger.info(message, ex); - } - - @Override - public void log(String message, Throwable ex) { - logger.info(message, ex); - } - - @Override - public String getRealPath(String path) { - Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); - try { - return resource.getFile().getAbsolutePath(); - } - catch (IOException ex) { - logger.warn("Couldn't determine real path of resource " + resource, ex); - return null; - } - } - - @Override - public String getServerInfo() { - return "MockServletContext"; - } - - @Override - public String getInitParameter(String name) { - Assert.notNull(name, "Parameter name must not be null"); - return this.initParameters.get(name); - } - - @Override - public Enumeration getInitParameterNames() { - return Collections.enumeration(this.initParameters.keySet()); - } - - public boolean setInitParameter(String name, String value) { - Assert.notNull(name, "Parameter name must not be null"); - if (this.initParameters.containsKey(name)) { - return false; - } - this.initParameters.put(name, value); - return true; - } - - public void addInitParameter(String name, String value) { - Assert.notNull(name, "Parameter name must not be null"); - this.initParameters.put(name, value); - } - - @Override - public Object getAttribute(String name) { - Assert.notNull(name, "Attribute name must not be null"); - return this.attributes.get(name); - } - - @Override - public Enumeration getAttributeNames() { - return new Vector(this.attributes.keySet()).elements(); - } - - @Override - public void setAttribute(String name, Object value) { - Assert.notNull(name, "Attribute name must not be null"); - if (value != null) { - this.attributes.put(name, value); - } - else { - this.attributes.remove(name); - } - } - - @Override - public void removeAttribute(String name) { - Assert.notNull(name, "Attribute name must not be null"); - this.attributes.remove(name); - } - - public void setServletContextName(String servletContextName) { - this.servletContextName = servletContextName; - } - - @Override - public String getServletContextName() { - return this.servletContextName; - } - - public ClassLoader getClassLoader() { - return ClassUtils.getDefaultClassLoader(); - } - - public void declareRoles(String... roleNames) { - Assert.notNull(roleNames, "Role names array must not be null"); - for (String roleName : roleNames) { - Assert.hasLength(roleName, "Role name must not be empty"); - this.declaredRoles.add(roleName); - } - } - - public Set getDeclaredRoles() { - return Collections.unmodifiableSet(this.declaredRoles); - } - - - /** - * Inner factory class used to introduce a Java Activation Framework - * dependency when actually asked to resolve a MIME type. - */ - private static class MimeTypeResolver { - - public static String getMimeType(String filePath) { - return FileTypeMap.getDefaultFileTypeMap().getContentType(filePath); - } - } - -} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java index 963ae040f27..da8aa73cac6 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,12 +21,13 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Map; + import javax.portlet.PortletContext; import javax.portlet.PortletSession; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; -import org.springframework.mock.web.MockHttpSession; +import org.springframework.mock.web.test.MockHttpSession; /** * Mock implementation of the {@link javax.portlet.PortletSession} interface. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java index 6cb7e3ae5f3..b1b1459ee75 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; + import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.EventRequest; @@ -47,9 +48,9 @@ import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.core.Ordered; -import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.portlet.MockPortletConfig; import org.springframework.mock.web.portlet.MockPortletContext; +import org.springframework.mock.web.test.MockMultipartFile; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.multipart.MaxUploadSizeExceededException; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java index 46ea7b2ba04..fdb7d9df461 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java @@ -1,5 +1,5 @@ /* -* Copyright 2002-2012 the original author or authors. +* Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import javax.portlet.PortletSession; import junit.framework.TestCase; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.i18n.LocaleContext; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java index 7bd390f9d29..3f53c7edfad 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import javax.portlet.RenderResponse; import org.springframework.beans.BeansException; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.ManagedMap; import org.springframework.validation.BindException; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java index 3f46ddd3a83..3bf24624893 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import java.util.Set; import junit.framework.TestCase; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.beans.propertyeditors.StringArrayPropertyEditor; import org.springframework.mock.web.portlet.MockPortletRequest; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java index 8aeeb819b5d..bec09daa5e2 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.web.portlet.context; import javax.servlet.ServletException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.AbstractApplicationContextTests; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java index 452ddb3c520..288b901f372 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2013 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,18 +16,20 @@ package org.springframework.web.portlet.context; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + import javax.portlet.PortletContext; import javax.portlet.PortletSession; import javax.servlet.ServletContextEvent; -import static org.junit.Assert.*; import org.junit.Test; - -import org.springframework.beans.DerivedTestBean; import org.springframework.beans.factory.support.GenericBeanDefinition; -import org.springframework.mock.web.MockServletContext; import org.springframework.mock.web.portlet.MockRenderRequest; import org.springframework.mock.web.portlet.ServletWrappingPortletContext; +import org.springframework.mock.web.test.MockServletContext; +import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.web.context.ContextCleanupListener; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.RequestContextHolder; @@ -125,4 +127,4 @@ public class PortletApplicationContextScopeTests { assertTrue(bean.wasDestroyed()); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/applicationContext.xml b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/applicationContext.xml index 04bc32bb88d..9a4a2163138 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/applicationContext.xml +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/applicationContext.xml @@ -9,7 +9,7 @@ - + - + dummy @@ -45,7 +45,7 @@ Tests of lifecycle callbacks --> + class="org.springframework.tests.sample.beans.MustBeInitialized"> - + yetanotherdummy diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/test-servlet.xml b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/test-servlet.xml index 4002703b211..85885f238d0 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/test-servlet.xml +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/WEB-INF/test-servlet.xml @@ -15,7 +15,7 @@ - + Rod 31 @@ -28,32 +28,32 @@ 31 - + - + Kerry 34 - + typeMismatch 34x - + - + false - + listenerVeto 66 - + diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java index 9ec0c1be3bb..2df278bba00 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -22,7 +22,7 @@ import javax.portlet.PortletConfig; import javax.portlet.PortletContext; import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java index bad17962411..2ea777d8c40 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -32,8 +32,8 @@ import javax.portlet.WindowState; import junit.framework.TestCase; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.mock.web.portlet.MockActionRequest; import org.springframework.mock.web.portlet.MockActionResponse; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java index 4705be2f542..600dc7e8fa6 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -41,9 +41,9 @@ import javax.servlet.http.Cookie; import org.junit.Test; import org.springframework.beans.BeansException; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.propertyeditors.CustomDateEditor; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java index 072476b61da..7a58b4a1c45 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -38,9 +38,9 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.TestCase; import org.springframework.beans.BeansException; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.propertyeditors.CustomDateEditor; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java index c291a8e74b1..8fd99d5357f 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,8 +27,8 @@ import javax.portlet.PortletSession; import org.junit.Test; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.portlet.MockActionRequest; import org.springframework.mock.web.portlet.MockActionResponse; import org.springframework.mock.web.portlet.MockPortletContext; diff --git a/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java b/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java deleted file mode 100644 index bb5e71f5cd0..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2002-2005 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; - -/** - * @author Juergen Hoeller - * @since 17.08.2004 - */ -public class BeanWithObjectProperty { - - private Object object; - - public Object getObject() { - return object; - } - - public void setObject(Object object) { - this.object = object; - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/Colour.java b/spring-webmvc/src/test/java/org/springframework/beans/Colour.java deleted file mode 100644 index a992a2ebfc6..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java deleted file mode 100644 index c5360de5316..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.Serializable; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; - -/** - * @author Juergen Hoeller - * @since 21.08.2003 - */ -@SuppressWarnings("serial") -public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean { - - private String beanName; - - private boolean initialized; - - private boolean destroyed; - - - public DerivedTestBean() { - } - - public DerivedTestBean(String[] names) { - if (names == null || names.length < 2) { - throw new IllegalArgumentException("Invalid names array"); - } - setName(names[0]); - setBeanName(names[1]); - } - - public static DerivedTestBean create(String[] names) { - return new DerivedTestBean(names); - } - - - @Override - public void setBeanName(String beanName) { - if (this.beanName == null || beanName == null) { - this.beanName = beanName; - } - } - - @Override - public String getBeanName() { - return beanName; - } - - public void setSpouseRef(String name) { - setSpouse(new TestBean(name)); - } - - - public void initialize() { - this.initialized = true; - } - - public boolean wasInitialized() { - return initialized; - } - - - @Override - public void destroy() { - this.destroyed = true; - } - - @Override - public boolean wasDestroyed() { - return destroyed; - } - -} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java b/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java deleted file mode 100644 index 00dd127e47c..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright 2002-2010 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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.springframework.core.io.Resource; - -/** - * @author Juergen Hoeller - */ -public class GenericBean { - - private Set integerSet; - - private Set testBeanSet; - - private List resourceList; - - private List> listOfLists; - - private ArrayList listOfArrays; - - private List> listOfMaps; - - private Map plainMap; - - private Map shortMap; - - private HashMap longMap; - - private Map> collectionMap; - - private Map> mapOfMaps; - - private Map> mapOfLists; - - private CustomEnum customEnum; - - private T genericProperty; - - private List genericListProperty; - - - public GenericBean() { - } - - public GenericBean(Set integerSet) { - this.integerSet = integerSet; - } - - public GenericBean(Set integerSet, List resourceList) { - this.integerSet = integerSet; - this.resourceList = resourceList; - } - - public GenericBean(HashSet integerSet, Map shortMap) { - this.integerSet = integerSet; - this.shortMap = shortMap; - } - - public GenericBean(Map shortMap, Resource resource) { - this.shortMap = shortMap; - this.resourceList = Collections.singletonList(resource); - } - - public GenericBean(Map plainMap, Map shortMap) { - this.plainMap = plainMap; - this.shortMap = shortMap; - } - - public GenericBean(HashMap longMap) { - this.longMap = longMap; - } - - public GenericBean(boolean someFlag, Map> collectionMap) { - this.collectionMap = collectionMap; - } - - - public Set getIntegerSet() { - return integerSet; - } - - public void setIntegerSet(Set integerSet) { - this.integerSet = integerSet; - } - - public Set getTestBeanSet() { - return testBeanSet; - } - - public void setTestBeanSet(Set testBeanSet) { - this.testBeanSet = testBeanSet; - } - - public List getResourceList() { - return resourceList; - } - - public void setResourceList(List resourceList) { - this.resourceList = resourceList; - } - - public List> getListOfLists() { - return listOfLists; - } - - public ArrayList getListOfArrays() { - return listOfArrays; - } - - public void setListOfArrays(ArrayList listOfArrays) { - this.listOfArrays = listOfArrays; - } - - public void setListOfLists(List> listOfLists) { - this.listOfLists = listOfLists; - } - - public List> getListOfMaps() { - return listOfMaps; - } - - public void setListOfMaps(List> listOfMaps) { - this.listOfMaps = listOfMaps; - } - - public Map getPlainMap() { - return plainMap; - } - - public Map getShortMap() { - return shortMap; - } - - public void setShortMap(Map shortMap) { - this.shortMap = shortMap; - } - - public HashMap getLongMap() { - return longMap; - } - - public void setLongMap(HashMap longMap) { - this.longMap = longMap; - } - - public Map> getCollectionMap() { - return collectionMap; - } - - public void setCollectionMap(Map> collectionMap) { - this.collectionMap = collectionMap; - } - - public Map> getMapOfMaps() { - return mapOfMaps; - } - - public void setMapOfMaps(Map> mapOfMaps) { - this.mapOfMaps = mapOfMaps; - } - - public Map> getMapOfLists() { - return mapOfLists; - } - - public void setMapOfLists(Map> mapOfLists) { - this.mapOfLists = mapOfLists; - } - - public T getGenericProperty() { - return genericProperty; - } - - public void setGenericProperty(T genericProperty) { - this.genericProperty = genericProperty; - } - - public List getGenericListProperty() { - return genericListProperty; - } - - public void setGenericListProperty(List genericListProperty) { - this.genericListProperty = genericListProperty; - } - - public CustomEnum getCustomEnum() { - return customEnum; - } - - public void setCustomEnum(CustomEnum customEnum) { - this.customEnum = customEnum; - } - - - public static GenericBean createInstance(Set integerSet) { - return new GenericBean(integerSet); - } - - public static GenericBean createInstance(Set integerSet, List resourceList) { - return new GenericBean(integerSet, resourceList); - } - - public static GenericBean createInstance(HashSet integerSet, Map shortMap) { - return new GenericBean(integerSet, shortMap); - } - - public static GenericBean createInstance(Map shortMap, Resource resource) { - return new GenericBean(shortMap, resource); - } - - public static GenericBean createInstance(Map map, Map shortMap) { - return new GenericBean(map, shortMap); - } - - public static GenericBean createInstance(HashMap longMap) { - return new GenericBean(longMap); - } - - public static GenericBean createInstance(boolean someFlag, Map> collectionMap) { - return new GenericBean(someFlag, collectionMap); - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/INestedTestBean.java deleted file mode 100644 index e0ae5f20a3f..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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; - -public interface INestedTestBean { - - public String getCompany(); - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/IOther.java b/spring-webmvc/src/test/java/org/springframework/beans/IOther.java deleted file mode 100644 index d7fb346185a..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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; - -public interface IOther { - - void absquatulate(); - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/ITestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/ITestBean.java deleted file mode 100644 index cdf5ef510dd..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 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; - -import java.io.IOException; - -/** - * Interface used for {@link org.springframework.beans.TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/IndexedTestBean.java deleted file mode 100644 index ddb091770ee..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/NestedTestBean.java deleted file mode 100644 index 412891c439b..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/Pet.java b/spring-webmvc/src/test/java/org/springframework/beans/Pet.java deleted file mode 100644 index 35d9c736c13..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/Pet.java +++ /dev/null @@ -1,54 +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; - -/** - * @author Rob Harrop - * @since 2.0 - */ -public class Pet { - - private String name; - - public Pet(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String toString() { - return getName(); - } - - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final Pet pet = (Pet) o; - - if (name != null ? !name.equals(pet.name) : pet.name != null) return false; - - return true; - } - - public int hashCode() { - return (name != null ? name.hashCode() : 0); - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/TestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/TestBean.java deleted file mode 100644 index 6d71de75764..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/TestBean.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see org.springframework.beans.ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see org.springframework.beans.ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see org.springframework.beans.IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-webmvc/src/test/java/org/springframework/beans/factory/DummyFactory.java deleted file mode 100644 index 6fc7e36aa90..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; - -/** - * Simple factory to allow testing of FactoryBean support in AbstractBeanFactory. - * Depending on whether its singleton property is set, it will return a singleton - * or a prototype instance. - * - *

Implements InitializingBean interface, so we can check that - * factories get this lifecycle callback if they want. - * - * @author Rod Johnson - * @since 10.03.2003 - */ -public class DummyFactory - implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - - public static final String SINGLETON_NAME = "Factory singleton"; - - private static boolean prototypeCreated; - - /** - * Clear static state. - */ - public static void reset() { - prototypeCreated = false; - } - - - /** - * Default is for factories to return a singleton instance. - */ - private boolean singleton = true; - - private String beanName; - - private AutowireCapableBeanFactory beanFactory; - - private boolean postProcessed; - - private boolean initialized; - - private TestBean testBean; - - private TestBean otherTestBean; - - - public DummyFactory() { - this.testBean = new TestBean(); - this.testBean.setName(SINGLETON_NAME); - this.testBean.setAge(25); - } - - /** - * Return if the bean managed by this factory is a singleton. - * @see FactoryBean#isSingleton() - */ - @Override - public boolean isSingleton() { - return this.singleton; - } - - /** - * Set if the bean managed by this factory is a singleton. - */ - public void setSingleton(boolean singleton) { - this.singleton = singleton; - } - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = (AutowireCapableBeanFactory) beanFactory; - this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName); - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - public void setOtherTestBean(TestBean otherTestBean) { - this.otherTestBean = otherTestBean; - this.testBean.setSpouse(otherTestBean); - } - - public TestBean getOtherTestBean() { - return otherTestBean; - } - - @Override - public void afterPropertiesSet() { - if (initialized) { - throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean"); - } - this.initialized = true; - } - - /** - * Was this initialized by invocation of the - * afterPropertiesSet() method from the InitializingBean interface? - */ - public boolean wasInitialized() { - return initialized; - } - - public static boolean wasPrototypeCreated() { - return prototypeCreated; - } - - - /** - * Return the managed object, supporting both singleton - * and prototype mode. - * @see FactoryBean#getObject() - */ - @Override - public Object getObject() throws BeansException { - if (isSingleton()) { - return this.testBean; - } - else { - TestBean prototype = new TestBean("prototype created at " + System.currentTimeMillis(), 11); - if (this.beanFactory != null) { - this.beanFactory.applyBeanPostProcessorsBeforeInitialization(prototype, this.beanName); - } - prototypeCreated = true; - return prototype; - } - } - - @Override - public Class getObjectType() { - return TestBean.class; - } - - - @Override - public void destroy() { - if (this.testBean != null) { - this.testBean.setName(null); - } - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/factory/LifecycleBean.java b/spring-webmvc/src/test/java/org/springframework/beans/factory/LifecycleBean.java deleted file mode 100644 index 013a65a0e49..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/factory/LifecycleBean.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; - -/** - * Simple test of BeanFactory initialization and lifecycle callbacks. - * - * @author Rod Johnson - * @author Colin Sampaleanu - * @since 12.03.2003 - */ -public class LifecycleBean implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - - protected boolean initMethodDeclared = false; - - protected String beanName; - - protected BeanFactory owningFactory; - - protected boolean postProcessedBeforeInit; - - protected boolean inited; - - protected boolean initedViaDeclaredInitMethod; - - protected boolean postProcessedAfterInit; - - protected boolean destroyed; - - - public void setInitMethodDeclared(boolean initMethodDeclared) { - this.initMethodDeclared = initMethodDeclared; - } - - public boolean isInitMethodDeclared() { - return initMethodDeclared; - } - - @Override - public void setBeanName(String name) { - this.beanName = name; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.owningFactory = beanFactory; - } - - public void postProcessBeforeInit() { - if (this.inited || this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called postProcessBeforeInit after afterPropertiesSet"); - } - if (this.postProcessedBeforeInit) { - throw new RuntimeException("Factory called postProcessBeforeInit twice"); - } - this.postProcessedBeforeInit = true; - } - - @Override - public void afterPropertiesSet() { - if (this.owningFactory == null) { - throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean"); - } - if (!this.postProcessedBeforeInit) { - throw new RuntimeException("Factory didn't call postProcessBeforeInit before afterPropertiesSet on lifecycle bean"); - } - if (this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory initialized via declared init method before initializing via afterPropertiesSet"); - } - if (this.inited) { - throw new RuntimeException("Factory called afterPropertiesSet twice"); - } - this.inited = true; - } - - public void declaredInitMethod() { - if (!this.inited) { - throw new RuntimeException("Factory didn't call afterPropertiesSet before declared init method"); - } - - if (this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called declared init method twice"); - } - this.initedViaDeclaredInitMethod = true; - } - - public void postProcessAfterInit() { - if (!this.inited) { - throw new RuntimeException("Factory called postProcessAfterInit before afterPropertiesSet"); - } - if (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) { - throw new RuntimeException("Factory called postProcessAfterInit before calling declared init method"); - } - if (this.postProcessedAfterInit) { - throw new RuntimeException("Factory called postProcessAfterInit twice"); - } - this.postProcessedAfterInit = true; - } - - /** - * Dummy business method that will fail unless the factory - * managed the bean's lifecycle correctly - */ - public void businessMethod() { - if (!this.inited || (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) || - !this.postProcessedAfterInit) { - throw new RuntimeException("Factory didn't initialize lifecycle object correctly"); - } - } - - @Override - public void destroy() { - if (this.destroyed) { - throw new IllegalStateException("Already destroyed"); - } - this.destroyed = true; - } - - public boolean isDestroyed() { - return destroyed; - } - - - public static class PostProcessor implements BeanPostProcessor { - - @Override - public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException { - if (bean instanceof LifecycleBean) { - ((LifecycleBean) bean).postProcessBeforeInit(); - } - return bean; - } - - @Override - public Object postProcessAfterInitialization(Object bean, String name) throws BeansException { - if (bean instanceof LifecycleBean) { - ((LifecycleBean) bean).postProcessAfterInit(); - } - return bean; - } - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/beans/factory/MustBeInitialized.java b/spring-webmvc/src/test/java/org/springframework/beans/factory/MustBeInitialized.java deleted file mode 100644 index b9a7925ad82..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/beans/factory/MustBeInitialized.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002-2012 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; - -import org.springframework.beans.factory.InitializingBean; - -/** - * Simple test of BeanFactory initialization - * @author Rod Johnson - * @since 12.03.2003 - */ -public class MustBeInitialized implements InitializingBean { - - private boolean inited; - - /** - * @see InitializingBean#afterPropertiesSet() - */ - @Override - public void afterPropertiesSet() throws Exception { - this.inited = true; - } - - /** - * Dummy business method that will fail unless the factory - * managed the bean's lifecycle correctly - */ - public void businessMethod() { - if (!this.inited) - throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object"); - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/context/LifecycleContextBean.java b/spring-webmvc/src/test/java/org/springframework/context/LifecycleContextBean.java index 14acac1ceb9..37d4c9715fb 100644 --- a/spring-webmvc/src/test/java/org/springframework/context/LifecycleContextBean.java +++ b/spring-webmvc/src/test/java/org/springframework/context/LifecycleContextBean.java @@ -3,7 +3,7 @@ package org.springframework.context; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.LifecycleBean; +import org.springframework.tests.sample.beans.LifecycleBean; /** * Simple bean to test ApplicationContext lifecycle methods for beans diff --git a/spring-webmvc/src/test/java/org/springframework/ui/jasperreports/PersonBean.java b/spring-webmvc/src/test/java/org/springframework/ui/jasperreports/PersonBean.java deleted file mode 100644 index 3d0bce4c841..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/ui/jasperreports/PersonBean.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2005 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.ui.jasperreports; - -/** - * @author Rob Harrop - */ -public class PersonBean { - - private int id; - - private String name; - - private String street; - - private String city; - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/ui/jasperreports/ProductBean.java b/spring-webmvc/src/test/java/org/springframework/ui/jasperreports/ProductBean.java deleted file mode 100644 index 070fa2dc426..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/ui/jasperreports/ProductBean.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2005 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.ui.jasperreports; - -/** - * @author Rob Harrop - */ -public class ProductBean { - - private int id; - - private String name; - - private float quantity; - - private float price; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public float getQuantity() { - return quantity; - } - - public void setQuantity(float quantity) { - this.quantity = quantity; - } - - public float getPrice() { - return price; - } - - public void setPrice(float price) { - this.price = price; - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-webmvc/src/test/java/org/springframework/util/SerializationTestUtils.java deleted file mode 100644 index 9ae4f54ec24..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/util/SerializationTestUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2002-2009 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.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * - * @author Rod Johnson - */ -public class SerializationTestUtils { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - return o2; - } - -} diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractApplicationContextTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractApplicationContextTests.java deleted file mode 100644 index facc86bace1..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractApplicationContextTests.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2002-2012 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.web.context; - -import java.util.Locale; - -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.LifecycleBean; -import org.springframework.context.ACATester; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.BeanThatListens; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.NoSuchMessageException; -import org.springframework.context.TestListener; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractApplicationContextTests extends AbstractListableBeanFactoryTests { - - /** Must be supplied as XML */ - public static final String TEST_NAMESPACE = "testNamespace"; - - protected ConfigurableApplicationContext applicationContext; - - /** Subclass must register this */ - protected TestListener listener = new TestListener(); - - protected TestListener parentListener = new TestListener(); - - @Override - protected void setUp() throws Exception { - this.applicationContext = createContext(); - } - - @Override - protected BeanFactory getBeanFactory() { - return applicationContext; - } - - protected ApplicationContext getApplicationContext() { - return applicationContext; - } - - /** - * Must register a TestListener. - * Must register standard beans. - * Parent must register rod with name Roderick - * and father with name Albert. - */ - protected abstract ConfigurableApplicationContext createContext() throws Exception; - - public void testContextAwareSingletonWasCalledBack() throws Exception { - ACATester aca = (ACATester) applicationContext.getBean("aca"); - assertTrue("has had context set", aca.getApplicationContext() == applicationContext); - Object aca2 = applicationContext.getBean("aca"); - assertTrue("Same instance", aca == aca2); - assertTrue("Says is singleton", applicationContext.isSingleton("aca")); - } - - public void testContextAwarePrototypeWasCalledBack() throws Exception { - ACATester aca = (ACATester) applicationContext.getBean("aca-prototype"); - assertTrue("has had context set", aca.getApplicationContext() == applicationContext); - Object aca2 = applicationContext.getBean("aca-prototype"); - assertTrue("NOT Same instance", aca != aca2); - assertTrue("Says is prototype", !applicationContext.isSingleton("aca-prototype")); - } - - public void testParentNonNull() { - assertTrue("parent isn't null", applicationContext.getParent() != null); - } - - public void testGrandparentNull() { - assertTrue("grandparent is null", applicationContext.getParent().getParent() == null); - } - - public void testOverrideWorked() throws Exception { - TestBean rod = (TestBean) applicationContext.getParent().getBean("rod"); - assertTrue("Parent's name differs", rod.getName().equals("Roderick")); - } - - public void testGrandparentDefinitionFound() throws Exception { - TestBean dad = (TestBean) applicationContext.getBean("father"); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testGrandparentTypedDefinitionFound() throws Exception { - TestBean dad = applicationContext.getBean("father", TestBean.class); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testCloseTriggersDestroy() { - LifecycleBean lb = (LifecycleBean) applicationContext.getBean("lifecycle"); - assertTrue("Not destroyed", !lb.isDestroyed()); - applicationContext.close(); - if (applicationContext.getParent() != null) { - ((ConfigurableApplicationContext) applicationContext.getParent()).close(); - } - assertTrue("Destroyed", lb.isDestroyed()); - applicationContext.close(); - if (applicationContext.getParent() != null) { - ((ConfigurableApplicationContext) applicationContext.getParent()).close(); - } - assertTrue("Destroyed", lb.isDestroyed()); - } - - public void testMessageSource() throws NoSuchMessageException { - assertEquals("message1", applicationContext.getMessage("code1", null, Locale.getDefault())); - assertEquals("message2", applicationContext.getMessage("code2", null, Locale.getDefault())); - - try { - applicationContext.getMessage("code0", null, Locale.getDefault()); - fail("looking for code0 should throw a NoSuchMessageException"); - } - catch (NoSuchMessageException ex) { - // that's how it should be - } - } - - public void testEvents() throws Exception { - listener.zeroCounter(); - parentListener.zeroCounter(); - assertTrue("0 events before publication", listener.getEventCount() == 0); - assertTrue("0 parent events before publication", parentListener.getEventCount() == 0); - this.applicationContext.publishEvent(new MyEvent(this)); - assertTrue("1 events after publication, not " + listener.getEventCount(), listener.getEventCount() == 1); - assertTrue("1 parent events after publication", parentListener.getEventCount() == 1); - } - - public void testBeanAutomaticallyHearsEvents() throws Exception { - //String[] listenerNames = ((ListableBeanFactory) applicationContext).getBeanDefinitionNames(ApplicationListener.class); - //assertTrue("listeners include beanThatListens", Arrays.asList(listenerNames).contains("beanThatListens")); - BeanThatListens b = (BeanThatListens) applicationContext.getBean("beanThatListens"); - b.zero(); - assertTrue("0 events before publication", b.getEventCount() == 0); - this.applicationContext.publishEvent(new MyEvent(this)); - assertTrue("1 events after publication, not " + b.getEventCount(), b.getEventCount() == 1); - } - - - @SuppressWarnings("serial") - public static class MyEvent extends ApplicationEvent { - - public MyEvent(Object source) { - super(source); - } - } - -} diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java deleted file mode 100644 index e51cb8d151a..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright 2002-2012 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.web.context; - -import java.beans.PropertyEditorSupport; -import java.util.StringTokenizer; - -import junit.framework.TestCase; - -import org.springframework.beans.BeansException; -import org.springframework.beans.PropertyBatchUpdateException; -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanIsNotAFactoryException; -import org.springframework.beans.factory.BeanNotOfRequiredTypeException; -import org.springframework.beans.factory.DummyFactory; -import org.springframework.beans.factory.LifecycleBean; -import org.springframework.beans.factory.MustBeInitialized; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; - -/** - * Subclasses must implement setUp() to initialize bean factory - * and any other variables they need. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractBeanFactoryTests extends TestCase { - - protected abstract BeanFactory getBeanFactory(); - - /** - * Roderick beans inherits from rod, overriding name only. - */ - public void testInheritance() { - assertTrue(getBeanFactory().containsBean("rod")); - assertTrue(getBeanFactory().containsBean("roderick")); - TestBean rod = (TestBean) getBeanFactory().getBean("rod"); - TestBean roderick = (TestBean) getBeanFactory().getBean("roderick"); - assertTrue("not == ", rod != roderick); - assertTrue("rod.name is Rod", rod.getName().equals("Rod")); - assertTrue("rod.age is 31", rod.getAge() == 31); - assertTrue("roderick.name is Roderick", roderick.getName().equals("Roderick")); - assertTrue("roderick.age was inherited", roderick.getAge() == rod.getAge()); - } - - public void testGetBeanWithNullArg() { - try { - getBeanFactory().getBean((String) null); - fail("Can't get null bean"); - } - catch (IllegalArgumentException ex) { - // OK - } - } - - /** - * Test that InitializingBean objects receive the afterPropertiesSet() callback - */ - public void testInitializingBeanCallback() { - MustBeInitialized mbi = (MustBeInitialized) getBeanFactory().getBean("mustBeInitialized"); - // The dummy business method will throw an exception if the - // afterPropertiesSet() callback wasn't invoked - mbi.businessMethod(); - } - - /** - * Test that InitializingBean/BeanFactoryAware/DisposableBean objects receive the - * afterPropertiesSet() callback before BeanFactoryAware callbacks - */ - public void testLifecycleCallbacks() { - LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle"); - assertEquals("lifecycle", lb.getBeanName()); - // The dummy business method will throw an exception if the - // necessary callbacks weren't invoked in the right order. - lb.businessMethod(); - assertTrue("Not destroyed", !lb.isDestroyed()); - } - - public void testFindsValidInstance() { - try { - Object o = getBeanFactory().getBean("rod"); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - TestBean rod = (TestBean) o; - assertTrue("rod.name is Rod", rod.getName().equals("Rod")); - assertTrue("rod.age is 31", rod.getAge() == 31); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testGetInstanceByMatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance with matching class"); - } - } - - public void testGetInstanceByNonmatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); - fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); - } - catch (BeanNotOfRequiredTypeException ex) { - // So far, so good - assertTrue("Exception has correct bean name", ex.getBeanName().equals("rod")); - assertTrue("Exception requiredType must be BeanFactory.class", ex.getRequiredType().equals(BeanFactory.class)); - assertTrue("Exception actualType as TestBean.class", TestBean.class.isAssignableFrom(ex.getActualType())); - assertTrue("Actual type is correct", ex.getActualType() == getBeanFactory().getBean("rod").getClass()); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testGetSharedInstanceByMatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance with matching class"); - } - } - - public void testGetSharedInstanceByMatchingClassNoCatch() { - Object o = getBeanFactory().getBean("rod", TestBean.class); - assertTrue("Rod bean is a TestBean", o instanceof TestBean); - } - - public void testGetSharedInstanceByNonmatchingClass() { - try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); - fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); - } - catch (BeanNotOfRequiredTypeException ex) { - // So far, so good - assertTrue("Exception has correct bean name", ex.getBeanName().equals("rod")); - assertTrue("Exception requiredType must be BeanFactory.class", ex.getRequiredType().equals(BeanFactory.class)); - assertTrue("Exception actualType as TestBean.class", TestBean.class.isAssignableFrom(ex.getActualType())); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testSharedInstancesAreEqual() { - try { - Object o = getBeanFactory().getBean("rod"); - assertTrue("Rod bean1 is a TestBean", o instanceof TestBean); - Object o1 = getBeanFactory().getBean("rod"); - assertTrue("Rod bean2 is a TestBean", o1 instanceof TestBean); - assertTrue("Object equals applies", o == o1); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testPrototypeInstancesAreIndependent() { - TestBean tb1 = (TestBean) getBeanFactory().getBean("kathy"); - TestBean tb2 = (TestBean) getBeanFactory().getBean("kathy"); - assertTrue("ref equal DOES NOT apply", tb1 != tb2); - assertTrue("object equal true", tb1.equals(tb2)); - tb1.setAge(1); - tb2.setAge(2); - assertTrue("1 age independent = 1", tb1.getAge() == 1); - assertTrue("2 age independent = 2", tb2.getAge() == 2); - assertTrue("object equal now false", !tb1.equals(tb2)); - } - - public void testNotThere() { - assertFalse(getBeanFactory().containsBean("Mr Squiggle")); - try { - Object o = getBeanFactory().getBean("Mr Squiggle"); - fail("Can't find missing bean"); - } - catch (BeansException ex) { - //ex.printStackTrace(); - //fail("Shouldn't throw exception on getting valid instance"); - } - } - - public void testValidEmpty() { - try { - Object o = getBeanFactory().getBean("validEmpty"); - assertTrue("validEmpty bean is a TestBean", o instanceof TestBean); - TestBean ve = (TestBean) o; - assertTrue("Valid empty has defaults", ve.getName() == null && ve.getAge() == 0 && ve.getSpouse() == null); - } - catch (BeansException ex) { - ex.printStackTrace(); - fail("Shouldn't throw exception on valid empty"); - } - } - - public void xtestTypeMismatch() { - try { - Object o = getBeanFactory().getBean("typeMismatch"); - fail("Shouldn't succeed with type mismatch"); - } - catch (BeanCreationException wex) { - assertEquals("typeMismatch", wex.getBeanName()); - assertTrue(wex.getCause() instanceof PropertyBatchUpdateException); - PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause(); - // Further tests - assertTrue("Has one error ", ex.getExceptionCount() == 1); - assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null); - assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x")); - } - } - - public void testGrandparentDefinitionFoundInBeanFactory() throws Exception { - TestBean dad = (TestBean) getBeanFactory().getBean("father"); - assertTrue("Dad has correct name", dad.getName().equals("Albert")); - } - - public void testFactorySingleton() throws Exception { - assertTrue(getBeanFactory().isSingleton("&singletonFactory")); - assertTrue(getBeanFactory().isSingleton("singletonFactory")); - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); - assertTrue("Singleton from factory has correct name, not " + tb.getName(), tb.getName().equals(DummyFactory.SINGLETON_NAME)); - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - TestBean tb2 = (TestBean) getBeanFactory().getBean("singletonFactory"); - assertTrue("Singleton references ==", tb == tb2); - assertTrue("FactoryBean is BeanFactoryAware", factory.getBeanFactory() != null); - } - - public void testFactoryPrototype() throws Exception { - assertTrue(getBeanFactory().isSingleton("&prototypeFactory")); - assertFalse(getBeanFactory().isSingleton("prototypeFactory")); - TestBean tb = (TestBean) getBeanFactory().getBean("prototypeFactory"); - assertTrue(!tb.getName().equals(DummyFactory.SINGLETON_NAME)); - TestBean tb2 = (TestBean) getBeanFactory().getBean("prototypeFactory"); - assertTrue("Prototype references !=", tb != tb2); - } - - /** - * Check that we can get the factory bean itself. - * This is only possible if we're dealing with a factory - * @throws Exception - */ - public void testGetFactoryItself() throws Exception { - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - assertTrue(factory != null); - } - - /** - * Check that afterPropertiesSet gets called on factory - * @throws Exception - */ - public void testFactoryIsInitialized() throws Exception { - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); - DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); - assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); - } - - /** - * It should be illegal to dereference a normal bean - * as a factory - */ - public void testRejectsFactoryGetOnNormalBean() { - try { - getBeanFactory().getBean("&rod"); - fail("Shouldn't permit factory get on normal bean"); - } - catch (BeanIsNotAFactoryException ex) { - // Ok - } - } - - // TODO: refactor in AbstractBeanFactory (tests for AbstractBeanFactory) - // and rename this class - public void testAliasing() { - BeanFactory bf = getBeanFactory(); - if (!(bf instanceof ConfigurableBeanFactory)) { - return; - } - ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf; - - String alias = "rods alias"; - try { - cbf.getBean(alias); - fail("Shouldn't permit factory get on normal bean"); - } - catch (NoSuchBeanDefinitionException ex) { - // Ok - assertTrue(alias.equals(ex.getBeanName())); - } - - // Create alias - cbf.registerAlias("rod", alias); - Object rod = getBeanFactory().getBean("rod"); - Object aliasRod = getBeanFactory().getBean(alias); - assertTrue(rod == aliasRod); - } - - - public static class TestBeanEditor extends PropertyEditorSupport { - - @Override - public void setAsText(String text) { - TestBean tb = new TestBean(); - StringTokenizer st = new StringTokenizer(text, "_"); - tb.setName(st.nextToken()); - tb.setAge(Integer.parseInt(st.nextToken())); - setValue(tb); - } - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java deleted file mode 100644 index 2b089f87482..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.springframework.web.context; - -import org.springframework.beans.TestBean; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.FactoryBean; -import org.springframework.beans.factory.ListableBeanFactory; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFactoryTests { - - /** Subclasses must initialize this */ - protected ListableBeanFactory getListableBeanFactory() { - BeanFactory bf = getBeanFactory(); - if (!(bf instanceof ListableBeanFactory)) { - throw new IllegalStateException("ListableBeanFactory required"); - } - return (ListableBeanFactory) bf; - } - - /** - * Subclasses can override this. - */ - public void testCount() { - assertCount(13); - } - - protected final void assertCount(int count) { - String[] defnames = getListableBeanFactory().getBeanDefinitionNames(); - assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); - } - - public void assertTestBeanCount(int count) { - String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false); - assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + - defNames.length, defNames.length == count); - - int countIncludingFactoryBeans = count + 2; - String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true); - assertTrue("We should have " + countIncludingFactoryBeans + - " beans for class org.springframework.beans.TestBean, not " + names.length, - names.length == countIncludingFactoryBeans); - } - - public void testGetDefinitionsForNoSuchClass() { - String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class); - assertTrue("No string definitions", defnames.length == 0); - } - - /** - * Check that count refers to factory class, not bean class. (We don't know - * what type factories may return, and it may even change over time.) - */ - public void testGetCountForFactoryClass() { - assertTrue("Should have 2 factories, not " + - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - - assertTrue("Should have 2 factories, not " + - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, - getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - } - - public void testContainsBeanDefinition() { - assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); - assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); - } - -} \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/ContextLoaderTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/ContextLoaderTests.java index a84b83f7ad6..15a7e36fea4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/ContextLoaderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/ContextLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -36,10 +36,10 @@ import javax.servlet.ServletContextListener; import org.junit.Test; import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; -import org.springframework.beans.factory.LifecycleBean; +import org.springframework.tests.sample.beans.LifecycleBean; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextException; diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/ResourceBundleMessageSourceTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/ResourceBundleMessageSourceTests.java deleted file mode 100644 index b9710dd7980..00000000000 --- a/spring-webmvc/src/test/java/org/springframework/web/context/ResourceBundleMessageSourceTests.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright 2002-2012 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.web.context; - -import java.util.Date; -import java.util.Locale; - -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.MessageSource; -import org.springframework.context.NoSuchMessageException; -import org.springframework.context.support.AbstractMessageSource; -import org.springframework.mock.web.test.MockServletContext; -import org.springframework.ui.context.Theme; -import org.springframework.ui.context.ThemeSource; -import org.springframework.web.context.support.StaticWebApplicationContext; -import org.springframework.web.context.support.XmlWebApplicationContext; -import org.springframework.web.servlet.theme.AbstractThemeResolver; - -/** - * Creates a WebApplicationContext that points to a "web.xml" file that - * contains the entry for what file to use for the applicationContext - * (file "org/springframework/web/context/WEB-INF/applicationContext.xml"). - * That file then has an entry for a bean called "messageSource". - * Whatever the basename property is set to for this bean is what the name of - * a properties file in the classpath must be (in our case the name is - * "messages" - note no package names). - * Thus the catalog filename will be in the root of where the classes are compiled - * to and will be called "messages_XX_YY.properties" where "XX" and "YY" are the - * language and country codes known by the ResourceBundle class. - * - *

NOTE: The main method of this class is the "createWebApplicationContext(...)" method, - * and it was copied from org.springframework.web.context.XmlWebApplicationContextTests. - * - * @author Rod Johnson - * @author Jean-Pierre Pawlak - */ -public class ResourceBundleMessageSourceTests extends AbstractApplicationContextTests { - - /** - * We use ticket WAR root for file structure. - * We don't attempt to read web.xml. - */ - public static final String WAR_ROOT = "/org/springframework/web/context"; - - private ConfigurableWebApplicationContext root; - - private MessageSource themeMsgSource; - - @Override - protected ConfigurableApplicationContext createContext() throws Exception { - root = new XmlWebApplicationContext(); - MockServletContext sc = new MockServletContext(); - root.setServletContext(sc); - root.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/applicationContext.xml"}); - root.refresh(); - - ConfigurableWebApplicationContext wac = new XmlWebApplicationContext(); - wac.setParent(root); - wac.setServletContext(sc); - wac.setNamespace("test-servlet"); - wac.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/test-servlet.xml"}); - wac.refresh(); - - Theme theme = ((ThemeSource) wac).getTheme(AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME); - assertNotNull(theme); - assertTrue("Theme name has to be the default theme name", AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME.equals(theme.getName())); - themeMsgSource = theme.getMessageSource(); - assertNotNull(themeMsgSource); - return wac; - } - - @Override - public void testCount() { - assertTrue("should have 14 beans, not " + - this.applicationContext.getBeanDefinitionCount(), - this.applicationContext.getBeanDefinitionCount() == 14); - } - - /** - * Overridden as we can't trust superclass method. - * @see org.springframework.context.AbstractApplicationContextTests#testEvents() - */ - @Override - public void testEvents() throws Exception { - // Do nothing - } - - public void testRootMessageSourceWithUseCodeAsDefaultMessage() throws NoSuchMessageException { - AbstractMessageSource messageSource = (AbstractMessageSource) root.getBean("messageSource"); - messageSource.setUseCodeAsDefaultMessage(true); - - assertEquals("message1", applicationContext.getMessage("code1", null, Locale.getDefault())); - assertEquals("message2", applicationContext.getMessage("code2", null, Locale.getDefault())); - - try { - applicationContext.getMessage("code0", null, Locale.getDefault()); - fail("looking for code0 should throw a NoSuchMessageException"); - } - catch (NoSuchMessageException ex) { - // that's how it should be - } - } - - /** - * @see org.springframework.context.support.AbstractMessageSource for more details. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/messagesXXX.properties" files. - */ - public void testGetMessageWithDefaultPassedInAndFoundInMsgCatalog() { - assertTrue("valid msg from resourcebundle with default msg passed in returned default msg. Expected msg from catalog.", - getApplicationContext().getMessage("message.format.example2", null, "This is a default msg if not found in msg.cat.", Locale.US - ) - .equals("This is a test message in the message catalog with no args.")); - // getApplicationContext().getTheme("theme").getMessageSource().getMessage() - } - - /** - * @see org.springframework.context.support.AbstractMessageSource for more details. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/messagesXXX.properties" files. - */ - public void testGetMessageWithDefaultPassedInAndNotFoundInMsgCatalog() { - assertTrue("bogus msg from resourcebundle with default msg passed in returned default msg", - getApplicationContext().getMessage("bogus.message", null, "This is a default msg if not found in msg.cat.", Locale.UK - ) - .equals("This is a default msg if not found in msg.cat.")); - } - - /** - * The underlying implementation uses a hashMap to cache messageFormats - * once a message has been asked for. This test is an attempt to - * make sure the cache is being used properly. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/messagesXXX.properties" files. - * @see org.springframework.context.support.AbstractMessageSource for more details. - */ - public void testGetMessageWithMessageAlreadyLookedFor() throws Exception { - Object[] arguments = { - new Integer(7), new Date(System.currentTimeMillis()), - "a disturbance in the Force" - }; - - // The first time searching, we don't care about for this test - getApplicationContext().getMessage("message.format.example1", arguments, Locale.US); - - // Now msg better be as expected - assertTrue("2nd search within MsgFormat cache returned expected message for Locale.US", - getApplicationContext().getMessage("message.format.example1", arguments, Locale.US - ) - .indexOf("there was \"a disturbance in the Force\" on planet 7.") != -1); - - Object[] newArguments = { - new Integer(8), new Date(System.currentTimeMillis()), - "a disturbance in the Force" - }; - - // Now msg better be as expected even with different args - assertTrue("2nd search within MsgFormat cache with different args returned expected message for Locale.US", - getApplicationContext().getMessage("message.format.example1", newArguments, Locale.US - ) - .indexOf("there was \"a disturbance in the Force\" on planet 8.") != -1); - } - - /** - * @see org.springframework.context.support.AbstractMessageSource for more details. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/messagesXXX.properties" files. - * Example taken from the javadocs for the java.text.MessageFormat class - */ - public void testGetMessageWithNoDefaultPassedInAndFoundInMsgCatalog() throws Exception { - Object[] arguments = { - new Integer(7), new Date(System.currentTimeMillis()), - "a disturbance in the Force" - }; - - /* - Try with Locale.US - Since the msg has a time value in it, we will use String.indexOf(...) - to just look for a substring without the time. This is because it is - possible that by the time we store a time variable in this method - and the time the ResourceBundleMessageSource resolves the msg the - minutes of the time might not be the same. - */ - assertTrue("msg from resourcebundle for Locale.US substituting args for placeholders is as expected", - getApplicationContext().getMessage("message.format.example1", arguments, Locale.US - ) - .indexOf("there was \"a disturbance in the Force\" on planet 7.") != -1); - - // Try with Locale.UK - assertTrue("msg from resourcebundle for Locale.UK substituting args for placeholders is as expected", - getApplicationContext().getMessage("message.format.example1", arguments, Locale.UK - ) - .indexOf("there was \"a disturbance in the Force\" on station number 7.") != -1); - - // Try with Locale.US - different test msg that requires no args - assertTrue("msg from resourcebundle that requires no args for Locale.US is as expected", - getApplicationContext().getMessage("message.format.example2", null, Locale.US) - .equals("This is a test message in the message catalog with no args.")); - } - - /** - * @see org.springframework.context.support.AbstractMessageSource for more details. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/messagesXXX.properties" files. - */ - public void testGetMessageWithNoDefaultPassedInAndNotFoundInMsgCatalog() { - // Expecting an exception - try { - getApplicationContext().getMessage("bogus.message", null, Locale.UK); - fail("bogus msg from resourcebundle without default msg should have thrown exception"); - } - catch (NoSuchMessageException tExcept) { - assertTrue("bogus msg from resourcebundle without default msg threw expected exception", - true); - } - } - - public void testGetMultipleBasenamesForMessageSource() throws NoSuchMessageException { - assertEquals("message1", getApplicationContext().getMessage("code1", null, Locale.UK)); - assertEquals("message2", getApplicationContext().getMessage("code2", null, Locale.UK)); - assertEquals("message3", getApplicationContext().getMessage("code3", null, Locale.UK)); - } - - /** - * @see org.springframework.context.support.AbstractMessageSource for more details. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/themeXXX.properties" files. - */ - public void testGetMessageWithDefaultPassedInAndFoundInThemeCatalog() { - // Try with Locale.US - String msg = getThemeMessage("theme.example1", null, "This is a default theme msg if not found in theme cat.", Locale.US); - assertTrue("valid msg from theme resourcebundle with default msg passed in returned default msg. Expected msg from catalog. Received: " + msg, - msg.equals("This is a test message in the theme message catalog.")); - // Try with Locale.UK - msg = getThemeMessage("theme.example1", null, "This is a default theme msg if not found in theme cat.", Locale.UK); - assertTrue("valid msg from theme resourcebundle with default msg passed in returned default msg. Expected msg from catalog.", - msg.equals("This is a test message in the theme message catalog with no args.")); - } - - /** - * @see org.springframework.context.support.AbstractMessageSource for more details. - * NOTE: Messages are contained within the "test/org/springframework/web/context/WEB-INF/themeXXX.properties" files. - */ - public void testGetMessageWithDefaultPassedInAndNotFoundInThemeCatalog() { - assertTrue("bogus msg from theme resourcebundle with default msg passed in returned default msg", - getThemeMessage("bogus.message", null, "This is a default msg if not found in theme cat.", Locale.UK - ) - .equals("This is a default msg if not found in theme cat.")); - } - - public void testThemeSourceNesting() throws NoSuchMessageException { - String overriddenMsg = getThemeMessage("theme.example2", null, null, Locale.UK); - MessageSource ms = ((ThemeSource) root).getTheme(AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME).getMessageSource(); - String originalMsg = ms.getMessage("theme.example2", null, Locale.UK); - assertTrue("correct overridden msg", "test-message2".equals(overriddenMsg)); - assertTrue("correct original msg", "message2".equals(originalMsg)); - } - - public void testThemeSourceNestingWithParentDefault() throws NoSuchMessageException { - StaticWebApplicationContext leaf = new StaticWebApplicationContext(); - leaf.setParent(getApplicationContext()); - leaf.refresh(); - assertNotNull("theme still found", leaf.getTheme("theme")); - MessageSource ms = leaf.getTheme("theme").getMessageSource(); - String msg = ms.getMessage("theme.example2", null, null, Locale.UK); - assertEquals("correct overridden msg", "test-message2", msg); - } - - private String getThemeMessage(String code, Object args[], String defaultMessage, Locale locale) { - return themeMsgSource.getMessage(code, args, defaultMessage, locale); - } - -} diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml index e25d3317379..6080b76eb0a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml +++ b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/applicationContext.xml b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/applicationContext.xml index 3a59552ded2..b4d7c366f24 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/applicationContext.xml +++ b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/applicationContext.xml @@ -9,7 +9,7 @@ - + - + dummy @@ -45,7 +45,7 @@ Tests of lifecycle callbacks --> + class="org.springframework.tests.sample.beans.MustBeInitialized"> 31 - + - + Kerry 34 - + typeMismatch 34x @@ -31,20 +31,20 @@ + class="org.springframework.tests.sample.beans.factory.DummyFactory"> + class="org.springframework.tests.sample.beans.factory.DummyFactory"> false - + listenerVeto 66 - + diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/contextInclude.xml b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/contextInclude.xml index 2e4938383be..5f178d50ebb 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/contextInclude.xml +++ b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/contextInclude.xml @@ -1,6 +1,6 @@ - + yetanotherdummy diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/sessionContext.xml b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/sessionContext.xml index 7da590d1f21..eb7bf0f6eae 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/sessionContext.xml +++ b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/sessionContext.xml @@ -3,12 +3,12 @@ - + - + diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/test-servlet.xml b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/test-servlet.xml index 4002703b211..85885f238d0 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/test-servlet.xml +++ b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/test-servlet.xml @@ -15,7 +15,7 @@ - + Rod 31 @@ -28,32 +28,32 @@ 31 - + - + Kerry 34 - + typeMismatch 34x - + - + false - + listenerVeto 66 - + diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/testNamespace.xml b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/testNamespace.xml index dd10e5fcab7..89c42365d4a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/testNamespace.xml +++ b/spring-webmvc/src/test/java/org/springframework/web/context/WEB-INF/testNamespace.xml @@ -3,12 +3,12 @@ - + Rod 31 - + Kerry 34 diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java index 3423fd8e884..4dce1e9fac3 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,12 +21,13 @@ import java.util.Locale; import javax.servlet.ServletException; import org.springframework.beans.BeansException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.context.AbstractApplicationContextTests; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.NoSuchMessageException; import org.springframework.context.TestListener; diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java index 9e0784f2519..07823327e66 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -31,7 +31,7 @@ import java.util.Set; import org.junit.Test; import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.config.ConstructorArgumentValues; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/ComplexWebApplicationContext.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/ComplexWebApplicationContext.java index 1e44c2f8156..b5b4f0206fa 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/ComplexWebApplicationContext.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/ComplexWebApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -131,7 +131,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext { registerSingleton("viewResolver2", InternalResourceViewResolver.class, pvs); pvs = new MutablePropertyValues(); - pvs.add("commandClass", "org.springframework.beans.TestBean"); + pvs.add("commandClass", "org.springframework.tests.sample.beans.TestBean"); pvs.add("formView", "form"); registerSingleton("formHandler", SimpleFormController.class, pvs); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java index 287ea086eb4..147875e4ca4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -36,7 +36,7 @@ import junit.framework.TestCase; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.core.env.ConfigurableEnvironment; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java index dbbb25fe5a9..ce525f937da 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -50,7 +50,7 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext { @Override public void refresh() throws BeansException { MutablePropertyValues pvs = new MutablePropertyValues(); - pvs.add("commandClass", "org.springframework.beans.TestBean"); + pvs.add("commandClass", "org.springframework.tests.sample.beans.TestBean"); pvs.add("formView", "form"); registerSingleton("/form.do", SimpleFormController.class, pvs); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportExtensionTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportExtensionTests.java index 1c270ae5716..40f10ea7e60 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportExtensionTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportExtensionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.convert.converter.Converter; import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.format.FormatterRegistry; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CancellableFormControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CancellableFormControllerTests.java index ea1b09ed217..ff3ebd962f4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CancellableFormControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CancellableFormControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.TestCase; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; import org.springframework.validation.BindException; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java index 4749c85df72..da2da2e174a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.TestCase; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java index d62174ab265..3c40caacd6b 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.TestCase; -import org.springframework.beans.IndexedTestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.support.StaticApplicationContext; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java index 705ac4ea815..1d37caff853 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,7 +28,7 @@ import javax.servlet.http.HttpSession; import junit.framework.TestCase; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; import org.springframework.util.ObjectUtils; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java index 05e0f3c2a51..bbfa7e29902 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -59,12 +59,12 @@ import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreato import org.springframework.aop.interceptor.SimpleTraceInterceptor; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.beans.BeansException; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.GenericBean; -import org.springframework.beans.ITestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.GenericBean; +import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.PropertyEditorRegistry; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -329,7 +329,7 @@ public class ServletAnnotationControllerTests { request.addParameter("testBeanSet", new String[] {"1", "2"}); MockHttpServletResponse response = new MockHttpServletResponse(); servlet.service(request, response); - assertEquals("[1, 2]-org.springframework.beans.TestBean", response.getContentAsString()); + assertEquals("[1, 2]-org.springframework.tests.sample.beans.TestBean", response.getContentAsString()); } @Test diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinderTests.java index 32ac81d6687..33307032e58 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -23,7 +23,7 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.WebDataBinder; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java index 54d187f91a1..e0a515c3b05 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,7 +28,7 @@ import java.util.List; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.MethodParameter; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.ui.ExtendedModelMap; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java index 450315e6de4..caa7fbcea66 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -44,7 +44,7 @@ import javax.validation.Valid; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.core.MethodParameter; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java index 3d77c292373..a15466aabc0 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -36,13 +36,13 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.http.client.FreePortScanner; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.ResourceHttpMessageConverter; import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter; import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; import org.springframework.stereotype.Controller; +import org.springframework.tests.web.FreePortScanner; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java index 21ef1b19592..26e95d0c33d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,7 +25,7 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.MethodParameter; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java index e42ccb29693..6c5c7327e08 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -64,10 +64,10 @@ import org.junit.Test; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.aop.interceptor.SimpleTraceInterceptor; import org.springframework.aop.support.DefaultPointcutAdvisor; -import org.springframework.beans.DerivedTestBean; -import org.springframework.beans.GenericBean; -import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.GenericBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -283,7 +283,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl request.addParameter("testBeanSet", new String[] {"1", "2"}); MockHttpServletResponse response = new MockHttpServletResponse(); getServlet().service(request, response); - assertEquals("[1, 2]-org.springframework.beans.TestBean", response.getContentAsString()); + assertEquals("[1, 2]-org.springframework.tests.sample.beans.TestBean", response.getContentAsString()); } @Test diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java index 18ae25f7e01..64de09b05af 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,7 +30,7 @@ import javax.servlet.http.HttpSession; import junit.framework.TestCase; import org.springframework.beans.FatalBeanException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.ApplicationContextException; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolverTests.java index 852c95fd8af..fe492bab941 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -26,7 +26,7 @@ import java.util.Collections; import org.junit.Before; import org.junit.Test; import org.springframework.beans.ConversionNotSupportedException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.TypeMismatchException; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java index 8a0518c5607..cb7b41e9d69 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -24,7 +24,7 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.convert.converter.Converter; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.format.support.FormattingConversionService; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/BindTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/BindTagTests.java index 98764500996..4af3a47cde6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/BindTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/BindTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,9 +27,9 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.IndexedTestBean; -import org.springframework.beans.NestedTestBean; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.IndexedTestBean; +import org.springframework.tests.sample.beans.NestedTestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractFormTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractFormTagTests.java index e380397ed48..f1b27c493ed 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractFormTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractFormTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.JspException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockPageContext; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java index 1d299c222ad..b471438f1e6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import java.io.Writer; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Rossen Stoyanchev diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxTagTests.java index 70aae8f0e49..657aab3c24a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -32,9 +32,9 @@ import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; -import org.springframework.beans.Colour; -import org.springframework.beans.Pet; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.Colour; +import org.springframework.tests.sample.beans.Pet; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BindingResult; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxesTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxesTagTests.java index 055580d5a34..9ffeefbf2ca 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxesTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/CheckboxesTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -36,9 +36,9 @@ import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; -import org.springframework.beans.Colour; -import org.springframework.beans.Pet; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.Colour; +import org.springframework.tests.sample.beans.Pet; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.format.Formatter; import org.springframework.format.support.FormattingConversionService; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ErrorsTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ErrorsTagTests.java index 6e11e063319..a36012bb60e 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ErrorsTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ErrorsTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,7 +25,7 @@ import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.BodyTag; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockBodyContent; import org.springframework.mock.web.test.MockPageContext; import org.springframework.validation.BeanPropertyBindingResult; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/HiddenInputTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/HiddenInputTagTests.java index 60beaccb6d1..613196224c0 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/HiddenInputTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/HiddenInputTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.BeanPropertyBindingResult; /** diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/InputTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/InputTagTests.java index 7ca869480b1..52ba57f9f27 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/InputTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/InputTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -21,7 +21,7 @@ import java.io.Writer; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.web.servlet.support.BindStatus; import org.springframework.web.servlet.tags.BindTag; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/LabelTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/LabelTagTests.java index 5654062ff7d..23b9016c747 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/LabelTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/LabelTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,7 +19,7 @@ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockPageContext; import org.springframework.web.servlet.tags.NestedPathTag; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagEnumTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagEnumTests.java index 7144652045e..aa853b99bfa 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagEnumTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagEnumTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,8 +19,8 @@ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.tagext.BodyTag; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.CustomEnum; -import org.springframework.beans.GenericBean; +import org.springframework.tests.sample.beans.CustomEnum; +import org.springframework.tests.sample.beans.GenericBean; import org.springframework.web.servlet.support.BindStatus; /** diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java index 3acacbb8b8d..1d554f5ef4f 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -25,8 +25,8 @@ import java.util.List; import javax.servlet.jsp.tagext.BodyTag; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.Colour; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.Colour; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.StringArrayPropertyEditor; import org.springframework.mock.web.test.MockBodyContent; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionsTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionsTagTests.java index 92290c23cc9..964e2d412f5 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionsTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionsTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -31,7 +31,7 @@ import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockPageContext; import org.springframework.validation.BeanPropertyBindingResult; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonTagTests.java index bcb5eeebaff..42190d39f82 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,8 +27,8 @@ import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; -import org.springframework.beans.Pet; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.Pet; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BindingResult; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonsTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonsTagTests.java index 93f6a04080a..702e790c9a3 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonsTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/RadioButtonsTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -34,9 +34,9 @@ import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; -import org.springframework.beans.Colour; -import org.springframework.beans.Pet; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.Colour; +import org.springframework.tests.sample.beans.Pet; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BindingResult; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/SelectTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/SelectTagTests.java index 8786a091fae..8dfc3e3e0cf 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/SelectTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/SelectTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -38,7 +38,7 @@ import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.propertyeditors.CustomCollectionEditor; import org.springframework.format.Formatter; import org.springframework.format.support.FormattingConversionService; @@ -337,7 +337,7 @@ public class SelectTagTests extends AbstractFormTagTests { catch (JspException expected) { String message = expected.getMessage(); assertTrue(message.indexOf("items") > -1); - assertTrue(message.indexOf("org.springframework.beans.TestBean") > -1); + assertTrue(message.indexOf("org.springframework.tests.sample.beans.TestBean") > -1); } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TestBeanWithRealCountry.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TestBeanWithRealCountry.java index e1a6a313d0d..4ea337bbd75 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TestBeanWithRealCountry.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TestBeanWithRealCountry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2013 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,7 @@ package org.springframework.web.servlet.tags.form; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; /** * @author Juergen Hoeller diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TextareaTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TextareaTagTests.java index 4684b5b659a..bfa9bd8dbe1 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TextareaTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/TextareaTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,7 +18,7 @@ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.tagext.Tag; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.BeanPropertyBindingResult; /** diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java index d252550f18a..d3c45fb2493 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -36,7 +36,7 @@ import junit.framework.AssertionFailedError; import org.easymock.EasyMock; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.http.HttpStatus; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ViewResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ViewResolverTests.java index fadc6063737..3836559480d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ViewResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ViewResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -35,7 +35,7 @@ import org.junit.Test; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.context.ApplicationContextException; import org.springframework.core.io.ClassPathResource; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java index d3af0683f4f..17a4c4f50c4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java index 3ed42765505..04c8497df3c 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -27,7 +27,7 @@ import org.apache.velocity.Template; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.context.Context; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; import org.springframework.mock.web.test.MockServletContext; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java index ff477a97f4b..b07a53716ea 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -33,7 +33,7 @@ import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.springframework.beans.TestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; import org.springframework.mock.web.test.MockServletContext; diff --git a/spring-webmvc/src/test/resources/org/springframework/web/context/WEB-INF/sessionContext.xml b/spring-webmvc/src/test/resources/org/springframework/web/context/WEB-INF/sessionContext.xml index 7da590d1f21..eb7bf0f6eae 100644 --- a/spring-webmvc/src/test/resources/org/springframework/web/context/WEB-INF/sessionContext.xml +++ b/spring-webmvc/src/test/resources/org/springframework/web/context/WEB-INF/sessionContext.xml @@ -3,12 +3,12 @@ - + - + diff --git a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests-context.xml b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests-context.xml index 4be55f0ea74..49e480a6644 100644 --- a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests-context.xml +++ b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests-context.xml @@ -11,19 +11,19 @@ - + - + - + - + diff --git a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java index 7472033a36b..8a3c1786275 100644 --- a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java +++ b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -17,20 +17,22 @@ package org.springframework.aop.config; import static java.lang.String.format; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; -import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import test.beans.ITestBean; -import test.beans.TestBean; -import test.util.SerializationTestUtils; - import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.context.ApplicationContext; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpSession; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.ClassUtils; +import org.springframework.util.SerializationTestUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.support.XmlWebApplicationContext; diff --git a/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests-context.xml b/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests-context.xml index 4f9a0361c04..c5b04a53df3 100644 --- a/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests-context.xml +++ b/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests-context.xml @@ -22,20 +22,20 @@ 9 false - + 11 true - + true - - + + @@ -71,37 +71,37 @@ - + - - - - - + + + + + - test.beans.ITestBean.getName + org.springframework.tests.sample.beans.ITestBean.getName - + - + 4 - + - + - + diff --git a/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java b/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java index 74ff0825e65..d2fbb3e1e06 100644 --- a/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java +++ b/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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.aop.framework.autoproxy; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.lang.reflect.Method; @@ -30,16 +32,13 @@ import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.tests.aop.advice.CountingBeforeAdvice; +import org.springframework.tests.aop.advice.MethodCounter; +import org.springframework.tests.aop.interceptor.NopInterceptor; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.NoTransactionException; -import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.interceptor.TransactionInterceptor; -import org.springframework.transaction.support.AbstractPlatformTransactionManager; -import org.springframework.transaction.support.DefaultTransactionStatus; - -import test.advice.CountingBeforeAdvice; -import test.advice.MethodCounter; -import test.beans.ITestBean; -import test.interceptor.NopInterceptor; /** * Integration tests for auto proxy creation by advisor recognition working in @@ -316,43 +315,3 @@ class Rollback { } } - - -@SuppressWarnings("serial") -class CallCountingTransactionManager extends AbstractPlatformTransactionManager { - - public TransactionDefinition lastDefinition; - public int begun; - public int commits; - public int rollbacks; - public int inflight; - - @Override - protected Object doGetTransaction() { - return new Object(); - } - - @Override - protected void doBegin(Object transaction, TransactionDefinition definition) { - this.lastDefinition = definition; - ++begun; - ++inflight; - } - - @Override - protected void doCommit(DefaultTransactionStatus status) { - ++commits; - --inflight; - } - - @Override - protected void doRollback(DefaultTransactionStatus status) { - ++rollbacks; - --inflight; - } - - public void clear() { - begun = commits = rollbacks = inflight = 0; - } - -} diff --git a/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java b/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java index fae32ac8f52..aca10a3fb26 100644 --- a/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java +++ b/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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,11 +16,18 @@ package org.springframework.scheduling.annotation; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.replay; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.concurrent.atomic.AtomicInteger; import org.junit.Before; import org.junit.Test; - import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -31,16 +38,11 @@ import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.stereotype.Repository; import org.springframework.tests.Assume; import org.springframework.tests.TestGroup; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; -import static org.easymock.EasyMock.*; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - /** * Integration tests cornering bug SPR-8651, which revealed that @Scheduled methods may * not work well with beans that have already been proxied for other reasons such diff --git a/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java deleted file mode 100644 index ff94b0dd222..00000000000 --- a/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2002-2012 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.transaction; - - - -import org.springframework.transaction.support.AbstractPlatformTransactionManager; -import org.springframework.transaction.support.DefaultTransactionStatus; - -/** - * @author Rod Johnson - * @author Juergen Hoeller - */ -@SuppressWarnings("serial") -public class CallCountingTransactionManager extends AbstractPlatformTransactionManager { - - public TransactionDefinition lastDefinition; - public int begun; - public int commits; - public int rollbacks; - public int inflight; - - @Override - protected Object doGetTransaction() { - return new Object(); - } - - @Override - protected void doBegin(Object transaction, TransactionDefinition definition) { - this.lastDefinition = definition; - ++begun; - ++inflight; - } - - @Override - protected void doCommit(DefaultTransactionStatus status) { - ++commits; - --inflight; - } - - @Override - protected void doRollback(DefaultTransactionStatus status) { - ++rollbacks; - --inflight; - } - - public void clear() { - begun = commits = rollbacks = inflight = 0; - } - -} diff --git a/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementIntegrationTests.java b/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementIntegrationTests.java index d4f33e642e8..54511e7e7b4 100644 --- a/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementIntegrationTests.java +++ b/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -46,7 +46,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.stereotype.Repository; -import org.springframework.transaction.CallCountingTransactionManager; +import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor; diff --git a/src/test/java/test/advice/CountingBeforeAdvice.java b/src/test/java/test/advice/CountingBeforeAdvice.java deleted file mode 100644 index 5aa37b61e14..00000000000 --- a/src/test/java/test/advice/CountingBeforeAdvice.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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 test.advice; - -import java.lang.reflect.Method; - -import org.springframework.aop.MethodBeforeAdvice; - -/** - * Simple before advice example that we can use for counting checks. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice { - - @Override - public void before(Method m, Object[] args, Object target) throws Throwable { - count(m); - } - -} diff --git a/src/test/java/test/beans/Colour.java b/src/test/java/test/beans/Colour.java deleted file mode 100644 index 533d0df36e3..00000000000 --- a/src/test/java/test/beans/Colour.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import org.springframework.core.enums.ShortCodedLabeledEnum; - -/** - * @author Rob Harrop - */ -@SuppressWarnings("serial") -public class Colour extends ShortCodedLabeledEnum { - - public static final Colour RED = new Colour(0, "RED"); - public static final Colour BLUE = new Colour(1, "BLUE"); - public static final Colour GREEN = new Colour(2, "GREEN"); - public static final Colour PURPLE = new Colour(3, "PURPLE"); - - private Colour(int code, String label) { - super(code, label); - } - -} diff --git a/src/test/java/test/beans/INestedTestBean.java b/src/test/java/test/beans/INestedTestBean.java deleted file mode 100644 index 2b63908467c..00000000000 --- a/src/test/java/test/beans/INestedTestBean.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -public interface INestedTestBean { - - public String getCompany(); - -} diff --git a/src/test/java/test/beans/IOther.java b/src/test/java/test/beans/IOther.java deleted file mode 100644 index f0c6aa7bf46..00000000000 --- a/src/test/java/test/beans/IOther.java +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright 2002-2012 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 test.beans; - -public interface IOther { - - void absquatulate(); - -} diff --git a/src/test/java/test/beans/ITestBean.java b/src/test/java/test/beans/ITestBean.java deleted file mode 100644 index 0434b6ad114..00000000000 --- a/src/test/java/test/beans/ITestBean.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.IOException; - -/** - * Interface used for {@link TestBean}. - * - *

Two methods are the same as on Person, but if this - * extends person it breaks quite a few tests.. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public interface ITestBean { - - int getAge(); - - void setAge(int age); - - String getName(); - - void setName(String name); - - ITestBean getSpouse(); - - void setSpouse(ITestBean spouse); - - ITestBean[] getSpouses(); - - String[] getStringArray(); - - void setStringArray(String[] stringArray); - - /** - * Throws a given (non-null) exception. - */ - void exceptional(Throwable t) throws Throwable; - - Object returnsThis(); - - INestedTestBean getDoctor(); - - INestedTestBean getLawyer(); - - IndexedTestBean getNestedIndexedBean(); - - /** - * Increment the age by one. - * @return the previous age - */ - int haveBirthday(); - - void unreliableFileOperation() throws IOException; - -} diff --git a/src/test/java/test/beans/IndexedTestBean.java b/src/test/java/test/beans/IndexedTestBean.java deleted file mode 100644 index 160681e5565..00000000000 --- a/src/test/java/test/beans/IndexedTestBean.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * @author Juergen Hoeller - * @since 11.11.2003 - */ -public class IndexedTestBean { - - private TestBean[] array; - - private Collection collection; - - private List list; - - private Set set; - - private SortedSet sortedSet; - - private Map map; - - private SortedMap sortedMap; - - - public IndexedTestBean() { - this(true); - } - - public IndexedTestBean(boolean populate) { - if (populate) { - populate(); - } - } - - public void populate() { - TestBean tb0 = new TestBean("name0", 0); - TestBean tb1 = new TestBean("name1", 0); - TestBean tb2 = new TestBean("name2", 0); - TestBean tb3 = new TestBean("name3", 0); - TestBean tb4 = new TestBean("name4", 0); - TestBean tb5 = new TestBean("name5", 0); - TestBean tb6 = new TestBean("name6", 0); - TestBean tb7 = new TestBean("name7", 0); - TestBean tbX = new TestBean("nameX", 0); - TestBean tbY = new TestBean("nameY", 0); - this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); - this.list.add(tb2); - this.list.add(tb3); - this.set = new TreeSet(); - this.set.add(tb6); - this.set.add(tb7); - this.map = new HashMap(); - this.map.put("key1", tb4); - this.map.put("key2", tb5); - this.map.put("key.3", tb5); - List list = new ArrayList(); - list.add(tbX); - list.add(tbY); - this.map.put("key4", list); - } - - - public TestBean[] getArray() { - return array; - } - - public void setArray(TestBean[] array) { - this.array = array; - } - - public Collection getCollection() { - return collection; - } - - public void setCollection(Collection collection) { - this.collection = collection; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - public Set getSet() { - return set; - } - - public void setSet(Set set) { - this.set = set; - } - - public SortedSet getSortedSet() { - return sortedSet; - } - - public void setSortedSet(SortedSet sortedSet) { - this.sortedSet = sortedSet; - } - - public Map getMap() { - return map; - } - - public void setMap(Map map) { - this.map = map; - } - - public SortedMap getSortedMap() { - return sortedMap; - } - - public void setSortedMap(SortedMap sortedMap) { - this.sortedMap = sortedMap; - } - -} diff --git a/src/test/java/test/beans/NestedTestBean.java b/src/test/java/test/beans/NestedTestBean.java deleted file mode 100644 index c6d1acd27b5..00000000000 --- a/src/test/java/test/beans/NestedTestBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -/** - * Simple nested test bean used for testing bean factories, AOP framework etc. - * - * @author Trevor D. Cook - * @since 30.09.2003 - */ -public class NestedTestBean implements INestedTestBean { - - private String company = ""; - - public NestedTestBean() { - } - - public NestedTestBean(String company) { - setCompany(company); - } - - public void setCompany(String company) { - this.company = (company != null ? company : ""); - } - - @Override - public String getCompany() { - return company; - } - - public boolean equals(Object obj) { - if (!(obj instanceof NestedTestBean)) { - return false; - } - NestedTestBean ntb = (NestedTestBean) obj; - return this.company.equals(ntb.company); - } - - public int hashCode() { - return this.company.hashCode(); - } - - public String toString() { - return "NestedTestBean: " + this.company; - } - -} diff --git a/src/test/java/test/beans/Pet.java b/src/test/java/test/beans/Pet.java deleted file mode 100644 index f81ac4f0921..00000000000 --- a/src/test/java/test/beans/Pet.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -/** - * @author Rob Harrop - * @since 2.0 - */ -public class Pet { - - private String name; - - public Pet(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String toString() { - return getName(); - } - - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final Pet pet = (Pet) o; - - if (name != null ? !name.equals(pet.name) : pet.name != null) return false; - - return true; - } - - public int hashCode() { - return (name != null ? name.hashCode() : 0); - } - -} diff --git a/src/test/java/test/beans/TestBean.java b/src/test/java/test/beans/TestBean.java deleted file mode 100644 index b76f12a75e8..00000000000 --- a/src/test/java/test/beans/TestBean.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright 2002-2012 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 test.beans; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.util.ObjectUtils; - -/** - * Simple test bean used for testing bean factories, the AOP framework etc. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 15 April 2001 - */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { - - private String beanName; - - private String country; - - private BeanFactory beanFactory; - - private boolean postProcessed; - - private String name; - - private String sex; - - private int age; - - private boolean jedi; - - private ITestBean[] spouses; - - private String touchy; - - private String[] stringArray; - - private Integer[] someIntegerArray; - - private Date date = new Date(); - - private Float myFloat = new Float(0.0); - - private Collection friends = new LinkedList(); - - private Set someSet = new HashSet(); - - private Map someMap = new HashMap(); - - private List someList = new ArrayList(); - - private Properties someProperties = new Properties(); - - private INestedTestBean doctor = new NestedTestBean(); - - private INestedTestBean lawyer = new NestedTestBean(); - - private IndexedTestBean nestedIndexedBean; - - private boolean destroyed; - - private Number someNumber; - - private Colour favouriteColour; - - private Boolean someBoolean; - - private List otherColours; - - private List pets; - - - public TestBean() { - } - - public TestBean(String name) { - this.name = name; - } - - public TestBean(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - public TestBean(String name, int age) { - this.name = name; - this.age = age; - } - - public TestBean(ITestBean spouse, Properties someProperties) { - this.spouses = new ITestBean[] {spouse}; - this.someProperties = someProperties; - } - - public TestBean(List someList) { - this.someList = someList; - } - - public TestBean(Set someSet) { - this.someSet = someSet; - } - - public TestBean(Map someMap) { - this.someMap = someMap; - } - - public TestBean(Properties someProperties) { - this.someProperties = someProperties; - } - - - @Override - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) { - this.beanFactory = beanFactory; - } - - public BeanFactory getBeanFactory() { - return beanFactory; - } - - public void setPostProcessed(boolean postProcessed) { - this.postProcessed = postProcessed; - } - - public boolean isPostProcessed() { - return postProcessed; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - if (this.name == null) { - this.name = sex; - } - } - - @Override - public int getAge() { - return age; - } - - @Override - public void setAge(int age) { - this.age = age; - } - - public boolean isJedi() { - return jedi; - } - - public void setJedi(boolean jedi) { - this.jedi = jedi; - } - - @Override - public ITestBean getSpouse() { - return (spouses != null ? spouses[0] : null); - } - - @Override - public void setSpouse(ITestBean spouse) { - this.spouses = new ITestBean[] {spouse}; - } - - @Override - public ITestBean[] getSpouses() { - return spouses; - } - - public String getTouchy() { - return touchy; - } - - public void setTouchy(String touchy) throws Exception { - if (touchy.indexOf('.') != -1) { - throw new Exception("Can't contain a ."); - } - if (touchy.indexOf(',') != -1) { - throw new NumberFormatException("Number format exception: contains a ,"); - } - this.touchy = touchy; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String[] getStringArray() { - return stringArray; - } - - @Override - public void setStringArray(String[] stringArray) { - this.stringArray = stringArray; - } - - public Integer[] getSomeIntegerArray() { - return someIntegerArray; - } - - public void setSomeIntegerArray(Integer[] someIntegerArray) { - this.someIntegerArray = someIntegerArray; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getMyFloat() { - return myFloat; - } - - public void setMyFloat(Float myFloat) { - this.myFloat = myFloat; - } - - public Collection getFriends() { - return friends; - } - - public void setFriends(Collection friends) { - this.friends = friends; - } - - public Set getSomeSet() { - return someSet; - } - - public void setSomeSet(Set someSet) { - this.someSet = someSet; - } - - public Map getSomeMap() { - return someMap; - } - - public void setSomeMap(Map someMap) { - this.someMap = someMap; - } - - public List getSomeList() { - return someList; - } - - public void setSomeList(List someList) { - this.someList = someList; - } - - public Properties getSomeProperties() { - return someProperties; - } - - public void setSomeProperties(Properties someProperties) { - this.someProperties = someProperties; - } - - @Override - public INestedTestBean getDoctor() { - return doctor; - } - - public void setDoctor(INestedTestBean doctor) { - this.doctor = doctor; - } - - @Override - public INestedTestBean getLawyer() { - return lawyer; - } - - public void setLawyer(INestedTestBean lawyer) { - this.lawyer = lawyer; - } - - public Number getSomeNumber() { - return someNumber; - } - - public void setSomeNumber(Number someNumber) { - this.someNumber = someNumber; - } - - public Colour getFavouriteColour() { - return favouriteColour; - } - - public void setFavouriteColour(Colour favouriteColour) { - this.favouriteColour = favouriteColour; - } - - public Boolean getSomeBoolean() { - return someBoolean; - } - - public void setSomeBoolean(Boolean someBoolean) { - this.someBoolean = someBoolean; - } - - @Override - public IndexedTestBean getNestedIndexedBean() { - return nestedIndexedBean; - } - - public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { - this.nestedIndexedBean = nestedIndexedBean; - } - - public List getOtherColours() { - return otherColours; - } - - public void setOtherColours(List otherColours) { - this.otherColours = otherColours; - } - - public List getPets() { - return pets; - } - - public void setPets(List pets) { - this.pets = pets; - } - - - /** - * @see ITestBean#exceptional(Throwable) - */ - @Override - public void exceptional(Throwable t) throws Throwable { - if (t != null) { - throw t; - } - } - - @Override - public void unreliableFileOperation() throws IOException { - throw new IOException(); - } - /** - * @see ITestBean#returnsThis() - */ - @Override - public Object returnsThis() { - return this; - } - - /** - * @see IOther#absquatulate() - */ - @Override - public void absquatulate() { - } - - @Override - public int haveBirthday() { - return age++; - } - - - public void destroy() { - this.destroyed = true; - } - - public boolean wasDestroyed() { - return destroyed; - } - - - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || !(other instanceof TestBean)) { - return false; - } - TestBean tb2 = (TestBean) other; - return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age); - } - - public int hashCode() { - return this.age; - } - - @Override - public int compareTo(Object other) { - if (this.name != null && other instanceof TestBean) { - return this.name.compareTo(((TestBean) other).getName()); - } - else { - return 1; - } - } - - public String toString() { - return this.name; - } - -} diff --git a/src/test/java/test/interceptor/NopInterceptor.java b/src/test/java/test/interceptor/NopInterceptor.java deleted file mode 100644 index b1cdf832a4a..00000000000 --- a/src/test/java/test/interceptor/NopInterceptor.java +++ /dev/null @@ -1,59 +0,0 @@ - -/* - * Copyright 2002-2012 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 test.interceptor; - -import org.aopalliance.intercept.MethodInterceptor; -import org.aopalliance.intercept.MethodInvocation; - -/** - * Trivial interceptor that can be introduced in a chain to display it. - * - * @author Rod Johnson - */ -public class NopInterceptor implements MethodInterceptor { - - private int count; - - /** - * @see org.aopalliance.intercept.MethodInterceptor#invoke(MethodInvocation) - */ - @Override - public Object invoke(MethodInvocation invocation) throws Throwable { - increment(); - return invocation.proceed(); - } - - public int getCount() { - return this.count; - } - - protected void increment() { - ++count; - } - - public boolean equals(Object other) { - if (!(other instanceof NopInterceptor)) { - return false; - } - if (this == other) { - return true; - } - return this.count == ((NopInterceptor) other).count; - } - -} diff --git a/src/test/java/test/interceptor/SerializableNopInterceptor.java b/src/test/java/test/interceptor/SerializableNopInterceptor.java deleted file mode 100644 index d2fbdc584af..00000000000 --- a/src/test/java/test/interceptor/SerializableNopInterceptor.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2002-2012 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 test.interceptor; - -import java.io.Serializable; - - -/** - * Subclass of NopInterceptor that is serializable and - * can be used to test proxy serialization. - * - * @author Rod Johnson - */ -@SuppressWarnings("serial") -public class SerializableNopInterceptor extends NopInterceptor implements Serializable { - - /** - * We must override this field and the related methods as - * otherwise count won't be serialized from the non-serializable - * NopInterceptor superclass. - */ - private int count; - - @Override - public int getCount() { - return this.count; - } - - @Override - protected void increment() { - ++count; - } - -} \ No newline at end of file diff --git a/src/test/java/test/util/SerializationTestUtils.java b/src/test/java/test/util/SerializationTestUtils.java deleted file mode 100644 index e9bc9fee04a..00000000000 --- a/src/test/java/test/util/SerializationTestUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2002-2012 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 test.util; - -import java.awt.*; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; - -import static org.junit.Assert.*; -import org.junit.Test; -import test.beans.TestBean; - -/** - * Utilities for testing serializability of objects. - * Exposes static methods for use in other test cases. - * Contains {@link org.junit.Test} methods to test itself. - * - * @author Rod Johnson - * @author Chris Beams - */ -public final class SerializationTestUtils { - - public static void testSerialization(Object o) throws IOException { - OutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - } - - public static boolean isSerializable(Object o) throws IOException { - try { - testSerialization(o); - return true; - } - catch (NotSerializableException ex) { - return false; - } - } - - public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(o); - oos.flush(); - baos.flush(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(is); - Object o2 = ois.readObject(); - return o2; - } - - - @Test(expected=NotSerializableException.class) - public void testWithNonSerializableObject() throws IOException { - TestBean o = new TestBean(); - assertFalse(o instanceof Serializable); - assertFalse(isSerializable(o)); - - testSerialization(o); - } - - @Test - public void testWithSerializableObject() throws Exception { - int x = 5; - int y = 10; - Point p = new Point(x, y); - assertTrue(p instanceof Serializable); - - testSerialization(p); - - assertTrue(isSerializable(p)); - - Point p2 = (Point) serializeAndDeserialize(p); - assertNotSame(p, p2); - assertEquals(x, (int) p2.getX()); - assertEquals(y, (int) p2.getY()); - } - -}