turned CountingBeforeAdvice into top-level class
This commit is contained in:
@@ -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 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.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.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;
|
||||
|
||||
/**
|
||||
* Also tests AdvisedSupport and ProxyCreatorSupport superclasses.
|
||||
*
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user