Package org.infinispan.loaders.dummy

Examples of org.infinispan.loaders.dummy.DummyInMemoryCacheStore$Cfg


      try {
         Cache cache = manager.getCache("cache");
         cache.put(k(m, 1), v(m, 1));
         cache.put(k(m, 2), v(m, 2));
         cache.put(k(m, 3), v(m, 3));
         DummyInMemoryCacheStore store = getDummyStore(cache);
         DataContainer data = getDataContainer(cache);
         assert !store.isEmpty();
         assert 0 != data.size();
         manager.removeCache("cache");
         assert store.isEmpty();
         assert 0 == data.size();
         // Try removing the cache again, it should be a no-op
         manager.removeCache("cache");
         assert store.isEmpty();
         assert 0 == data.size();
      } finally {
         manager.stop();
      }
   }
View Full Code Here


   private EmbeddedCacheManager getManagerWithStore(Method m, boolean isClustered, boolean isStoreShared, String storePrefix) {
      String storeName = storePrefix + m.getName();
      ConfigurationBuilder c = new ConfigurationBuilder();
      c
            .loaders()
               .shared(isStoreShared).addStore().cacheStore(new DummyInMemoryCacheStore(storeName))
            .clustering()
               .cacheMode(isClustered ? CacheMode.REPL_SYNC : CacheMode.LOCAL);

      GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder().clusteredDefault();
      gcb.globalJmxStatistics().allowDuplicateDomains(true);
View Full Code Here

            cache1.put(k(m, 1), v(m, 1));
            cache1.put(k(m, 2), v(m, 2));
            cache1.put(k(m, 3), v(m, 3));
            cache2.put(k(m, 4), v(m, 4));
            cache2.put(k(m, 5), v(m, 5));
            DummyInMemoryCacheStore store1 = getDummyStore(cache1);
            DataContainer data1 = getDataContainer(cache1);
            DummyInMemoryCacheStore store2 = getDummyStore(cache2);
            DataContainer data2 = getDataContainer(cache2);
            assert !store1.isEmpty();
            assert 5 == data1.size();
            assert !store2.isEmpty();
            assert 5 == data2.size();
            manager1.removeCache("cache");
            assert !manager1.cacheExists("cache");
            assert !manager2.cacheExists("cache");
            assert null == manager1.getCache("cache", false);
            assert null == manager2.getCache("cache", false);
            assert store1.isEmpty();
            assert 0 == data1.size();
            assert store2.isEmpty();
            assert 0 == data2.size();
         }
      });
   }
View Full Code Here

      CacheLoaderManager clm = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class);
      return clm.getCacheStore();
   }

   private int getCacheStoreStats(Cache<?, ?> cache, String cacheStoreMethod) {
      DummyInMemoryCacheStore cs = (DummyInMemoryCacheStore) getCacheStore(cache);
      return cs.stats().get(cacheStoreMethod);
   }
View Full Code Here

      // cb.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL);

      cb.loaders().passivation(false).preload(true).shared(true);
      // Make it really shared by adding the test's name as store name
      LegacyStoreConfigurationBuilder sb = cb.loaders().addStore().cacheStore(
            new DummyInMemoryCacheStore());
      sb.addProperty("storeName", getClass().getSimpleName());
      sb.async().disable();
      return cb;
   }
View Full Code Here

   protected void configureCache(ConfigurationBuilder builder) {
      // To force a shared cache store, make sure storeName property
      // for dummy store is the same for all nodes
      builder.clustering().stateTransfer().fetchInMemoryState(false)
         .loaders().shared(true).preload(true).addStore()
            .cacheStore(new DummyInMemoryCacheStore()).addProperty("storeName", getClass().getName());
   }
View Full Code Here

      loadCacheEntries(this.<String, Person>caches().get(0));

      for (CacheStore cs: TestingUtil.cachestores(this.<String, Person>caches())) {
         assert cs.containsKey(persons[0].getName()) :
               "Cache misconfigured, maybe cache store not pointing to same place, maybe passivation on...etc";
         DummyInMemoryCacheStore dimcs = (DummyInMemoryCacheStore) cs;
         assert dimcs.stats().get("clear") == 0:
               "Cache store should not be cleared, purgeOnStartup is false";
         assert dimcs.stats().get("store") == 4:
               "Cache store should have been written to 4 times, but was written to " + dimcs.stats().get("store") + " times";
      }

      // Before adding a node, verify that the query resolves properly
      executeSimpleQuery(this.<String, Person>caches().get(0));
View Full Code Here

      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg.loaders()
            .preload(true)
            .passivation(true)
            .addStore()
            .cacheStore(new DummyInMemoryCacheStore())
            .purgeOnStartup(true)
         .indexing()
            .enable()
            .addProperty("default.directory_provider", "ram")
            .addProperty("lucene_version", "LUCENE_CURRENT")
View Full Code Here

   protected void configureCache(ConfigurationBuilder builder) {
      // Explicitly disable fetching in-memory state in order
      // to fetch it from the persistence layer
      builder.clustering().stateTransfer().fetchInMemoryState(false)
            .loaders().passivation(true).shared(false).addStore()
            .cacheStore(new DummyInMemoryCacheStore())
                  .fetchPersistentState(true);
   }
View Full Code Here

         assert "value".equals(c.get("key"));

      List<CacheStore> cachestores = TestingUtil.cachestores(caches());
      for (CacheStore cs: cachestores) {
         assert cs.containsKey("key");
         DummyInMemoryCacheStore dimcs = (DummyInMemoryCacheStore) cs;
         assert dimcs.stats().get("clear") == 0: "Cache store should not be cleared, purgeOnStartup is false";
         assert dimcs.stats().get("store") == 1: "Cache store should have been written to just once, but was written to " + dimcs.stats().get("store") + " times";
      }

      cache(0).remove("key");

      for (Cache<Object, Object> c: caches())
         assert c.get("key") == null;

      for (CacheStore cs: cachestores) {
         assert !cs.containsKey("key");
         DummyInMemoryCacheStore dimcs = (DummyInMemoryCacheStore) cs;
         assert dimcs.stats().get("remove") == 1 : "Entry should have been removed from the cache store just once, but was removed " + dimcs.stats().get("remove") + " times";
      }
   }
View Full Code Here

TOP

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

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.