Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
bb6e07bd
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 搜索 >>
提交
bb6e07bd
编写于
5月 26, 2014
作者:
S
Stephane Nicoll
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polishing
上级
05041ff3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
43 deletion
+13
-43
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java
...ork/cache/jcache/interceptor/JCacheErrorHandlerTests.java
+10
-26
spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java
...ngframework/cache/interceptor/CacheErrorHandlerTests.java
+3
-17
未找到文件。
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java
浏览文件 @
bb6e07bd
...
...
@@ -36,16 +36,15 @@ import org.junit.Rule;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cache.interceptor.CacheErrorHandler
;
import
org.springframework.cache.jcache.config.JCacheConfigurerSupport
;
import
org.springframework.cache.support.SimpleCacheManager
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Role
;
/**
*
...
...
@@ -112,42 +111,27 @@ public class JCacheErrorHandlerTests {
@Configuration
@EnableCaching
static
class
Config
{
@Bean
(
name
=
"jCacheInterceptor"
)
@Role
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
)
public
JCacheInterceptor
cacheInterceptor
()
{
JCacheInterceptor
interceptor
=
new
JCacheInterceptor
();
interceptor
.
setCacheOperationSource
(
cacheOperationSource
());
interceptor
.
setErrorHandler
(
errorHandler
());
return
interceptor
;
static
class
Config
extends
JCacheConfigurerSupport
{
@Bean
@Override
public
CacheManager
cacheManager
()
{
SimpleCacheManager
cacheManager
=
new
SimpleCacheManager
();
cacheManager
.
setCaches
(
Arrays
.
asList
(
mockCache
()));
return
cacheManager
;
}
@Bean
@Override
public
CacheErrorHandler
errorHandler
()
{
return
mock
(
CacheErrorHandler
.
class
);
}
@Bean
(
name
=
"jCacheOperationSource"
)
@Role
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
)
public
JCacheOperationSource
cacheOperationSource
()
{
DefaultJCacheOperationSource
source
=
new
DefaultJCacheOperationSource
();
source
.
setCacheManager
(
cacheManager
());
return
source
;
}
@Bean
public
SimpleService
simpleService
()
{
return
new
SimpleService
();
}
@Bean
public
CacheManager
cacheManager
()
{
SimpleCacheManager
cacheManager
=
new
SimpleCacheManager
();
cacheManager
.
setCaches
(
Arrays
.
asList
(
mockCache
()));
return
cacheManager
;
}
@Bean
public
Cache
mockCache
()
{
Cache
cache
=
mock
(
Cache
.
class
);
...
...
spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java
浏览文件 @
bb6e07bd
...
...
@@ -34,11 +34,11 @@ import org.junit.rules.ExpectedException;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.annotation.AnnotationCacheOperationSource
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.CachingConfigurerSupport
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cache.support.SimpleCacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
...
...
@@ -172,28 +172,14 @@ public class CacheErrorHandlerTests {
@Configuration
@EnableCaching
static
class
Config
{
@Bean
public
CacheInterceptor
cacheInterceptor
()
{
CacheInterceptor
cacheInterceptor
=
new
CacheInterceptor
();
cacheInterceptor
.
setCacheManager
(
cacheManager
());
cacheInterceptor
.
setCacheOperationSources
(
cacheOperationSource
());
cacheInterceptor
.
setErrorHandler
(
errorHandler
());
return
cacheInterceptor
;
}
static
class
Config
extends
CachingConfigurerSupport
{
@Bean
@Override
public
CacheErrorHandler
errorHandler
()
{
return
mock
(
CacheErrorHandler
.
class
);
}
@Bean
public
CacheOperationSource
cacheOperationSource
()
{
return
new
AnnotationCacheOperationSource
();
}
@Bean
public
SimpleService
simpleService
()
{
return
new
SimpleService
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录