polishing .aop tests
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@499 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
77d06ae50e
commit
926032b860
|
|
@ -32,11 +32,11 @@ import org.springframework.aop.MethodMatcher;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||||
import org.springframework.beans.IOther;
|
|
||||||
import org.springframework.beans.ITestBean;
|
import test.beans.IOther;
|
||||||
import org.springframework.beans.TestBean;
|
import test.beans.ITestBean;
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import test.beans.TestBean;
|
||||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
import test.beans.subpkg.DeepBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
|
|
@ -66,7 +66,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMatchExplicit() {
|
public void testMatchExplicit() {
|
||||||
String expression = "execution(int org.springframework.beans.TestBean.getAge())";
|
String expression = "execution(int test.beans.TestBean.getAge())";
|
||||||
|
|
||||||
Pointcut pointcut = getPointcut(expression);
|
Pointcut pointcut = getPointcut(expression);
|
||||||
ClassFilter classFilter = pointcut.getClassFilter();
|
ClassFilter classFilter = pointcut.getClassFilter();
|
||||||
|
|
@ -127,8 +127,8 @@ public final class AspectJExpressionPointcutTests {
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
*/
|
*/
|
||||||
private void testThisOrTarget(String which) throws SecurityException, NoSuchMethodException {
|
private void testThisOrTarget(String which) throws SecurityException, NoSuchMethodException {
|
||||||
String matchesTestBean = which + "(org.springframework.beans.TestBean)";
|
String matchesTestBean = which + "(test.beans.TestBean)";
|
||||||
String matchesIOther = which + "(org.springframework.beans.IOther)";
|
String matchesIOther = which + "(test.beans.IOther)";
|
||||||
AspectJExpressionPointcut testBeanPc = new AspectJExpressionPointcut();
|
AspectJExpressionPointcut testBeanPc = new AspectJExpressionPointcut();
|
||||||
testBeanPc.setExpression(matchesTestBean);
|
testBeanPc.setExpression(matchesTestBean);
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testWithinPackage(boolean matchSubpackages) throws SecurityException, NoSuchMethodException {
|
private void testWithinPackage(boolean matchSubpackages) throws SecurityException, NoSuchMethodException {
|
||||||
String withinBeansPackage = "within(org.springframework.beans.";
|
String withinBeansPackage = "within(test.beans.";
|
||||||
// Subpackages are matched by **
|
// Subpackages are matched by **
|
||||||
if (matchSubpackages) {
|
if (matchSubpackages) {
|
||||||
withinBeansPackage += ".";
|
withinBeansPackage += ".";
|
||||||
|
|
@ -166,10 +166,9 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
assertTrue(withinBeansPc.matches(TestBean.class));
|
assertTrue(withinBeansPc.matches(TestBean.class));
|
||||||
assertTrue(withinBeansPc.matches(getAge, TestBean.class));
|
assertTrue(withinBeansPc.matches(getAge, TestBean.class));
|
||||||
assertEquals(matchSubpackages, withinBeansPc.matches(BeanFactory.class));
|
assertEquals(matchSubpackages, withinBeansPc.matches(DeepBean.class));
|
||||||
assertEquals(matchSubpackages, withinBeansPc.matches(
|
assertEquals(matchSubpackages, withinBeansPc.matches(
|
||||||
DefaultListableBeanFactory.class.getMethod("getBeanDefinitionCount", (Class<?>[])null),
|
DeepBean.class.getMethod("aMethod", String.class), DeepBean.class));
|
||||||
DefaultListableBeanFactory.class));
|
|
||||||
assertFalse(withinBeansPc.matches(String.class));
|
assertFalse(withinBeansPc.matches(String.class));
|
||||||
assertFalse(withinBeansPc.matches(OtherIOther.class.getMethod("absquatulate", (Class<?>[])null),
|
assertFalse(withinBeansPc.matches(OtherIOther.class.getMethod("absquatulate", (Class<?>[])null),
|
||||||
OtherIOther.class));
|
OtherIOther.class));
|
||||||
|
|
@ -214,7 +213,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMatchWithArgs() throws Exception {
|
public void testMatchWithArgs() throws Exception {
|
||||||
String expression = "execution(void org.springframework.beans.TestBean.setSomeNumber(Number)) && args(Double)";
|
String expression = "execution(void test.beans.TestBean.setSomeNumber(Number)) && args(Double)";
|
||||||
|
|
||||||
Pointcut pointcut = getPointcut(expression);
|
Pointcut pointcut = getPointcut(expression);
|
||||||
ClassFilter classFilter = pointcut.getClassFilter();
|
ClassFilter classFilter = pointcut.getClassFilter();
|
||||||
|
|
@ -235,7 +234,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleAdvice() {
|
public void testSimpleAdvice() {
|
||||||
String expression = "execution(int org.springframework.beans.TestBean.getAge())";
|
String expression = "execution(int test.beans.TestBean.getAge())";
|
||||||
|
|
||||||
CallCountingInterceptor interceptor = new CallCountingInterceptor();
|
CallCountingInterceptor interceptor = new CallCountingInterceptor();
|
||||||
|
|
||||||
|
|
@ -254,7 +253,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDynamicMatchingProxy() {
|
public void testDynamicMatchingProxy() {
|
||||||
String expression = "execution(void org.springframework.beans.TestBean.setSomeNumber(Number)) && args(Double)";
|
String expression = "execution(void test.beans.TestBean.setSomeNumber(Number)) && args(Double)";
|
||||||
|
|
||||||
CallCountingInterceptor interceptor = new CallCountingInterceptor();
|
CallCountingInterceptor interceptor = new CallCountingInterceptor();
|
||||||
|
|
||||||
|
|
@ -273,7 +272,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidExpression() {
|
public void testInvalidExpression() {
|
||||||
String expression = "execution(void org.springframework.beans.TestBean.setSomeNumber(Number) && args(Double)";
|
String expression = "execution(void test.beans.TestBean.setSomeNumber(Number) && args(Double)";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getPointcut(expression).getClassFilter(); // call to getClassFilter forces resolution
|
getPointcut(expression).getClassFilter(); // call to getClassFilter forces resolution
|
||||||
|
|
@ -315,7 +314,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithUnsupportedPointcutPrimitive() throws Exception {
|
public void testWithUnsupportedPointcutPrimitive() throws Exception {
|
||||||
String expression = "call(int org.springframework.beans.TestBean.getAge())";
|
String expression = "call(int test.beans.TestBean.getAge())";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getPointcut(expression).getClassFilter(); // call to getClassFilter forces resolution...
|
getPointcut(expression).getClassFilter(); // call to getClassFilter forces resolution...
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ package org.springframework.aop.aspectj;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for matching of bean() pointcut designator.
|
* Tests for matching of bean() pointcut designator.
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,9 @@ import org.springframework.aop.framework.AopContext;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
import test.annotation.EmptySpringAnnotation;
|
import test.annotation.EmptySpringAnnotation;
|
||||||
import test.annotation.transaction.Tx;
|
import test.annotation.transaction.Tx;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +70,7 @@ public final class TigerAspectJExpressionPointcutTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMatchGenericArgument() {
|
public void testMatchGenericArgument() {
|
||||||
String expression = "execution(* set*(java.util.List<org.springframework.beans.TestBean>) )";
|
String expression = "execution(* set*(java.util.List<test.beans.TestBean>) )";
|
||||||
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
|
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
|
||||||
ajexp.setExpression(expression);
|
ajexp.setExpression(expression);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,13 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.framework.autoproxy.CountingTestBean;
|
import org.springframework.aop.framework.autoproxy.CountingTestBean;
|
||||||
import org.springframework.beans.IOther;
|
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||||
|
|
||||||
|
import test.beans.IOther;
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the {@link TypePatternClassFilter} class.
|
* Unit tests for the {@link TypePatternClassFilter} class.
|
||||||
*
|
*
|
||||||
|
|
@ -43,7 +44,7 @@ public final class TypePatternClassFilterTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidPatternMatching() {
|
public void testValidPatternMatching() {
|
||||||
TypePatternClassFilter tpcf = new TypePatternClassFilter("org.springframework.beans.*");
|
TypePatternClassFilter tpcf = new TypePatternClassFilter("test.beans.*");
|
||||||
assertTrue("Must match: in package", tpcf.matches(TestBean.class));
|
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(ITestBean.class));
|
||||||
assertTrue("Must match: in package", tpcf.matches(IOther.class));
|
assertTrue("Must match: in package", tpcf.matches(IOther.class));
|
||||||
|
|
@ -54,7 +55,7 @@ public final class TypePatternClassFilterTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSubclassMatching() {
|
public void testSubclassMatching() {
|
||||||
TypePatternClassFilter tpcf = new TypePatternClassFilter("org.springframework.beans.ITestBean+");
|
TypePatternClassFilter tpcf = new TypePatternClassFilter("test.beans.ITestBean+");
|
||||||
assertTrue("Must match: in package", tpcf.matches(TestBean.class));
|
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(ITestBean.class));
|
||||||
assertTrue("Must match: in package", tpcf.matches(CountingTestBean.class));
|
assertTrue("Must match: in package", tpcf.matches(CountingTestBean.class));
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,6 @@ import org.springframework.aop.framework.AopConfigException;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.core.OrderComparator;
|
import org.springframework.core.OrderComparator;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
|
|
@ -54,6 +52,8 @@ import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import test.aspect.PerTargetAspect;
|
import test.aspect.PerTargetAspect;
|
||||||
import test.aspect.TwoAdviceAspect;
|
import test.aspect.TwoAdviceAspect;
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.mixin.DefaultLockable;
|
import test.mixin.DefaultLockable;
|
||||||
import test.mixin.Lockable;
|
import test.mixin.Lockable;
|
||||||
|
|
||||||
|
|
@ -638,7 +638,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Aspect("pertypewithin(org.springframework.beans.IOther+)")
|
@Aspect("pertypewithin(test.beans.IOther+)")
|
||||||
public static class PerTypeWithinAspect {
|
public static class PerTypeWithinAspect {
|
||||||
|
|
||||||
public int count;
|
public int count;
|
||||||
|
|
@ -847,7 +847,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
|
||||||
|
|
||||||
|
|
||||||
@Aspect
|
@Aspect
|
||||||
@DeclarePrecedence("org.springframework..*")
|
@DeclarePrecedence("test..*")
|
||||||
public static class DeclarePrecedenceShouldSucceed {
|
public static class DeclarePrecedenceShouldSucceed {
|
||||||
|
|
||||||
@Pointcut("execution(int *.getAge())")
|
@Pointcut("execution(int *.getAge())")
|
||||||
|
|
@ -960,7 +960,7 @@ abstract class AbstractMakeModifiable {
|
||||||
@Aspect
|
@Aspect
|
||||||
class MakeITestBeanModifiable extends AbstractMakeModifiable {
|
class MakeITestBeanModifiable extends AbstractMakeModifiable {
|
||||||
|
|
||||||
@DeclareParents(value = "org.springframework.beans.ITestBean+",
|
@DeclareParents(value = "test.beans.ITestBean+",
|
||||||
defaultImpl=ModifiableImpl.class)
|
defaultImpl=ModifiableImpl.class)
|
||||||
public static MutableModifable mixin;
|
public static MutableModifable mixin;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,9 @@ import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer;
|
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Colyer
|
* @author Adrian Colyer
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
||||||
import org.springframework.aop.aspectj.AspectJExpressionPointcutTests;
|
import org.springframework.aop.aspectj.AspectJExpressionPointcutTests;
|
||||||
import org.springframework.aop.framework.AopConfigException;
|
import org.springframework.aop.framework.AopConfigException;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
import test.aspect.PerTargetAspect;
|
import test.aspect.PerTargetAspect;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<bean id="getAgeCounter" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
|
<bean id="getAgeCounter" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
|
||||||
|
|
||||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
<bean id="testBean" class="test.beans.TestBean"/>
|
||||||
|
|
||||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<bean id="getAgeCounter" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
|
<bean id="getAgeCounter" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
|
||||||
|
|
||||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
<bean id="testBean" class="test.beans.TestBean"/>
|
||||||
|
|
||||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<bean id="getAgeCounter" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
|
<bean id="getAgeCounter" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
|
||||||
|
|
||||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
<bean id="testBean" class="test.beans.TestBean"/>
|
||||||
|
|
||||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,9 @@ import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.SpringProxy;
|
import org.springframework.aop.SpringProxy;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,11 @@ package org.springframework.aop.framework;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.util.StopWatch;
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Benchmarks for introductions.
|
* Benchmarks for introductions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ import java.util.List;
|
||||||
import org.aopalliance.intercept.MethodInterceptor;
|
import org.aopalliance.intercept.MethodInterceptor;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ import org.springframework.aop.support.AopUtils;
|
||||||
import org.springframework.aop.support.DefaultIntroductionAdvisor;
|
import org.springframework.aop.support.DefaultIntroductionAdvisor;
|
||||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||||
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||||
import org.springframework.beans.IOther;
|
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
import test.advice.MethodCounter;
|
import test.advice.MethodCounter;
|
||||||
|
import test.beans.IOther;
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.interceptor.NopInterceptor;
|
import test.interceptor.NopInterceptor;
|
||||||
import test.util.TimeStamped;
|
import test.util.TimeStamped;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
package org.springframework.aop.framework.autoproxy;
|
package org.springframework.aop.framework.autoproxy;
|
||||||
|
|
||||||
import org.springframework.beans.TestBean;
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@ import org.junit.Test;
|
||||||
|
|
||||||
import org.springframework.aop.framework.Advised;
|
import org.springframework.aop.framework.Advised;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.beans.DerivedTestBean;
|
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
|
import test.beans.DerivedTestBean;
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.beans.factory.NamedBean;
|
import org.springframework.beans.factory.NamedBean;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-XML tests are in AbstractAopProxyTests
|
* Non-XML tests are in AbstractAopProxyTests
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ import org.springframework.aop.MethodMatcher;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||||
import org.springframework.aop.target.EmptyTargetSource;
|
import org.springframework.aop.target.EmptyTargetSource;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.interceptor.NopInterceptor;
|
import test.interceptor.NopInterceptor;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.ClassFilter;
|
import org.springframework.aop.ClassFilter;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.core.NestedRuntimeException;
|
import org.springframework.core.NestedRuntimeException;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,10 @@ import org.junit.Test;
|
||||||
import org.springframework.aop.ClassFilter;
|
import org.springframework.aop.ClassFilter;
|
||||||
import org.springframework.aop.MethodMatcher;
|
import org.springframework.aop.MethodMatcher;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.core.NestedRuntimeException;
|
import org.springframework.core.NestedRuntimeException;
|
||||||
|
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ import static org.junit.Assert.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.interceptor.NopInterceptor;
|
import test.interceptor.NopInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ import org.junit.Test;
|
||||||
import org.springframework.aop.IntroductionAdvisor;
|
import org.springframework.aop.IntroductionAdvisor;
|
||||||
import org.springframework.aop.IntroductionInterceptor;
|
import org.springframework.aop.IntroductionInterceptor;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.beans.INestedTestBean;
|
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.NestedTestBean;
|
|
||||||
import org.springframework.beans.Person;
|
|
||||||
import org.springframework.beans.SerializablePerson;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
|
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.interceptor.SerializableNopInterceptor;
|
import test.interceptor.SerializableNopInterceptor;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
import test.util.TimeStamped;
|
import test.util.TimeStamped;
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.MethodMatcher;
|
import org.springframework.aop.MethodMatcher;
|
||||||
import org.springframework.beans.IOther;
|
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
|
||||||
|
import test.beans.IOther;
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.framework.Advised;
|
import org.springframework.aop.framework.Advised;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.beans.Person;
|
|
||||||
import org.springframework.beans.SerializablePerson;
|
|
||||||
|
|
||||||
|
import test.beans.Person;
|
||||||
|
import test.beans.SerializablePerson;
|
||||||
import test.interceptor.NopInterceptor;
|
import test.interceptor.NopInterceptor;
|
||||||
import test.interceptor.SerializableNopInterceptor;
|
import test.interceptor.SerializableNopInterceptor;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ import java.lang.reflect.Method;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.ClassFilter;
|
import org.springframework.aop.ClassFilter;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<!-- Simple target -->
|
<!-- Simple target -->
|
||||||
<bean id="test" class="org.springframework.beans.TestBean">
|
<bean id="test" class="test.beans.TestBean">
|
||||||
<property name="name"><value>custom</value></property>
|
<property name="name"><value>custom</value></property>
|
||||||
<property name="age"><value>666</value></property>
|
<property name="age"><value>666</value></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
@ -21,15 +21,15 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="settersAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="settersAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
<property name="proxyInterfaces"><value>test.beans.ITestBean</value></property>
|
||||||
<property name="target"><ref local="test"/></property>
|
<property name="target"><ref local="test"/></property>
|
||||||
<property name="interceptorNames"><value>settersAdvisor</value></property>
|
<property name="interceptorNames"><value>settersAdvisor</value></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="serializableSettersAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="serializableSettersAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
<property name="proxyInterfaces"><value>org.springframework.beans.Person</value></property>
|
<property name="proxyInterfaces"><value>test.beans.Person</value></property>
|
||||||
<property name="target">
|
<property name="target">
|
||||||
<bean class="org.springframework.beans.SerializablePerson">
|
<bean class="test.beans.SerializablePerson">
|
||||||
<property name="name"><value>serializableSettersAdvised</value></property>
|
<property name="name"><value>serializableSettersAdvised</value></property>
|
||||||
</bean>
|
</bean>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="settersAndAbsquatulateAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="settersAndAbsquatulateAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
<property name="proxyInterfaces"><value>test.beans.ITestBean</value></property>
|
||||||
<!-- Force CGLIB so we can cast to TestBean -->
|
<!-- Force CGLIB so we can cast to TestBean -->
|
||||||
<property name="proxyTargetClass"><value>true</value></property>
|
<property name="proxyTargetClass"><value>true</value></property>
|
||||||
<property name="target"><ref local="test"/></property>
|
<property name="target"><ref local="test"/></property>
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.framework.Advised;
|
import org.springframework.aop.framework.Advised;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.Person;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
import test.beans.Person;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.interceptor.NopInterceptor;
|
import test.interceptor.NopInterceptor;
|
||||||
import test.interceptor.SerializableNopInterceptor;
|
import test.interceptor.SerializableNopInterceptor;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<bean id="testBeanTarget" class="org.springframework.beans.TestBean" scope="prototype"/>
|
<bean id="testBeanTarget" class="test.beans.TestBean" scope="prototype"/>
|
||||||
|
|
||||||
<bean id="targetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">
|
<bean id="targetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">
|
||||||
<property name="targetBeanName" value="testBeanTarget"/>
|
<property name="targetBeanName" value="testBeanTarget"/>
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,12 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ import org.junit.Test;
|
||||||
import org.springframework.aop.framework.Advised;
|
import org.springframework.aop.framework.Advised;
|
||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||||
import org.springframework.beans.Person;
|
|
||||||
import org.springframework.beans.SerializablePerson;
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import test.beans.Person;
|
||||||
|
import test.beans.SerializablePerson;
|
||||||
import test.beans.SideEffectBean;
|
import test.beans.SideEffectBean;
|
||||||
import test.interceptor.SerializableNopInterceptor;
|
import test.interceptor.SerializableNopInterceptor;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<bean id="target" class="org.springframework.beans.TestBean" lazy-init="true">
|
<bean id="target" class="test.beans.TestBean" lazy-init="true">
|
||||||
<property name="age"><value>10</value></property>
|
<property name="age"><value>10</value></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<bean id="target" class="org.springframework.beans.TestBean" lazy-init="true">
|
<bean id="target" class="test.beans.TestBean" lazy-init="true">
|
||||||
<property name="age"><value>10</value></property>
|
<property name="age"><value>10</value></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,11 @@ import static org.junit.Assert.*;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ import static org.junit.Assert.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.aop.TargetSource;
|
import org.springframework.aop.TargetSource;
|
||||||
import org.springframework.beans.MutablePropertyValues;
|
import org.springframework.beans.MutablePropertyValues;
|
||||||
import org.springframework.beans.SerializablePerson;
|
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||||
|
|
||||||
|
import test.beans.SerializablePerson;
|
||||||
|
import test.beans.TestBean;
|
||||||
import test.util.SerializationTestUtils;
|
import test.util.SerializationTestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@
|
||||||
|
|
||||||
<!-- ================ Definitions for second ThreadLocalTargetSource ====== -->
|
<!-- ================ Definitions for second ThreadLocalTargetSource ====== -->
|
||||||
|
|
||||||
<bean id="test" class="org.springframework.beans.TestBean" scope="prototype">
|
<bean id="test" class="test.beans.TestBean" scope="prototype">
|
||||||
<property name="name"><value>Rod</value></property>
|
<property name="name"><value>Rod</value></property>
|
||||||
<property name="spouse"><ref local="wife"/></property>
|
<property name="spouse"><ref local="wife"/></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="wife" class="org.springframework.beans.TestBean">
|
<bean id="wife" class="test.beans.TestBean">
|
||||||
<property name="name"><value>Kerry</value></property>
|
<property name="name"><value>Kerry</value></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.ITestBean;
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import test.beans.ITestBean;
|
||||||
import test.beans.SideEffectBean;
|
import test.beans.SideEffectBean;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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<TestBean> collection;
|
|
||||||
|
|
||||||
private List<TestBean> list;
|
|
||||||
|
|
||||||
private Set<TestBean> set;
|
|
||||||
|
|
||||||
private SortedSet<TestBean> sortedSet;
|
|
||||||
|
|
||||||
private Map<String, ? super Object> 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<TestBean>();
|
|
||||||
this.list.add(tb2);
|
|
||||||
this.list.add(tb3);
|
|
||||||
this.set = new TreeSet<TestBean>();
|
|
||||||
this.set.add(tb6);
|
|
||||||
this.set.add(tb7);
|
|
||||||
this.map = new HashMap<String, Object>();
|
|
||||||
this.map.put("key1", tb4);
|
|
||||||
this.map.put("key2", tb5);
|
|
||||||
this.map.put("key.3", tb5);
|
|
||||||
List<TestBean> list = new ArrayList<TestBean>();
|
|
||||||
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<TestBean> getCollection() {
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCollection(Collection<TestBean> collection) {
|
|
||||||
this.collection = collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TestBean> getList() {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setList(List<TestBean> list) {
|
|
||||||
this.list = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<TestBean> getSet() {
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSet(Set<TestBean> set) {
|
|
||||||
this.set = set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedSet<TestBean> getSortedSet() {
|
|
||||||
return sortedSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSortedSet(SortedSet<TestBean> sortedSet) {
|
|
||||||
this.sortedSet = sortedSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, ? super Object> getMap() {
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMap(Map<String, ? super Object> map) {
|
|
||||||
this.map = map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedMap<?, ?> getSortedMap() {
|
|
||||||
return sortedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSortedMap(SortedMap<?, ?> sortedMap) {
|
|
||||||
this.sortedMap = sortedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
import org.springframework.core.enums.ShortCodedLabeledEnum;
|
import org.springframework.core.enums.ShortCodedLabeledEnum;
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.DisposableBean;
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 21.08.2003
|
* @since 21.08.2003
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean {
|
public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean {
|
||||||
|
|
||||||
private String beanName;
|
private String beanName;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
public interface INestedTestBean {
|
public interface INestedTestBean {
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
public interface IOther {
|
public interface IOther {
|
||||||
|
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface used for {@link org.springframework.beans.TestBean}.
|
* Interface used for {@link test.beans.TestBean}.
|
||||||
*
|
*
|
||||||
* <p>Two methods are the same as on Person, but if this
|
* <p>Two methods are the same as on Person, but if this
|
||||||
* extends person it breaks quite a few tests..
|
* extends person it breaks quite a few tests..
|
||||||
|
|
@ -58,8 +58,6 @@ public interface ITestBean {
|
||||||
|
|
||||||
INestedTestBean getLawyer();
|
INestedTestBean getLawyer();
|
||||||
|
|
||||||
IndexedTestBean getNestedIndexedBean();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increment the age by one.
|
* Increment the age by one.
|
||||||
* @return the previous age
|
* @return the previous age
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple nested test bean used for testing bean factories, AOP framework etc.
|
* Simple nested test bean used for testing bean factories, AOP framework etc.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -25,6 +25,7 @@ import org.springframework.util.ObjectUtils;
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class SerializablePerson implements Person, Serializable {
|
public class SerializablePerson implements Person, Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.beans;
|
package test.beans;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -79,8 +79,6 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
|
|
||||||
private INestedTestBean lawyer = new NestedTestBean();
|
private INestedTestBean lawyer = new NestedTestBean();
|
||||||
|
|
||||||
private IndexedTestBean nestedIndexedBean;
|
|
||||||
|
|
||||||
private boolean destroyed;
|
private boolean destroyed;
|
||||||
|
|
||||||
private Number someNumber;
|
private Number someNumber;
|
||||||
|
|
@ -329,14 +327,6 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
this.someBoolean = someBoolean;
|
this.someBoolean = someBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexedTestBean getNestedIndexedBean() {
|
|
||||||
return nestedIndexedBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) {
|
|
||||||
this.nestedIndexedBean = nestedIndexedBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<?> getOtherColours() {
|
public List<?> getOtherColours() {
|
||||||
return otherColours;
|
return otherColours;
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* 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.subpkg;
|
||||||
|
|
||||||
|
import org.springframework.aop.aspectj.AspectJExpressionPointcutTests;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for testing pointcut matching.
|
||||||
|
*
|
||||||
|
* @see AspectJExpressionPointcutTests#testWithinRootAndSubpackages()
|
||||||
|
*
|
||||||
|
* @author Chris Beams
|
||||||
|
*/
|
||||||
|
public class DeepBean {
|
||||||
|
public void aMethod(String foo) {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,7 +18,8 @@ import java.io.OutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.TestBean;
|
|
||||||
|
import test.beans.TestBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for testing serializability of objects.
|
* Utilities for testing serializability of objects.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue