Search in sources :

Example 36 with DummyInMemoryStore

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();
}
Also used : DummyInMemoryStore(org.infinispan.persistence.dummy.DummyInMemoryStore) Person(org.infinispan.query.test.Person)

Example 37 with DummyInMemoryStore

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();
    }
}
Also used : DummyInMemoryStore(org.infinispan.persistence.dummy.DummyInMemoryStore) CacheWriterInterceptor(org.infinispan.interceptors.impl.CacheWriterInterceptor) ScatteredCacheWriterInterceptor(org.infinispan.interceptors.impl.ScatteredCacheWriterInterceptor) DistCacheWriterInterceptor(org.infinispan.interceptors.impl.DistCacheWriterInterceptor)

Example 38 with DummyInMemoryStore

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());
        }
    }
}
Also used : DummyInMemoryStore(org.infinispan.persistence.dummy.DummyInMemoryStore)

Example 39 with DummyInMemoryStore

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());
        }
    }
}
Also used : DummyInMemoryStore(org.infinispan.persistence.dummy.DummyInMemoryStore)

Example 40 with DummyInMemoryStore

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);
            }
        }
    }
}
Also used : DummyInMemoryStore(org.infinispan.persistence.dummy.DummyInMemoryStore)

Aggregations

DummyInMemoryStore (org.infinispan.persistence.dummy.DummyInMemoryStore)74 PersistenceManager (org.infinispan.persistence.manager.PersistenceManager)14 Test (org.testng.annotations.Test)13 MarshallableEntry (org.infinispan.persistence.spi.MarshallableEntry)11 HashMap (java.util.HashMap)9 TestObjectStreamMarshaller (org.infinispan.marshall.TestObjectStreamMarshaller)7 Map (java.util.Map)6 Cache (org.infinispan.Cache)6 DataContainer (org.infinispan.container.DataContainer)6 CacheEntry (org.infinispan.container.entries.CacheEntry)6 ImmortalCacheEntry (org.infinispan.container.entries.ImmortalCacheEntry)6 CheckPoint (org.infinispan.test.fwk.CheckPoint)6 MagicKey (org.infinispan.distribution.MagicKey)5 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)4 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)4 DummyInMemoryStoreConfigurationBuilder (org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)4 Set (java.util.Set)3 PersistenceException (org.infinispan.persistence.spi.PersistenceException)3 List (java.util.List)2 TimeUnit (java.util.concurrent.TimeUnit)2