Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.ConfigurationBuilder.storeAsBinary()


   }

   public void testDefiningConfigurationOverridingBooleans() {
      EmbeddedCacheManager cm = createCacheManager(false);
      ConfigurationBuilder c = new ConfigurationBuilder();
      c.storeAsBinary().enable();
      Configuration lazy = cm.defineConfiguration("storeAsBinary", c.build());
      assert lazy.storeAsBinary().enabled();

      c = new ConfigurationBuilder().read(lazy);
      c.eviction().strategy(EvictionStrategy.LRU).maxEntries(1);
View Full Code Here


   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);
View Full Code Here

      TestingUtil.killCaches(c);
   }

   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;
   }
View Full Code Here

   @Override
   protected EmbeddedCacheManager createCacheManager() throws Exception {
      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg.locking().useLockStriping(false); // to minimise chances of deadlock in the unit test
      cfg.storeAsBinary().enable();
      EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(cfg);
      cache = cm.getCache();
      StreamingMarshaller marshaller = TestingUtil.extractComponent(cache, StreamingMarshaller.class);
      MockMarshalledValueInterceptor interceptor = new MockMarshalledValueInterceptor(marshaller);
      assert TestingUtil.replaceInterceptor(cache, interceptor, MarshalledValueInterceptor.class);
View Full Code Here

      ecm = null;
   }

   public void testKeysOnly() {
      ConfigurationBuilder c = new ConfigurationBuilder();
      c.storeAsBinary().enable().storeValuesAsBinary(false);
      ecm = TestCacheManagerFactory.createCacheManager(c);
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().enabled();
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().storeKeysAsBinary();
      assert !ecm.getCache().getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
   }
View Full Code Here

      assert !ecm.getCache().getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
   }

   public void testValuesOnly() {
      ConfigurationBuilder c = new ConfigurationBuilder();
      c.storeAsBinary().enable().storeKeysAsBinary(false);
      ecm = TestCacheManagerFactory.createCacheManager(c);
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().enabled();
      assert !ecm.getCache().getCacheConfiguration().storeAsBinary().storeKeysAsBinary();
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
   }
View Full Code Here

      assert ecm.getCache().getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
   }

   public void testBoth() {
      ConfigurationBuilder c = new ConfigurationBuilder();
      c.storeAsBinary().enable();
      ecm = TestCacheManagerFactory.createCacheManager(c);
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().enabled();
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().storeKeysAsBinary();
      assert ecm.getCache().getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
   }
View Full Code Here

      assert ecm.getCache().getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
   }

   public void testConfigCloning() {
      ConfigurationBuilder c = new ConfigurationBuilder();
      c.storeAsBinary().enable().storeKeysAsBinary(false);
      ConfigurationBuilder builder = new ConfigurationBuilder().read(c.build());
      Configuration clone = builder.build();
      assert !clone.storeAsBinary().storeKeysAsBinary();
      assert clone.storeAsBinary().storeValuesAsBinary();
   }
View Full Code Here

      assert clone.storeAsBinary().storeValuesAsBinary();
   }

   public void testConfigOverriding() {
      ConfigurationBuilder c = new ConfigurationBuilder();
      c.storeAsBinary().enable().storeKeysAsBinary(false);
      ecm = TestCacheManagerFactory.createCacheManager(c);
      ecm.defineConfiguration("newCache", new ConfigurationBuilder().read(c.build()).storeAsBinary().storeValuesAsBinary(false).storeKeysAsBinary(true).build());
      assert ecm.getCache("newCache").getCacheConfiguration().storeAsBinary().enabled();
      assert ecm.getCache("newCache").getCacheConfiguration().storeAsBinary().storeKeysAsBinary();
      assert !ecm.getCache("newCache").getCacheConfiguration().storeAsBinary().storeValuesAsBinary();
View Full Code Here

    public <E extends SerializationGroupMember<K, V, G>> BackingCacheEntryStore<K, V, E> createIntegratedObjectStore(final String beanName, IdentifierFactory<K> identifierFactory, PassivationManager<K, E> passivationManager, StatefulTimeoutInfo timeout) {
        Cache<?, ?> groupCache = this.groupCache.getValue();
        Configuration groupCacheConfiguration = groupCache.getCacheConfiguration();
        EmbeddedCacheManager container = groupCache.getCacheManager();
        ConfigurationBuilder builder = new ConfigurationBuilder().read(groupCacheConfiguration);
        builder.storeAsBinary().enable().storeKeysAsBinary(true).storeValuesAsBinary(false);
        if (this.maxSize > 0) {
            if (!groupCacheConfiguration.eviction().strategy().isEnabled()) {
                builder.eviction().strategy(EvictionStrategy.LRU);
            }
            builder.eviction().maxEntries(this.maxSize);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.