use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method fullClassLevelWithCustomKeyManager.
@Test
public void fullClassLevelWithCustomKeyManager() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelKeyGenerator", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "custom", "", "classCacheResolver", "classCacheName");
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method customCacheResolver.
@Test
public void customCacheResolver() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheResolver", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertEquals("Custom cache resolver not set", "custom", cacheOperation.getCacheResolver());
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method fullClassLevelWithCustomCacheName.
@Test
public void fullClassLevelWithCustomCacheName() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelCacheName", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "classCacheResolver", "custom");
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method multipleComposedAnnotations.
@Test
public void multipleComposedAnnotations() throws Exception {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleComposed", 4);
Iterator<CacheOperation> it = ops.iterator();
CacheOperation cacheOperation = it.next();
assertThat(cacheOperation, instanceOf(CacheableOperation.class));
assertThat(cacheOperation.getCacheNames(), equalTo(Collections.singleton("directly declared")));
assertThat(cacheOperation.getKey(), equalTo(""));
cacheOperation = it.next();
assertThat(cacheOperation, instanceOf(CacheableOperation.class));
assertThat(cacheOperation.getCacheNames(), equalTo(Collections.singleton("composedCache")));
assertThat(cacheOperation.getKey(), equalTo("composedKey"));
cacheOperation = it.next();
assertThat(cacheOperation, instanceOf(CacheableOperation.class));
assertThat(cacheOperation.getCacheNames(), equalTo(Collections.singleton("foo")));
assertThat(cacheOperation.getKey(), equalTo(""));
cacheOperation = it.next();
assertThat(cacheOperation, instanceOf(CacheEvictOperation.class));
assertThat(cacheOperation.getCacheNames(), equalTo(Collections.singleton("composedCacheEvict")));
assertThat(cacheOperation.getKey(), equalTo("composedEvictionKey"));
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method severalCacheConfigUseClosest.
@Test
public void severalCacheConfigUseClosest() {
Collection<CacheOperation> ops = getOps(MultipleCacheConfig.class, "multipleCacheConfig");
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "", "", "", "myCache");
}
Aggregations