+ update Spring's Cache abstraction to Spring 3.1 M2
This commit is contained in:
@@ -69,17 +69,6 @@ public abstract class AbstractNativeCacheTest<T> {
|
||||
assertEquals(value, cache.get(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheRemove() throws Exception {
|
||||
Object key = "enescu";
|
||||
Object value = "george";
|
||||
|
||||
assertNull(cache.get(key));
|
||||
cache.put(key, value);
|
||||
assertEquals(value, cache.remove(key));
|
||||
assertNull(cache.get(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheClear() throws Exception {
|
||||
assertNull(cache.get("enescu"));
|
||||
@@ -91,65 +80,4 @@ public abstract class AbstractNativeCacheTest<T> {
|
||||
assertNull(cache.get("enescu"));
|
||||
}
|
||||
|
||||
// concurrent map tests
|
||||
@Test
|
||||
public void testPutIfAbsent() throws Exception {
|
||||
Object key = "enescu";
|
||||
Object value1 = "george";
|
||||
Object value2 = "geo";
|
||||
|
||||
assertNull(cache.get("enescu"));
|
||||
cache.put(key, value1);
|
||||
cache.putIfAbsent(key, value2);
|
||||
assertEquals(value1, cache.get(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentRemove() throws Exception {
|
||||
Object key = "enescu";
|
||||
Object value1 = "george";
|
||||
Object value2 = "geo";
|
||||
|
||||
assertNull(cache.get("enescu"));
|
||||
cache.put(key, value1);
|
||||
// no remove
|
||||
cache.remove(key, value2);
|
||||
assertEquals(value1, cache.get(key));
|
||||
// one remove
|
||||
cache.remove(key, value1);
|
||||
assertNull(cache.get("enescu"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentReplace() throws Exception {
|
||||
Object key = "enescu";
|
||||
Object value1 = "george";
|
||||
Object value2 = "geo";
|
||||
|
||||
assertNull(cache.get("enescu"));
|
||||
cache.put(key, value1);
|
||||
cache.replace(key, value2);
|
||||
assertEquals(value2, cache.get(key));
|
||||
cache.remove(key);
|
||||
cache.replace(key, value1);
|
||||
assertNull(cache.get("enescu"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentReplaceIfEqual() throws Exception {
|
||||
Object key = "enescu";
|
||||
Object value1 = "george";
|
||||
Object value2 = "geo";
|
||||
|
||||
assertNull(cache.get("enescu"));
|
||||
cache.put(key, value1);
|
||||
assertEquals(value1, cache.get(key));
|
||||
// no replace
|
||||
cache.replace(key, value2, value1);
|
||||
assertEquals(value1, cache.get(key));
|
||||
cache.replace(key, value1, value2);
|
||||
assertEquals(value2, cache.get(key));
|
||||
cache.replace(key, value2, value1);
|
||||
assertEquals(value1, cache.get(key));
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class GemfireCacheTest extends AbstractNativeCacheTest<Region<Object, Obj
|
||||
|
||||
@Override
|
||||
protected Cache createCache(Region<Object, Object> nativeCache) {
|
||||
return new GemfireCache<Object, Object>(nativeCache);
|
||||
return new GemfireCache(nativeCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user