use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method customCacheResolverInherited.
@Test
public void customCacheResolverInherited() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheResolverInherited", 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 multipleStereotypes.
@Test
public void multipleStereotypes() throws Exception {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleStereotype", 3);
Iterator<CacheOperation> it = ops.iterator();
assertTrue(it.next() instanceof CacheableOperation);
CacheOperation next = it.next();
assertTrue(next instanceof CacheEvictOperation);
assertTrue(next.getCacheNames().contains("foo"));
next = it.next();
assertTrue(next instanceof CacheEvictOperation);
assertTrue(next.getCacheNames().contains("bar"));
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method validateNoCacheIsValid.
@Test
public void validateNoCacheIsValid() {
// Valid as a CacheResolver might return the cache names to use with other info
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "noCacheNameSpecified");
CacheOperation cacheOperation = ops.iterator().next();
assertNotNull("cache names set must not be null", cacheOperation.getCacheNames());
assertEquals("no cache names specified", 0, cacheOperation.getCacheNames().size());
}
use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method fullClassLevelWithCustomCacheManager.
@Test
public void fullClassLevelWithCustomCacheManager() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelCacheManager", 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 customKeyGenerator.
@Test
public void customKeyGenerator() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customKeyGenerator", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertEquals("Custom key generator not set", "custom", cacheOperation.getKeyGenerator());
}
Aggregations