use of cn.taketoday.cache.interceptor.CacheInterceptor in project today-infrastructure by TAKETODAY.
the class CacheAdviceNamespaceTests method testKeyStrategy.
@Test
public void testKeyStrategy() {
CacheInterceptor bean = this.ctx.getBean("cacheAdviceClass", CacheInterceptor.class);
assertThat(bean.getKeyGenerator()).isSameAs(this.ctx.getBean("keyGenerator"));
}
use of cn.taketoday.cache.interceptor.CacheInterceptor in project today-infrastructure by TAKETODAY.
the class AnnotationNamespaceDrivenTests method cacheResolver.
@Test
public void cacheResolver() {
try {
ConfigurableApplicationContext context = new GenericXmlApplicationContext("cn/taketoday/cache/config/annotationDrivenCacheNamespace-resolver.xml");
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
assertThat(ci.getCacheResolver()).isSameAs(context.getBean("cacheResolver"));
context.close();
} catch (Throwable e) {
e.printStackTrace();
}
}
use of cn.taketoday.cache.interceptor.CacheInterceptor in project today-infrastructure by TAKETODAY.
the class ProxyCachingConfiguration method cacheInterceptor.
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheInterceptor cacheInterceptor(CacheOperationSource cacheOperationSource) {
CacheInterceptor interceptor = new CacheInterceptor();
interceptor.configure(this.errorHandler, this.keyGenerator, this.cacheResolver, this.cacheManager);
interceptor.setCacheOperationSource(cacheOperationSource);
return interceptor;
}
use of cn.taketoday.cache.interceptor.CacheInterceptor in project today-framework by TAKETODAY.
the class EnableCachingTests method emptyConfigSupport.
@Test
public void emptyConfigSupport() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
assertThat(ci.getCacheResolver()).isNotNull();
assertThat(ci.getCacheResolver().getClass()).isEqualTo(SimpleCacheResolver.class);
assertThat(((SimpleCacheResolver) ci.getCacheResolver()).getCacheManager()).isSameAs(context.getBean(CacheManager.class));
context.close();
}
use of cn.taketoday.cache.interceptor.CacheInterceptor in project today-framework by TAKETODAY.
the class AnnotationNamespaceDrivenTests method testCacheErrorHandler.
@Test
public void testCacheErrorHandler() {
CacheInterceptor ci = this.ctx.getBean("cn.taketoday.cache.interceptor.CacheInterceptor#0", CacheInterceptor.class);
assertThat(ci.getErrorHandler()).isSameAs(this.ctx.getBean("errorHandler", CacheErrorHandler.class));
}
Aggregations