use of cn.taketoday.cache.interceptor.NamedCacheResolver in project today-infrastructure by TAKETODAY.
the class JCacheInterceptorTests method noCacheCouldBeResolved.
@Test
public void noCacheCouldBeResolved() {
JCacheInterceptor interceptor = createInterceptor(createOperationSource(// Returns empty list
cacheManager, // Returns empty list
new NamedCacheResolver(cacheManager), defaultExceptionCacheResolver, defaultKeyGenerator));
AnnotatedJCacheableService service = new AnnotatedJCacheableService(cacheManager.getCache("default"));
Method m = ReflectionUtils.findMethod(AnnotatedJCacheableService.class, "cache", String.class);
assertThatIllegalStateException().isThrownBy(() -> interceptor.execute(dummyInvoker, service, m, new Object[] { "myId" })).withMessageContaining("Cache could not have been resolved for");
}
use of cn.taketoday.cache.interceptor.NamedCacheResolver in project today-infrastructure by TAKETODAY.
the class JCacheInterceptorTests method severalCachesNotSupported.
@Test
public void severalCachesNotSupported() {
JCacheInterceptor interceptor = createInterceptor(createOperationSource(cacheManager, new NamedCacheResolver(cacheManager, "default", "simpleCache"), defaultExceptionCacheResolver, defaultKeyGenerator));
AnnotatedJCacheableService service = new AnnotatedJCacheableService(cacheManager.getCache("default"));
Method m = ReflectionUtils.findMethod(AnnotatedJCacheableService.class, "cache", String.class);
assertThatIllegalStateException().isThrownBy(() -> interceptor.execute(dummyInvoker, service, m, new Object[] { "myId" })).withMessageContaining("JSR-107 only supports a single cache");
}
use of cn.taketoday.cache.interceptor.NamedCacheResolver in project today-framework by TAKETODAY.
the class JCacheInterceptorTests method severalCachesNotSupported.
@Test
public void severalCachesNotSupported() {
JCacheInterceptor interceptor = createInterceptor(createOperationSource(cacheManager, new NamedCacheResolver(cacheManager, "default", "simpleCache"), defaultExceptionCacheResolver, defaultKeyGenerator));
AnnotatedJCacheableService service = new AnnotatedJCacheableService(cacheManager.getCache("default"));
Method m = ReflectionUtils.findMethod(AnnotatedJCacheableService.class, "cache", String.class);
assertThatIllegalStateException().isThrownBy(() -> interceptor.execute(dummyInvoker, service, m, new Object[] { "myId" })).withMessageContaining("JSR-107 only supports a single cache");
}
use of cn.taketoday.cache.interceptor.NamedCacheResolver in project today-framework by TAKETODAY.
the class JCacheInterceptorTests method noCacheCouldBeResolved.
@Test
public void noCacheCouldBeResolved() {
JCacheInterceptor interceptor = createInterceptor(createOperationSource(// Returns empty list
cacheManager, // Returns empty list
new NamedCacheResolver(cacheManager), defaultExceptionCacheResolver, defaultKeyGenerator));
AnnotatedJCacheableService service = new AnnotatedJCacheableService(cacheManager.getCache("default"));
Method m = ReflectionUtils.findMethod(AnnotatedJCacheableService.class, "cache", String.class);
assertThatIllegalStateException().isThrownBy(() -> interceptor.execute(dummyInvoker, service, m, new Object[] { "myId" })).withMessageContaining("Cache could not have been resolved for");
}
Aggregations