コード例 #1
0
 public void testDisabledInterceptorStack() {
   ConfigurationBuilder cfg = new ConfigurationBuilder();
   cfg.storeAsBinary().disable();
   cm.defineConfiguration("a", cfg.build());
   Cache<?, ?> c = cm.getCache("a");
   assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
 }
コード例 #2
0
 @Override
 protected EmbeddedCacheManager createCacheManager() throws Exception {
   // start a single cache instance
   ConfigurationBuilder c = getDefaultStandaloneCacheConfig(true);
   c.storeAsBinary().enable();
   EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(false);
   cm.defineConfiguration("lazy-cache-test", c.build());
   cache = cm.getCache("lazy-cache-test");
   return cm;
 }
コード例 #3
0
  public void testDefaultInterceptorStack() {
    assert TestingUtil.findInterceptor(cm.getCache(), MarshalledValueInterceptor.class) == null;

    ConfigurationBuilder configuration = new ConfigurationBuilder();
    configuration.storeAsBinary().enable();
    cm.defineConfiguration("someCache", configuration.build());
    Cache<?, ?> c = cm.getCache("someCache");

    assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) != null;
    TestingUtil.killCaches(c);
  }
コード例 #4
0
  public org.infinispan.configuration.cache.Configuration build() {
    ConfigurationBuilder cb = new ConfigurationBuilder();
    if (c.isStoreByValue()) cb.storeAsBinary().enable();

    Factory<CacheLoader<K, V>> cacheLoaderFactory = c.getCacheLoaderFactory();
    if (cacheLoaderFactory != null) {
      // User-defined cache loader will be plugged once cache has started
      cb.persistence().addStore(JStoreAdapterConfigurationBuilder.class);
    }

    Factory<CacheWriter<? super K, ? super V>> cacheWriterFactory = c.getCacheWriterFactory();
    if (cacheWriterFactory != null) {
      // User-defined cache writer will be plugged once cache has started
      cb.persistence().addStore(JCacheWriterAdapterConfigurationBuilder.class);
    }

    if (c.isStatisticsEnabled()) cb.jmxStatistics().enable();

    return cb.build();
  }