Merge branch 'cleanup-test-duplicates' into cleanup-3.2.x
* cleanup-test-duplicates: Update Apache license headers for affected sources Remove duplicate test classes Replace test beans with test objects Conflicts: spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.AdviceBindingTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<aop:after-returning method="oneObjectArg" returning="bean" pointcut="execution(* returnsThis())"/>
|
||||
<aop:after-returning method="oneTestBeanArg" returning="bean" pointcut="execution(* returnsThis())"/>
|
||||
<aop:after-returning method="testBeanArrayArg" returning="beans"
|
||||
pointcut="execution(org.springframework.beans.ITestBean[] *(..))"/>
|
||||
pointcut="execution(org.springframework.tests.sample.beans.ITestBean[] *(..))"/>
|
||||
<aop:after-returning method="oneString" returning="name" pointcut="execution(* getSpouse())"/>
|
||||
<aop:after-returning method="objectMatchNoArgs" returning="java.lang.Object"
|
||||
pointcut="execution(* returnsThis())"/>
|
||||
@@ -30,6 +30,6 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.AfterReturningAdviceBindingTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,6 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.AfterThrowingAdviceBindingTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.AroundAdviceBindingTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.AroundAdviceBindingTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="spouse" ref="testBean2"/>
|
||||
</bean>
|
||||
|
||||
<bean id="testBean2" class="org.springframework.beans.TestBean" autowire-candidate="false">
|
||||
<bean id="testBean2" class="org.springframework.tests.sample.beans.TestBean" autowire-candidate="false">
|
||||
<property name="spouse" ref="testBean"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
@@ -85,6 +85,6 @@
|
||||
|
||||
<bean id="lowPrecedenceAspect" class="org.springframework.aop.aspectj.PrecedenceTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
<bean id="proxyCreator" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="advisor" class="org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor">
|
||||
<property name="expression"
|
||||
value="execution(org.springframework.beans.ITestBean[] org.springframework.beans.ITestBean.*(..))"/>
|
||||
value="execution(org.springframework.tests.sample.beans.ITestBean[] org.springframework.tests.sample.beans.ITestBean.*(..))"/>
|
||||
<property name="advice" ref="interceptor"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
|
||||
|
||||
<aop:aspectj-autoproxy/>
|
||||
|
||||
<bean id="testBean1" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean2" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean3" class="org.springframework.beans.TestBean"/>
|
||||
|
||||
<bean id="testBean1" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
<bean id="testBean2" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
<bean id="testBean3" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="counterAspect" class="org.springframework.aop.aspectj.CounterAspect"/>
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="testBean1" name="myBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean1" name="myBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="testBean2" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean2" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="testBeanContainingNestedBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="testBeanContainingNestedBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="doctor">
|
||||
<bean class="org.springframework.beans.NestedTestBean"/>
|
||||
<bean class="org.springframework.tests.sample.beans.NestedTestBean"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
<aop:advisor pointcut="bean(*This) and !bean(dont*)" advice-ref="testInterceptor"/>
|
||||
</aop:config>
|
||||
|
||||
<bean id="interceptThis" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="interceptThis" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="dontInterceptThis" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="dontInterceptThis" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="testInterceptor" class="org.springframework.aop.aspectj.BeanNamePointcutTests$TestInterceptor"/>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.AdviceBindingTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="authenticationLogger" class="org.springframework.aop.aspectj.AuthenticationLogger"/>
|
||||
|
||||
|
||||
@@ -20,8 +20,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;
|
||||
import org.springframework.tests.Assume;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<aop:config>
|
||||
<aop:aspect id="beforeAdviceBindingTests" ref="introduction">
|
||||
<aop:declare-parents
|
||||
types-matching="org.springframework.beans..*"
|
||||
types-matching="org.springframework.tests.sample.beans..*"
|
||||
implement-interface="test.mixin.Lockable"
|
||||
default-impl="test.mixin.DefaultLockable"
|
||||
/>
|
||||
@@ -17,11 +17,11 @@
|
||||
pointcut="execution(* set*(*)) and this(mixin)"
|
||||
arg-names="mixin"
|
||||
/>
|
||||
</aop:aspect>
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="introduction" class="org.springframework.aop.aspectj.NonAnnotatedMakeLockable"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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();
|
||||
|
||||
@@ -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">
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="aTestBean"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<aop:config proxy-target-class="true">
|
||||
<aop:aspect ref="counterAspect">
|
||||
<aop:pointcut id="anyOperation"
|
||||
expression="execution(* org.springframework.beans.TestBean.*(..)) and this(bean) and args(argument)"/>
|
||||
expression="execution(* org.springframework.tests.sample.beans.TestBean.*(..)) and this(bean) and args(argument)"/>
|
||||
<aop:around pointcut-ref="anyOperation" method="increment" arg-names="bean,argument"/>
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="aTestBean"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.OverloadedAdviceTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -16,6 +16,6 @@
|
||||
|
||||
<bean id="testAspect" class="org.springframework.aop.aspectj.OverloadedAdviceTestAspect"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -13,7 +13,7 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean" />
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean" />
|
||||
|
||||
<bean id="interfaceExtendingAspect"
|
||||
class="org.springframework.aop.aspectj.autoproxy.InterfaceExtendingAspect"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
<property name="name" value="adrian"/>
|
||||
</bean>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" parent="adrianParent">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" parent="adrianParent">
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
<bean id="adrian2Parent" class="org.springframework.beans.TestBean" abstract="true">
|
||||
<bean id="adrian2Parent" class="org.springframework.tests.sample.beans.TestBean" abstract="true">
|
||||
<property name="name" value="adrian"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
<property name="multiple" value="3"/>
|
||||
</bean>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="Adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
<bean id="adrian2" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="adrian2" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="Adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
<bean id="i21" class="org.springframework.beans.NestedTestBean" scope="prototype">
|
||||
<bean id="i21" class="org.springframework.tests.sample.beans.NestedTestBean" scope="prototype">
|
||||
<property name="company" value="i21"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<property name="name" value="adrian"/>
|
||||
</bean>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" parent="adrianParent">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" parent="adrianParent">
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<bean class="org.springframework.aop.aspectj.autoproxy.IncreaseReturnValue"/>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
<property name="order" value="5"/>
|
||||
</bean>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
<bean id="juergen" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="juergen" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="juergen"/>
|
||||
<property name="age" value="30"/>
|
||||
</bean>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<bean class="test.aspect.PerThisAspect" scope="prototype"/>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<bean id="aspect" class="test.aspect.TwoAdviceAspect"/>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<bean id="aspect" class="test.aspect.TwoAdviceAspect"
|
||||
scope="prototype"/>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<property name="multiple" value="2" />
|
||||
</bean>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="adrian" />
|
||||
<property name="age" value="34" />
|
||||
</bean>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<bean id="aspect" class="org.springframework.aop.aspectj.autoproxy.AdviceUsingThisJoinPoint"/>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean" scope="prototype">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<aop:aspectj-autoproxy/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="aspect" class="org.springframework.aop.aspectj.autoproxy.ExceptionHandlingAspect"/>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
class="org.springframework.aop.aspectj.autoproxy.benchmark.TraceAspect" >
|
||||
</bean>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="adrian" />
|
||||
<property name="age" value="34" />
|
||||
</bean>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<bean class="org.springframework.aop.aspectj.autoproxy.benchmark.TraceAspect"/>
|
||||
|
||||
<bean id="adrian" class="org.springframework.beans.TestBean">
|
||||
<bean id="adrian" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="adrian"/>
|
||||
<property name="age" value="34"/>
|
||||
</bean>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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.
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="getNameCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getNameCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="getAgeCounter" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="getAgeCounter" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="countingAdvice" class="org.springframework.aop.config.CountingAspectJAdvice"/>
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
<bean id="service" class="org.springframework.beans.TestBean" scope="prototype"/>
|
||||
<bean id="service" class="org.springframework.tests.sample.beans.TestBean" scope="prototype"/>
|
||||
|
||||
<bean id="serviceDependent1" class="org.springframework.beans.TestBean">
|
||||
<bean id="serviceDependent1" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<constructor-arg ref="service"/>
|
||||
</bean>
|
||||
|
||||
<bean id="serviceDependent2" class="org.springframework.beans.TestBean">
|
||||
<bean id="serviceDependent2" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<constructor-arg ref="service"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nullInstance" class="test.beans.FactoryMethods" factory-method="nullInstance"/>
|
||||
<bean id="nullInstance" class="org.springframework.tests.sample.beans.FactoryMethods" factory-method="nullInstance"/>
|
||||
|
||||
<bean id="serviceInterceptor" class="org.springframework.aop.interceptor.DebugInterceptor"/>
|
||||
|
||||
<aop:config proxy-target-class="false">
|
||||
<aop:pointcut id="servicePointcut" expression="target(org.springframework.beans.ITestBean)"/>
|
||||
<aop:pointcut id="servicePointcut" expression="target(org.springframework.tests.sample.beans.ITestBean)"/>
|
||||
<aop:advisor advice-ref="serviceInterceptor" pointcut-ref="servicePointcut"/>
|
||||
</aop:config>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="debugInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="debugInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<!-- Target is autowired, so can check type of parent without a guard -->
|
||||
<property name="target">
|
||||
<bean class="org.springframework.beans.TestBean" autowire="byType"/>
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean" autowire="byType"/>
|
||||
</property>
|
||||
<property name="interceptorNames" value="debugInterceptor"/>
|
||||
</bean>
|
||||
|
||||
@@ -4,19 +4,19 @@
|
||||
<beans>
|
||||
|
||||
<!-- Simple target -->
|
||||
<bean id="test" class="org.springframework.beans.TestBean">
|
||||
<bean id="test" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>666</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="debugInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="debugInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="test1" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="interfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="target"><ref local="test"/></property>
|
||||
<property name="interceptorNames"><value>debugInterceptor</value></property>
|
||||
<property name="interceptorNames"><value>debugInterceptor</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<!--
|
||||
Check that invoker is automatically added to wrap target.
|
||||
Non pointcut bean name should be wrapped in invoker.
|
||||
@@ -27,36 +27,36 @@
|
||||
Aspect interfaces don't need to be included here.
|
||||
They may, for example, be added by global interceptors.
|
||||
-->
|
||||
<property name="interfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
|
||||
<property name="interfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
|
||||
<!--
|
||||
Note that "test" is a target. An InvokerInterceptor
|
||||
will be added automatically.
|
||||
-->
|
||||
<property name="interceptorNames"><value>global*,test</value></property>
|
||||
|
||||
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="prototype" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interfaces">
|
||||
<value>
|
||||
org.springframework.beans.ITestBean
|
||||
</value>
|
||||
org.springframework.tests.sample.beans.ITestBean
|
||||
</value>
|
||||
</property>
|
||||
<property name="singleton"><value>false</value></property>
|
||||
<property name="interceptorNames"><value>test</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="test2" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>
|
||||
org.springframework.beans.ITestBean
|
||||
</value>
|
||||
org.springframework.tests.sample.beans.ITestBean
|
||||
</value>
|
||||
</property>
|
||||
<property name="singleton"><value>false</value></property>
|
||||
<property name="targetName"><value>test</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="test3" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="autodetectInterfaces"><value>true</value></property>
|
||||
<property name="target"><ref local="test"/></property>
|
||||
@@ -74,7 +74,7 @@
|
||||
<property name="targetName"><value>testCircleTarget1</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="testCircleTarget1" class="org.springframework.beans.TestBean">
|
||||
<bean id="testCircleTarget1" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>666</value></property>
|
||||
<property name="spouse"><ref bean="testCircle2"/></property>
|
||||
@@ -85,18 +85,18 @@
|
||||
<property name="targetName"><value>testCircleTarget2</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="testCircleTarget2" class="org.springframework.beans.TestBean">
|
||||
<bean id="testCircleTarget2" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>666</value></property>
|
||||
<property name="spouse"><ref bean="testCircle1"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="pointcuts" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="interceptorNames"><value>pointcutForVoid</value></property>
|
||||
<property name="targetName"><value>test</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="pointcutForVoid" class="org.springframework.aop.framework.ProxyFactoryBeanTests$PointcutForVoid"/>
|
||||
|
||||
<!--
|
||||
@@ -104,22 +104,22 @@
|
||||
Must have target because there are no interceptors.
|
||||
-->
|
||||
<!--
|
||||
<bean id="noInterceptorNamesWithoutTarget"
|
||||
<bean id="noInterceptorNamesWithoutTarget"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean"
|
||||
>
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
|
||||
>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
|
||||
</bean>
|
||||
|
||||
<bean id="noInterceptorNamesWithTarget"
|
||||
|
||||
<bean id="noInterceptorNamesWithTarget"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean"
|
||||
>
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="target"><ref local="test"/></property>
|
||||
|
||||
>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="target"><ref local="test"/></property>
|
||||
|
||||
</bean>
|
||||
-->
|
||||
|
||||
|
||||
<bean id="validGlobals" scope="singleton" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.context.ApplicationListener</value></property>
|
||||
<property name="interceptorNames"><value>debugInterceptor,global*,target2</value></property>
|
||||
@@ -137,10 +137,10 @@
|
||||
|
||||
<bean id="prototypeLockMixinAdvisor" class="test.mixin.LockMixinAdvisor" scope="prototype"/>
|
||||
|
||||
<bean id="prototypeTestBean" class="org.springframework.beans.TestBean" scope="prototype"/>
|
||||
<bean id="prototypeTestBean" class="org.springframework.tests.sample.beans.TestBean" scope="prototype"/>
|
||||
|
||||
<bean id="prototypeTestBeanProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="interfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="singleton"><value>false</value></property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
@@ -155,7 +155,7 @@
|
||||
<bean id="prototypeTestBeanProxySingletonTarget" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interfaces">
|
||||
<list>
|
||||
<value>org.springframework.beans.ITestBean</value>
|
||||
<value>org.springframework.tests.sample.beans.ITestBean</value>
|
||||
<value>test.mixin.Lockable</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
<bean id="eveTargetSource" class="org.springframework.aop.target.SingletonTargetSource">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.beans.TestBean">
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Eve</value></property>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="adam" class="org.springframework.beans.TestBean">
|
||||
<bean id="adam" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Adam</value></property>
|
||||
</bean>
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
</bean>
|
||||
|
||||
<bean id="countingBeforeAdvice"
|
||||
class="test.advice.CountingBeforeAdvice"
|
||||
class="org.springframework.tests.aop.advice.CountingBeforeAdvice"
|
||||
/>
|
||||
|
||||
<bean id="doubleTarget"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<!-- this is the one used and NOT the one set by targetSource -->
|
||||
<property name="interceptorNames"><value>countingBeforeAdvice,adamTargetSource</value></property>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<!-- but this is also possible -->
|
||||
<bean id="arbitraryTarget"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<!-- this is the one used and NOT the one set by targetSource -->
|
||||
<property name="interceptorNames"><value>adam</value></property>
|
||||
<property name="targetSource"><ref local="eveTargetSource"/></property>
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
<beans>
|
||||
|
||||
<!-- Simple target -->
|
||||
<bean id="test" class="org.springframework.beans.TestBean">
|
||||
<bean id="test" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>666</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="debugInterceptor" class="test.interceptor.NopInterceptor">
|
||||
</bean>
|
||||
|
||||
<bean id="frozen"
|
||||
|
||||
|
||||
<bean id="debugInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor">
|
||||
</bean>
|
||||
|
||||
<bean id="frozen"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean"
|
||||
>
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
|
||||
<property name="target"><ref local="test"/></property>
|
||||
<property name="interceptorNames"><value>debugInterceptor</value></property>
|
||||
>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
|
||||
<property name="target"><ref local="test"/></property>
|
||||
<property name="interceptorNames"><value>debugInterceptor</value></property>
|
||||
<property name="frozen"><value>true</value></property>
|
||||
<property name="optimize"><value>true</value></property>
|
||||
|
||||
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -9,31 +9,30 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="nopInterceptor" class="test.interceptor.NopInterceptor">
|
||||
<bean id="nopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor">
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="testBean"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean"
|
||||
>
|
||||
>
|
||||
<property name="target">
|
||||
<bean class="org.springframework.beans.TestBean">
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>innerBeanTarget</value></property>
|
||||
</bean>
|
||||
</property>
|
||||
|
||||
|
||||
<property name="interceptorNames">
|
||||
<value>nopInterceptor</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
|
||||
<!--
|
||||
Autowire would fail if distinct target and proxy:
|
||||
we expect just to have proxy
|
||||
-->
|
||||
<bean id="autowireCheck"
|
||||
<bean id="autowireCheck"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBeanTests$DependsOnITestBean"
|
||||
autowire="constructor" />
|
||||
|
||||
</beans>
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<!-- Same effect as noInterceptor names: also invalid -->
|
||||
<bean id="emptyInterceptorNames" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="interfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="interceptorNames"><value></value></property>
|
||||
</bean>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
Must have target after *.
|
||||
-->
|
||||
<bean id="globalsWithoutTarget" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="interfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="interceptorNames"><value>global*</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<beans>
|
||||
|
||||
|
||||
<bean id="adam" class="org.springframework.beans.TestBean">
|
||||
<bean id="adam" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Adam</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="countingBeforeAdvice"
|
||||
class="test.advice.CountingBeforeAdvice"
|
||||
class="org.springframework.tests.aop.advice.CountingBeforeAdvice"
|
||||
/>
|
||||
|
||||
<!--
|
||||
@@ -23,7 +23,7 @@
|
||||
-->
|
||||
<bean id="targetSourceNotLast"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<!-- this is the one used and NOT the one set by targetSource -->
|
||||
<property name="interceptorNames"><value>adam,countingBeforeAdvice</value></property>
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
<beans>
|
||||
|
||||
<!-- Simple target -->
|
||||
<bean id="test" class="test.beans.SideEffectBean">
|
||||
<bean id="test" class="org.springframework.tests.sample.beans.SideEffectBean">
|
||||
<property name="count"><value>10</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="prototypeTarget" class="test.beans.SideEffectBean" scope="prototype">
|
||||
<bean id="prototypeTarget" class="org.springframework.tests.sample.beans.SideEffectBean" scope="prototype">
|
||||
<property name="count"><value>10</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="debugInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="debugInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="singleton" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames"><value>debugInterceptor,test</value></property>
|
||||
|
||||
@@ -6,35 +6,35 @@
|
||||
-->
|
||||
<beans>
|
||||
|
||||
<bean id="nopInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="nopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="serializableNopInterceptor" class="test.interceptor.SerializableNopInterceptor"/>
|
||||
<bean id="serializableNopInterceptor" class="org.springframework.tests.aop.interceptor.SerializableNopInterceptor"/>
|
||||
|
||||
<bean id="serializableSingleton" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames"><value>serializableNopInterceptor</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.Person</value></property>
|
||||
<property name="interceptorNames"><value>serializableNopInterceptor</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.Person</value></property>
|
||||
<property name="target">
|
||||
<bean class="org.springframework.beans.SerializablePerson">
|
||||
<bean class="org.springframework.tests.sample.beans.SerializablePerson">
|
||||
<property name="name"><value>serializableSingleton</value></property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="prototypeTarget" class="org.springframework.beans.SerializablePerson">
|
||||
<bean id="prototypeTarget" class="org.springframework.tests.sample.beans.SerializablePerson">
|
||||
<property name="name"><value>serializablePrototype</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="serializablePrototype" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames"><value>serializableNopInterceptor,prototypeTarget</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.Person</value></property>
|
||||
<property name="interceptorNames"><value>serializableNopInterceptor,prototypeTarget</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.Person</value></property>
|
||||
<property name="singleton"><value>false</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="interceptorNotSerializableSingleton" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames"><value>nopInterceptor</value></property>
|
||||
<property name="target">
|
||||
<bean class="org.springframework.beans.SerializablePerson"/>
|
||||
<bean class="org.springframework.tests.sample.beans.SerializablePerson"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
<beans>
|
||||
|
||||
<!-- Simple target -->
|
||||
<bean id="target" class="org.springframework.beans.TestBean">
|
||||
<bean id="target" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<!-- initial value :-) -->
|
||||
<property name="name"><value>Adam</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="nopInterceptor" class="test.interceptor.NopInterceptor">
|
||||
|
||||
<bean id="nopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor">
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="countingBeforeAdvice"
|
||||
class="test.advice.CountingBeforeAdvice"
|
||||
class="org.springframework.tests.aop.advice.CountingBeforeAdvice"
|
||||
/>
|
||||
|
||||
|
||||
<!--
|
||||
Note that there's normally no reason to create objects of this type
|
||||
in a BeanFactory. If for some strange reason you want to, use Type 3 IoC.
|
||||
@@ -29,30 +29,30 @@
|
||||
</bean>
|
||||
|
||||
<bean id="directTarget"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames" value="countingBeforeAdvice,nopInterceptor,target"/>
|
||||
<property name="proxyTargetClass" value="true"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="viaTargetSource"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames"><value>nopInterceptor,targetSource</value></property>
|
||||
<property name="proxyTargetClass" value="true"/>
|
||||
<property name="proxyTargetClass" value="true"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id ="unsupportedInterceptor"
|
||||
class="org.springframework.aop.framework.UnsupportedInterceptor"
|
||||
/>
|
||||
|
||||
|
||||
<!--
|
||||
No target or target source, just the interceptor
|
||||
-->
|
||||
<bean id="noTarget"
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="interceptorNames"><value>nopInterceptor,unsupportedInterceptor</value></property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
<beans>
|
||||
|
||||
<!-- Simple target -->
|
||||
<bean id="target" class="org.springframework.aop.framework.Echo"/>
|
||||
|
||||
<bean id="nopInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="countingBeforeAdvice" class="test.advice.CountingBeforeAdvice" />
|
||||
|
||||
<bean id="throwsAdvice" class="test.advice.MyThrowsHandler"/>
|
||||
<bean id="target" class="org.springframework.aop.framework.Echo"/>
|
||||
|
||||
<bean id="throwsAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<bean id="nopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="countingBeforeAdvice" class="org.springframework.tests.aop.advice.CountingBeforeAdvice" />
|
||||
|
||||
<bean id="throwsAdvice" class="org.springframework.tests.aop.advice.MyThrowsHandler"/>
|
||||
|
||||
<bean id="throwsAdvised" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="interceptorNames">
|
||||
<value>countingBeforeAdvice,nopInterceptor,throwsAdvice,target</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="testBeanTarget" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBeanTarget" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="simpleBeforeAdvice" class="org.springframework.aop.framework.adapter.SimpleBeforeAdviceImpl"/>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="testBean" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="interceptorNames"><value>simpleBeforeAdviceAdvisor,testBeanTarget</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="testBeanTarget" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="testBeanTarget" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<bean id="simpleBeforeAdvice" class="org.springframework.aop.framework.adapter.SimpleBeforeAdviceImpl"/>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="testBean" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>org.springframework.beans.ITestBean</value></property>
|
||||
<property name="proxyInterfaces"><value>org.springframework.tests.sample.beans.ITestBean</value></property>
|
||||
<property name="interceptorNames"><value>simpleBeforeAdviceAdvisor,testBeanTarget</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="nopInterceptor" class="test.interceptor.NopInterceptor" />
|
||||
<bean id="nopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor" />
|
||||
|
||||
<!--
|
||||
Stateful mixin. Will apply to all objects
|
||||
@@ -32,12 +32,12 @@
|
||||
/>
|
||||
|
||||
<bean id="test1"
|
||||
class="org.springframework.beans.TestBean">
|
||||
class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="age"><value>4</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="test2"
|
||||
class="org.springframework.beans.TestBean">
|
||||
class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="age"><value>4</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -11,24 +11,24 @@
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="test" scope="prototype" class="org.springframework.beans.TestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="prototypeTest" class="org.springframework.aop.framework.autoproxy.CountingTestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="lazyInitTest" class="org.springframework.aop.framework.autoproxy.CountingTestBean" lazy-init="true">
|
||||
|
||||
<bean id="test" scope="prototype" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="wife" class="org.springframework.beans.TestBean">
|
||||
<bean id="prototypeTest" class="org.springframework.tests.sample.beans.CountingTestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="lazyInitTest" class="org.springframework.tests.sample.beans.CountingTestBean" lazy-init="true">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="wife" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Kerry</value></property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="optimizedTestBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="optimizedTestBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="Optimized"/>
|
||||
</bean>
|
||||
|
||||
<bean id="countingAdvice" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="countingAdvice" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="advisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
|
||||
<property name="advice" ref="countingAdvice"/>
|
||||
|
||||
@@ -14,29 +14,29 @@
|
||||
<bean id="aapc.quickTargetSourceCreator"
|
||||
class="org.springframework.aop.framework.autoproxy.target.QuickTargetSourceCreator"/>
|
||||
|
||||
<bean id="test" scope="prototype" class="org.springframework.beans.TestBean">
|
||||
<bean id="test" scope="prototype" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="wife" class="org.springframework.beans.TestBean">
|
||||
<bean id="wife" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Kerry</value></property>
|
||||
</bean>
|
||||
|
||||
<!-- Prefix means it will be pooled -->
|
||||
<bean id=":test" class="org.springframework.beans.TestBean">
|
||||
<bean id=":test" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<!-- Prefix means it will be thread local -->
|
||||
<bean name="%test" scope="prototype" class="org.springframework.beans.TestBean">
|
||||
<bean name="%test" scope="prototype" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
<!-- Prefix means it will be a prototype target source -->
|
||||
<bean name="!test" scope="prototype" class="org.springframework.beans.TestBean">
|
||||
<bean name="!test" scope="prototype" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>Rod</value></property>
|
||||
<property name="spouse"><ref local="wife"/></property>
|
||||
</bean>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="bean" class="org.springframework.beans.TestBean"/>
|
||||
<bean id="bean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="timestampIntroduction" class="test.advice.TimestampIntroductionAdvisor"/>
|
||||
<bean id="timestampIntroduction" class="org.springframework.tests.aop.advice.TimestampIntroductionAdvisor"/>
|
||||
|
||||
<!--
|
||||
Stateful mixin. Note that singleton property is false.
|
||||
@@ -67,17 +67,17 @@
|
||||
<bean id="lockableAdvisor" class="test.mixin.LockMixinAdvisor"
|
||||
scope="prototype"/>
|
||||
|
||||
<bean id="countingBeforeAdvice" class="test.advice.CountingBeforeAdvice"/>
|
||||
<bean id="countingBeforeAdvice" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/>
|
||||
|
||||
<bean id="nopInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="nopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="introductionNopInterceptor" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="introductionNopInterceptor" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<bean id="introductionUsingJdk" class="org.springframework.beans.TestBean">
|
||||
<bean id="introductionUsingJdk" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>introductionUsingJdk</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="second-introductionUsingJdk" class="org.springframework.beans.TestBean">
|
||||
<bean id="second-introductionUsingJdk" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>second-introductionUsingJdk</value></property>
|
||||
</bean>
|
||||
|
||||
@@ -88,30 +88,30 @@
|
||||
lazy-init="true">
|
||||
</bean>
|
||||
|
||||
<bean id="jdk1" class="org.springframework.beans.TestBean">
|
||||
<bean id="jdk1" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>jdk1</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="frozen" class="org.springframework.beans.TestBean">
|
||||
<bean id="frozen" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name" value="frozenBean"/>
|
||||
</bean>
|
||||
|
||||
<alias name="frozen" alias="frozenBean"/>
|
||||
|
||||
<bean id="cglib1" class="org.springframework.beans.TestBean">
|
||||
<bean id="cglib1" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>cglib1</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="onlyJdk" class="org.springframework.beans.TestBean">
|
||||
<bean id="onlyJdk" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>onlyJdk</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="doubleJdk" class="org.springframework.beans.TestBean">
|
||||
<bean id="doubleJdk" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>doubleJdk</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="noproxy" class="org.springframework.beans.TestBean">
|
||||
<bean id="noproxy" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="name"><value>noproxy</value></property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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,10 @@
|
||||
|
||||
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 static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -24,17 +27,17 @@ 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.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
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.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import test.advice.CountingBeforeAdvice;
|
||||
import test.interceptor.NopInterceptor;
|
||||
import test.mixin.Lockable;
|
||||
import test.mixin.LockedException;
|
||||
import test.util.TimeStamped;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
@@ -226,4 +229,4 @@ class CreatesTestBean implements FactoryBean<Object> {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<aop:scoped-proxy/>
|
||||
</bean>
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<property name="friends" ref="scopedList"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
|
||||
|
||||
<bean id="testBean" class="org.springframework.beans.TestBean" scope="request">
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean" scope="request">
|
||||
<aop:scoped-proxy proxy-target-class="false"/>
|
||||
<property name="age" value="99"/>
|
||||
</bean>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="testBeanTarget" class="org.springframework.beans.TestBean" scope="request"/>
|
||||
<bean id="testBeanTarget" class="org.springframework.tests.sample.beans.TestBean" scope="request"/>
|
||||
|
||||
<bean id="testBean" class="org.springframework.aop.scope.ScopedProxyFactoryBean">
|
||||
<property name="targetBeanName" value="testBeanTarget"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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,9 +26,9 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.ITestBean;
|
||||
import org.springframework.beans.TestBean;
|
||||
import org.springframework.beans.factory.config.SimpleMapScope;
|
||||
import org.springframework.tests.context.SimpleMapScope;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="prototypeTest" class="test.beans.SideEffectBean" scope="prototype">
|
||||
<bean id="prototypeTest" class="org.springframework.tests.sample.beans.SideEffectBean" scope="prototype">
|
||||
<property name="count"><value>10</value></property>
|
||||
</bean>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<property name="targetMethod"><value>getPoolingConfigMixin</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="nop" class="test.interceptor.NopInterceptor"/>
|
||||
<bean id="nop" class="org.springframework.tests.aop.interceptor.NopInterceptor"/>
|
||||
|
||||
<!--
|
||||
This will create a bean for each thread ("apartment")
|
||||
@@ -40,9 +40,9 @@
|
||||
</bean>
|
||||
|
||||
<!-- Serialization tests using serializable target and advice -->
|
||||
<bean id="serializableNop" class="test.interceptor.SerializableNopInterceptor" />
|
||||
<bean id="serializableNop" class="org.springframework.tests.aop.interceptor.SerializableNopInterceptor" />
|
||||
|
||||
<bean id="prototypePerson" class="org.springframework.beans.SerializablePerson" scope="prototype"/>
|
||||
<bean id="prototypePerson" class="org.springframework.tests.sample.beans.SerializablePerson" scope="prototype"/>
|
||||
|
||||
<bean id="personPoolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">
|
||||
<property name="targetBeanName"><value>prototypePerson</value></property>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author 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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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}.
|
||||
*
|
||||
* <p>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;
|
||||
|
||||
}
|
||||
@@ -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<TestBean> list;
|
||||
|
||||
private Set<TestBean> set;
|
||||
|
||||
private SortedSet<?> sortedSet;
|
||||
|
||||
private Map<String, 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<>();
|
||||
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<Object> 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<TestBean> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<TestBean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public Set<TestBean> 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<String, Object> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map<String, Object> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public SortedMap<?, ?> getSortedMap() {
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
public void setSortedMap(SortedMap<?, ?> sortedMap) {
|
||||
this.sortedMap = sortedMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Object> {
|
||||
|
||||
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<? super Object> 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<? super Object> getFriends() {
|
||||
return friends;
|
||||
}
|
||||
|
||||
public void setFriends(Collection<? super Object> 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;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user