polishing

This commit is contained in:
Stephane Nicoll
2014-07-23 17:08:19 +02:00
parent 5be1ff281c
commit d9e0b292ab
53 changed files with 434 additions and 294 deletions

View File

@@ -29,8 +29,8 @@ import javax.cache.annotation.CacheResult;
import javax.cache.annotation.CacheValue;
import org.springframework.cache.Cache;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
import org.springframework.cache.jcache.config.JCacheableService;
import org.springframework.cache.jcache.interceptor.SimpleGeneratedCacheKey;
import org.springframework.cache.jcache.support.TestableCacheKeyGenerator;
import org.springframework.cache.jcache.support.TestableCacheResolverFactory;
@@ -111,7 +111,7 @@ public class AnnotatedJCacheableService implements JCacheableService<Long> {
@Override
@CachePut(afterInvocation = false)
public void earlyPut(String id, @CacheValue Object value) {
SimpleGeneratedCacheKey key = new SimpleGeneratedCacheKey(id);
Object key = SimpleKeyGenerator.generateKey(id);
Cache.ValueWrapper valueWrapper = defaultCache.get(key);
if (valueWrapper == null) {
throw new AssertionError("Excepted value to be put in cache with key " + key);
@@ -143,7 +143,7 @@ public class AnnotatedJCacheableService implements JCacheableService<Long> {
@Override
@CacheRemove(afterInvocation = false)
public void earlyRemove(String id) {
SimpleGeneratedCacheKey key = new SimpleGeneratedCacheKey(id);
Object key = SimpleKeyGenerator.generateKey(id);
Cache.ValueWrapper valueWrapper = defaultCache.get(key);
if (valueWrapper != null) {
throw new AssertionError("Value with key " + key + " expected to be already remove from cache");