use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method singleComposedAnnotation.
@Test
public void singleComposedAnnotation() throws Exception {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singleComposed", 2);
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"));
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method fullClassLevelWithCustomCacheResolver.
@Test
public void fullClassLevelWithCustomCacheResolver() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelCacheResolver", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "custom", "classCacheName");
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method partialClassLevelWithCustomCacheResolver.
@Test
public void partialClassLevelWithCustomCacheResolver() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "methodLevelCacheResolver", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "custom", "classCacheName");
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method cacheConfigFromInterface.
@Test
public void cacheConfigFromInterface() {
assertNull(getOps(InterfaceCacheConfig.class, "interfaceCacheConfig"));
Collection<CacheOperation> ops = getOps(CacheConfigIfc.class, "interfaceCacheConfig");
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "", "", "", "myCache");
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method cacheAnnotationOverride.
@Test
public void cacheAnnotationOverride() {
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheableOverride");
assertSame(1, ops.size());
CacheOperation cacheOperation = ops.iterator().next();
assertTrue(cacheOperation instanceof CacheableOperation);
}
Aggregations