use of cn.taketoday.cache.jcache.interceptor.JCacheInterceptor in project today-infrastructure by TAKETODAY.
the class JCacheCustomInterceptorTests method onlyOneInterceptorIsAvailable.
@Test
public void onlyOneInterceptorIsAvailable() {
Map<String, JCacheInterceptor> interceptors = ctx.getBeansOfType(JCacheInterceptor.class);
assertThat(interceptors.size()).as("Only one interceptor should be defined").isEqualTo(1);
JCacheInterceptor interceptor = interceptors.values().iterator().next();
assertThat(interceptor.getClass()).as("Custom interceptor not defined").isEqualTo(TestCacheInterceptor.class);
}
use of cn.taketoday.cache.jcache.interceptor.JCacheInterceptor in project today-infrastructure by TAKETODAY.
the class JCacheJavaConfigTests method fullCachingConfig.
@Test
public void fullCachingConfig() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(FullCachingConfig.class);
DefaultJCacheOperationSource cos = context.getBean(DefaultJCacheOperationSource.class);
assertThat(cos.getKeyGenerator()).isSameAs(context.getBean(KeyGenerator.class));
assertThat(cos.getCacheResolver()).isSameAs(context.getBean("cacheResolver", CacheResolver.class));
assertThat(cos.getExceptionCacheResolver()).isSameAs(context.getBean("exceptionCacheResolver", CacheResolver.class));
JCacheInterceptor interceptor = context.getBean(JCacheInterceptor.class);
assertThat(interceptor.getErrorHandler()).isSameAs(context.getBean("errorHandler", CacheErrorHandler.class));
context.close();
}
use of cn.taketoday.cache.jcache.interceptor.JCacheInterceptor in project today-framework by TAKETODAY.
the class JCacheCustomInterceptorTests method onlyOneInterceptorIsAvailable.
@Test
public void onlyOneInterceptorIsAvailable() {
Map<String, JCacheInterceptor> interceptors = ctx.getBeansOfType(JCacheInterceptor.class);
assertThat(interceptors.size()).as("Only one interceptor should be defined").isEqualTo(1);
JCacheInterceptor interceptor = interceptors.values().iterator().next();
assertThat(interceptor.getClass()).as("Custom interceptor not defined").isEqualTo(TestCacheInterceptor.class);
}
use of cn.taketoday.cache.jcache.interceptor.JCacheInterceptor in project today-framework by TAKETODAY.
the class JCacheJavaConfigTests method fullCachingConfig.
@Test
public void fullCachingConfig() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(FullCachingConfig.class);
DefaultJCacheOperationSource cos = context.getBean(DefaultJCacheOperationSource.class);
assertThat(cos.getKeyGenerator()).isSameAs(context.getBean(KeyGenerator.class));
assertThat(cos.getCacheResolver()).isSameAs(context.getBean("cacheResolver", CacheResolver.class));
assertThat(cos.getExceptionCacheResolver()).isSameAs(context.getBean("exceptionCacheResolver", CacheResolver.class));
JCacheInterceptor interceptor = context.getBean(JCacheInterceptor.class);
assertThat(interceptor.getErrorHandler()).isSameAs(context.getBean("errorHandler", CacheErrorHandler.class));
context.close();
}
use of cn.taketoday.cache.jcache.interceptor.JCacheInterceptor in project today-framework by TAKETODAY.
the class JCacheNamespaceDrivenTests method testCacheErrorHandler.
@Test
public void testCacheErrorHandler() {
JCacheInterceptor ci = ctx.getBean(JCacheInterceptor.class);
assertThat(ci.getErrorHandler()).isSameAs(ctx.getBean("errorHandler", CacheErrorHandler.class));
}
Aggregations