|
|
@ -40,13 +40,13 @@ import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
|
|
|
|
* @author Stephane Nicoll |
|
|
|
* @author Stephane Nicoll |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class JCacheEhCacheTest extends AbstractAnnotationTests { |
|
|
|
public class JCacheEhCacheTests extends AbstractAnnotationTests { |
|
|
|
|
|
|
|
|
|
|
|
private CacheManager jCacheManager; |
|
|
|
private CacheManager jCacheManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected ConfigurableApplicationContext getApplicationContext() { |
|
|
|
protected ConfigurableApplicationContext getApplicationContext() { |
|
|
|
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableCachingConfig.class); |
|
|
|
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableCachingConfig.class); |
|
|
@ -59,12 +59,14 @@ public class JCacheEhCacheTest extends AbstractAnnotationTests { |
|
|
|
jCacheManager.close(); |
|
|
|
jCacheManager.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@Ignore("Multi cache manager support to be added") |
|
|
|
@Ignore("Multi cache manager support to be added") |
|
|
|
public void testCustomCacheManager() { |
|
|
|
public void testCustomCacheManager() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
@EnableCaching |
|
|
|
@EnableCaching |
|
|
|
static class EnableCachingConfig extends CachingConfigurerSupport { |
|
|
|
static class EnableCachingConfig extends CachingConfigurerSupport { |
|
|
@ -78,16 +80,11 @@ public class JCacheEhCacheTest extends AbstractAnnotationTests { |
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
public CacheManager jCacheManager() { |
|
|
|
public CacheManager jCacheManager() { |
|
|
|
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(); |
|
|
|
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(); |
|
|
|
final MutableConfiguration<Object, Object> mutableConfiguration |
|
|
|
MutableConfiguration<Object, Object> mutableConfiguration = new MutableConfiguration<Object, Object>(); |
|
|
|
= new MutableConfiguration<Object, Object>(); |
|
|
|
mutableConfiguration.setStoreByValue(false); // otherwise value has to be Serializable
|
|
|
|
mutableConfiguration.setStoreByValue(false); // Otherwise value has to be Serializable
|
|
|
|
cacheManager.createCache("testCache", new JCacheConfiguration<Object, Object>(mutableConfiguration)); |
|
|
|
cacheManager.createCache("testCache", |
|
|
|
cacheManager.createCache("primary", new JCacheConfiguration<Object, Object>(mutableConfiguration)); |
|
|
|
new JCacheConfiguration<Object, Object>(mutableConfiguration)); |
|
|
|
cacheManager.createCache("secondary", new JCacheConfiguration<Object, Object>(mutableConfiguration)); |
|
|
|
cacheManager.createCache("primary", |
|
|
|
|
|
|
|
new JCacheConfiguration<Object, Object>(mutableConfiguration)); |
|
|
|
|
|
|
|
cacheManager.createCache("secondary", |
|
|
|
|
|
|
|
new JCacheConfiguration<Object, Object>(mutableConfiguration)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return cacheManager; |
|
|
|
return cacheManager; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -111,6 +108,6 @@ public class JCacheEhCacheTest extends AbstractAnnotationTests { |
|
|
|
public KeyGenerator customKeyGenerator() { |
|
|
|
public KeyGenerator customKeyGenerator() { |
|
|
|
return new SomeCustomKeyGenerator(); |
|
|
|
return new SomeCustomKeyGenerator(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |