use of org.springframework.cache.interceptor.CacheInterceptor in project spring-framework by spring-projects.
the class AnnotationNamespaceDrivenTests method cacheResolver.
@Test
public void cacheResolver() {
ConfigurableApplicationContext context = new GenericXmlApplicationContext("/org/springframework/cache/config/annotationDrivenCacheNamespace-resolver.xml");
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
assertSame(context.getBean("cacheResolver"), ci.getCacheResolver());
context.close();
}
use of org.springframework.cache.interceptor.CacheInterceptor in project spring-framework by spring-projects.
the class AnnotationNamespaceDrivenTests method testKeyStrategy.
@Test
public void testKeyStrategy() {
CacheInterceptor ci = this.ctx.getBean("org.springframework.cache.interceptor.CacheInterceptor#0", CacheInterceptor.class);
assertSame(this.ctx.getBean("keyGenerator"), ci.getKeyGenerator());
}
use of org.springframework.cache.interceptor.CacheInterceptor in project spring-framework by spring-projects.
the class AnnotationNamespaceDrivenTests method bothSetOnlyResolverIsUsed.
@Test
public void bothSetOnlyResolverIsUsed() {
ConfigurableApplicationContext context = new GenericXmlApplicationContext("/org/springframework/cache/config/annotationDrivenCacheNamespace-manager-resolver.xml");
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
assertSame(context.getBean("cacheResolver"), ci.getCacheResolver());
context.close();
}
use of org.springframework.cache.interceptor.CacheInterceptor in project spring-framework by spring-projects.
the class CustomInterceptorTests method onlyOneInterceptorIsAvailable.
@Test
public void onlyOneInterceptorIsAvailable() {
Map<String, CacheInterceptor> interceptors = this.ctx.getBeansOfType(CacheInterceptor.class);
assertEquals("Only one interceptor should be defined", 1, interceptors.size());
CacheInterceptor interceptor = interceptors.values().iterator().next();
assertEquals("Custom interceptor not defined", TestCacheInterceptor.class, interceptor.getClass());
}
use of org.springframework.cache.interceptor.CacheInterceptor in project spring-framework by spring-projects.
the class EnableCachingTests method testCacheErrorHandler.
@Test
public void testCacheErrorHandler() {
CacheInterceptor ci = this.ctx.getBean(CacheInterceptor.class);
assertSame(this.ctx.getBean("errorHandler", CacheErrorHandler.class), ci.getErrorHandler());
}
Aggregations