Add @Override annotations to test sources
Issue: SPR-10129
This commit is contained in:
parent
6f0c7eb8c1
commit
4c8cd7b0bd
|
@ -113,6 +113,7 @@ public final class AspectJExpressionPointcutTests {
|
||||||
|
|
||||||
public static class OtherIOther implements IOther {
|
public static class OtherIOther implements IOther {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void absquatulate() {
|
public void absquatulate() {
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
@ -354,6 +355,7 @@ class CallCountingInterceptor implements MethodInterceptor {
|
||||||
|
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||||
count++;
|
count++;
|
||||||
return methodInvocation.proceed();
|
return methodInvocation.proceed();
|
||||||
|
|
|
@ -90,6 +90,7 @@ public final class BeanNamePointcutMatchingTests {
|
||||||
private static boolean matches(final String beanName, String pcExpression) {
|
private static boolean matches(final String beanName, String pcExpression) {
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() {
|
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() {
|
||||||
|
@Override
|
||||||
protected String getCurrentProxiedBeanName() {
|
protected String getCurrentProxiedBeanName() {
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ public final class MethodInvocationProceedingJoinPointTests {
|
||||||
pf.addAdvice(new MethodBeforeAdvice() {
|
pf.addAdvice(new MethodBeforeAdvice() {
|
||||||
private int depth;
|
private int depth;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||||
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
|
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
|
||||||
assertTrue("Method named in toString", jp.toString().contains(method.getName()));
|
assertTrue("Method named in toString", jp.toString().contains(method.getName()));
|
||||||
|
@ -135,6 +136,7 @@ public final class MethodInvocationProceedingJoinPointTests {
|
||||||
ProxyFactory pf = new ProxyFactory(raw);
|
ProxyFactory pf = new ProxyFactory(raw);
|
||||||
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
||||||
pf.addAdvice(new MethodBeforeAdvice() {
|
pf.addAdvice(new MethodBeforeAdvice() {
|
||||||
|
@Override
|
||||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||||
SourceLocation sloc = AbstractAspectJAdvice.currentJoinPoint().getSourceLocation();
|
SourceLocation sloc = AbstractAspectJAdvice.currentJoinPoint().getSourceLocation();
|
||||||
assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation());
|
assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation());
|
||||||
|
@ -167,6 +169,7 @@ public final class MethodInvocationProceedingJoinPointTests {
|
||||||
ProxyFactory pf = new ProxyFactory(raw);
|
ProxyFactory pf = new ProxyFactory(raw);
|
||||||
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
||||||
pf.addAdvice(new MethodBeforeAdvice() {
|
pf.addAdvice(new MethodBeforeAdvice() {
|
||||||
|
@Override
|
||||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||||
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
|
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
|
||||||
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
|
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
|
||||||
|
@ -186,6 +189,7 @@ public final class MethodInvocationProceedingJoinPointTests {
|
||||||
ProxyFactory pf = new ProxyFactory(raw);
|
ProxyFactory pf = new ProxyFactory(raw);
|
||||||
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
||||||
pf.addAdvice(new MethodBeforeAdvice() {
|
pf.addAdvice(new MethodBeforeAdvice() {
|
||||||
|
@Override
|
||||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||||
// makeEncSJP, although meant for computing the enclosing join point,
|
// makeEncSJP, although meant for computing the enclosing join point,
|
||||||
// it serves our purpose here
|
// it serves our purpose here
|
||||||
|
|
|
@ -137,6 +137,7 @@ public class TrickyAspectJPointcutExpressionTests {
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public static class TestServiceImpl implements TestService {
|
public static class TestServiceImpl implements TestService {
|
||||||
|
@Override
|
||||||
public String sayHello() {
|
public String sayHello() {
|
||||||
throw new TestException("TestServiceImpl");
|
throw new TestException("TestServiceImpl");
|
||||||
}
|
}
|
||||||
|
@ -148,6 +149,7 @@ public class TrickyAspectJPointcutExpressionTests {
|
||||||
|
|
||||||
private int countThrows = 0;
|
private int countThrows = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void before(Method method, Object[] objects, Object o) throws Throwable {
|
public void before(Method method, Object[] objects, Object o) throws Throwable {
|
||||||
countBefore++;
|
countBefore++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -675,19 +675,23 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
|
||||||
return this.count;
|
return this.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getAspectInstance() {
|
public Object getAspectInstance() {
|
||||||
++this.count;
|
++this.count;
|
||||||
return new PerTypeWithinAspect();
|
return new PerTypeWithinAspect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ClassLoader getAspectClassLoader() {
|
public ClassLoader getAspectClassLoader() {
|
||||||
return PerTypeWithinAspect.class.getClassLoader();
|
return PerTypeWithinAspect.class.getClassLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public AspectMetadata getAspectMetadata() {
|
public AspectMetadata getAspectMetadata() {
|
||||||
return new AspectMetadata(PerTypeWithinAspect.class, "perTypeWithin");
|
return new AspectMetadata(PerTypeWithinAspect.class, "perTypeWithin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return Ordered.LOWEST_PRECEDENCE;
|
return Ordered.LOWEST_PRECEDENCE;
|
||||||
}
|
}
|
||||||
|
@ -897,14 +901,17 @@ abstract class AbstractMakeModifiable {
|
||||||
public static class ModifiableImpl implements MutableModifable {
|
public static class ModifiableImpl implements MutableModifable {
|
||||||
private boolean modified;
|
private boolean modified;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void acceptChanges() {
|
public void acceptChanges() {
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isModified() {
|
public boolean isModified() {
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void markDirty() {
|
public void markDirty() {
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
}
|
}
|
||||||
|
@ -1020,17 +1027,21 @@ class MakeLockable {
|
||||||
|
|
||||||
class CannotBeUnlocked implements Lockable, Comparable<Object> {
|
class CannotBeUnlocked implements Lockable, Comparable<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void lock() {
|
public void lock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void unlock() {
|
public void unlock() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean locked() {
|
public boolean locked() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareTo(Object arg0) {
|
public int compareTo(Object arg0) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public final class ArgumentBindingTests {
|
||||||
|
|
||||||
public static class TransactionalBean implements ITransactionalBean {
|
public static class TransactionalBean implements ITransactionalBean {
|
||||||
|
|
||||||
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void doInTransaction() {
|
public void doInTransaction() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ public final class AspectProxyFactoryTests {
|
||||||
|
|
||||||
private int age;
|
private int age;
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,7 @@ public final class AspectJPrecedenceComparatorTests {
|
||||||
|
|
||||||
private Advisor createSpringAOPAfterAdvice(int order) {
|
private Advisor createSpringAOPAfterAdvice(int order) {
|
||||||
AfterReturningAdvice advice = new AfterReturningAdvice() {
|
AfterReturningAdvice advice = new AfterReturningAdvice() {
|
||||||
|
@Override
|
||||||
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
|
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -129,6 +129,7 @@ public final class AopProxyUtilsTests {
|
||||||
public void testProxiedUserInterfacesWithNoInterface() {
|
public void testProxiedUserInterfacesWithNoInterface() {
|
||||||
Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[0],
|
Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[0],
|
||||||
new InvocationHandler() {
|
new InvocationHandler() {
|
||||||
|
@Override
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public final class IntroductionBenchmarkTests {
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public static class SimpleCounterIntroduction extends DelegatingIntroductionInterceptor implements Counter {
|
public static class SimpleCounterIntroduction extends DelegatingIntroductionInterceptor implements Counter {
|
||||||
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return EXPECTED_COMPARE;
|
return EXPECTED_COMPARE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public final class MethodInvocationTests {
|
||||||
final Object returnValue = new Object();
|
final Object returnValue = new Object();
|
||||||
List<Object> is = new LinkedList<Object>();
|
List<Object> is = new LinkedList<Object>();
|
||||||
is.add(new MethodInterceptor() {
|
is.add(new MethodInterceptor() {
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class NullPrimitiveTests {
|
||||||
public void testNullPrimitiveWithJdkProxy() {
|
public void testNullPrimitiveWithJdkProxy() {
|
||||||
|
|
||||||
class SimpleFoo implements Foo {
|
class SimpleFoo implements Foo {
|
||||||
|
@Override
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,7 @@ public class NullPrimitiveTests {
|
||||||
SimpleFoo target = new SimpleFoo();
|
SimpleFoo target = new SimpleFoo();
|
||||||
ProxyFactory factory = new ProxyFactory(target);
|
ProxyFactory factory = new ProxyFactory(target);
|
||||||
factory.addAdvice(new MethodInterceptor() {
|
factory.addAdvice(new MethodInterceptor() {
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +78,7 @@ public class NullPrimitiveTests {
|
||||||
Bar target = new Bar();
|
Bar target = new Bar();
|
||||||
ProxyFactory factory = new ProxyFactory(target);
|
ProxyFactory factory = new ProxyFactory(target);
|
||||||
factory.addAdvice(new MethodInterceptor() {
|
factory.addAdvice(new MethodInterceptor() {
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ public final class PrototypeTargetTests {
|
||||||
constructionCount++;
|
constructionCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doSomething() {
|
public void doSomething() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +82,7 @@ public final class PrototypeTargetTests {
|
||||||
public static class TestInterceptor implements MethodInterceptor {
|
public static class TestInterceptor implements MethodInterceptor {
|
||||||
private int invocationCount = 0;
|
private int invocationCount = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||||
invocationCount++;
|
invocationCount++;
|
||||||
return methodInvocation.proceed();
|
return methodInvocation.proceed();
|
||||||
|
|
|
@ -165,6 +165,7 @@ public final class ProxyFactoryTests {
|
||||||
@Test
|
@Test
|
||||||
public void testAddRepeatedInterface() {
|
public void testAddRepeatedInterface() {
|
||||||
TimeStamped tst = new TimeStamped() {
|
TimeStamped tst = new TimeStamped() {
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
throw new UnsupportedOperationException("getTimeStamp");
|
throw new UnsupportedOperationException("getTimeStamp");
|
||||||
}
|
}
|
||||||
|
@ -181,6 +182,7 @@ public final class ProxyFactoryTests {
|
||||||
public void testGetsAllInterfaces() throws Exception {
|
public void testGetsAllInterfaces() throws Exception {
|
||||||
// Extend to get new interface
|
// Extend to get new interface
|
||||||
class TestBeanSubclass extends TestBean implements Comparable<Object> {
|
class TestBeanSubclass extends TestBean implements Comparable<Object> {
|
||||||
|
@Override
|
||||||
public int compareTo(Object arg0) {
|
public int compareTo(Object arg0) {
|
||||||
throw new UnsupportedOperationException("compareTo");
|
throw new UnsupportedOperationException("compareTo");
|
||||||
}
|
}
|
||||||
|
@ -214,6 +216,7 @@ public final class ProxyFactoryTests {
|
||||||
@Test
|
@Test
|
||||||
public void testInterceptorInclusionMethods() {
|
public void testInterceptorInclusionMethods() {
|
||||||
class MyInterceptor implements MethodInterceptor {
|
class MyInterceptor implements MethodInterceptor {
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@ -350,6 +353,7 @@ public final class ProxyFactoryTests {
|
||||||
this.ts = ts;
|
this.ts = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,7 @@ public final class ThrowsAdviceInterceptorTests {
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
MyThrowsHandler th = new MyThrowsHandler() {
|
MyThrowsHandler th = new MyThrowsHandler() {
|
||||||
|
@Override
|
||||||
public void afterThrowing(RemoteException ex) throws Throwable {
|
public void afterThrowing(RemoteException ex) throws Throwable {
|
||||||
super.afterThrowing(ex);
|
super.afterThrowing(ex);
|
||||||
throw t;
|
throw t;
|
||||||
|
|
|
@ -120,6 +120,7 @@ public final class ConcurrencyThrottleInterceptorTests {
|
||||||
this.ex = ex;
|
this.ex = ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (this.ex != null) {
|
if (this.ex != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -189,6 +189,7 @@ public final class CustomizableTraceInterceptorTests {
|
||||||
this.log = log;
|
this.log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Log getLoggerForInvocation(MethodInvocation invocation) {
|
protected Log getLoggerForInvocation(MethodInvocation invocation) {
|
||||||
return this.log;
|
return this.log;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ public final class DebugInterceptorTests {
|
||||||
this.log = log;
|
this.log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Log getLoggerForInvocation(MethodInvocation invocation) {
|
protected Log getLoggerForInvocation(MethodInvocation invocation) {
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public final class ExposeBeanNameAdvisorsTests {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
assertEquals(beanName, ExposeBeanNameAdvisors.getBeanName());
|
assertEquals(beanName, ExposeBeanNameAdvisors.getBeanName());
|
||||||
return super.getAge();
|
return super.getAge();
|
||||||
|
|
|
@ -53,12 +53,14 @@ public final class ExposeInvocationInterceptorTests {
|
||||||
|
|
||||||
abstract class ExposedInvocationTestBean extends TestBean {
|
abstract class ExposedInvocationTestBean extends TestBean {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation();
|
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation();
|
||||||
assertions(invocation);
|
assertions(invocation);
|
||||||
return super.getName();
|
return super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void absquatulate() {
|
public void absquatulate() {
|
||||||
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation();
|
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation();
|
||||||
assertions(invocation);
|
assertions(invocation);
|
||||||
|
@ -70,6 +72,7 @@ abstract class ExposedInvocationTestBean extends TestBean {
|
||||||
|
|
||||||
|
|
||||||
class InvocationCheckExposedInvocationTestBean extends ExposedInvocationTestBean {
|
class InvocationCheckExposedInvocationTestBean extends ExposedInvocationTestBean {
|
||||||
|
@Override
|
||||||
protected void assertions(MethodInvocation invocation) {
|
protected void assertions(MethodInvocation invocation) {
|
||||||
assertTrue(invocation.getThis() == this);
|
assertTrue(invocation.getThis() == this);
|
||||||
assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),
|
assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),
|
||||||
|
|
|
@ -40,6 +40,7 @@ public final class AopUtilsTests {
|
||||||
@Test
|
@Test
|
||||||
public void testPointcutCanNeverApply() {
|
public void testPointcutCanNeverApply() {
|
||||||
class TestPointcut extends StaticMethodMatcherPointcut {
|
class TestPointcut extends StaticMethodMatcherPointcut {
|
||||||
|
@Override
|
||||||
public boolean matches(Method method, Class<?> clazzy) {
|
public boolean matches(Method method, Class<?> clazzy) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +59,7 @@ public final class AopUtilsTests {
|
||||||
@Test
|
@Test
|
||||||
public void testPointcutAppliesToOneMethodOnObject() {
|
public void testPointcutAppliesToOneMethodOnObject() {
|
||||||
class TestPointcut extends StaticMethodMatcherPointcut {
|
class TestPointcut extends StaticMethodMatcherPointcut {
|
||||||
|
@Override
|
||||||
public boolean matches(Method method, Class<?> clazz) {
|
public boolean matches(Method method, Class<?> clazz) {
|
||||||
return method.getName().equals("hashCode");
|
return method.getName().equals("hashCode");
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,24 +35,28 @@ import test.beans.TestBean;
|
||||||
public final class ComposablePointcutTests {
|
public final class ComposablePointcutTests {
|
||||||
|
|
||||||
public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() {
|
public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().startsWith("get");
|
return m.getName().startsWith("get");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static MethodMatcher GET_AGE_METHOD_MATCHER = new StaticMethodMatcher() {
|
public static MethodMatcher GET_AGE_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().equals("getAge");
|
return m.getName().equals("getAge");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static MethodMatcher ABSQUATULATE_METHOD_MATCHER = new StaticMethodMatcher() {
|
public static MethodMatcher ABSQUATULATE_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().equals("absquatulate");
|
return m.getName().equals("absquatulate");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static MethodMatcher SETTER_METHOD_MATCHER = new StaticMethodMatcher() {
|
public static MethodMatcher SETTER_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().startsWith("set");
|
return m.getName().startsWith("set");
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,8 +112,10 @@ public final class DelegatingIntroductionInterceptorTests {
|
||||||
public void testAutomaticInterfaceRecognitionInDelegate() throws Exception {
|
public void testAutomaticInterfaceRecognitionInDelegate() throws Exception {
|
||||||
final long t = 1001L;
|
final long t = 1001L;
|
||||||
class Tester implements TimeStamped, ITester {
|
class Tester implements TimeStamped, ITester {
|
||||||
|
@Override
|
||||||
public void foo() throws Exception {
|
public void foo() throws Exception {
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -141,8 +143,10 @@ public final class DelegatingIntroductionInterceptorTests {
|
||||||
final long t = 1001L;
|
final long t = 1001L;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped, ITester {
|
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped, ITester {
|
||||||
|
@Override
|
||||||
public void foo() throws Exception {
|
public void foo() throws Exception {
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -206,6 +210,7 @@ public final class DelegatingIntroductionInterceptorTests {
|
||||||
String company = "Interface21";
|
String company = "Interface21";
|
||||||
target.setCompany(company);
|
target.setCompany(company);
|
||||||
TestBean delegate = new TestBean() {
|
TestBean delegate = new TestBean() {
|
||||||
|
@Override
|
||||||
public ITestBean getSpouse() {
|
public ITestBean getSpouse() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -250,6 +255,7 @@ public final class DelegatingIntroductionInterceptorTests {
|
||||||
final long t = 1001L;
|
final long t = 1001L;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped {
|
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped {
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -278,6 +284,7 @@ public final class DelegatingIntroductionInterceptorTests {
|
||||||
this.ts = ts;
|
this.ts = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
@ -292,6 +299,7 @@ public final class DelegatingIntroductionInterceptorTests {
|
||||||
this.t = t;
|
this.t = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTimeStamp() {
|
public long getTimeStamp() {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.springframework.aop.support;
|
||||||
*/
|
*/
|
||||||
public final class JdkRegexpMethodPointcutTests extends AbstractRegexpMethodPointcutTests {
|
public final class JdkRegexpMethodPointcutTests extends AbstractRegexpMethodPointcutTests {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected AbstractRegexpMethodPointcut getRegexpMethodPointcut() {
|
protected AbstractRegexpMethodPointcut getRegexpMethodPointcut() {
|
||||||
return new JdkRegexpMethodPointcut();
|
return new JdkRegexpMethodPointcut();
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ public final class MethodMatchersTests {
|
||||||
public StartsWithMatcher(String s) {
|
public StartsWithMatcher(String s) {
|
||||||
this.prefix = s;
|
this.prefix = s;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().startsWith(prefix);
|
return m.getName().startsWith(prefix);
|
||||||
}
|
}
|
||||||
|
@ -114,12 +115,14 @@ public final class MethodMatchersTests {
|
||||||
|
|
||||||
|
|
||||||
private static class TestDynamicMethodMatcherWhichMatches extends DynamicMethodMatcher {
|
private static class TestDynamicMethodMatcherWhichMatches extends DynamicMethodMatcher {
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass, Object[] args) {
|
public boolean matches(Method m, Class<?> targetClass, Object[] args) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestDynamicMethodMatcherWhichDoesNotMatch extends DynamicMethodMatcher {
|
private static class TestDynamicMethodMatcherWhichDoesNotMatch extends DynamicMethodMatcher {
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass, Object[] args) {
|
public boolean matches(Method m, Class<?> targetClass, Object[] args) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,17 @@ public final class PointcutsTests {
|
||||||
* Matches only TestBean class, not subclasses
|
* Matches only TestBean class, not subclasses
|
||||||
*/
|
*/
|
||||||
public static Pointcut allTestBeanMethodsPointcut = new StaticMethodMatcherPointcut() {
|
public static Pointcut allTestBeanMethodsPointcut = new StaticMethodMatcherPointcut() {
|
||||||
|
@Override
|
||||||
public ClassFilter getClassFilter() {
|
public ClassFilter getClassFilter() {
|
||||||
return new ClassFilter() {
|
return new ClassFilter() {
|
||||||
|
@Override
|
||||||
public boolean matches(Class<?> clazz) {
|
public boolean matches(Class<?> clazz) {
|
||||||
return clazz.equals(TestBean.class);
|
return clazz.equals(TestBean.class);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -73,10 +76,12 @@ public final class PointcutsTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pointcut myTestBeanSetterPointcut = new StaticMethodMatcherPointcut() {
|
public static Pointcut myTestBeanSetterPointcut = new StaticMethodMatcherPointcut() {
|
||||||
|
@Override
|
||||||
public ClassFilter getClassFilter() {
|
public ClassFilter getClassFilter() {
|
||||||
return new RootClassFilter(MyTestBean.class);
|
return new RootClassFilter(MyTestBean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().startsWith("set");
|
return m.getName().startsWith("set");
|
||||||
}
|
}
|
||||||
|
@ -84,10 +89,12 @@ public final class PointcutsTests {
|
||||||
|
|
||||||
// Will match MyTestBeanSubclass
|
// Will match MyTestBeanSubclass
|
||||||
public static Pointcut myTestBeanGetterPointcut = new StaticMethodMatcherPointcut() {
|
public static Pointcut myTestBeanGetterPointcut = new StaticMethodMatcherPointcut() {
|
||||||
|
@Override
|
||||||
public ClassFilter getClassFilter() {
|
public ClassFilter getClassFilter() {
|
||||||
return new RootClassFilter(MyTestBean.class);
|
return new RootClassFilter(MyTestBean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().startsWith("get");
|
return m.getName().startsWith("get");
|
||||||
}
|
}
|
||||||
|
@ -98,10 +105,12 @@ public final class PointcutsTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pointcut myTestBeanSubclassGetterPointcut = new StaticMethodMatcherPointcut() {
|
public static Pointcut myTestBeanSubclassGetterPointcut = new StaticMethodMatcherPointcut() {
|
||||||
|
@Override
|
||||||
public ClassFilter getClassFilter() {
|
public ClassFilter getClassFilter() {
|
||||||
return new RootClassFilter(MyTestBeanSubclass.class);
|
return new RootClassFilter(MyTestBeanSubclass.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean matches(Method m, Class<?> targetClass) {
|
public boolean matches(Method m, Class<?> targetClass) {
|
||||||
return m.getName().startsWith("get");
|
return m.getName().startsWith("get");
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,11 @@ public final class LazyCreationTargetSourceTests {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateLazy() {
|
public void testCreateLazy() {
|
||||||
TargetSource targetSource = new AbstractLazyCreationTargetSource() {
|
TargetSource targetSource = new AbstractLazyCreationTargetSource() {
|
||||||
|
@Override
|
||||||
protected Object createObject() {
|
protected Object createObject() {
|
||||||
return new InitCountingBean();
|
return new InitCountingBean();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class<?> getTargetClass() {
|
public Class<?> getTargetClass() {
|
||||||
return InitCountingBean.class;
|
return InitCountingBean.class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ public final class LazyInitTargetSourceTests {
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public static class CustomLazyInitTargetSource extends LazyInitTargetSource {
|
public static class CustomLazyInitTargetSource extends LazyInitTargetSource {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void postProcessTargetObject(Object targetObject) {
|
protected void postProcessTargetObject(Object targetObject) {
|
||||||
((ITestBean) targetObject).setName("Rob Harrop");
|
((ITestBean) targetObject).setName("Rob Harrop");
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,12 @@ public final class PrototypeBasedTargetSourceTests {
|
||||||
*/
|
*/
|
||||||
private TestBean thisFieldIsNotSerializable = new TestBean();
|
private TestBean thisFieldIsNotSerializable = new TestBean();
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getTarget() throws Exception {
|
public Object getTarget() throws Exception {
|
||||||
return newPrototypeInstance();
|
return newPrototypeInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void releaseTarget(Object target) throws Exception {
|
public void releaseTarget(Object target) throws Exception {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ public class ThreadLocalTargetSourceTests {
|
||||||
|
|
||||||
class Runner implements Runnable {
|
class Runner implements Runnable {
|
||||||
public SideEffectBean mine;
|
public SideEffectBean mine;
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
this.mine = (SideEffectBean) beanFactory.getBean("apartment");
|
this.mine = (SideEffectBean) beanFactory.getBean("apartment");
|
||||||
assertEquals(INITIAL_COUNT, mine.getCount() );
|
assertEquals(INITIAL_COUNT, mine.getCount() );
|
||||||
|
|
|
@ -116,6 +116,7 @@ public final class RefreshableTargetSourceTests {
|
||||||
this.requiresRefresh = requiresRefresh;
|
this.requiresRefresh = requiresRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Object freshTarget() {
|
protected Object freshTarget() {
|
||||||
this.callCount++;
|
this.callCount++;
|
||||||
return new Object();
|
return new Object();
|
||||||
|
@ -125,6 +126,7 @@ public final class RefreshableTargetSourceTests {
|
||||||
return this.callCount;
|
return this.callCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean requiresRefresh() {
|
protected boolean requiresRefresh() {
|
||||||
return this.requiresRefresh;
|
return this.requiresRefresh;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.aop.MethodBeforeAdvice;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice {
|
public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void before(Method m, Object[] args, Object target) throws Throwable {
|
public void before(Method m, Object[] args, Object target) throws Throwable {
|
||||||
count(m);
|
count(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,17 @@ public class DefaultLockable implements Lockable {
|
||||||
|
|
||||||
private boolean locked;
|
private boolean locked;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void lock() {
|
public void lock() {
|
||||||
this.locked = true;
|
this.locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void unlock() {
|
public void unlock() {
|
||||||
this.locked = false;
|
this.locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean locked() {
|
public boolean locked() {
|
||||||
return this.locked;
|
return this.locked;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class NopInterceptor implements MethodInterceptor {
|
||||||
/**
|
/**
|
||||||
* @see org.aopalliance.intercept.MethodInterceptor#invoke(MethodInvocation)
|
* @see org.aopalliance.intercept.MethodInterceptor#invoke(MethodInvocation)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||||
increment();
|
increment();
|
||||||
return invocation.proceed();
|
return invocation.proceed();
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class PerTargetAspect implements Ordered {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return this.order;
|
return this.order;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,12 @@ public class SerializableNopInterceptor extends NopInterceptor implements Serial
|
||||||
*/
|
*/
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return this.count;
|
return this.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void increment() {
|
protected void increment() {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,14 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String beanName) {
|
public void setBeanName(String beanName) {
|
||||||
if (this.beanName == null || beanName == null) {
|
if (this.beanName == null || beanName == null) {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getBeanName() {
|
public String getBeanName() {
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
@ -75,10 +77,12 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean wasDestroyed() {
|
public boolean wasDestroyed() {
|
||||||
return destroyed;
|
return destroyed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
|
||||||
this.company = (company != null ? company : "");
|
this.company = (company != null ? company : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCompany() {
|
public String getCompany() {
|
||||||
return company;
|
return company;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,22 +31,27 @@ public class SerializablePerson implements Person, Serializable {
|
||||||
private String name;
|
private String name;
|
||||||
private int age;
|
private int age;
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
this.age = age;
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object echo(Object o) throws Throwable {
|
public Object echo(Object o) throws Throwable {
|
||||||
if (o instanceof Throwable) {
|
if (o instanceof Throwable) {
|
||||||
throw (Throwable) o;
|
throw (Throwable) o;
|
||||||
|
|
|
@ -146,10 +146,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
return postProcessed;
|
return postProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -165,10 +167,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
this.age = age;
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
@ -181,14 +185,17 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
this.jedi = jedi;
|
this.jedi = jedi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITestBean getSpouse() {
|
public ITestBean getSpouse() {
|
||||||
return (spouses != null ? spouses[0] : null);
|
return (spouses != null ? spouses[0] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSpouse(ITestBean spouse) {
|
public void setSpouse(ITestBean spouse) {
|
||||||
this.spouses = new ITestBean[] {spouse};
|
this.spouses = new ITestBean[] {spouse};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITestBean[] getSpouses() {
|
public ITestBean[] getSpouses() {
|
||||||
return spouses;
|
return spouses;
|
||||||
}
|
}
|
||||||
|
@ -215,10 +222,12 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
this.country = country;
|
this.country = country;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getStringArray() {
|
public String[] getStringArray() {
|
||||||
return stringArray;
|
return stringArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setStringArray(String[] stringArray) {
|
public void setStringArray(String[] stringArray) {
|
||||||
this.stringArray = stringArray;
|
this.stringArray = stringArray;
|
||||||
}
|
}
|
||||||
|
@ -287,6 +296,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
this.someProperties = someProperties;
|
this.someProperties = someProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public INestedTestBean getDoctor() {
|
public INestedTestBean getDoctor() {
|
||||||
return doctor;
|
return doctor;
|
||||||
}
|
}
|
||||||
|
@ -295,6 +305,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
this.doctor = doctor;
|
this.doctor = doctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public INestedTestBean getLawyer() {
|
public INestedTestBean getLawyer() {
|
||||||
return lawyer;
|
return lawyer;
|
||||||
}
|
}
|
||||||
|
@ -347,18 +358,21 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
/**
|
/**
|
||||||
* @see ITestBean#exceptional(Throwable)
|
* @see ITestBean#exceptional(Throwable)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void exceptional(Throwable t) throws Throwable {
|
public void exceptional(Throwable t) throws Throwable {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
throw t;
|
throw t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void unreliableFileOperation() throws IOException {
|
public void unreliableFileOperation() throws IOException {
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @see ITestBean#returnsThis()
|
* @see ITestBean#returnsThis()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object returnsThis() {
|
public Object returnsThis() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -366,9 +380,11 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
/**
|
/**
|
||||||
* @see IOther#absquatulate()
|
* @see IOther#absquatulate()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void absquatulate() {
|
public void absquatulate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int haveBirthday() {
|
public int haveBirthday() {
|
||||||
return age++;
|
return age++;
|
||||||
}
|
}
|
||||||
|
@ -398,6 +414,7 @@ public class TestBean implements ITestBean, IOther, Comparable<Object> {
|
||||||
return this.age;
|
return this.age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareTo(Object other) {
|
public int compareTo(Object other) {
|
||||||
if (this.name != null && other instanceof TestBean) {
|
if (this.name != null && other instanceof TestBean) {
|
||||||
return this.name.compareTo(((TestBean) other).getName());
|
return this.name.compareTo(((TestBean) other).getName());
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
private final List<ImportDefinition> imports = new LinkedList<ImportDefinition>();
|
private final List<ImportDefinition> imports = new LinkedList<ImportDefinition>();
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
||||||
this.defaults.add(defaultsDefinition);
|
this.defaults.add(defaultsDefinition);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +55,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
return Collections.unmodifiableList(this.defaults);
|
return Collections.unmodifiableList(this.defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void componentRegistered(ComponentDefinition componentDefinition) {
|
public void componentRegistered(ComponentDefinition componentDefinition) {
|
||||||
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
|
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +69,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
return collection.toArray(new ComponentDefinition[collection.size()]);
|
return collection.toArray(new ComponentDefinition[collection.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
||||||
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
|
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
|
||||||
|
@ -82,6 +85,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
return aliases == null ? null : Collections.unmodifiableList(aliases);
|
return aliases == null ? null : Collections.unmodifiableList(aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void importProcessed(ImportDefinition importDefinition) {
|
public void importProcessed(ImportDefinition importDefinition) {
|
||||||
this.imports.add(importDefinition);
|
this.imports.add(importDefinition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.w3c.dom.Element;
|
||||||
|
|
||||||
public class ComponentBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
public class ComponentBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected AbstractBeanDefinition parseInternal(Element element,
|
protected AbstractBeanDefinition parseInternal(Element element,
|
||||||
ParserContext parserContext) {
|
ParserContext parserContext) {
|
||||||
return parseComponentElement(element);
|
return parseComponentElement(element);
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class ComponentFactoryBean implements FactoryBean<Component> {
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component getObject() throws Exception {
|
public Component getObject() throws Exception {
|
||||||
if (this.children != null && this.children.size() > 0) {
|
if (this.children != null && this.children.size() > 0) {
|
||||||
for (Component child : children) {
|
for (Component child : children) {
|
||||||
|
@ -25,10 +26,12 @@ public class ComponentFactoryBean implements FactoryBean<Component> {
|
||||||
return this.parent;
|
return this.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<Component> getObjectType() {
|
public Class<Component> getObjectType() {
|
||||||
return Component.class;
|
return Component.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.foo;
|
||||||
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
||||||
|
|
||||||
public class ComponentNamespaceHandler extends NamespaceHandlerSupport {
|
public class ComponentNamespaceHandler extends NamespaceHandlerSupport {
|
||||||
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
registerBeanDefinitionParser("component",
|
registerBeanDefinitionParser("component",
|
||||||
new ComponentBeanDefinitionParser());
|
new ComponentBeanDefinitionParser());
|
||||||
|
|
|
@ -360,18 +360,22 @@ public final class BeanUtilsTests {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setKey(String aKey) {
|
public void setKey(String aKey) {
|
||||||
key = aKey;
|
key = aKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setValue(String aValue) {
|
public void setValue(String aValue) {
|
||||||
value = aValue;
|
value = aValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,6 +507,7 @@ public class BeanWrapperGenericsTests {
|
||||||
|
|
||||||
private Map<String, List<List<Integer>>> mapOfListOfListOfInteger;
|
private Map<String, List<List<Integer>>> mapOfListOfListOfInteger;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, Integer> getMapOfInteger() {
|
public Map<String, Integer> getMapOfInteger() {
|
||||||
return mapOfInteger;
|
return mapOfInteger;
|
||||||
}
|
}
|
||||||
|
@ -515,10 +516,12 @@ public class BeanWrapperGenericsTests {
|
||||||
this.mapOfInteger = mapOfInteger;
|
this.mapOfInteger = mapOfInteger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, List<Integer>> getMapOfListOfInteger() {
|
public Map<String, List<Integer>> getMapOfListOfInteger() {
|
||||||
return mapOfListOfInteger;
|
return mapOfListOfInteger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMapOfListOfInteger(Map<String, List<Integer>> mapOfListOfInteger) {
|
public void setMapOfListOfInteger(Map<String, List<Integer>> mapOfListOfInteger) {
|
||||||
this.mapOfListOfInteger = mapOfListOfInteger;
|
this.mapOfListOfInteger = mapOfListOfInteger;
|
||||||
}
|
}
|
||||||
|
@ -591,6 +594,7 @@ public class BeanWrapperGenericsTests {
|
||||||
|
|
||||||
private double version;
|
private double version;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Double getVersion() {
|
public Double getVersion() {
|
||||||
return this.version;
|
return this.version;
|
||||||
}
|
}
|
||||||
|
@ -613,10 +617,12 @@ public class BeanWrapperGenericsTests {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setId(Long aId) {
|
public void setId(Long aId) {
|
||||||
this.id = aId;
|
this.id = aId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -329,6 +329,7 @@ public final class BeanWrapperTests {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
super.setValue(value.toString());
|
super.setValue(value.toString());
|
||||||
}
|
}
|
||||||
|
@ -500,6 +501,7 @@ public final class BeanWrapperTests {
|
||||||
PropsTester pt = new PropsTester();
|
PropsTester pt = new PropsTester();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(pt);
|
BeanWrapper bw = new BeanWrapperImpl(pt);
|
||||||
bw.registerCustomEditor(String.class, "stringArray", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "stringArray", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
setValue(text.substring(1));
|
setValue(text.substring(1));
|
||||||
}
|
}
|
||||||
|
@ -559,6 +561,7 @@ public final class BeanWrapperTests {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, "name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
if (value instanceof String[]) {
|
if (value instanceof String[]) {
|
||||||
setValue(StringUtils.arrayToDelimitedString(((String[]) value), "-"));
|
setValue(StringUtils.arrayToDelimitedString(((String[]) value), "-"));
|
||||||
|
@ -636,6 +639,7 @@ public final class BeanWrapperTests {
|
||||||
PropsTester pt = new PropsTester();
|
PropsTester pt = new PropsTester();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(pt);
|
BeanWrapper bw = new BeanWrapperImpl(pt);
|
||||||
bw.registerCustomEditor(int.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(int.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
setValue(new Integer(Integer.parseInt(text) + 1));
|
setValue(new Integer(Integer.parseInt(text) + 1));
|
||||||
}
|
}
|
||||||
|
@ -1022,6 +1026,7 @@ public final class BeanWrapperTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
if (!StringUtils.hasLength(text)) {
|
if (!StringUtils.hasLength(text)) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
@ -1055,6 +1060,7 @@ public final class BeanWrapperTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
if (!StringUtils.hasLength(text)) {
|
if (!StringUtils.hasLength(text)) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
@ -1078,6 +1084,7 @@ public final class BeanWrapperTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
if (!StringUtils.hasLength(text)) {
|
if (!StringUtils.hasLength(text)) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
@ -1191,6 +1198,7 @@ public final class BeanWrapperTests {
|
||||||
PrimitiveArrayBean tb = new PrimitiveArrayBean();
|
PrimitiveArrayBean tb = new PrimitiveArrayBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(int.class, "array", new PropertyEditorSupport() {
|
bw.registerCustomEditor(int.class, "array", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
if (value instanceof Integer) {
|
if (value instanceof Integer) {
|
||||||
super.setValue(new Integer(((Integer) value).intValue() + 1));
|
super.setValue(new Integer(((Integer) value).intValue() + 1));
|
||||||
|
@ -1209,6 +1217,7 @@ public final class BeanWrapperTests {
|
||||||
PrimitiveArrayBean tb = new PrimitiveArrayBean();
|
PrimitiveArrayBean tb = new PrimitiveArrayBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(int.class, "array[1]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(int.class, "array[1]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
if (value instanceof Integer) {
|
if (value instanceof Integer) {
|
||||||
super.setValue(new Integer(((Integer) value).intValue() + 1));
|
super.setValue(new Integer(((Integer) value).intValue() + 1));
|
||||||
|
@ -1821,6 +1830,7 @@ public final class BeanWrapperTests {
|
||||||
this.frozen = true;
|
this.frozen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public V put(K key, V value) {
|
public V put(K key, V value) {
|
||||||
if (this.frozen) {
|
if (this.frozen) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -1830,16 +1840,19 @@ public final class BeanWrapperTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<Map.Entry<K, V>> entrySet() {
|
public Set<Map.Entry<K, V>> entrySet() {
|
||||||
this.accessed = true;
|
this.accessed = true;
|
||||||
return super.entrySet();
|
return super.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<K> keySet() {
|
public Set<K> keySet() {
|
||||||
this.accessed = true;
|
this.accessed = true;
|
||||||
return super.keySet();
|
return super.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
this.accessed = true;
|
this.accessed = true;
|
||||||
return super.size();
|
return super.size();
|
||||||
|
|
|
@ -115,6 +115,7 @@ public final class ConcurrentBeanWrapperTests {
|
||||||
this.test = test;
|
this.test = test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
|
|
|
@ -214,6 +214,7 @@ public class ExtendedBeanInfoTests {
|
||||||
@Test
|
@Test
|
||||||
public void cornerSpr9453() throws IntrospectionException {
|
public void cornerSpr9453() throws IntrospectionException {
|
||||||
final class Bean implements Spr9453<Class<?>> {
|
final class Bean implements Spr9453<Class<?>> {
|
||||||
|
@Override
|
||||||
public Class<?> getProp() {
|
public Class<?> getProp() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -589,7 +590,9 @@ public class ExtendedBeanInfoTests {
|
||||||
public Number setFoo(String foo) { return null; }
|
public Number setFoo(String foo) { return null; }
|
||||||
}
|
}
|
||||||
class C extends B {
|
class C extends B {
|
||||||
|
@Override
|
||||||
public String getFoo() { return null; }
|
public String getFoo() { return null; }
|
||||||
|
@Override
|
||||||
public Integer setFoo(String foo) { return null; }
|
public Integer setFoo(String foo) { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,6 +864,7 @@ public class ExtendedBeanInfoTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TextBookOperations extends BookOperations {
|
interface TextBookOperations extends BookOperations {
|
||||||
|
@Override
|
||||||
TextBook getBook();
|
TextBook getBook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,6 +874,7 @@ public class ExtendedBeanInfoTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LawLibrary extends Library implements TextBookOperations {
|
class LawLibrary extends Library implements TextBookOperations {
|
||||||
|
@Override
|
||||||
public LawBook getBook() { return null; }
|
public LawBook getBook() { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,10 +182,12 @@ class RequiredTestBean implements BeanNameAware, BeanFactoryAware {
|
||||||
this.jobTitle = jobTitle;
|
this.jobTitle = jobTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Required
|
@Required
|
||||||
public void setBeanName(String name) {
|
public void setBeanName(String name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Required
|
@Required
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ public final class ConcurrentBeanFactoryTests {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
XmlBeanFactory factory = new XmlBeanFactory(CONTEXT);
|
XmlBeanFactory factory = new XmlBeanFactory(CONTEXT);
|
||||||
factory.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
factory.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
||||||
|
@Override
|
||||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false));
|
registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false));
|
||||||
}
|
}
|
||||||
|
@ -125,6 +126,7 @@ public final class ConcurrentBeanFactoryTests {
|
||||||
|
|
||||||
private class TestRun extends Thread {
|
private class TestRun extends Thread {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 10000; i++) {
|
for (int i = 0; i < 10000; i++) {
|
||||||
|
|
|
@ -836,6 +836,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
public void testCustomEditor() {
|
public void testCustomEditor() {
|
||||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||||
lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
||||||
|
@Override
|
||||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||||
registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
|
registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
|
||||||
|
@ -853,6 +854,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||||
GenericConversionService conversionService = new DefaultConversionService();
|
GenericConversionService conversionService = new DefaultConversionService();
|
||||||
conversionService.addConverter(new Converter<String, Float>() {
|
conversionService.addConverter(new Converter<String, Float>() {
|
||||||
|
@Override
|
||||||
public Float convert(String source) {
|
public Float convert(String source) {
|
||||||
try {
|
try {
|
||||||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||||
|
@ -875,6 +877,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
public void testCustomEditorWithBeanReference() {
|
public void testCustomEditorWithBeanReference() {
|
||||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||||
lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
||||||
|
@Override
|
||||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||||
registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
|
registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
|
||||||
|
@ -1907,9 +1910,11 @@ public class DefaultListableBeanFactoryTests {
|
||||||
RootBeanDefinition bd = new RootBeanDefinition(BeanWithDisposableBean.class);
|
RootBeanDefinition bd = new RootBeanDefinition(BeanWithDisposableBean.class);
|
||||||
lbf.registerBeanDefinition("test", bd);
|
lbf.registerBeanDefinition("test", bd);
|
||||||
lbf.addBeanPostProcessor(new BeanPostProcessor() {
|
lbf.addBeanPostProcessor(new BeanPostProcessor() {
|
||||||
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||||
return new TestBean();
|
return new TestBean();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
@ -1926,9 +1931,11 @@ public class DefaultListableBeanFactoryTests {
|
||||||
RootBeanDefinition bd = new RootBeanDefinition(BeanWithCloseable.class);
|
RootBeanDefinition bd = new RootBeanDefinition(BeanWithCloseable.class);
|
||||||
lbf.registerBeanDefinition("test", bd);
|
lbf.registerBeanDefinition("test", bd);
|
||||||
lbf.addBeanPostProcessor(new BeanPostProcessor() {
|
lbf.addBeanPostProcessor(new BeanPostProcessor() {
|
||||||
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||||
return new TestBean();
|
return new TestBean();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
@ -1946,9 +1953,11 @@ public class DefaultListableBeanFactoryTests {
|
||||||
bd.setDestroyMethodName("close");
|
bd.setDestroyMethodName("close");
|
||||||
lbf.registerBeanDefinition("test", bd);
|
lbf.registerBeanDefinition("test", bd);
|
||||||
lbf.addBeanPostProcessor(new BeanPostProcessor() {
|
lbf.addBeanPostProcessor(new BeanPostProcessor() {
|
||||||
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||||
return new TestBean();
|
return new TestBean();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
@ -2117,6 +2126,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
lbf.registerBeanDefinition("test", bd);
|
lbf.registerBeanDefinition("test", bd);
|
||||||
final String nameSetOnField = "nameSetOnField";
|
final String nameSetOnField = "nameSetOnField";
|
||||||
lbf.addBeanPostProcessor(new InstantiationAwareBeanPostProcessorAdapter() {
|
lbf.addBeanPostProcessor(new InstantiationAwareBeanPostProcessorAdapter() {
|
||||||
|
@Override
|
||||||
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
|
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
|
||||||
TestBean tb = (TestBean) bean;
|
TestBean tb = (TestBean) bean;
|
||||||
try {
|
try {
|
||||||
|
@ -2156,6 +2166,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
|
|
||||||
TestSecuredBean bean = (TestSecuredBean) Subject.doAsPrivileged(subject,
|
TestSecuredBean bean = (TestSecuredBean) Subject.doAsPrivileged(subject,
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction() {
|
||||||
|
@Override
|
||||||
public Object run() {
|
public Object run() {
|
||||||
return lbf.getBean("test");
|
return lbf.getBean("test");
|
||||||
}
|
}
|
||||||
|
@ -2244,14 +2255,17 @@ public class DefaultListableBeanFactoryTests {
|
||||||
public ConstructorDependencyFactoryBean(String dependency) {
|
public ConstructorDependencyFactoryBean(String dependency) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() {
|
public Object getObject() {
|
||||||
return "test";
|
return "test";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2262,6 +2276,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
|
|
||||||
private static boolean closed;
|
private static boolean closed;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
|
@ -2272,6 +2287,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
|
|
||||||
private static boolean closed;
|
private static boolean closed;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
|
@ -2316,14 +2332,17 @@ public class DefaultListableBeanFactoryTests {
|
||||||
|
|
||||||
public static class FactoryBeanThatShouldntBeCalled implements FactoryBean<Object> {
|
public static class FactoryBeanThatShouldntBeCalled implements FactoryBean<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() {
|
public Object getObject() {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2334,15 +2353,18 @@ public class DefaultListableBeanFactoryTests {
|
||||||
|
|
||||||
public boolean initialized = false;
|
public boolean initialized = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() throws Exception {
|
public Object getObject() throws Exception {
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2353,23 +2375,28 @@ public class DefaultListableBeanFactoryTests {
|
||||||
|
|
||||||
public boolean initialized = false;
|
public boolean initialized = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() throws Exception {
|
public Object getObject() throws Exception {
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPrototype() {
|
public boolean isPrototype() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEagerInit() {
|
public boolean isEagerInit() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2452,6 +2479,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
this.numberFormat = numberFormat;
|
this.numberFormat = numberFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object convertIfNecessary(Object value, Class requiredType) {
|
public Object convertIfNecessary(Object value, Class requiredType) {
|
||||||
if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
|
if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
|
||||||
|
@ -2470,11 +2498,13 @@ public class DefaultListableBeanFactoryTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) {
|
public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) {
|
||||||
return convertIfNecessary(value, requiredType);
|
return convertIfNecessary(value, requiredType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object convertIfNecessary(Object value, Class requiredType, Field field) {
|
public Object convertIfNecessary(Object value, Class requiredType, Field field) {
|
||||||
return convertIfNecessary(value, requiredType);
|
return convertIfNecessary(value, requiredType);
|
||||||
|
@ -2490,6 +2520,7 @@ public class DefaultListableBeanFactoryTests {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,14 +77,17 @@ public final class FactoryBeanTests {
|
||||||
|
|
||||||
public static class NullReturningFactoryBean implements FactoryBean<Object> {
|
public static class NullReturningFactoryBean implements FactoryBean<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() {
|
public Object getObject() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +106,7 @@ public final class FactoryBeanTests {
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(beta, "'beta' property is required");
|
Assert.notNull(beta, "'beta' property is required");
|
||||||
}
|
}
|
||||||
|
@ -131,6 +135,7 @@ public final class FactoryBeanTests {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(gamma, "'gamma' property is required");
|
Assert.notNull(gamma, "'gamma' property is required");
|
||||||
}
|
}
|
||||||
|
@ -149,14 +154,17 @@ public final class FactoryBeanTests {
|
||||||
this.beta = beta;
|
this.beta = beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() {
|
public Object getObject() {
|
||||||
return this.beta;
|
return this.beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ public final class SharedBeanRegistryTests {
|
||||||
assertSame(tb, beanRegistry.getSingleton("tb"));
|
assertSame(tb, beanRegistry.getSingleton("tb"));
|
||||||
|
|
||||||
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", new ObjectFactory<Object>() {
|
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", new ObjectFactory<Object>() {
|
||||||
|
@Override
|
||||||
public Object getObject() throws BeansException {
|
public Object getObject() throws BeansException {
|
||||||
return new TestBean();
|
return new TestBean();
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,6 +989,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
public ExtendedResourceInjectionBean() {
|
public ExtendedResourceInjectionBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Autowired @Required
|
@Autowired @Required
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -1068,6 +1069,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
|
|
||||||
private ITestBean testBean4;
|
private ITestBean testBean4;
|
||||||
|
|
||||||
|
@Override
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -1114,6 +1116,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
|
|
||||||
private ITestBean testBean4;
|
private ITestBean testBean4;
|
||||||
|
|
||||||
|
@Override
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -1185,6 +1188,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -1447,14 +1451,17 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
|
|
||||||
public static class StringFactoryBean implements FactoryBean<String> {
|
public static class StringFactoryBean implements FactoryBean<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getObject() throws Exception {
|
public String getObject() throws Exception {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<String> getObjectType() {
|
public Class<String> getObjectType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ public final class CustomAutowireConfigurerTests {
|
||||||
|
|
||||||
public static class CustomResolver implements AutowireCandidateResolver {
|
public static class CustomResolver implements AutowireCandidateResolver {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
|
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
|
||||||
if (!bdHolder.getBeanDefinition().isAutowireCandidate()) {
|
if (!bdHolder.getBeanDefinition().isAutowireCandidate()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -82,6 +83,7 @@ public final class CustomAutowireConfigurerTests {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getSuggestedValue(DependencyDescriptor descriptor) {
|
public Object getSuggestedValue(DependencyDescriptor descriptor) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,6 +609,7 @@ public class InjectAnnotationBeanPostProcessorTests {
|
||||||
public ExtendedResourceInjectionBean() {
|
public ExtendedResourceInjectionBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Inject @Required
|
@Inject @Required
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -662,6 +663,7 @@ public class InjectAnnotationBeanPostProcessorTests {
|
||||||
|
|
||||||
private ITestBean testBean4;
|
private ITestBean testBean4;
|
||||||
|
|
||||||
|
@Override
|
||||||
@Inject
|
@Inject
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -708,6 +710,7 @@ public class InjectAnnotationBeanPostProcessorTests {
|
||||||
|
|
||||||
private ITestBean testBean4;
|
private ITestBean testBean4;
|
||||||
|
|
||||||
|
@Override
|
||||||
@Inject
|
@Inject
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -779,6 +782,7 @@ public class InjectAnnotationBeanPostProcessorTests {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Inject
|
@Inject
|
||||||
public void setTestBean2(TestBean testBean2) {
|
public void setTestBean2(TestBean testBean2) {
|
||||||
super.setTestBean2(testBean2);
|
super.setTestBean2(testBean2);
|
||||||
|
@ -1074,14 +1078,17 @@ public class InjectAnnotationBeanPostProcessorTests {
|
||||||
|
|
||||||
public static class StringFactoryBean implements FactoryBean<String> {
|
public static class StringFactoryBean implements FactoryBean<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getObject() throws Exception {
|
public String getObject() throws Exception {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<String> getObjectType() {
|
public Class<String> getObjectType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public final class CustomEditorConfigurerTests {
|
||||||
final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
|
final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
|
||||||
cec.setPropertyEditorRegistrars(new PropertyEditorRegistrar[] {
|
cec.setPropertyEditorRegistrars(new PropertyEditorRegistrar[] {
|
||||||
new PropertyEditorRegistrar() {
|
new PropertyEditorRegistrar() {
|
||||||
|
@Override
|
||||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
registry.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
|
registry.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
|
||||||
}
|
}
|
||||||
|
@ -189,6 +190,7 @@ public final class CustomEditorConfigurerTests {
|
||||||
|
|
||||||
public static class MyTestEditor extends PropertyEditorSupport {
|
public static class MyTestEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
setValue(new String[] {"test"});
|
setValue(new String[] {"test"});
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,6 +812,7 @@ public final class PropertyResourceConfigurerTests {
|
||||||
|
|
||||||
private static class ConvertingOverrideConfigurer extends PropertyOverrideConfigurer {
|
private static class ConvertingOverrideConfigurer extends PropertyOverrideConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected String convertPropertyValue(String originalValue) {
|
protected String convertPropertyValue(String originalValue) {
|
||||||
return "X" + originalValue;
|
return "X" + originalValue;
|
||||||
}
|
}
|
||||||
|
@ -826,10 +827,12 @@ public final class PropertyResourceConfigurerTests {
|
||||||
|
|
||||||
private Preferences userRoot = new MockPreferences();
|
private Preferences userRoot = new MockPreferences();
|
||||||
|
|
||||||
|
@Override
|
||||||
public Preferences systemRoot() {
|
public Preferences systemRoot() {
|
||||||
return systemRoot;
|
return systemRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Preferences userRoot() {
|
public Preferences userRoot() {
|
||||||
return userRoot;
|
return userRoot;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public final class SimpleScopeTests {
|
||||||
objects.add(new TestBean());
|
objects.add(new TestBean());
|
||||||
objects.add(new TestBean());
|
objects.add(new TestBean());
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Object get(String name, ObjectFactory<?> objectFactory) {
|
public Object get(String name, ObjectFactory<?> objectFactory) {
|
||||||
if (index >= objects.size()) {
|
if (index >= objects.size()) {
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
|
@ -30,21 +30,26 @@ final class TestTypes {}
|
||||||
*/
|
*/
|
||||||
class NoOpScope implements Scope {
|
class NoOpScope implements Scope {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(String name, ObjectFactory<?> objectFactory) {
|
public Object get(String name, ObjectFactory<?> objectFactory) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object remove(String name) {
|
public Object remove(String name) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerDestructionCallback(String name, Runnable callback) {
|
public void registerDestructionCallback(String name, Runnable callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object resolveContextualObject(String key) {
|
public Object resolveContextualObject(String key) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getConversationId() {
|
public String getConversationId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,10 +71,12 @@ public final class CustomProblemReporterTests {
|
||||||
private List<Problem> warnings = new ArrayList<Problem>();
|
private List<Problem> warnings = new ArrayList<Problem>();
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void fatal(Problem problem) {
|
public void fatal(Problem problem) {
|
||||||
throw new BeanDefinitionParsingException(problem);
|
throw new BeanDefinitionParsingException(problem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void error(Problem problem) {
|
public void error(Problem problem) {
|
||||||
System.out.println(problem);
|
System.out.println(problem);
|
||||||
this.errors.add(problem);
|
this.errors.add(problem);
|
||||||
|
@ -84,6 +86,7 @@ public final class CustomProblemReporterTests {
|
||||||
return this.errors.toArray(new Problem[this.errors.size()]);
|
return this.errors.toArray(new Problem[this.errors.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void warning(Problem problem) {
|
public void warning(Problem problem) {
|
||||||
System.out.println(problem);
|
System.out.println(problem);
|
||||||
this.warnings.add(problem);
|
this.warnings.add(problem);
|
||||||
|
|
|
@ -391,6 +391,7 @@ public class BeanFactoryGenericsTests {
|
||||||
public void testGenericMapWithCollectionValueConstructor() throws MalformedURLException {
|
public void testGenericMapWithCollectionValueConstructor() throws MalformedURLException {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
bf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
bf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
||||||
|
@Override
|
||||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
registry.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
registry.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
||||||
}
|
}
|
||||||
|
@ -547,6 +548,7 @@ public class BeanFactoryGenericsTests {
|
||||||
public void testGenericMapWithCollectionValueFactoryMethod() throws MalformedURLException {
|
public void testGenericMapWithCollectionValueFactoryMethod() throws MalformedURLException {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
bf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
bf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
|
||||||
|
@Override
|
||||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
registry.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
registry.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class PropertiesBeanDefinitionReaderTests extends TestCase {
|
||||||
|
|
||||||
private PropertiesBeanDefinitionReader reader;
|
private PropertiesBeanDefinitionReader reader;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
this.beanFactory = new DefaultListableBeanFactory();
|
this.beanFactory = new DefaultListableBeanFactory();
|
||||||
this.reader = new PropertiesBeanDefinitionReader(beanFactory);
|
this.reader = new PropertiesBeanDefinitionReader(beanFactory);
|
||||||
|
|
|
@ -61,14 +61,17 @@ public class Spr8954Tests {
|
||||||
|
|
||||||
static class FooFactoryBean implements FactoryBean<Foo>, AnInterface {
|
static class FooFactoryBean implements FactoryBean<Foo>, AnInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Foo getObject() throws Exception {
|
public Foo getObject() throws Exception {
|
||||||
return new Foo();
|
return new Foo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return Foo.class;
|
return Foo.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,23 +129,28 @@ public class CallbacksSecurityTests {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
destroyed = true;
|
destroyed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String name) {
|
public void setBeanName(String name) {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory)
|
public void setBeanFactory(BeanFactory beanFactory)
|
||||||
throws BeansException {
|
throws BeansException {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
|
@ -164,26 +169,31 @@ public class CallbacksSecurityTests {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEagerInit() {
|
public boolean isEagerInit() {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPrototype() {
|
public boolean isPrototype() {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() throws Exception {
|
public Object getObject() throws Exception {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class getObjectType() {
|
public Class getObjectType() {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
checkCurrentContext();
|
checkCurrentContext();
|
||||||
return false;
|
return false;
|
||||||
|
@ -219,6 +229,7 @@ public class CallbacksSecurityTests {
|
||||||
|
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String run() {
|
public String run() {
|
||||||
Subject subject = Subject.getSubject(acc);
|
Subject subject = Subject.getSubject(acc);
|
||||||
if (subject == null) {
|
if (subject == null) {
|
||||||
|
@ -246,6 +257,7 @@ public class CallbacksSecurityTests {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
@ -291,6 +303,7 @@ public class CallbacksSecurityTests {
|
||||||
private final AccessControlContext acc = new AccessControlContext(
|
private final AccessControlContext acc = new AccessControlContext(
|
||||||
new ProtectionDomain[] { empty });
|
new ProtectionDomain[] { empty });
|
||||||
|
|
||||||
|
@Override
|
||||||
public AccessControlContext getAccessControlContext() {
|
public AccessControlContext getAccessControlContext() {
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +333,7 @@ public class CallbacksSecurityTests {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
method.invoke(bean);
|
method.invoke(bean);
|
||||||
return null;
|
return null;
|
||||||
|
@ -334,6 +348,7 @@ public class CallbacksSecurityTests {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Object>() {
|
new PrivilegedExceptionAction<Object>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
return cl.newInstance();
|
return cl.newInstance();
|
||||||
}
|
}
|
||||||
|
@ -444,6 +459,7 @@ public class CallbacksSecurityTests {
|
||||||
|
|
||||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
beanFactory.getBean("working-factory-method");
|
beanFactory.getBean("working-factory-method");
|
||||||
beanFactory.getBean("container-execution");
|
beanFactory.getBean("container-execution");
|
||||||
|
@ -478,6 +494,7 @@ public class CallbacksSecurityTests {
|
||||||
|
|
||||||
NonPrivilegedBean bean = Subject.doAsPrivileged(
|
NonPrivilegedBean bean = Subject.doAsPrivileged(
|
||||||
subject, new PrivilegedAction<NonPrivilegedBean>() {
|
subject, new PrivilegedAction<NonPrivilegedBean>() {
|
||||||
|
@Override
|
||||||
public NonPrivilegedBean run() {
|
public NonPrivilegedBean run() {
|
||||||
return lbf.getBean("test", NonPrivilegedBean.class);
|
return lbf.getBean("test", NonPrivilegedBean.class);
|
||||||
}
|
}
|
||||||
|
@ -502,6 +519,7 @@ public class CallbacksSecurityTests {
|
||||||
// request the beans from non-privileged code
|
// request the beans from non-privileged code
|
||||||
Subject.doAsPrivileged(subject, new PrivilegedAction<Object>() {
|
Subject.doAsPrivileged(subject, new PrivilegedAction<Object>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object run() {
|
public Object run() {
|
||||||
// sanity check
|
// sanity check
|
||||||
assertEquals("user1", getCurrentSubjectName());
|
assertEquals("user1", getCurrentSubjectName());
|
||||||
|
|
|
@ -24,15 +24,18 @@ import org.springframework.beans.factory.FactoryBean;
|
||||||
*/
|
*/
|
||||||
public class CustomFactoryBean implements FactoryBean<Object> {
|
public class CustomFactoryBean implements FactoryBean<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() throws Exception {
|
public Object getObject() throws Exception {
|
||||||
return System.getProperties();
|
return System.getProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class getObjectType() {
|
public Class getObjectType() {
|
||||||
System.setProperty("factory.object.type", "true");
|
System.setProperty("factory.object.type", "true");
|
||||||
return Properties.class;
|
return Properties.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.beans.factory.DisposableBean;
|
||||||
*/
|
*/
|
||||||
public class DestroyBean implements DisposableBean {
|
public class DestroyBean implements DisposableBean {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() throws Exception {
|
public void destroy() throws Exception {
|
||||||
System.setProperty("security.destroy", "true");
|
System.setProperty("security.destroy", "true");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||||
*/
|
*/
|
||||||
public class InitBean implements InitializingBean {
|
public class InitBean implements InitializingBean {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
System.getProperties();
|
System.getProperties();
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,6 +326,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
|
||||||
|
|
||||||
public static class TestBeanEditor extends PropertyEditorSupport {
|
public static class TestBeanEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
StringTokenizer st = new StringTokenizer(text, "_");
|
StringTokenizer st = new StringTokenizer(text, "_");
|
||||||
|
@ -350,6 +351,7 @@ class MustBeInitialized implements InitializingBean {
|
||||||
/**
|
/**
|
||||||
* @see InitializingBean#afterPropertiesSet()
|
* @see InitializingBean#afterPropertiesSet()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
this.inited = true;
|
this.inited = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class BeanNameGenerationTests extends TestCase {
|
||||||
|
|
||||||
private DefaultListableBeanFactory beanFactory;
|
private DefaultListableBeanFactory beanFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
this.beanFactory = new DefaultListableBeanFactory();
|
this.beanFactory = new DefaultListableBeanFactory();
|
||||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
private final List imports = new LinkedList();
|
private final List imports = new LinkedList();
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
||||||
this.defaults.add(defaultsDefinition);
|
this.defaults.add(defaultsDefinition);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +54,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
return Collections.unmodifiableList(this.defaults);
|
return Collections.unmodifiableList(this.defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void componentRegistered(ComponentDefinition componentDefinition) {
|
public void componentRegistered(ComponentDefinition componentDefinition) {
|
||||||
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
|
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
|
||||||
}
|
}
|
||||||
|
@ -66,6 +68,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]);
|
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
||||||
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
|
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
|
||||||
if(aliases == null) {
|
if(aliases == null) {
|
||||||
|
@ -80,6 +83,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
return aliases == null ? null : Collections.unmodifiableList(aliases);
|
return aliases == null ? null : Collections.unmodifiableList(aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void importProcessed(ImportDefinition importDefinition) {
|
public void importProcessed(ImportDefinition importDefinition) {
|
||||||
this.imports.add(importDefinition);
|
this.imports.add(importDefinition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class CollectionMergingTests extends TestCase {
|
||||||
|
|
||||||
private DefaultListableBeanFactory beanFactory;
|
private DefaultListableBeanFactory beanFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
this.beanFactory = new DefaultListableBeanFactory();
|
this.beanFactory = new DefaultListableBeanFactory();
|
||||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
BeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
||||||
|
|
|
@ -51,14 +51,17 @@ public class CountingFactory implements FactoryBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getObject() {
|
public Object getObject() {
|
||||||
return "myString";
|
return "myString";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class getObjectType() {
|
public Class getObjectType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class DefaultLifecycleMethodsTests extends TestCase {
|
||||||
|
|
||||||
private XmlBeanFactory beanFactory;
|
private XmlBeanFactory beanFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
this.beanFactory = new XmlBeanFactory(new ClassPathResource("defaultLifecycleMethods.xml", getClass()));
|
this.beanFactory = new XmlBeanFactory(new ClassPathResource("defaultLifecycleMethods.xml", getClass()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public final class DelegatingEntityResolverTests {
|
||||||
|
|
||||||
|
|
||||||
private static final class NoOpEntityResolver implements EntityResolver {
|
private static final class NoOpEntityResolver implements EntityResolver {
|
||||||
|
@Override
|
||||||
public InputSource resolveEntity(String publicId, String systemId) {
|
public InputSource resolveEntity(String publicId, String systemId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class DependenciesBean implements BeanFactoryAware {
|
||||||
return spouse;
|
return spouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.beanFactory = beanFactory;
|
this.beanFactory = beanFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class EventPublicationTests extends TestCase {
|
||||||
private final CollectingReaderEventListener eventListener = new CollectingReaderEventListener();
|
private final CollectingReaderEventListener eventListener = new CollectingReaderEventListener();
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
||||||
reader.setEventListener(this.eventListener);
|
reader.setEventListener(this.eventListener);
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class GeneratedNameBean implements BeanNameAware {
|
||||||
|
|
||||||
private GeneratedNameBean child;
|
private GeneratedNameBean child;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String beanName) {
|
public void setBeanName(String beanName) {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class MetadataAttachmentTests extends TestCase {
|
||||||
|
|
||||||
private XmlBeanFactory beanFactory;
|
private XmlBeanFactory beanFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
this.beanFactory = new XmlBeanFactory(new ClassPathResource("withMeta.xml", getClass()));
|
this.beanFactory = new XmlBeanFactory(new ClassPathResource("withMeta.xml", getClass()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,7 @@ public class ProfileXmlBeanDefinitionTests {
|
||||||
private static Matcher<BeanDefinitionRegistry> containsBeanDefinition(final String beanName) {
|
private static Matcher<BeanDefinitionRegistry> containsBeanDefinition(final String beanName) {
|
||||||
return new TypeSafeMatcher<BeanDefinitionRegistry>() {
|
return new TypeSafeMatcher<BeanDefinitionRegistry>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void describeTo(Description desc) {
|
public void describeTo(Description desc) {
|
||||||
desc.appendText("a BeanDefinitionRegistry containing bean named ")
|
desc.appendText("a BeanDefinitionRegistry containing bean named ")
|
||||||
.appendValue(beanName);
|
.appendValue(beanName);
|
||||||
|
|
|
@ -57,6 +57,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
|
||||||
return initMethodDeclared;
|
return initMethodDeclared;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String name) {
|
public void setBeanName(String name) {
|
||||||
this.beanName = name;
|
this.beanName = name;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +66,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.owningFactory = beanFactory;
|
this.owningFactory = beanFactory;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +81,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
|
||||||
this.postProcessedBeforeInit = true;
|
this.postProcessedBeforeInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
if (this.owningFactory == null) {
|
if (this.owningFactory == null) {
|
||||||
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
|
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
|
||||||
|
@ -130,6 +133,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
throw new IllegalStateException("Already destroyed");
|
throw new IllegalStateException("Already destroyed");
|
||||||
|
@ -144,6 +148,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
|
||||||
|
|
||||||
public static class PostProcessor implements BeanPostProcessor {
|
public static class PostProcessor implements BeanPostProcessor {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
||||||
if (bean instanceof ProtectedLifecycleBean) {
|
if (bean instanceof ProtectedLifecycleBean) {
|
||||||
((ProtectedLifecycleBean) bean).postProcessBeforeInit();
|
((ProtectedLifecycleBean) bean).postProcessBeforeInit();
|
||||||
|
@ -151,6 +156,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
||||||
if (bean instanceof ProtectedLifecycleBean) {
|
if (bean instanceof ProtectedLifecycleBean) {
|
||||||
((ProtectedLifecycleBean) bean).postProcessAfterInit();
|
((ProtectedLifecycleBean) bean).postProcessAfterInit();
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class UtilNamespaceHandlerTests extends TestCase {
|
||||||
|
|
||||||
private CollectingReaderEventListener listener = new CollectingReaderEventListener();
|
private CollectingReaderEventListener listener = new CollectingReaderEventListener();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
this.beanFactory = new DefaultListableBeanFactory();
|
this.beanFactory = new DefaultListableBeanFactory();
|
||||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
|
||||||
|
|
||||||
private XmlBeanFactory factory;
|
private XmlBeanFactory factory;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() {
|
protected void setUp() {
|
||||||
parent = new DefaultListableBeanFactory();
|
parent = new DefaultListableBeanFactory();
|
||||||
Map m = new HashMap();
|
Map m = new HashMap();
|
||||||
|
@ -59,6 +60,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
|
||||||
|
|
||||||
this.factory = new XmlBeanFactory(new ClassPathResource("test.xml", getClass()), parent);
|
this.factory = new XmlBeanFactory(new ClassPathResource("test.xml", getClass()), parent);
|
||||||
this.factory.addBeanPostProcessor(new BeanPostProcessor() {
|
this.factory.addBeanPostProcessor(new BeanPostProcessor() {
|
||||||
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
||||||
if (bean instanceof TestBean) {
|
if (bean instanceof TestBean) {
|
||||||
((TestBean) bean).setPostProcessed(true);
|
((TestBean) bean).setPostProcessed(true);
|
||||||
|
@ -68,6 +70,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
|
||||||
}
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
@ -77,10 +80,12 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
|
||||||
//this.factory.preInstantiateSingletons();
|
//this.factory.preInstantiateSingletons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected BeanFactory getBeanFactory() {
|
protected BeanFactory getBeanFactory() {
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void testCount() {
|
public void testCount() {
|
||||||
assertCount(24);
|
assertCount(24);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class BeanInfoTests extends TestCase {
|
||||||
|
|
||||||
public static class ValueBeanBeanInfo extends SimpleBeanInfo {
|
public static class ValueBeanBeanInfo extends SimpleBeanInfo {
|
||||||
|
|
||||||
|
@Override
|
||||||
public PropertyDescriptor[] getPropertyDescriptors() {
|
public PropertyDescriptor[] getPropertyDescriptors() {
|
||||||
try {
|
try {
|
||||||
PropertyDescriptor pd = new PropertyDescriptor("value", ValueBean.class);
|
PropertyDescriptor pd = new PropertyDescriptor("value", ValueBean.class);
|
||||||
|
@ -96,6 +97,7 @@ public class BeanInfoTests extends TestCase {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
|
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
|
||||||
Assert.isTrue(this.target instanceof ValueBean, "Target must be available on JDK 1.5+");
|
Assert.isTrue(this.target instanceof ValueBean, "Target must be available on JDK 1.5+");
|
||||||
|
|
|
@ -113,6 +113,7 @@ public class CustomEditorTests {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, "name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("prefix" + text);
|
setValue("prefix" + text);
|
||||||
}
|
}
|
||||||
|
@ -130,6 +131,7 @@ public class CustomEditorTests {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("prefix" + text);
|
setValue("prefix" + text);
|
||||||
}
|
}
|
||||||
|
@ -148,6 +150,7 @@ public class CustomEditorTests {
|
||||||
tb.setSpouse(new TestBean());
|
tb.setSpouse(new TestBean());
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, "spouse.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "spouse.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("prefix" + text);
|
setValue("prefix" + text);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +169,7 @@ public class CustomEditorTests {
|
||||||
tb.setSpouse(new TestBean());
|
tb.setSpouse(new TestBean());
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("prefix" + text);
|
setValue("prefix" + text);
|
||||||
}
|
}
|
||||||
|
@ -853,6 +857,7 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("prefix" + text);
|
setValue("prefix" + text);
|
||||||
}
|
}
|
||||||
|
@ -905,16 +910,19 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean(false);
|
IndexedTestBean bean = new IndexedTestBean(false);
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(String.class, "array.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "array.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("array" + text);
|
setValue("array" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "list.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "list.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("list" + text);
|
setValue("list" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "map.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "map.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("map" + text);
|
setValue("map" + text);
|
||||||
}
|
}
|
||||||
|
@ -969,31 +977,37 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean(false);
|
IndexedTestBean bean = new IndexedTestBean(false);
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(String.class, "array[0].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "array[0].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("array0" + text);
|
setValue("array0" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "array[1].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "array[1].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("array1" + text);
|
setValue("array1" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "list[0].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "list[0].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("list0" + text);
|
setValue("list0" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "list[1].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "list[1].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("list1" + text);
|
setValue("list1" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "map[key1].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "map[key1].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("mapkey1" + text);
|
setValue("mapkey1" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "map[key2].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "map[key2].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("mapkey2" + text);
|
setValue("mapkey2" + text);
|
||||||
}
|
}
|
||||||
|
@ -1060,28 +1074,34 @@ public class CustomEditorTests {
|
||||||
tb5.setNestedIndexedBean(new IndexedTestBean());
|
tb5.setNestedIndexedBean(new IndexedTestBean());
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(String.class, "array.nestedIndexedBean.array.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "array.nestedIndexedBean.array.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("array" + text);
|
setValue("array" + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((String) getValue()).substring(5);
|
return ((String) getValue()).substring(5);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("list" + text);
|
setValue("list" + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((String) getValue()).substring(4);
|
return ((String) getValue()).substring(4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "map.nestedIndexedBean.map.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "map.nestedIndexedBean.map.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("map" + text);
|
setValue("map" + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((String) getValue()).substring(4);
|
return ((String) getValue()).substring(4);
|
||||||
}
|
}
|
||||||
|
@ -1138,16 +1158,19 @@ public class CustomEditorTests {
|
||||||
tb5.setNestedIndexedBean(new IndexedTestBean());
|
tb5.setNestedIndexedBean(new IndexedTestBean());
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(String.class, "array[0].nestedIndexedBean.array[0].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "array[0].nestedIndexedBean.array[0].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("array" + text);
|
setValue("array" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list[1].name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list[1].name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("list" + text);
|
setValue("list" + text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(String.class, "map[key1].nestedIndexedBean.map.name", new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, "map[key1].nestedIndexedBean.map.name", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("map" + text);
|
setValue("map" + text);
|
||||||
}
|
}
|
||||||
|
@ -1174,28 +1197,34 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(TestBean.class, "array", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "array", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("array" + text, 99));
|
setValue(new TestBean("array" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "list", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "list", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("list" + text, 99));
|
setValue(new TestBean("list" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("map" + text, 99));
|
setValue(new TestBean("map" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
|
@ -1222,55 +1251,67 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(TestBean.class, "array[0]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "array[0]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("array0" + text, 99));
|
setValue(new TestBean("array0" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "array[1]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "array[1]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("array1" + text, 99));
|
setValue(new TestBean("array1" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "list[0]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "list[0]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("list0" + text, 99));
|
setValue(new TestBean("list0" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "list[1]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "list[1]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("list1" + text, 99));
|
setValue(new TestBean("list1" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "map[key1]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "map[key1]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("mapkey1" + text, 99));
|
setValue(new TestBean("mapkey1" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bw.registerCustomEditor(TestBean.class, "map[key2]", new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, "map[key2]", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean("mapkey2" + text, 99));
|
setValue(new TestBean("mapkey2" + text, 99));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAsText() {
|
public String getAsText() {
|
||||||
return ((TestBean) getValue()).getName();
|
return ((TestBean) getValue()).getName();
|
||||||
}
|
}
|
||||||
|
@ -1297,6 +1338,7 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean bean = new IndexedTestBean();
|
IndexedTestBean bean = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||||
bw.registerCustomEditor(List.class, "list", new PropertyEditorSupport() {
|
bw.registerCustomEditor(List.class, "list", new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
List<TestBean> result = new ArrayList<TestBean>();
|
List<TestBean> result = new ArrayList<TestBean>();
|
||||||
result.add(new TestBean("list" + text, 99));
|
result.add(new TestBean("list" + text, 99));
|
||||||
|
@ -1347,6 +1389,7 @@ public class CustomEditorTests {
|
||||||
IndexedTestBean tb = new IndexedTestBean();
|
IndexedTestBean tb = new IndexedTestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue(new TestBean(text, 99));
|
setValue(new TestBean(text, 99));
|
||||||
}
|
}
|
||||||
|
@ -1362,6 +1405,7 @@ public class CustomEditorTests {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
public void setAsText(String text) throws IllegalArgumentException {
|
||||||
setValue("-" + text + "-");
|
setValue("-" + text + "-");
|
||||||
}
|
}
|
||||||
|
@ -1436,6 +1480,7 @@ public class CustomEditorTests {
|
||||||
|
|
||||||
private static class TestBeanEditor extends PropertyEditorSupport {
|
private static class TestBeanEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
StringTokenizer st = new StringTokenizer(text, "_");
|
StringTokenizer st = new StringTokenizer(text, "_");
|
||||||
|
@ -1448,6 +1493,7 @@ public class CustomEditorTests {
|
||||||
|
|
||||||
private static class OldValueAccessingTestBeanEditor extends PropertyEditorSupport {
|
private static class OldValueAccessingTestBeanEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
StringTokenizer st = new StringTokenizer(text, "_");
|
StringTokenizer st = new StringTokenizer(text, "_");
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class PropertyComparatorTests {
|
||||||
|
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
return nickName.compareTo(((Dog)o).nickName);
|
return nickName.compareTo(((Dog)o).nickName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,14 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String beanName) {
|
public void setBeanName(String beanName) {
|
||||||
if (this.beanName == null || beanName == null) {
|
if (this.beanName == null || beanName == null) {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getBeanName() {
|
public String getBeanName() {
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
@ -79,10 +81,12 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean wasDestroyed() {
|
public boolean wasDestroyed() {
|
||||||
return destroyed;
|
return destroyed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class DummyFactory
|
||||||
* Return if the bean managed by this factory is a singleton.
|
* Return if the bean managed by this factory is a singleton.
|
||||||
* @see FactoryBean#isSingleton()
|
* @see FactoryBean#isSingleton()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isSingleton() {
|
public boolean isSingleton() {
|
||||||
return this.singleton;
|
return this.singleton;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ public class DummyFactory
|
||||||
this.singleton = singleton;
|
this.singleton = singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String beanName) {
|
public void setBeanName(String beanName) {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +102,7 @@ public class DummyFactory
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.beanFactory = (AutowireCapableBeanFactory) beanFactory;
|
this.beanFactory = (AutowireCapableBeanFactory) beanFactory;
|
||||||
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName);
|
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName);
|
||||||
|
@ -126,6 +129,7 @@ public class DummyFactory
|
||||||
return otherTestBean;
|
return otherTestBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean");
|
throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean");
|
||||||
|
@ -151,6 +155,7 @@ public class DummyFactory
|
||||||
* and prototype mode.
|
* and prototype mode.
|
||||||
* @see FactoryBean#getObject()
|
* @see FactoryBean#getObject()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getObject() throws BeansException {
|
public Object getObject() throws BeansException {
|
||||||
if (isSingleton()) {
|
if (isSingleton()) {
|
||||||
return this.testBean;
|
return this.testBean;
|
||||||
|
@ -165,11 +170,13 @@ public class DummyFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<?> getObjectType() {
|
public Class<?> getObjectType() {
|
||||||
return TestBean.class;
|
return TestBean.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (this.testBean != null) {
|
if (this.testBean != null) {
|
||||||
this.testBean.setName(null);
|
this.testBean.setName(null);
|
||||||
|
|
|
@ -59,6 +59,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
|
||||||
return initMethodDeclared;
|
return initMethodDeclared;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String name) {
|
public void setBeanName(String name) {
|
||||||
this.beanName = name;
|
this.beanName = name;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.owningFactory = beanFactory;
|
this.owningFactory = beanFactory;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +83,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
|
||||||
this.postProcessedBeforeInit = true;
|
this.postProcessedBeforeInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
if (this.owningFactory == null) {
|
if (this.owningFactory == null) {
|
||||||
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
|
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
|
||||||
|
@ -132,6 +135,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
throw new IllegalStateException("Already destroyed");
|
throw new IllegalStateException("Already destroyed");
|
||||||
|
@ -146,6 +150,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
|
||||||
|
|
||||||
public static class PostProcessor implements BeanPostProcessor {
|
public static class PostProcessor implements BeanPostProcessor {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
||||||
if (bean instanceof LifecycleBean) {
|
if (bean instanceof LifecycleBean) {
|
||||||
((LifecycleBean) bean).postProcessBeforeInit();
|
((LifecycleBean) bean).postProcessBeforeInit();
|
||||||
|
@ -153,6 +158,7 @@ public class LifecycleBean implements BeanNameAware, BeanFactoryAware, Initializ
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
||||||
if (bean instanceof LifecycleBean) {
|
if (bean instanceof LifecycleBean) {
|
||||||
((LifecycleBean) bean).postProcessAfterInit();
|
((LifecycleBean) bean).postProcessAfterInit();
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
|
||||||
this.company = (company != null ? company : "");
|
this.company = (company != null ? company : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCompany() {
|
public String getCompany() {
|
||||||
return company;
|
return company;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String beanName) {
|
public void setBeanName(String beanName) {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.beanFactory = beanFactory;
|
this.beanFactory = beanFactory;
|
||||||
}
|
}
|
||||||
|
@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
return postProcessed;
|
return postProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
this.age = age;
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.jedi = jedi;
|
this.jedi = jedi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSpouse(ITestBean spouse) {
|
public void setSpouse(ITestBean spouse) {
|
||||||
this.spouses = new ITestBean[] {spouse};
|
this.spouses = new ITestBean[] {spouse};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITestBean getSpouse() {
|
public ITestBean getSpouse() {
|
||||||
return (spouses != null ? spouses[0] : null);
|
return (spouses != null ? spouses[0] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITestBean[] getSpouses() {
|
public ITestBean[] getSpouses() {
|
||||||
return spouses;
|
return spouses;
|
||||||
}
|
}
|
||||||
|
@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.country = country;
|
this.country = country;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getStringArray() {
|
public String[] getStringArray() {
|
||||||
return stringArray;
|
return stringArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setStringArray(String[] stringArray) {
|
public void setStringArray(String[] stringArray) {
|
||||||
this.stringArray = stringArray;
|
this.stringArray = stringArray;
|
||||||
}
|
}
|
||||||
|
@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.someProperties = someProperties;
|
this.someProperties = someProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public INestedTestBean getDoctor() {
|
public INestedTestBean getDoctor() {
|
||||||
return doctor;
|
return doctor;
|
||||||
}
|
}
|
||||||
|
@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.doctor = doctor;
|
this.doctor = doctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public INestedTestBean getLawyer() {
|
public INestedTestBean getLawyer() {
|
||||||
return lawyer;
|
return lawyer;
|
||||||
}
|
}
|
||||||
|
@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.someBoolean = someBoolean;
|
this.someBoolean = someBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IndexedTestBean getNestedIndexedBean() {
|
public IndexedTestBean getNestedIndexedBean() {
|
||||||
return nestedIndexedBean;
|
return nestedIndexedBean;
|
||||||
}
|
}
|
||||||
|
@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
/**
|
/**
|
||||||
* @see ITestBean#exceptional(Throwable)
|
* @see ITestBean#exceptional(Throwable)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void exceptional(Throwable t) throws Throwable {
|
public void exceptional(Throwable t) throws Throwable {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
throw t;
|
throw t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void unreliableFileOperation() throws IOException {
|
public void unreliableFileOperation() throws IOException {
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @see ITestBean#returnsThis()
|
* @see ITestBean#returnsThis()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object returnsThis() {
|
public Object returnsThis() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
/**
|
/**
|
||||||
* @see IOther#absquatulate()
|
* @see IOther#absquatulate()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void absquatulate() {
|
public void absquatulate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int haveBirthday() {
|
public int haveBirthday() {
|
||||||
return age++;
|
return age++;
|
||||||
}
|
}
|
||||||
|
@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
return this.age;
|
return this.age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareTo(Object other) {
|
public int compareTo(Object other) {
|
||||||
if (this.name != null && other instanceof TestBean) {
|
if (this.name != null && other instanceof TestBean) {
|
||||||
return this.name.compareTo(((TestBean) other).getName());
|
return this.name.compareTo(((TestBean) other).getName());
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
|
||||||
this.company = (company != null ? company : "");
|
this.company = (company != null ? company : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCompany() {
|
public String getCompany() {
|
||||||
return company;
|
return company;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanName(String beanName) {
|
public void setBeanName(String beanName) {
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
return beanName;
|
return beanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.beanFactory = beanFactory;
|
this.beanFactory = beanFactory;
|
||||||
}
|
}
|
||||||
|
@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
return postProcessed;
|
return postProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
this.age = age;
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.jedi = jedi;
|
this.jedi = jedi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITestBean getSpouse() {
|
public ITestBean getSpouse() {
|
||||||
return (spouses != null ? spouses[0] : null);
|
return (spouses != null ? spouses[0] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSpouse(ITestBean spouse) {
|
public void setSpouse(ITestBean spouse) {
|
||||||
this.spouses = new ITestBean[] {spouse};
|
this.spouses = new ITestBean[] {spouse};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITestBean[] getSpouses() {
|
public ITestBean[] getSpouses() {
|
||||||
return spouses;
|
return spouses;
|
||||||
}
|
}
|
||||||
|
@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.country = country;
|
this.country = country;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getStringArray() {
|
public String[] getStringArray() {
|
||||||
return stringArray;
|
return stringArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setStringArray(String[] stringArray) {
|
public void setStringArray(String[] stringArray) {
|
||||||
this.stringArray = stringArray;
|
this.stringArray = stringArray;
|
||||||
}
|
}
|
||||||
|
@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.someProperties = someProperties;
|
this.someProperties = someProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public INestedTestBean getDoctor() {
|
public INestedTestBean getDoctor() {
|
||||||
return doctor;
|
return doctor;
|
||||||
}
|
}
|
||||||
|
@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.doctor = doctor;
|
this.doctor = doctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public INestedTestBean getLawyer() {
|
public INestedTestBean getLawyer() {
|
||||||
return lawyer;
|
return lawyer;
|
||||||
}
|
}
|
||||||
|
@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
this.someBoolean = someBoolean;
|
this.someBoolean = someBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IndexedTestBean getNestedIndexedBean() {
|
public IndexedTestBean getNestedIndexedBean() {
|
||||||
return nestedIndexedBean;
|
return nestedIndexedBean;
|
||||||
}
|
}
|
||||||
|
@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
/**
|
/**
|
||||||
* @see org.springframework.beans.ITestBean#exceptional(Throwable)
|
* @see org.springframework.beans.ITestBean#exceptional(Throwable)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void exceptional(Throwable t) throws Throwable {
|
public void exceptional(Throwable t) throws Throwable {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
throw t;
|
throw t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void unreliableFileOperation() throws IOException {
|
public void unreliableFileOperation() throws IOException {
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @see org.springframework.beans.ITestBean#returnsThis()
|
* @see org.springframework.beans.ITestBean#returnsThis()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object returnsThis() {
|
public Object returnsThis() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
/**
|
/**
|
||||||
* @see org.springframework.beans.IOther#absquatulate()
|
* @see org.springframework.beans.IOther#absquatulate()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void absquatulate() {
|
public void absquatulate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int haveBirthday() {
|
public int haveBirthday() {
|
||||||
return age++;
|
return age++;
|
||||||
}
|
}
|
||||||
|
@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||||
return this.age;
|
return this.age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareTo(Object other) {
|
public int compareTo(Object other) {
|
||||||
if (this.name != null && other instanceof TestBean) {
|
if (this.name != null && other instanceof TestBean) {
|
||||||
return this.name.compareTo(((TestBean) other).getName());
|
return this.name.compareTo(((TestBean) other).getName());
|
||||||
|
|
|
@ -188,6 +188,7 @@ public class EhCacheSupportTests extends TestCase {
|
||||||
cacheFb.setCacheManager(cm);
|
cacheFb.setCacheManager(cm);
|
||||||
cacheFb.setCacheName("myCache1");
|
cacheFb.setCacheName("myCache1");
|
||||||
cacheFb.setCacheEntryFactory(new CacheEntryFactory() {
|
cacheFb.setCacheEntryFactory(new CacheEntryFactory() {
|
||||||
|
@Override
|
||||||
public Object createEntry(Object key) throws Exception {
|
public Object createEntry(Object key) throws Exception {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -212,9 +213,11 @@ public class EhCacheSupportTests extends TestCase {
|
||||||
cacheFb.setCacheManager(cm);
|
cacheFb.setCacheManager(cm);
|
||||||
cacheFb.setCacheName("myCache1");
|
cacheFb.setCacheName("myCache1");
|
||||||
cacheFb.setCacheEntryFactory(new UpdatingCacheEntryFactory() {
|
cacheFb.setCacheEntryFactory(new UpdatingCacheEntryFactory() {
|
||||||
|
@Override
|
||||||
public Object createEntry(Object key) throws Exception {
|
public Object createEntry(Object key) throws Exception {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void updateEntryValue(Object key, Object value) throws Exception {
|
public void updateEntryValue(Object key, Object value) throws Exception {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class InternetAddressEditorTests extends TestCase {
|
||||||
|
|
||||||
private InternetAddressEditor editor;
|
private InternetAddressEditor editor;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() {
|
protected void setUp() {
|
||||||
editor = new InternetAddressEditor();
|
editor = new InternetAddressEditor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ public class JavaMailSenderTests extends TestCase {
|
||||||
final List<Message> messages = new ArrayList<Message>();
|
final List<Message> messages = new ArrayList<Message>();
|
||||||
|
|
||||||
MimeMessagePreparator preparator = new MimeMessagePreparator() {
|
MimeMessagePreparator preparator = new MimeMessagePreparator() {
|
||||||
|
@Override
|
||||||
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
||||||
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("you@mail.org"));
|
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("you@mail.org"));
|
||||||
messages.add(mimeMessage);
|
messages.add(mimeMessage);
|
||||||
|
@ -194,12 +195,14 @@ public class JavaMailSenderTests extends TestCase {
|
||||||
final List<Message> messages = new ArrayList<Message>();
|
final List<Message> messages = new ArrayList<Message>();
|
||||||
|
|
||||||
MimeMessagePreparator preparator1 = new MimeMessagePreparator() {
|
MimeMessagePreparator preparator1 = new MimeMessagePreparator() {
|
||||||
|
@Override
|
||||||
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
||||||
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("he@mail.org"));
|
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("he@mail.org"));
|
||||||
messages.add(mimeMessage);
|
messages.add(mimeMessage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MimeMessagePreparator preparator2 = new MimeMessagePreparator() {
|
MimeMessagePreparator preparator2 = new MimeMessagePreparator() {
|
||||||
|
@Override
|
||||||
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
||||||
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("she@mail.org"));
|
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("she@mail.org"));
|
||||||
messages.add(mimeMessage);
|
messages.add(mimeMessage);
|
||||||
|
@ -300,6 +303,7 @@ public class JavaMailSenderTests extends TestCase {
|
||||||
public void testJavaMailSenderWithParseExceptionOnMimeMessagePreparator() {
|
public void testJavaMailSenderWithParseExceptionOnMimeMessagePreparator() {
|
||||||
MockJavaMailSender sender = new MockJavaMailSender();
|
MockJavaMailSender sender = new MockJavaMailSender();
|
||||||
MimeMessagePreparator preparator = new MimeMessagePreparator() {
|
MimeMessagePreparator preparator = new MimeMessagePreparator() {
|
||||||
|
@Override
|
||||||
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
public void prepare(MimeMessage mimeMessage) throws MessagingException {
|
||||||
mimeMessage.setFrom(new InternetAddress(""));
|
mimeMessage.setFrom(new InternetAddress(""));
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,7 @@ public class QuartzSupportTests {
|
||||||
schedulerControl.replay();
|
schedulerControl.replay();
|
||||||
|
|
||||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
||||||
|
@Override
|
||||||
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
@ -248,6 +249,7 @@ public class QuartzSupportTests {
|
||||||
schedulerControl.replay();
|
schedulerControl.replay();
|
||||||
|
|
||||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
||||||
|
@Override
|
||||||
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
@ -346,6 +348,7 @@ public class QuartzSupportTests {
|
||||||
schedulerControl.replay();
|
schedulerControl.replay();
|
||||||
|
|
||||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
||||||
|
@Override
|
||||||
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
@ -401,6 +404,7 @@ public class QuartzSupportTests {
|
||||||
schedulerControl.replay();
|
schedulerControl.replay();
|
||||||
|
|
||||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
||||||
|
@Override
|
||||||
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
@ -570,6 +574,7 @@ public class QuartzSupportTests {
|
||||||
schedulerControl.replay();
|
schedulerControl.replay();
|
||||||
|
|
||||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
||||||
|
@Override
|
||||||
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
@ -605,6 +610,7 @@ public class QuartzSupportTests {
|
||||||
schedulerControl.replay();
|
schedulerControl.replay();
|
||||||
|
|
||||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
|
||||||
|
@Override
|
||||||
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
@ -1040,30 +1046,39 @@ public class QuartzSupportTests {
|
||||||
|
|
||||||
private static class TestSchedulerListener implements SchedulerListener {
|
private static class TestSchedulerListener implements SchedulerListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobScheduled(Trigger trigger) {
|
public void jobScheduled(Trigger trigger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobUnscheduled(String triggerName, String triggerGroup) {
|
public void jobUnscheduled(String triggerName, String triggerGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void triggerFinalized(Trigger trigger) {
|
public void triggerFinalized(Trigger trigger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void triggersPaused(String triggerName, String triggerGroup) {
|
public void triggersPaused(String triggerName, String triggerGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void triggersResumed(String triggerName, String triggerGroup) {
|
public void triggersResumed(String triggerName, String triggerGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobsPaused(String jobName, String jobGroup) {
|
public void jobsPaused(String jobName, String jobGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobsResumed(String jobName, String jobGroup) {
|
public void jobsResumed(String jobName, String jobGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void schedulerError(String msg, SchedulerException cause) {
|
public void schedulerError(String msg, SchedulerException cause) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void schedulerShutdown() {
|
public void schedulerShutdown() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1071,16 +1086,20 @@ public class QuartzSupportTests {
|
||||||
|
|
||||||
private static class TestJobListener implements JobListener {
|
private static class TestJobListener implements JobListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobToBeExecuted(JobExecutionContext context) {
|
public void jobToBeExecuted(JobExecutionContext context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobExecutionVetoed(JobExecutionContext context) {
|
public void jobExecutionVetoed(JobExecutionContext context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
|
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1088,20 +1107,25 @@ public class QuartzSupportTests {
|
||||||
|
|
||||||
private static class TestTriggerListener implements TriggerListener {
|
private static class TestTriggerListener implements TriggerListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void triggerFired(Trigger trigger, JobExecutionContext context) {
|
public void triggerFired(Trigger trigger, JobExecutionContext context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) {
|
public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void triggerMisfired(Trigger trigger) {
|
public void triggerMisfired(Trigger trigger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void triggerComplete(Trigger trigger, JobExecutionContext context, int triggerInstructionCode) {
|
public void triggerComplete(Trigger trigger, JobExecutionContext context, int triggerInstructionCode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1111,6 +1135,7 @@ public class QuartzSupportTests {
|
||||||
|
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void execute(Runnable task) {
|
public void execute(Runnable task) {
|
||||||
this.count++;
|
this.count++;
|
||||||
task.run();
|
task.run();
|
||||||
|
@ -1131,6 +1156,7 @@ public class QuartzSupportTests {
|
||||||
param = value;
|
param = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
public synchronized void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1150,6 +1176,7 @@ public class QuartzSupportTests {
|
||||||
param = value;
|
param = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected synchronized void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
protected synchronized void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1169,6 +1196,7 @@ public class QuartzSupportTests {
|
||||||
param = value;
|
param = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,6 +236,7 @@ public class JasperReportsUtilsTests extends TestCase {
|
||||||
|
|
||||||
private boolean invoked = false;
|
private boolean invoked = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPageExport() {
|
public void afterPageExport() {
|
||||||
this.invoked = true;
|
this.invoked = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,17 @@ public class AutowiredQualifierFooService implements FooService {
|
||||||
this.initCalled = true;
|
this.initCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String foo(int id) {
|
public String foo(int id) {
|
||||||
return this.fooDao.findFoo(id);
|
return this.fooDao.findFoo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Future<String> asyncFoo(int id) {
|
public Future<String> asyncFoo(int id) {
|
||||||
return new AsyncResult<String>(this.fooDao.findFoo(id));
|
return new AsyncResult<String>(this.fooDao.findFoo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isInitCalled() {
|
public boolean isInitCalled() {
|
||||||
return this.initCalled;
|
return this.initCalled;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue