Package org.infinispan.loaders.dummy

Examples of org.infinispan.loaders.dummy.DummyInMemoryCacheStore


   @AfterMethod(alwaysRun = true)
   public void clearStats() {
      for (Cache<?, ?> c: caches) {
         log.trace("Clearing stats for cache store on cache "+ c);
         DummyInMemoryCacheStore cs = (DummyInMemoryCacheStore) TestingUtil.extractComponent(c, CacheLoaderManager.class).getCacheStore();
         cs.clear();
         cs.clearStats();
      }
   }
View Full Code Here


         c1.put("k" + i, "v" + i);
      }
      DataContainer dc1 = c1.getAdvancedCache().getDataContainer();
      assert dc1.size() == NUM_KEYS;

      DummyInMemoryCacheStore cs = (DummyInMemoryCacheStore) TestingUtil.extractComponent(c1, CacheLoaderManager.class).getCacheStore();
      assert cs.loadAllKeys(Collections.emptySet()).size() == NUM_KEYS;

      addClusterEnabledCacheManager();
      EmbeddedCacheManager cm2 = cacheManagers.get(1);
      cm2.defineConfiguration(cacheName, buildConfiguration().build());
      c2 = cache(1, cacheName);
View Full Code Here

public class AsyncStoreTest extends AbstractInfinispanTest {
   private static final Log log = LogFactory.getLog(AsyncStoreTest.class);
   private AsyncStore store;

   private void createStore() throws CacheLoaderException {
      DummyInMemoryCacheStore underlying = new DummyInMemoryCacheStore();
      AsyncStoreConfig asyncConfig = new AsyncStoreConfig().threadPoolSize(10);
      store = new AsyncStore(underlying, asyncConfig);
      DummyInMemoryCacheStore.Cfg dummyCfg = new DummyInMemoryCacheStore.Cfg().storeName(AsyncStoreTest.class.getName());
      store.init(dummyCfg, null, null);
      store.start();
View Full Code Here

      try {
         final String key = "k1";
         final CountDownLatch v1Latch = new CountDownLatch(1);
         final CountDownLatch v2Latch = new CountDownLatch(1);
         final CountDownLatch endLatch = new CountDownLatch(1);
         DummyInMemoryCacheStore underlying = new DummyInMemoryCacheStore();
         AsyncStoreConfig asyncConfig = new AsyncStoreConfig().threadPoolSize(10);
         store = new MockAsyncStore(key, v1Latch, v2Latch, endLatch, underlying, asyncConfig);
         DummyInMemoryCacheStore.Cfg dummyCfg = new DummyInMemoryCacheStore.Cfg();
         dummyCfg.storeName(m.getName());
         store.init(dummyCfg, null, null);
View Full Code Here

         final TransactionFactory gtf = new TransactionFactory();
         gtf.init(false, false, true, false);
         final String k1 = k(m, 1), k2 = k(m, 2), v1 = v(m, 1), v2 = v(m, 2);
         final ConcurrentMap<Object, Modification> localMods = new ConcurrentHashMap<Object, Modification>();
         final CyclicBarrier barrier = new CyclicBarrier(2);
         DummyInMemoryCacheStore underlying = new DummyInMemoryCacheStore();
         AsyncStoreConfig asyncConfig = new AsyncStoreConfig().threadPoolSize(10);
         store = new AsyncStore(underlying, asyncConfig) {
            @Override
            protected void applyModificationsSync(List<Modification> mods) throws CacheLoaderException {
               for (Modification mod : mods)
View Full Code Here

         final String k1 = k(m, 1), k2 = k(m, 2), k3 = k(m, 3), v1 = v(m, 1), v2 = v(m, 2), v3 = v(m, 3);
         final AtomicInteger storeCount = new AtomicInteger();
         final AtomicInteger removeCount = new AtomicInteger();
         final AtomicInteger clearCount = new AtomicInteger();
         final CyclicBarrier barrier = new CyclicBarrier(2);
         DummyInMemoryCacheStore underlying = new DummyInMemoryCacheStore() {
            @Override
            public void store(InternalCacheEntry ed) {
               super.store(ed);
               storeCount.getAndIncrement();
            }
View Full Code Here

   @AfterMethod(alwaysRun = true)
   public void clearStats() {
      for (Cache<?, ?> c: caches) {
         log.trace("Clearing stats for cache store on cache "+ c);
         DummyInMemoryCacheStore cs = (DummyInMemoryCacheStore) TestingUtil.extractComponent(c, CacheLoaderManager.class).getCacheStore();
         cs.clearStats();
      }
   }
View Full Code Here

      stores.put("ASYNC", createAsyncStore());
      return stores;
   }

   private AsyncStore createAsyncStore() throws CacheLoaderException {
      DummyInMemoryCacheStore backendStore = createBackendStore("async2");
      AsyncStoreConfig asyncCfg = new AsyncStoreConfig();
      asyncCfg.modificationQueueSize(0);
      AsyncStore store = new AsyncStore(backendStore, asyncCfg);
      store.init(backendStore.getCacheStoreConfig(), null, new TestObjectStreamMarshaller());
      store.start();
      return store;
   }
View Full Code Here

      store.start();
      return store;
   }

   private DummyInMemoryCacheStore createBackendStore(String storeName) throws CacheLoaderException {
      DummyInMemoryCacheStore store = new DummyInMemoryCacheStore();
      store.init(new DummyInMemoryCacheStore.Cfg(storeName), null, new TestObjectStreamMarshaller());
      store.start();
      return store;
   }
View Full Code Here

      assertTrue("Not all stores were properly shut down", stores.isEmpty());
   }

   private void mapTestReadWriteRemove(String name, AbstractDelegatingStore store,
         int numKeys, int readerThreads, int writerThreads, int removerThreads) throws Exception {
      DummyInMemoryCacheStore delegate = (DummyInMemoryCacheStore) store.getDelegate();
      try {
         // warm up for 1 second
         System.out.printf("[store=%s] Warming up\n", name);
         runMapTestReadWriteRemove(name, store, readerThreads, writerThreads, removerThreads, 1000);

         // real test
         System.out.printf("[store=%s] Testing...\n", name);
         TotalStats perf = runMapTestReadWriteRemove(name, store, readerThreads, writerThreads, removerThreads, RUNNING_TIME);

         // Wait until the cache store contains the expected state
         System.out.printf("[store=%s] Verify contents\n", name);
         delegate.blockUntilCacheStoreContains(expectedState.keySet(), 60000);

         System.out.printf("Container %-12s  ", name);
         System.out.printf("Ops/s %10.2f  ", perf.getTotalOpsPerSec());
         System.out.printf("Gets/s %10.2f  ", perf.getOpsPerSec("GET"));
         System.out.printf("Puts/s %10.2f  ", perf.getOpsPerSec("PUT"));
         System.out.printf("Removes/s %10.2f  ", perf.getOpsPerSec("REMOVE"));
         System.out.printf("HitRatio %10.2f  ", perf.getTotalHitRatio() * 100);
         System.out.printf("Size %10d  ", store.loadAllKeys(null).size());
         double stdDev = computeStdDev(store, numKeys);
         System.out.printf("StdDev %10.2f\n", stdDev);
      } finally {
         // Clean up state, expected state and keys
         expectedState.clear();
         delegate.clear();
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.loaders.dummy.DummyInMemoryCacheStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.