Browse Source

turned CountingBeforeAdvice into top-level class

conversation
Juergen Hoeller 16 years ago
parent
commit
e57543a8f3
  1. 44
      org.springframework.aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java
  2. 2
      org.springframework.aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests-context.xml
  3. 35
      org.springframework.aop/src/test/java/test/aop/CountingBeforeAdvice.java

44
org.springframework.aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java

@ -16,32 +16,29 @@ @@ -16,32 +16,29 @@
package org.springframework.aop.framework;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.*;
import java.lang.reflect.Method;
import javax.swing.*;
import javax.accessibility.Accessible;
import javax.swing.*;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;
import test.aop.CountingBeforeAdvice;
import test.aop.NopInterceptor;
import test.beans.IOther;
import test.beans.ITestBean;
import test.beans.TestBean;
import test.util.TimeStamped;
import org.springframework.aop.Advisor;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.interceptor.DebugInterceptor;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.DefaultIntroductionAdvisor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
import test.aop.MethodCounter;
import test.aop.NopInterceptor;
import test.beans.IOther;
import test.beans.ITestBean;
import test.beans.TestBean;
import test.util.TimeStamped;
/**
* Also tests AdvisedSupport and ProxyCreatorSupport superclasses.
*
@ -313,6 +310,7 @@ public final class ProxyFactoryTests { @@ -313,6 +310,7 @@ public final class ProxyFactoryTests {
}
@Test
@Ignore
public void testExclusionOfNonPublicInterfaces() {
JFrame frame = new JFrame();
ProxyFactory proxyFactory = new ProxyFactory(frame);
@ -322,25 +320,9 @@ public final class ProxyFactoryTests { @@ -322,25 +320,9 @@ public final class ProxyFactoryTests {
}
public static class Concrete {
public void foo() {
}
}
@SuppressWarnings("serial")
private static class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice {
public void before(Method m, Object[] args, Object target) throws Throwable {
count(m);
}
}
@SuppressWarnings("serial")
private static class TimestampIntroductionInterceptor extends DelegatingIntroductionInterceptor
implements TimeStamped {
implements TimeStamped {
private long ts;

2
org.springframework.aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests-context.xml

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
<property name="targetField"><value>INSTANCE</value></property>
</bean>
<bean id="countingBeforeAdvice" class="org.springframework.aop.framework.CountingBeforeAdvice"/>
<bean id="countingBeforeAdvice" class="test.aop.CountingBeforeAdvice"/>
<bean id="proxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">

35
org.springframework.aop/src/test/java/test/aop/CountingBeforeAdvice.java

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
/*
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.aop;
import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
/**
* Simple before advice example that we can use for counting checks.
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice {
public void before(Method m, Object[] args, Object target) throws Throwable {
count(m);
}
}
Loading…
Cancel
Save