use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method testRemoveFromNonOwnerWithFlags.
public void testRemoveFromNonOwnerWithFlags() throws Exception {
String key = "k1", value = "value";
initAndTest();
Object retval = getFirstNonOwner(key).getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).remove(key);
if (testRetVals)
assert value.equals(retval);
for (Cache<Object, String> c : caches) {
if (isOwner(c, key)) {
DummyInMemoryStore store = TestingUtil.getFirstStore(c);
assertTrue(store.contains(key));
}
}
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method testPutFromNonOwnerWithFlags.
public void testPutFromNonOwnerWithFlags(Method m) throws Exception {
String key = k(m), value = "value2";
Cache<Object, String> nonOwner = getFirstNonOwner(key);
Cache<Object, String> owner = getFirstOwner(key);
DummyInMemoryStore nonOwnerLoader = TestingUtil.getFirstStore(nonOwner);
DummyInMemoryStore ownerLoader = TestingUtil.getFirstStore(owner);
assertFalse(ownerLoader.contains(key));
assertFalse(nonOwnerLoader.contains(key));
Object retval = nonOwner.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).put(key, value);
assertFalse(ownerLoader.contains(key));
assertFalse(nonOwnerLoader.contains(key));
if (testRetVals)
assert retval == null;
assertOnAllCachesAndOwnership(key, value);
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method testPutForStateTransfer.
public void testPutForStateTransfer() throws Exception {
MagicKey k1 = getMagicKey();
DummyInMemoryStore store2 = TestingUtil.getFirstStore(c2);
c2.put(k1, v1);
assertTrue(store2.contains(k1));
assertEquals(v1, store2.loadEntry(k1).getValue());
c2.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).put(k1, v2);
assertEquals(v2, store2.loadEntry(k1).getValue());
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method testAtomicPutIfAbsentFromNonOwner.
public void testAtomicPutIfAbsentFromNonOwner(Method m) throws Exception {
String key = k(m), value = "value", value2 = "v2";
String replaced = getFirstNonOwner(key).putIfAbsent(key, value);
assertNull(replaced);
replaced = getFirstNonOwner(key).putIfAbsent(key, value2);
assertEquals(replaced, value);
for (Cache<Object, String> c : caches) {
assertEquals(replaced, c.get(key));
if (isOwner(c, key)) {
DummyInMemoryStore store = TestingUtil.getFirstStore(c);
assertTrue(store.contains(key));
assertEquals(value, store.loadEntry(key).getValue());
}
}
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method assertInStores.
protected void assertInStores(String key, String value, boolean allowL1) {
for (Cache<Object, String> c : caches) {
DummyInMemoryStore store = TestingUtil.getFirstStore(c);
if (isOwner(c, key)) {
assertIsInContainerImmortal(c, key);
assertEquals(value, store.loadEntry(key).getValue());
} else {
if (!allowL1) {
assertIsNotInL1(c, key);
}
assertFalse(store.contains(key));
}
}
}
Aggregations