diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java index 2e7b84ffb0b..5d72d4f0068 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java @@ -27,7 +27,8 @@ import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.DerivedTestBean; import org.springframework.beans.ITestBean; import org.springframework.beans.TestBean; -import org.springframework.util.SerializationTestUtils; + +import test.util.SerializationTestUtils; /** * @author Juergen Hoeller diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java index c33782401ec..80f62da86b7 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; * Unit tests for the {@link DefaultScopedObject} class. * * @author Rick Evans + * @author Chris Beams */ public final class DefaultScopedObjectTests { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/scope/scopedAutowireFalse.xml b/org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests-scopedAutowireFalse.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/scope/scopedAutowireFalse.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests-scopedAutowireFalse.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/scope/scopedAutowireTrue.xml b/org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests-scopedAutowireTrue.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/scope/scopedAutowireTrue.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests-scopedAutowireTrue.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java index ab32bec7fa4..710786dbde3 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,11 +26,19 @@ import org.springframework.core.io.ClassPathResource; * @author Mark Fisher * @author Chris Beams */ -public class ScopedProxyAutowireTests { +public final class ScopedProxyAutowireTests { + + private static final Class CLASS = ScopedProxyAutowireTests.class; + private static final String CLASSNAME = CLASS.getSimpleName(); + + private static final ClassPathResource SCOPED_AUTOWIRE_TRUE_CONTEXT = + new ClassPathResource(CLASSNAME + "-scopedAutowireTrue.xml", CLASS); + private static final ClassPathResource SCOPED_AUTOWIRE_FALSE_CONTEXT = + new ClassPathResource(CLASSNAME + "-scopedAutowireFalse.xml", CLASS); @Test public void testScopedProxyInheritsAutowireCandidateFalse() { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("scopedAutowireFalse.xml", getClass())); + XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_FALSE_CONTEXT); TestBean autowired = (TestBean) bf.getBean("autowired"); TestBean unscoped = (TestBean) bf.getBean("unscoped"); assertSame(unscoped, autowired.getChild()); @@ -38,7 +46,7 @@ public class ScopedProxyAutowireTests { @Test public void testScopedProxyReplacesAutowireCandidateTrue() { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("scopedAutowireTrue.xml", getClass())); + XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_TRUE_CONTEXT); TestBean autowired = (TestBean) bf.getBean("autowired"); TestBean scoped = (TestBean) bf.getBean("scoped"); assertSame(scoped, autowired.getChild()); diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java index 0dc9bbfda80..1248e396369 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java @@ -23,7 +23,8 @@ import java.io.IOException; import org.junit.Before; import org.junit.Test; import org.springframework.beans.TestBean; -import org.springframework.util.SerializationTestUtils; + +import test.util.SerializationTestUtils; /** * @author Rod Johnson diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java index 576e335229b..9e0bfd252e5 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,15 +27,15 @@ import org.springframework.aop.Pointcut; import org.springframework.aop.interceptor.ExposeInvocationInterceptor; import org.springframework.aop.target.EmptyTargetSource; import org.springframework.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import test.interceptor.NopInterceptor; +import test.util.SerializationTestUtils; /** * @author Rod Johnson * @author Chris Beams */ -public class AopUtilsTests { +public final class AopUtilsTests { @Test public void testPointcutCanNeverApply() { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java index 0610b8f6a27..074dccdce62 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java @@ -1,6 +1,5 @@ - /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +28,7 @@ import org.springframework.core.NestedRuntimeException; * @author Rod Johnson * @author Chris Beams */ -public class ClassFiltersTests { +public final class ClassFiltersTests { private ClassFilter exceptionFilter = new RootClassFilter(Exception.class); diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java index ebe1f00090f..c31340b023e 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java @@ -1,6 +1,5 @@ - /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +31,7 @@ import org.springframework.core.NestedRuntimeException; * @author Rod Johnson * @author Chris Beams */ -public class ComposablePointcutTests { +public final class ComposablePointcutTests { public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() { public boolean matches(Method m, Class targetClass) { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java index 469274e6990..16a573e88b4 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import test.interceptor.NopInterceptor; * @author Rod Johnson * @author Chris Beams */ -public class ControlFlowPointcutTests { +public final class ControlFlowPointcutTests { @Test public void testMatches() { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java index 4a3a5d7e3a2..72677482da6 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,9 +32,9 @@ import org.springframework.beans.NestedTestBean; import org.springframework.beans.Person; import org.springframework.beans.SerializablePerson; import org.springframework.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import test.interceptor.SerializableNopInterceptor; +import test.util.SerializationTestUtils; import test.util.TimeStamped; /** @@ -42,7 +42,7 @@ import test.util.TimeStamped; * @author Chris Beams * @since 13.05.2003 */ -public class DelegatingIntroductionInterceptorTests { +public final class DelegatingIntroductionInterceptorTests { @Test(expected=IllegalArgumentException.class) public void testNullTarget() throws Exception { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java index a8d9aa20f2f..ca4f8839c8e 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package org.springframework.aop.support; /** * @author Dmitriy Kopylenko */ -public class JdkRegexpMethodPointcutTests extends AbstractRegexpMethodPointcutTests { +public final class JdkRegexpMethodPointcutTests extends AbstractRegexpMethodPointcutTests { protected AbstractRegexpMethodPointcut getRegexpMethodPointcut() { return new JdkRegexpMethodPointcut(); diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java index b19fca1fc94..07638571b51 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,13 +25,14 @@ import org.springframework.aop.MethodMatcher; import org.springframework.beans.IOther; import org.springframework.beans.ITestBean; import org.springframework.beans.TestBean; -import org.springframework.util.SerializationTestUtils; + +import test.util.SerializationTestUtils; /** * @author Juergen Hoeller * @author Chris Beams */ -public class MethodMatchersTests { +public final class MethodMatchersTests { private final Method EXCEPTION_GETMESSAGE; @@ -106,20 +107,20 @@ public class MethodMatchersTests { public StartsWithMatcher(String s) { this.prefix = s; } - public boolean matches(Method m, Class targetClass) { + public boolean matches(Method m, Class targetClass) { return m.getName().startsWith(prefix); } } private static class TestDynamicMethodMatcherWhichMatches extends DynamicMethodMatcher { - public boolean matches(Method m, Class targetClass, Object[] args) { + public boolean matches(Method m, Class targetClass, Object[] args) { return true; } } private static class TestDynamicMethodMatcherWhichDoesNotMatch extends DynamicMethodMatcher { - public boolean matches(Method m, Class targetClass, Object[] args) { + public boolean matches(Method m, Class targetClass, Object[] args) { return false; } } diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java index b6e24bc8294..97888ce0e28 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,16 +24,16 @@ import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.Person; import org.springframework.beans.SerializablePerson; -import org.springframework.util.SerializationTestUtils; import test.interceptor.NopInterceptor; import test.interceptor.SerializableNopInterceptor; +import test.util.SerializationTestUtils; /** * @author Rod Johnson * @author Chris Beams */ -public class NameMatchMethodPointcutTests { +public final class NameMatchMethodPointcutTests { protected NameMatchMethodPointcut pc; diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/PointcutsTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/PointcutsTests.java index d3cfd9759c4..5090e8f03e7 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/PointcutsTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/PointcutsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import org.springframework.beans.TestBean; * @author Rod Johnson * @author Chris Beams */ -public class PointcutsTests { +public final class PointcutsTests { public static Method TEST_BEAN_SET_AGE; public static Method TEST_BEAN_GET_AGE; diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/regexpSetterTests.xml b/org.springframework.aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests-context.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/support/regexpSetterTests.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests-context.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java index 3c1736a9076..96fd84fedc1 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,20 +26,26 @@ import org.springframework.beans.TestBean; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; -import org.springframework.util.SerializationTestUtils; import test.interceptor.NopInterceptor; import test.interceptor.SerializableNopInterceptor; +import test.util.SerializationTestUtils; /** * @author Rod Johnson * @author Chris Beams */ -public class RegexpMethodPointcutAdvisorIntegrationTests { +public final class RegexpMethodPointcutAdvisorIntegrationTests { + + private static final Class CLASS = RegexpMethodPointcutAdvisorIntegrationTests.class; + private static final String CLASSNAME = CLASS.getSimpleName(); + + private static final ClassPathResource CONTEXT = + new ClassPathResource(CLASSNAME + "-context.xml", CLASS); @Test public void testSinglePattern() throws Throwable { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource("regexpSetterTests.xml", getClass())); + BeanFactory bf = new XmlBeanFactory(CONTEXT); ITestBean advised = (ITestBean) bf.getBean("settersAdvised"); // Interceptor behind regexp advisor NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor"); @@ -57,7 +63,7 @@ public class RegexpMethodPointcutAdvisorIntegrationTests { @Test public void testMultiplePatterns() throws Throwable { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource("regexpSetterTests.xml", getClass())); + BeanFactory bf = new XmlBeanFactory(CONTEXT); // This is a CGLIB proxy, so we can proxy it to the target class TestBean advised = (TestBean) bf.getBean("settersAndAbsquatulateAdvised"); // Interceptor behind regexp advisor @@ -80,7 +86,7 @@ public class RegexpMethodPointcutAdvisorIntegrationTests { @Test public void testSerialization() throws Throwable { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource("regexpSetterTests.xml", getClass())); + BeanFactory bf = new XmlBeanFactory(CONTEXT); // This is a CGLIB proxy, so we can proxy it to the target class Person p = (Person) bf.getBean("serializableSettersAdvised"); // Interceptor behind regexp advisor diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/commonsPoolProxyTests.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests-context.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/commonsPoolProxyTests.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests-context.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java index fc2143e619e..f6166291498 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +30,13 @@ import org.springframework.core.io.ClassPathResource; * @author Chris Beams * @since 2.0 */ -public class CommonsPoolTargetSourceProxyTests { +public final class CommonsPoolTargetSourceProxyTests { @Test public void testProxy() throws Exception { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - reader.loadBeanDefinitions(new ClassPathResource("commonsPoolProxyTests.xml", getClass())); + reader.loadBeanDefinitions(new ClassPathResource("CommonsPoolTargetSourceProxyTests-context.xml", getClass())); beanFactory.preInstantiateSingletons(); ITestBean bean = (ITestBean)beanFactory.getBean("testBean"); assertTrue(AopUtils.isAopProxy(bean)); diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/hotSwapTests.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests-context.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/hotSwapTests.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests-context.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java index c26460c2c26..933e301041b 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,17 +28,17 @@ import org.springframework.beans.Person; import org.springframework.beans.SerializablePerson; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; -import org.springframework.util.SerializationTestUtils; import test.beans.SideEffectBean; import test.interceptor.SerializableNopInterceptor; +import test.util.SerializationTestUtils; /** * @author Rod Johnson * @author Chris Beams */ -public class HotSwappableTargetSourceTests { +public final class HotSwappableTargetSourceTests { /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; @@ -47,7 +47,8 @@ public class HotSwappableTargetSourceTests { @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("hotSwapTests.xml", getClass())); + this.beanFactory = new XmlBeanFactory( + new ClassPathResource("HotSwappableTargetSourceTests-context.xml", getClass())); } /** diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java index 11f29045086..d6dc8f426cd 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.springframework.aop.framework.ProxyFactory; * @author Juergen Hoeller * @author Chris Beams */ -public class LazyCreationTargetSourceTests { +public final class LazyCreationTargetSourceTests { @Test public void testCreateLazy() { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/customLazyInitTarget.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-customTarget.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/customLazyInitTarget.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-customTarget.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitFactoryBean.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-factoryBean.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitFactoryBean.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-factoryBean.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitSingletonTests.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-singleton.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/lazyInitSingletonTests.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests-singleton.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java index 4f0bb347d21..e4b3860a74f 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,21 @@ import org.springframework.core.io.ClassPathResource; * @author Chris Beams * @since 07.01.2005 */ -public class LazyInitTargetSourceTests { +public final class LazyInitTargetSourceTests { + + private static final Class CLASS = LazyInitTargetSourceTests.class; + private static final String CLASSNAME = CLASS.getSimpleName(); + + private static final ClassPathResource SINGLETON_CONTEXT = + new ClassPathResource(CLASSNAME + "-singleton.xml", CLASS); + private static final ClassPathResource CUSTOM_TARGET_CONTEXT = + new ClassPathResource(CLASSNAME + "-customTarget.xml", CLASS); + private static final ClassPathResource FACTORY_BEAN_CONTEXT = + new ClassPathResource(CLASSNAME + "-factoryBean.xml", CLASS); @Test public void testLazyInitSingletonTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("lazyInitSingletonTests.xml", getClass())); + XmlBeanFactory bf = new XmlBeanFactory(SINGLETON_CONTEXT); bf.preInstantiateSingletons(); ITestBean tb = (ITestBean) bf.getBean("proxy"); @@ -46,7 +56,7 @@ public class LazyInitTargetSourceTests { @Test public void testCustomLazyInitSingletonTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("customLazyInitTarget.xml", getClass())); + XmlBeanFactory bf = new XmlBeanFactory(CUSTOM_TARGET_CONTEXT); bf.preInstantiateSingletons(); ITestBean tb = (ITestBean) bf.getBean("proxy"); @@ -57,7 +67,7 @@ public class LazyInitTargetSourceTests { @Test public void testLazyInitFactoryBeanTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("lazyInitFactoryBean.xml", getClass())); + XmlBeanFactory bf = new XmlBeanFactory(FACTORY_BEAN_CONTEXT); bf.preInstantiateSingletons(); Set set1 = (Set) bf.getBean("proxy1"); diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java index 9c10a07f9df..51f45db6131 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java @@ -25,16 +25,17 @@ import org.springframework.beans.SerializablePerson; import org.springframework.beans.TestBean; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.util.SerializationTestUtils; + +import test.util.SerializationTestUtils; /** - * Unit tests relating to the abstract AbstractPrototypeBasedTargetSource + * Unit tests relating to the abstract {@link AbstractPrototypeBasedTargetSource} * and not subclasses. * * @author Rod Johnson * @author Chris Beams */ -public class PrototypeBasedTargetSourceTests { +public final class PrototypeBasedTargetSourceTests { @Test public void testSerializability() throws Exception { diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/prototypeTests.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests-context.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/prototypeTests.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests-context.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java index 478518d803b..275fa6e2ac6 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,10 @@ import test.beans.SideEffectBean; * @author Rod Johnson * @author Chris Beams */ -public class PrototypeTargetSourceTests { +public final class PrototypeTargetSourceTests { + + private static final ClassPathResource CONTEXT = + new ClassPathResource("PrototypeTargetSourceTests-context.xml", PrototypeTargetSourceTests.class); /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; @@ -40,7 +43,7 @@ public class PrototypeTargetSourceTests { @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("prototypeTests.xml", getClass())); + this.beanFactory = new XmlBeanFactory(CONTEXT); } /** diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/threadLocalTests.xml b/org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests-context.xml similarity index 100% rename from org.springframework.aop/src/test/java/org/springframework/aop/target/threadLocalTests.xml rename to org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests-context.xml diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java index bc13e330e96..f2c8713bc32 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java @@ -32,6 +32,9 @@ import test.beans.SideEffectBean; * @author Chris Beams */ public class ThreadLocalTargetSourceTests { + + private static final ClassPathResource CONTEXT = + new ClassPathResource("ThreadLocalTargetSourceTests-context.xml", ThreadLocalTargetSourceTests.class); /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; @@ -40,7 +43,7 @@ public class ThreadLocalTargetSourceTests { @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("threadLocalTests.xml", getClass())); + this.beanFactory = new XmlBeanFactory(CONTEXT); } /** diff --git a/org.springframework.aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java b/org.springframework.aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java index 11bd5964d8e..ee0913a1146 100644 --- a/org.springframework.aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java +++ b/org.springframework.aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import org.junit.Test; * @author Rob Harrop * @author Chris Beams */ -public class RefreshableTargetSourceTests { +public final class RefreshableTargetSourceTests { /** * Test what happens when checking for refresh but not refreshing object. diff --git a/org.springframework.aop/src/test/java/org/springframework/util/SerializationTestUtils.java b/org.springframework.aop/src/test/java/test/util/SerializationTestUtils.java similarity index 85% rename from org.springframework.aop/src/test/java/org/springframework/util/SerializationTestUtils.java rename to org.springframework.aop/src/test/java/test/util/SerializationTestUtils.java index bdffe7578da..e6aed97ff44 100644 --- a/org.springframework.aop/src/test/java/org/springframework/util/SerializationTestUtils.java +++ b/org.springframework.aop/src/test/java/test/util/SerializationTestUtils.java @@ -3,7 +3,9 @@ * of the Apache Software License. */ -package org.springframework.util; +package test.util; + +import static org.junit.Assert.*; import java.awt.Point; import java.io.ByteArrayInputStream; @@ -15,18 +17,18 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Serializable; -import junit.framework.TestCase; - +import org.junit.Test; 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. + * Contains {@link org.junit.Test} methods to test itself. * * @author Rod Johnson + * @author Chris Beams */ -public class SerializationTestUtils extends TestCase { +public final class SerializationTestUtils { public static void testSerialization(Object o) throws IOException { OutputStream baos = new ByteArrayOutputStream(); @@ -59,25 +61,16 @@ public class SerializationTestUtils extends TestCase { return o2; } - public SerializationTestUtils(String s) { - super(s); - } - + @Test(expected=NotSerializableException.class) public void testWithNonSerializableObject() throws IOException { TestBean o = new TestBean(); assertFalse(o instanceof Serializable); - assertFalse(isSerializable(o)); - try { - testSerialization(o); - fail(); - } - catch (NotSerializableException ex) { - // Ok - } + testSerialization(o); } + @Test public void testWithSerializableObject() throws Exception { int x = 5; int y = 10;