moved ApplicationContext-dependent .aop.* unit tests from .testsuite -> .context
in the process, identified and refactored two genuine integration tests (AopNamespaceHandlerScopeIntegrationTests, AdvisorAutoProxyCreatorIntegrationTests), which will remain in .testsuite due to broad-ranging dependencies
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package example.aspects;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
|
||||
@Aspect
|
||||
public class TwoAdviceAspect {
|
||||
private int totalCalls;
|
||||
|
||||
@Around("execution(* getAge())")
|
||||
public int returnCallCount(ProceedingJoinPoint pjp) throws Exception {
|
||||
return totalCalls;
|
||||
}
|
||||
|
||||
@Before("execution(* setAge(int)) && args(newAge)")
|
||||
public void countSet(int newAge) throws Exception {
|
||||
++totalCalls;
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,9 @@ import org.springframework.core.OrderComparator;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
import example.aspects.PerTargetAspect;
|
||||
import example.aspects.TwoAdviceAspect;
|
||||
import test.aspect.PerTargetAspect;
|
||||
import test.aspect.TwoAdviceAspect;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract tests for AspectJAdvisorFactory.
|
||||
|
||||
@@ -25,7 +25,8 @@ import org.springframework.aop.aspectj.AspectJExpressionPointcutTests;
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.beans.TestBean;
|
||||
|
||||
import example.aspects.PerTargetAspect;
|
||||
import test.aspect.PerTargetAspect;
|
||||
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
|
||||
@@ -23,7 +23,8 @@ import org.junit.Test;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactoryTests.ExceptionAspect;
|
||||
|
||||
import example.aspects.PerTargetAspect;
|
||||
import test.aspect.PerTargetAspect;
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
|
||||
@@ -21,7 +21,8 @@ import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.aspectj.autoproxy.MultiplyReturnValue;
|
||||
|
||||
import example.aspects.PerThisAspect;
|
||||
import test.aspect.PerThisAspect;
|
||||
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package example.aspects;
|
||||
package test.aspect;
|
||||
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package example.aspects;
|
||||
package test.aspect;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package test.aspect;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
|
||||
@Aspect
|
||||
public class TwoAdviceAspect {
|
||||
private int totalCalls;
|
||||
|
||||
@Around("execution(* getAge())")
|
||||
public int returnCallCount(ProceedingJoinPoint pjp) throws Exception {
|
||||
return totalCalls;
|
||||
}
|
||||
|
||||
@Before("execution(* setAge(int)) && args(newAge)")
|
||||
public void countSet(int newAge) throws Exception {
|
||||
++totalCalls;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user