use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class SharedCacheLoaderQueryIndexTest method testPreloadIndexingAfterAddingNewNode.
public void testPreloadIndexingAfterAddingNewNode() {
loadCacheEntries(this.<String, Person>caches().get(0));
List<DummyInMemoryStore> cacheStores = TestingUtil.cachestores(caches());
for (DummyInMemoryStore dimcs : cacheStores) {
assertTrue("Cache misconfigured, maybe cache store not pointing to same place, maybe passivation on...etc", dimcs.contains(persons[0].getName()));
int clear = dimcs.stats().get("clear");
assertEquals("Cache store should not be cleared, purgeOnStartup is false", clear, 0);
int write = dimcs.stats().get("write");
assertEquals("Cache store should have been written to 4 times, but was written to " + write + " times", write, 4);
}
// Before adding a node, verify that the query resolves properly
executeSimpleQuery(this.<String, Person>caches().get(0));
addNodeCheckingContentsAndQuery();
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class BaseDistStoreTest method clearStats.
protected void clearStats(Cache<?, ?> cache) {
DummyInMemoryStore store = TestingUtil.getFirstStore(cache);
store.clearStats();
CacheWriterInterceptor cacheWriterInterceptor = getCacheWriterInterceptor(cache);
if (cacheWriterInterceptor != null) {
cacheWriterInterceptor.resetStatistics();
}
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method testAtomicReplaceFromNonOwner.
public void testAtomicReplaceFromNonOwner() throws Exception {
String key = "k1", value = "value", value2 = "v2";
initAndTest();
boolean replaced = getFirstNonOwner(key).replace(key, value2, value);
assertFalse(replaced);
replaced = getFirstNonOwner(key).replace(key, value, value2);
assertTrue(replaced);
for (Cache<Object, String> c : caches) {
assertEquals(value2, c.get(key));
if (isOwner(c, key)) {
DummyInMemoryStore store = TestingUtil.getFirstStore(c);
assertTrue(store.contains(key));
assertEquals(value2, store.loadEntry(key).getValue());
}
}
}
use of org.infinispan.persistence.dummy.DummyInMemoryStore in project infinispan by infinispan.
the class DistSyncStoreNotSharedTest method testAtomicReplaceFromNonOwnerWithFlag.
public void testAtomicReplaceFromNonOwnerWithFlag() throws Exception {
String key = "k1", value = "value", value2 = "v2";
initAndTest();
boolean replaced = getFirstNonOwner(key).replace(key, value2, value);
assertFalse(replaced);
replaced = getFirstNonOwner(key).getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).replace(key, value, value2);
assertTrue(replaced);
for (Cache<Object, String> c : caches) {
assertEquals(value2, 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 testPutAllWithFlags.
public void testPutAllWithFlags() throws Exception {
Map<String, String> data = makePutAllTestData();
c1.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).putAll(data);
for (Cache<Object, String> c : caches) {
DummyInMemoryStore store = TestingUtil.getFirstStore(c);
for (String key : keys) {
assertFalse(store.contains(key));
if (isOwner(c, key)) {
assertIsInContainerImmortal(c, key);
}
}
}
}
Aggregations