Search in sources :

Example 1 with CacheOperation

use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.

the class AnnotationCacheOperationSourceTests method customCacheManager.

@Test
public void customCacheManager() {
    Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheManager", 1);
    CacheOperation cacheOperation = ops.iterator().next();
    assertEquals("Custom cache manager not set", "custom", cacheOperation.getCacheManager());
}
Also used : CacheOperation(org.springframework.cache.interceptor.CacheOperation) Test(org.junit.Test)

Example 2 with CacheOperation

use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.

the class AnnotationCacheOperationSourceTests method customClassLevelWithCustomCacheName.

@Test
public void customClassLevelWithCustomCacheName() {
    Collection<CacheOperation> ops = getOps(AnnotatedClassWithCustomDefault.class, "methodLevelCacheName", 1);
    CacheOperation cacheOperation = ops.iterator().next();
    assertSharedConfig(cacheOperation, "classKeyGenerator", "", "classCacheResolver", "custom");
}
Also used : CacheOperation(org.springframework.cache.interceptor.CacheOperation) Test(org.junit.Test)

Example 3 with CacheOperation

use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.

the class AnnotationCacheOperationSourceTests method partialClassLevelWithCustomCacheManager.

@Test
public void partialClassLevelWithCustomCacheManager() {
    Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "methodLevelCacheManager", 1);
    CacheOperation cacheOperation = ops.iterator().next();
    assertSharedConfig(cacheOperation, "classKeyGenerator", "custom", "", "classCacheName");
}
Also used : CacheOperation(org.springframework.cache.interceptor.CacheOperation) Test(org.junit.Test)

Example 4 with CacheOperation

use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.

the class AnnotationCacheOperationSourceTests method customKeyGeneratorInherited.

@Test
public void customKeyGeneratorInherited() {
    Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customKeyGeneratorInherited", 1);
    CacheOperation cacheOperation = ops.iterator().next();
    assertEquals("Custom key generator not set", "custom", cacheOperation.getKeyGenerator());
}
Also used : CacheOperation(org.springframework.cache.interceptor.CacheOperation) Test(org.junit.Test)

Example 5 with CacheOperation

use of org.springframework.cache.interceptor.CacheOperation in project spring-framework by spring-projects.

the class AnnotationCacheOperationSourceTests method partialClassLevelWithNoCustomization.

@Test
public void partialClassLevelWithNoCustomization() {
    Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "noCustomization", 1);
    CacheOperation cacheOperation = ops.iterator().next();
    assertSharedConfig(cacheOperation, "classKeyGenerator", "classCacheManager", "", "classCacheName");
}
Also used : CacheOperation(org.springframework.cache.interceptor.CacheOperation) Test(org.junit.Test)

Aggregations

CacheOperation (org.springframework.cache.interceptor.CacheOperation)22 Test (org.junit.Test)21 CacheableOperation (org.springframework.cache.interceptor.CacheableOperation)5 CacheEvictOperation (org.springframework.cache.interceptor.CacheEvictOperation)3 Collection (java.util.Collection)1 TypedStringValue (org.springframework.beans.factory.config.TypedStringValue)1 ManagedMap (org.springframework.beans.factory.support.ManagedMap)1 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)1 CachePutOperation (org.springframework.cache.interceptor.CachePutOperation)1 Element (org.w3c.dom.Element)1