Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sesemomo
spring-framework
提交
de4ff4b1
S
spring-framework
项目概览
sesemomo
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
de4ff4b1
编写于
4月 14, 2018
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
b95e05db
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
92 addition
and
96 deletion
+92
-96
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java
...tj/AspectJAdviceParameterNameDiscoverAnnotationTests.java
+7
-11
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
...op/aspectj/AspectJAdviceParameterNameDiscovererTests.java
+58
-52
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
...framework/aop/aspectj/AspectJExpressionPointcutTests.java
+3
-14
spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
...gframework/aop/aspectj/BeanNamePointcutMatchingTests.java
+3
-1
spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java
...work/aop/aspectj/TigerAspectJExpressionPointcutTests.java
+21
-18
未找到文件。
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java
浏览文件 @
de4ff4b1
/*
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,9 +16,6 @@
...
@@ -16,9 +16,6 @@
package
org.springframework.aop.aspectj
;
package
org.springframework.aop.aspectj
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -30,13 +27,7 @@ import org.junit.Test;
...
@@ -30,13 +27,7 @@ import org.junit.Test;
* @author Adrian Colyer
* @author Adrian Colyer
* @author Chris Beams
* @author Chris Beams
*/
*/
public
class
AspectJAdviceParameterNameDiscoverAnnotationTests
public
class
AspectJAdviceParameterNameDiscoverAnnotationTests
extends
AspectJAdviceParameterNameDiscovererTests
{
extends
AspectJAdviceParameterNameDiscovererTests
{
@Retention
(
RetentionPolicy
.
RUNTIME
)
@interface
MyAnnotation
{}
public
void
pjpAndAnAnnotation
(
ProceedingJoinPoint
pjp
,
MyAnnotation
ann
)
{}
@Test
@Test
public
void
testAnnotationBinding
()
{
public
void
testAnnotationBinding
()
{
...
@@ -45,4 +36,9 @@ public class AspectJAdviceParameterNameDiscoverAnnotationTests
...
@@ -45,4 +36,9 @@ public class AspectJAdviceParameterNameDiscoverAnnotationTests
new
String
[]
{
"thisJoinPoint"
,
"ann"
});
new
String
[]
{
"thisJoinPoint"
,
"ann"
});
}
}
public
void
pjpAndAnAnnotation
(
ProceedingJoinPoint
pjp
,
MyAnnotation
ann
)
{}
@interface
MyAnnotation
{}
}
}
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
浏览文件 @
de4ff4b1
/*
/*
* Copyright 2002-201
7
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
package
org.springframework.aop.aspectj
;
package
org.springframework.aop.aspectj
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
...
@@ -34,47 +35,6 @@ import static org.junit.Assert.*;
...
@@ -34,47 +35,6 @@ import static org.junit.Assert.*;
*/
*/
public
class
AspectJAdviceParameterNameDiscovererTests
{
public
class
AspectJAdviceParameterNameDiscovererTests
{
// methods to discover parameter names for
public
void
noArgs
()
{
}
public
void
tjp
(
JoinPoint
jp
)
{
}
public
void
tjpsp
(
JoinPoint
.
StaticPart
tjpsp
)
{
}
public
void
twoJoinPoints
(
JoinPoint
jp1
,
JoinPoint
jp2
)
{
}
public
void
oneThrowable
(
Exception
ex
)
{
}
public
void
jpAndOneThrowable
(
JoinPoint
jp
,
Exception
ex
)
{
}
public
void
jpAndTwoThrowables
(
JoinPoint
jp
,
Exception
ex
,
Error
err
)
{
}
public
void
oneObject
(
Object
x
)
{
}
public
void
twoObjects
(
Object
x
,
Object
y
)
{
}
public
void
onePrimitive
(
int
x
)
{
}
public
void
oneObjectOnePrimitive
(
Object
x
,
int
y
)
{
}
public
void
oneThrowableOnePrimitive
(
Throwable
x
,
int
y
)
{
}
public
void
theBigOne
(
JoinPoint
jp
,
Throwable
x
,
int
y
,
Object
foo
)
{
}
@Test
@Test
public
void
testNoArgs
()
{
public
void
testNoArgs
()
{
assertParameterNames
(
getMethod
(
"noArgs"
),
"execution(* *(..))"
,
new
String
[
0
]);
assertParameterNames
(
getMethod
(
"noArgs"
),
"execution(* *(..))"
,
new
String
[
0
]);
...
@@ -221,22 +181,26 @@ public class AspectJAdviceParameterNameDiscovererTests {
...
@@ -221,22 +181,26 @@ public class AspectJAdviceParameterNameDiscovererTests {
@Test
@Test
public
void
testThisAndPrimitive
()
{
public
void
testThisAndPrimitive
()
{
assertParameterNames
(
getMethod
(
"oneObjectOnePrimitive"
),
"args(count) && this(obj)"
,
new
String
[]
{
"obj"
,
"count"
});
assertParameterNames
(
getMethod
(
"oneObjectOnePrimitive"
),
"args(count) && this(obj)"
,
new
String
[]
{
"obj"
,
"count"
});
}
}
@Test
@Test
public
void
testTargetAndPrimitive
()
{
public
void
testTargetAndPrimitive
()
{
assertParameterNames
(
getMethod
(
"oneObjectOnePrimitive"
),
"args(count) && target(obj)"
,
new
String
[]
{
"obj"
,
"count"
});
assertParameterNames
(
getMethod
(
"oneObjectOnePrimitive"
),
"args(count) && target(obj)"
,
new
String
[]
{
"obj"
,
"count"
});
}
}
@Test
@Test
public
void
testThrowingAndPrimitive
()
{
public
void
testThrowingAndPrimitive
()
{
assertParameterNames
(
getMethod
(
"oneThrowableOnePrimitive"
),
"args(count)"
,
null
,
"ex"
,
new
String
[]
{
"ex"
,
"count"
});
assertParameterNames
(
getMethod
(
"oneThrowableOnePrimitive"
),
"args(count)"
,
null
,
"ex"
,
new
String
[]
{
"ex"
,
"count"
});
}
}
@Test
@Test
public
void
testAllTogetherNow
()
{
public
void
testAllTogetherNow
()
{
assertParameterNames
(
getMethod
(
"theBigOne"
),
"this(foo) && args(x)"
,
null
,
"ex"
,
new
String
[]
{
"thisJoinPoint"
,
"ex"
,
"x"
,
"foo"
});
assertParameterNames
(
getMethod
(
"theBigOne"
),
"this(foo) && args(x)"
,
null
,
"ex"
,
new
String
[]
{
"thisJoinPoint"
,
"ex"
,
"x"
,
"foo"
});
}
}
@Test
@Test
...
@@ -253,8 +217,8 @@ public class AspectJAdviceParameterNameDiscovererTests {
...
@@ -253,8 +217,8 @@ public class AspectJAdviceParameterNameDiscovererTests {
protected
Method
getMethod
(
String
name
)
{
protected
Method
getMethod
(
String
name
)
{
//
a
ssumes no overloading of test methods...
//
A
ssumes no overloading of test methods...
Method
[]
candidates
=
this
.
getClass
().
getMethods
();
Method
[]
candidates
=
getClass
().
getMethods
();
for
(
Method
candidate
:
candidates
)
{
for
(
Method
candidate
:
candidates
)
{
if
(
candidate
.
getName
().
equals
(
name
))
{
if
(
candidate
.
getName
().
equals
(
name
))
{
return
candidate
;
return
candidate
;
...
@@ -268,8 +232,8 @@ public class AspectJAdviceParameterNameDiscovererTests {
...
@@ -268,8 +232,8 @@ public class AspectJAdviceParameterNameDiscovererTests {
assertParameterNames
(
method
,
pointcut
,
null
,
null
,
parameterNames
);
assertParameterNames
(
method
,
pointcut
,
null
,
null
,
parameterNames
);
}
}
protected
void
assertParameterNames
(
Method
method
,
String
pointcut
,
String
returning
,
String
throwing
,
protected
void
assertParameterNames
(
String
[]
parameterNames
)
{
Method
method
,
String
pointcut
,
String
returning
,
String
throwing
,
String
[]
parameterNames
)
{
assertEquals
(
"bad test specification, must have same number of parameter names as method arguments"
,
assertEquals
(
"bad test specification, must have same number of parameter names as method arguments"
,
method
.
getParameterCount
(),
parameterNames
.
length
);
method
.
getParameterCount
(),
parameterNames
.
length
);
...
@@ -300,8 +264,8 @@ public class AspectJAdviceParameterNameDiscovererTests {
...
@@ -300,8 +264,8 @@ public class AspectJAdviceParameterNameDiscovererTests {
assertException
(
method
,
pointcut
,
null
,
null
,
exceptionType
,
message
);
assertException
(
method
,
pointcut
,
null
,
null
,
exceptionType
,
message
);
}
}
protected
void
assertException
(
Method
method
,
String
pointcut
,
String
returning
,
String
throwing
,
protected
void
assertException
(
Class
<?>
exceptionType
,
String
message
)
{
Method
method
,
String
pointcut
,
String
returning
,
String
throwing
,
Class
<?>
exceptionType
,
String
message
)
{
AspectJAdviceParameterNameDiscoverer
discoverer
=
new
AspectJAdviceParameterNameDiscoverer
(
pointcut
);
AspectJAdviceParameterNameDiscoverer
discoverer
=
new
AspectJAdviceParameterNameDiscoverer
(
pointcut
);
discoverer
.
setRaiseExceptions
(
true
);
discoverer
.
setRaiseExceptions
(
true
);
...
@@ -333,4 +297,46 @@ public class AspectJAdviceParameterNameDiscovererTests {
...
@@ -333,4 +297,46 @@ public class AspectJAdviceParameterNameDiscovererTests {
return
sb
.
toString
();
return
sb
.
toString
();
}
}
// Methods to discover parameter names for
public
void
noArgs
()
{
}
public
void
tjp
(
JoinPoint
jp
)
{
}
public
void
tjpsp
(
JoinPoint
.
StaticPart
tjpsp
)
{
}
public
void
twoJoinPoints
(
JoinPoint
jp1
,
JoinPoint
jp2
)
{
}
public
void
oneThrowable
(
Exception
ex
)
{
}
public
void
jpAndOneThrowable
(
JoinPoint
jp
,
Exception
ex
)
{
}
public
void
jpAndTwoThrowables
(
JoinPoint
jp
,
Exception
ex
,
Error
err
)
{
}
public
void
oneObject
(
Object
x
)
{
}
public
void
twoObjects
(
Object
x
,
Object
y
)
{
}
public
void
onePrimitive
(
int
x
)
{
}
public
void
oneObjectOnePrimitive
(
Object
x
,
int
y
)
{
}
public
void
oneThrowableOnePrimitive
(
Throwable
x
,
int
y
)
{
}
public
void
theBigOne
(
JoinPoint
jp
,
Throwable
x
,
int
y
,
Object
foo
)
{
}
}
}
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
浏览文件 @
de4ff4b1
/*
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -218,38 +218,27 @@ public class AspectJExpressionPointcutTests {
...
@@ -218,38 +218,27 @@ public class AspectJExpressionPointcutTests {
@Test
@Test
public
void
testSimpleAdvice
()
{
public
void
testSimpleAdvice
()
{
String
expression
=
"execution(int org.springframework.tests.sample.beans.TestBean.getAge())"
;
String
expression
=
"execution(int org.springframework.tests.sample.beans.TestBean.getAge())"
;
CallCountingInterceptor
interceptor
=
new
CallCountingInterceptor
();
CallCountingInterceptor
interceptor
=
new
CallCountingInterceptor
();
TestBean
testBean
=
getAdvisedProxy
(
expression
,
interceptor
);
TestBean
testBean
=
getAdvisedProxy
(
expression
,
interceptor
);
assertEquals
(
"Calls should be 0"
,
0
,
interceptor
.
getCount
());
assertEquals
(
"Calls should be 0"
,
0
,
interceptor
.
getCount
());
testBean
.
getAge
();
testBean
.
getAge
();
assertEquals
(
"Calls should be 1"
,
1
,
interceptor
.
getCount
());
assertEquals
(
"Calls should be 1"
,
1
,
interceptor
.
getCount
());
testBean
.
setAge
(
90
);
testBean
.
setAge
(
90
);
assertEquals
(
"Calls should still be 1"
,
1
,
interceptor
.
getCount
());
assertEquals
(
"Calls should still be 1"
,
1
,
interceptor
.
getCount
());
}
}
@Test
@Test
public
void
testDynamicMatchingProxy
()
{
public
void
testDynamicMatchingProxy
()
{
String
expression
=
"execution(void org.springframework.tests.sample.beans.TestBean.setSomeNumber(Number)) && args(Double)"
;
String
expression
=
"execution(void org.springframework.tests.sample.beans.TestBean.setSomeNumber(Number)) && args(Double)"
;
CallCountingInterceptor
interceptor
=
new
CallCountingInterceptor
();
CallCountingInterceptor
interceptor
=
new
CallCountingInterceptor
();
TestBean
testBean
=
getAdvisedProxy
(
expression
,
interceptor
);
TestBean
testBean
=
getAdvisedProxy
(
expression
,
interceptor
);
assertEquals
(
"Calls should be 0"
,
0
,
interceptor
.
getCount
());
assertEquals
(
"Calls should be 0"
,
0
,
interceptor
.
getCount
());
testBean
.
setSomeNumber
(
new
Double
(
30
));
testBean
.
setSomeNumber
(
new
Double
(
30
));
assertEquals
(
"Calls should be 1"
,
1
,
interceptor
.
getCount
());
assertEquals
(
"Calls should be 1"
,
1
,
interceptor
.
getCount
());
testBean
.
setSomeNumber
(
new
Integer
(
90
));
testBean
.
setSomeNumber
(
new
Integer
(
90
));
assertEquals
(
"Calls should be 1"
,
1
,
interceptor
.
getCount
());
assertEquals
(
"Calls should be 1"
,
1
,
interceptor
.
getCount
());
}
}
...
@@ -291,7 +280,7 @@ public class AspectJExpressionPointcutTests {
...
@@ -291,7 +280,7 @@ public class AspectJExpressionPointcutTests {
}
}
@Test
@Test
public
void
testWithUnsupportedPointcutPrimitive
()
throws
Exception
{
public
void
testWithUnsupportedPointcutPrimitive
()
{
String
expression
=
"call(int org.springframework.tests.sample.beans.TestBean.getAge())"
;
String
expression
=
"call(int org.springframework.tests.sample.beans.TestBean.getAge())"
;
try
{
try
{
...
@@ -301,7 +290,6 @@ public class AspectJExpressionPointcutTests {
...
@@ -301,7 +290,6 @@ public class AspectJExpressionPointcutTests {
catch
(
UnsupportedPointcutPrimitiveException
ex
)
{
catch
(
UnsupportedPointcutPrimitiveException
ex
)
{
assertEquals
(
"Should not support call pointcut"
,
PointcutPrimitive
.
CALL
,
ex
.
getUnsupportedPrimitive
());
assertEquals
(
"Should not support call pointcut"
,
PointcutPrimitive
.
CALL
,
ex
.
getUnsupportedPrimitive
());
}
}
}
}
@Test
@Test
...
@@ -332,6 +320,7 @@ public class AspectJExpressionPointcutTests {
...
@@ -332,6 +320,7 @@ public class AspectJExpressionPointcutTests {
// Empty
// Empty
}
}
}
}
}
}
...
...
spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
浏览文件 @
de4ff4b1
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -77,6 +77,7 @@ public class BeanNamePointcutMatchingTests {
...
@@ -77,6 +77,7 @@ public class BeanNamePointcutMatchingTests {
assertMisMatch
(
"someName"
,
"!bean(someName) || bean(someOtherName)"
);
assertMisMatch
(
"someName"
,
"!bean(someName) || bean(someOtherName)"
);
}
}
private
void
assertMatch
(
String
beanName
,
String
pcExpression
)
{
private
void
assertMatch
(
String
beanName
,
String
pcExpression
)
{
assertTrue
(
"Unexpected mismatch for bean \""
+
beanName
+
"\" for pcExpression \""
+
pcExpression
+
"\""
,
assertTrue
(
"Unexpected mismatch for bean \""
+
beanName
+
"\" for pcExpression \""
+
pcExpression
+
"\""
,
matches
(
beanName
,
pcExpression
));
matches
(
beanName
,
pcExpression
));
...
@@ -98,4 +99,5 @@ public class BeanNamePointcutMatchingTests {
...
@@ -98,4 +99,5 @@ public class BeanNamePointcutMatchingTests {
pointcut
.
setExpression
(
pcExpression
);
pointcut
.
setExpression
(
pcExpression
);
return
pointcut
.
matches
(
TestBean
.
class
);
return
pointcut
.
matches
(
TestBean
.
class
);
}
}
}
}
spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java
浏览文件 @
de4ff4b1
/*
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -31,25 +31,24 @@ import org.springframework.tests.sample.beans.TestBean;
...
@@ -31,25 +31,24 @@ import org.springframework.tests.sample.beans.TestBean;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.*;
/**
/**
* Java
5-
specific {@link AspectJExpressionPointcutTests}.
* Java
5
specific {@link AspectJExpressionPointcutTests}.
*
*
* @author Rod Johnson
* @author Rod Johnson
* @author Chris Beams
* @author Chris Beams
*/
*/
public
class
TigerAspectJExpressionPointcutTests
{
public
class
TigerAspectJExpressionPointcutTests
{
// TODO factor into static in AspectJExpressionPointcut
private
Method
getAge
;
private
Method
getAge
;
private
Map
<
String
,
Method
>
methodsOnHasGeneric
=
new
HashMap
<>();
private
final
Map
<
String
,
Method
>
methodsOnHasGeneric
=
new
HashMap
<>();
@Before
@Before
public
void
set
U
p
()
throws
NoSuchMethodException
{
public
void
set
u
p
()
throws
NoSuchMethodException
{
getAge
=
TestBean
.
class
.
getMethod
(
"getAge"
);
getAge
=
TestBean
.
class
.
getMethod
(
"getAge"
);
// Assumes no overloading
// Assumes no overloading
for
(
Method
m
:
HasGeneric
.
class
.
getMethods
())
{
for
(
Method
m
ethod
:
HasGeneric
.
class
.
getMethods
())
{
methodsOnHasGeneric
.
put
(
m
.
getName
(),
m
);
methodsOnHasGeneric
.
put
(
m
ethod
.
getName
(),
method
);
}
}
}
}
...
@@ -87,11 +86,6 @@ public class TigerAspectJExpressionPointcutTests {
...
@@ -87,11 +86,6 @@ public class TigerAspectJExpressionPointcutTests {
AspectJExpressionPointcut
jdbcVarArgs
=
new
AspectJExpressionPointcut
();
AspectJExpressionPointcut
jdbcVarArgs
=
new
AspectJExpressionPointcut
();
jdbcVarArgs
.
setExpression
(
expression
);
jdbcVarArgs
.
setExpression
(
expression
);
// TODO: the expression above no longer matches Object[]
// assertFalse(jdbcVarArgs.matches(
// JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
// JdbcTemplate.class));
assertTrue
(
jdbcVarArgs
.
matches
(
assertTrue
(
jdbcVarArgs
.
matches
(
MyTemplate
.
class
.
getMethod
(
"queryForInt"
,
String
.
class
,
Object
[].
class
),
MyTemplate
.
class
.
getMethod
(
"queryForInt"
,
String
.
class
,
Object
[].
class
),
MyTemplate
.
class
));
MyTemplate
.
class
));
...
@@ -167,8 +161,10 @@ public class TigerAspectJExpressionPointcutTests {
...
@@ -167,8 +161,10 @@ public class TigerAspectJExpressionPointcutTests {
anySpringMethodAnnotation
.
setExpression
(
expression
);
anySpringMethodAnnotation
.
setExpression
(
expression
);
assertFalse
(
anySpringMethodAnnotation
.
matches
(
getAge
,
TestBean
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
getAge
,
TestBean
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"foo"
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
assertFalse
(
anySpringMethodAnnotation
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"bar"
,
String
.
class
),
HasTransactionalAnnotation
.
class
));
HasTransactionalAnnotation
.
class
.
getMethod
(
"foo"
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"bar"
,
String
.
class
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertTrue
(
anySpringMethodAnnotation
.
matches
(
BeanA
.
class
.
getMethod
(
"getAge"
),
BeanA
.
class
));
assertTrue
(
anySpringMethodAnnotation
.
matches
(
BeanA
.
class
.
getMethod
(
"getAge"
),
BeanA
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
anySpringMethodAnnotation
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
...
@@ -181,8 +177,10 @@ public class TigerAspectJExpressionPointcutTests {
...
@@ -181,8 +177,10 @@ public class TigerAspectJExpressionPointcutTests {
takesSpringAnnotatedArgument2
.
setExpression
(
expression
);
takesSpringAnnotatedArgument2
.
setExpression
(
expression
);
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
getAge
,
TestBean
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
getAge
,
TestBean
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"foo"
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"bar"
,
String
.
class
),
HasTransactionalAnnotation
.
class
));
HasTransactionalAnnotation
.
class
.
getMethod
(
"foo"
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"bar"
,
String
.
class
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"getAge"
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"getAge"
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
...
@@ -209,8 +207,10 @@ public class TigerAspectJExpressionPointcutTests {
...
@@ -209,8 +207,10 @@ public class TigerAspectJExpressionPointcutTests {
takesSpringAnnotatedArgument2
.
setExpression
(
expression
);
takesSpringAnnotatedArgument2
.
setExpression
(
expression
);
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
getAge
,
TestBean
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
getAge
,
TestBean
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"foo"
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"bar"
,
String
.
class
),
HasTransactionalAnnotation
.
class
));
HasTransactionalAnnotation
.
class
.
getMethod
(
"foo"
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
HasTransactionalAnnotation
.
class
.
getMethod
(
"bar"
,
String
.
class
),
HasTransactionalAnnotation
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"getAge"
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"getAge"
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
assertFalse
(
takesSpringAnnotatedArgument2
.
matches
(
BeanA
.
class
.
getMethod
(
"setName"
,
String
.
class
),
BeanA
.
class
));
...
@@ -260,12 +260,14 @@ public class TigerAspectJExpressionPointcutTests {
...
@@ -260,12 +260,14 @@ public class TigerAspectJExpressionPointcutTests {
@EmptySpringAnnotation
@EmptySpringAnnotation
public
static
class
SpringAnnotated
{
public
static
class
SpringAnnotated
{
public
void
foo
()
{
public
void
foo
()
{
}
}
}
}
static
class
BeanA
{
static
class
BeanA
{
private
String
name
;
private
String
name
;
private
int
age
;
private
int
age
;
...
@@ -283,6 +285,7 @@ public class TigerAspectJExpressionPointcutTests {
...
@@ -283,6 +285,7 @@ public class TigerAspectJExpressionPointcutTests {
@Tx
@Tx
static
class
BeanB
{
static
class
BeanB
{
private
String
name
;
private
String
name
;
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录