Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
8abb3150
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
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,体验更适合开发者的 AI 搜索 >>
提交
8abb3150
编写于
11月 16, 2011
作者:
C
Chris Beams
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cache generics warnings; polish whitespace
上级
1533822b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
31 deletion
+22
-31
org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java
...springframework/cache/config/AbstractAnnotationTests.java
+21
-24
org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java
...ramework/cache/config/AnnotatedClassCacheableService.java
+1
-1
org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java
...ramework/cache/config/AnnotationNamespaceDrivenTests.java
+0
-1
org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java
...ava/org/springframework/cache/config/AnnotationTests.java
+0
-2
org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java
...ringframework/cache/config/CacheAdviceNamespaceTests.java
+0
-2
org.springframework.context/src/test/java/org/springframework/cache/config/CacheableService.java
...va/org/springframework/cache/config/CacheableService.java
+0
-1
未找到文件。
org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java
浏览文件 @
8abb3150
...
@@ -31,16 +31,16 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
...
@@ -31,16 +31,16 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
/**
* Abstract annotation test (containing several reusable methods).
* Abstract annotation test (containing several reusable methods).
*
*
* @author Costin Leau
* @author Costin Leau
*/
*/
public
abstract
class
AbstractAnnotationTests
{
public
abstract
class
AbstractAnnotationTests
{
protected
ApplicationContext
ctx
;
protected
ApplicationContext
ctx
;
protected
CacheableService
cs
;
protected
CacheableService
<?>
cs
;
protected
CacheableService
ccs
;
protected
CacheableService
<?>
ccs
;
protected
CacheManager
cm
;
protected
CacheManager
cm
;
...
@@ -58,9 +58,8 @@ public abstract class AbstractAnnotationTests {
...
@@ -58,9 +58,8 @@ public abstract class AbstractAnnotationTests {
assertTrue
(
cn
.
contains
(
"primary"
));
assertTrue
(
cn
.
contains
(
"primary"
));
}
}
public
void
testCacheable
(
CacheableService
service
)
throws
Exception
{
public
void
testCacheable
(
CacheableService
<?>
service
)
throws
Exception
{
Object
o1
=
new
Object
();
Object
o1
=
new
Object
();
Object
o2
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
Object
r1
=
service
.
cache
(
o1
);
Object
r2
=
service
.
cache
(
o1
);
Object
r2
=
service
.
cache
(
o1
);
...
@@ -70,9 +69,8 @@ public abstract class AbstractAnnotationTests {
...
@@ -70,9 +69,8 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r1
,
r3
);
assertSame
(
r1
,
r3
);
}
}
public
void
testInvalidate
(
CacheableService
service
)
throws
Exception
{
public
void
testInvalidate
(
CacheableService
<?>
service
)
throws
Exception
{
Object
o1
=
new
Object
();
Object
o1
=
new
Object
();
Object
o2
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
Object
r1
=
service
.
cache
(
o1
);
Object
r2
=
service
.
cache
(
o1
);
Object
r2
=
service
.
cache
(
o1
);
...
@@ -85,9 +83,8 @@ public abstract class AbstractAnnotationTests {
...
@@ -85,9 +83,8 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r3
,
r4
);
assertSame
(
r3
,
r4
);
}
}
public
void
testInvalidateWKey
(
CacheableService
service
)
throws
Exception
{
public
void
testInvalidateWKey
(
CacheableService
<?>
service
)
throws
Exception
{
Object
o1
=
new
Object
();
Object
o1
=
new
Object
();
Object
o2
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
Object
r1
=
service
.
cache
(
o1
);
Object
r2
=
service
.
cache
(
o1
);
Object
r2
=
service
.
cache
(
o1
);
...
@@ -100,7 +97,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -100,7 +97,7 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r3
,
r4
);
assertSame
(
r3
,
r4
);
}
}
public
void
testConditionalExpression
(
CacheableService
service
)
public
void
testConditionalExpression
(
CacheableService
<?>
service
)
throws
Exception
{
throws
Exception
{
Object
r1
=
service
.
conditional
(
4
);
Object
r1
=
service
.
conditional
(
4
);
Object
r2
=
service
.
conditional
(
4
);
Object
r2
=
service
.
conditional
(
4
);
...
@@ -113,7 +110,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -113,7 +110,7 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r3
,
r4
);
assertSame
(
r3
,
r4
);
}
}
public
void
testKeyExpression
(
CacheableService
service
)
throws
Exception
{
public
void
testKeyExpression
(
CacheableService
<?>
service
)
throws
Exception
{
Object
r1
=
service
.
key
(
5
,
1
);
Object
r1
=
service
.
key
(
5
,
1
);
Object
r2
=
service
.
key
(
5
,
2
);
Object
r2
=
service
.
key
(
5
,
2
);
...
@@ -125,7 +122,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -125,7 +122,7 @@ public abstract class AbstractAnnotationTests {
assertNotSame
(
r3
,
r4
);
assertNotSame
(
r3
,
r4
);
}
}
public
void
testNullValue
(
CacheableService
service
)
throws
Exception
{
public
void
testNullValue
(
CacheableService
<?>
service
)
throws
Exception
{
Object
key
=
new
Object
();
Object
key
=
new
Object
();
assertNull
(
service
.
nullValue
(
key
));
assertNull
(
service
.
nullValue
(
key
));
int
nr
=
service
.
nullInvocations
().
intValue
();
int
nr
=
service
.
nullInvocations
().
intValue
();
...
@@ -135,7 +132,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -135,7 +132,7 @@ public abstract class AbstractAnnotationTests {
assertEquals
(
nr
+
1
,
service
.
nullInvocations
().
intValue
());
assertEquals
(
nr
+
1
,
service
.
nullInvocations
().
intValue
());
}
}
public
void
testMethodName
(
CacheableService
service
,
String
keyName
)
public
void
testMethodName
(
CacheableService
<?>
service
,
String
keyName
)
throws
Exception
{
throws
Exception
{
Object
key
=
new
Object
();
Object
key
=
new
Object
();
Object
r1
=
service
.
name
(
key
);
Object
r1
=
service
.
name
(
key
);
...
@@ -145,7 +142,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -145,7 +142,7 @@ public abstract class AbstractAnnotationTests {
assertNotNull
(
cache
.
get
(
keyName
));
assertNotNull
(
cache
.
get
(
keyName
));
}
}
public
void
testRootVars
(
CacheableService
service
)
{
public
void
testRootVars
(
CacheableService
<?>
service
)
{
Object
key
=
new
Object
();
Object
key
=
new
Object
();
Object
r1
=
service
.
rootVars
(
key
);
Object
r1
=
service
.
rootVars
(
key
);
assertSame
(
r1
,
service
.
rootVars
(
key
));
assertSame
(
r1
,
service
.
rootVars
(
key
));
...
@@ -155,7 +152,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -155,7 +152,7 @@ public abstract class AbstractAnnotationTests {
assertNotNull
(
cache
.
get
(
expectedKey
));
assertNotNull
(
cache
.
get
(
expectedKey
));
}
}
public
void
testCheckedThrowable
(
CacheableService
service
)
throws
Exception
{
public
void
testCheckedThrowable
(
CacheableService
<?>
service
)
throws
Exception
{
String
arg
=
UUID
.
randomUUID
().
toString
();
String
arg
=
UUID
.
randomUUID
().
toString
();
try
{
try
{
service
.
throwChecked
(
arg
);
service
.
throwChecked
(
arg
);
...
@@ -165,7 +162,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -165,7 +162,7 @@ public abstract class AbstractAnnotationTests {
}
}
}
}
public
void
testUncheckedThrowable
(
CacheableService
service
)
throws
Exception
{
public
void
testUncheckedThrowable
(
CacheableService
<?>
service
)
throws
Exception
{
try
{
try
{
service
.
throwUnchecked
(
Long
.
valueOf
(
1
));
service
.
throwUnchecked
(
Long
.
valueOf
(
1
));
fail
(
"Excepted exception"
);
fail
(
"Excepted exception"
);
...
@@ -176,12 +173,12 @@ public abstract class AbstractAnnotationTests {
...
@@ -176,12 +173,12 @@ public abstract class AbstractAnnotationTests {
}
}
}
}
public
void
testNullArg
(
CacheableService
service
)
{
public
void
testNullArg
(
CacheableService
<?>
service
)
{
Object
r1
=
service
.
cache
(
null
);
Object
r1
=
service
.
cache
(
null
);
assertSame
(
r1
,
service
.
cache
(
null
));
assertSame
(
r1
,
service
.
cache
(
null
));
}
}
public
void
testCacheUpdate
(
CacheableService
service
)
{
public
void
testCacheUpdate
(
CacheableService
<?>
service
)
{
Object
o
=
new
Object
();
Object
o
=
new
Object
();
Cache
cache
=
cm
.
getCache
(
"default"
);
Cache
cache
=
cm
.
getCache
(
"default"
);
assertNull
(
cache
.
get
(
o
));
assertNull
(
cache
.
get
(
o
));
...
@@ -194,7 +191,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -194,7 +191,7 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r2
,
cache
.
get
(
o
).
get
());
assertSame
(
r2
,
cache
.
get
(
o
).
get
());
}
}
public
void
testConditionalCacheUpdate
(
CacheableService
service
)
{
public
void
testConditionalCacheUpdate
(
CacheableService
<?>
service
)
{
Integer
one
=
Integer
.
valueOf
(
1
);
Integer
one
=
Integer
.
valueOf
(
1
);
Integer
three
=
Integer
.
valueOf
(
3
);
Integer
three
=
Integer
.
valueOf
(
3
);
...
@@ -206,7 +203,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -206,7 +203,7 @@ public abstract class AbstractAnnotationTests {
assertEquals
(
three
,
Integer
.
valueOf
(
cache
.
get
(
three
).
get
().
toString
()));
assertEquals
(
three
,
Integer
.
valueOf
(
cache
.
get
(
three
).
get
().
toString
()));
}
}
public
void
testMultiCache
(
CacheableService
service
)
{
public
void
testMultiCache
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
o1
=
new
Object
();
Object
o2
=
new
Object
();
Object
o2
=
new
Object
();
...
@@ -232,7 +229,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -232,7 +229,7 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r4
,
secondary
.
get
(
o2
).
get
());
assertSame
(
r4
,
secondary
.
get
(
o2
).
get
());
}
}
public
void
testMultiEvict
(
CacheableService
service
)
{
public
void
testMultiEvict
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
o1
=
new
Object
();
Object
r1
=
service
.
multiCache
(
o1
);
Object
r1
=
service
.
multiCache
(
o1
);
...
@@ -258,7 +255,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -258,7 +255,7 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r4
,
secondary
.
get
(
o1
).
get
());
assertSame
(
r4
,
secondary
.
get
(
o1
).
get
());
}
}
public
void
testMultiPut
(
CacheableService
service
)
{
public
void
testMultiPut
(
CacheableService
<?>
service
)
{
Object
o
=
Integer
.
valueOf
(
1
);
Object
o
=
Integer
.
valueOf
(
1
);
Cache
primary
=
cm
.
getCache
(
"primary"
);
Cache
primary
=
cm
.
getCache
(
"primary"
);
...
@@ -278,7 +275,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -278,7 +275,7 @@ public abstract class AbstractAnnotationTests {
assertSame
(
r2
,
secondary
.
get
(
o
).
get
());
assertSame
(
r2
,
secondary
.
get
(
o
).
get
());
}
}
public
void
testMultiCacheAndEvict
(
CacheableService
service
)
{
public
void
testMultiCacheAndEvict
(
CacheableService
<?>
service
)
{
String
methodName
=
"multiCacheAndEvict"
;
String
methodName
=
"multiCacheAndEvict"
;
Cache
primary
=
cm
.
getCache
(
"primary"
);
Cache
primary
=
cm
.
getCache
(
"primary"
);
...
@@ -299,7 +296,7 @@ public abstract class AbstractAnnotationTests {
...
@@ -299,7 +296,7 @@ public abstract class AbstractAnnotationTests {
assertNull
(
secondary
.
get
(
key
));
assertNull
(
secondary
.
get
(
key
));
}
}
public
void
testMultiConditionalCacheAndEvict
(
CacheableService
service
)
{
public
void
testMultiConditionalCacheAndEvict
(
CacheableService
<?>
service
)
{
Cache
primary
=
cm
.
getCache
(
"primary"
);
Cache
primary
=
cm
.
getCache
(
"primary"
);
Cache
secondary
=
cm
.
getCache
(
"secondary"
);
Cache
secondary
=
cm
.
getCache
(
"secondary"
);
Object
key
=
Integer
.
valueOf
(
1
);
Object
key
=
Integer
.
valueOf
(
1
);
...
...
org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java
浏览文件 @
8abb3150
...
@@ -27,7 +27,7 @@ import org.springframework.cache.annotation.Cacheable;
...
@@ -27,7 +27,7 @@ import org.springframework.cache.annotation.Cacheable;
* @author Costin Leau
* @author Costin Leau
*/
*/
@Cacheable
(
"default"
)
@Cacheable
(
"default"
)
public
class
AnnotatedClassCacheableService
implements
CacheableService
{
public
class
AnnotatedClassCacheableService
implements
CacheableService
<
Object
>
{
private
final
AtomicLong
counter
=
new
AtomicLong
();
private
final
AtomicLong
counter
=
new
AtomicLong
();
public
static
final
AtomicLong
nullInvocations
=
new
AtomicLong
();
public
static
final
AtomicLong
nullInvocations
=
new
AtomicLong
();
...
...
org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java
浏览文件 @
8abb3150
...
@@ -21,7 +21,6 @@ import junit.framework.Assert;
...
@@ -21,7 +21,6 @@ import junit.framework.Assert;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.cache.interceptor.CacheInterceptor
;
import
org.springframework.cache.interceptor.CacheInterceptor
;
/**
/**
* @author Costin Leau
* @author Costin Leau
*/
*/
...
...
org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java
浏览文件 @
8abb3150
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
package
org.springframework.cache.config
;
package
org.springframework.cache.config
;
/**
/**
* @author Costin Leau
* @author Costin Leau
*/
*/
...
...
org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java
浏览文件 @
8abb3150
...
@@ -20,13 +20,11 @@ import org.junit.Assert;
...
@@ -20,13 +20,11 @@ import org.junit.Assert;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.cache.interceptor.CacheInterceptor
;
import
org.springframework.cache.interceptor.CacheInterceptor
;
/**
/**
* @author Costin Leau
* @author Costin Leau
*/
*/
public
class
CacheAdviceNamespaceTests
extends
AbstractAnnotationTests
{
public
class
CacheAdviceNamespaceTests
extends
AbstractAnnotationTests
{
@Override
@Override
protected
String
getConfig
()
{
protected
String
getConfig
()
{
return
"/org/springframework/cache/config/cache-advice.xml"
;
return
"/org/springframework/cache/config/cache-advice.xml"
;
...
...
org.springframework.context/src/test/java/org/springframework/cache/config/CacheableService.java
浏览文件 @
8abb3150
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
package
org.springframework.cache.config
;
package
org.springframework.cache.config
;
/**
/**
* Basic service interface.
* Basic service interface.
*
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录