Package org.jboss.cache.config

Examples of org.jboss.cache.config.Configuration


   @BeforeMethod
   public void setUp() throws CloneNotSupportedException
   {
      UnitTestCacheFactory cf = new UnitTestCacheFactory<Object, Object>();
      Configuration conf = new Configuration();
      conf.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      BuddyReplicationConfig brc = new BuddyReplicationConfig();
      brc.setEnabled(true);
      conf.setBuddyReplicationConfig(brc);

      c1 = cf.createCache(conf, false, getClass());
      c2 = cf.createCache(conf.clone(), false, getClass());
      c3 = cf.createCache(conf.clone(), false, getClass());

      c1.start();
      c2.start();
      c3.start();
View Full Code Here


public class PessSyncInvalidationTest extends AbstractMultipleCachesSyncInvalidationTest
{

   protected void createCaches() throws Throwable
   {
      Configuration c = new Configuration();
      c.setStateRetrievalTimeout(3000);
      c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
      c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, true, getClass());
      cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), true, getClass());
      TestingUtil.blockUntilViewReceived(cache1, 2, 10000);
      registerCaches(cache1, cache2);
   }
View Full Code Here

   {
      notifier = new NotifierImpl();
      CacheSPI cacheSPI = createNiceMock(CacheSPI.class);
      expect(cacheSPI.getInvocationContext()).andStubReturn(new MVCCInvocationContext());
      replay(cacheSPI);
      notifier.injectDependencies(cacheSPI, new Configuration());
      notifier.start();
      ctx = new MVCCInvocationContext();
      allEventsListener = new AllEventsListener();
      notifier.addCacheListener(allEventsListener);
   }
View Full Code Here

   public void testInvalidatedCallback() throws CloneNotSupportedException
   {
      Cache<String, String> c1 = null, c2 = null;
      try
      {
         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.INVALIDATION_SYNC, false);
         cfg.setNodeLockingScheme(NodeLockingScheme.MVCC);
         c1 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
         c2 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
         EventLog eventLog = new EventLog();
         c2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
         c2.put("/a/b/c", "x", "y");
         c2.addCacheListener(eventLog);
         c1.put("/a/b/c", "k", "v");
View Full Code Here

   private final Fqn fqn = Fqn.fromString("/test");

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      Configuration c = new Configuration();
      c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      if (optLocking)
         c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
      else
         c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
      c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");

      // we need this because notifications emitted by the notification interceptor are done during the commit call.
      // If we want to check notifications on remote nodes we need to make sure the commit completes before we test anything.
      c.setSyncCommitPhase(true);

      // more time to help with debugging
      c.setSyncReplTimeout(60000);

      UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
      cache1 = instance.createCache(c, getClass());
      cache2 = instance.createCache(c.clone(), getClass());

      eventLog1.events.clear();
      eventLog2.events.clear();

      cache1.addCacheListener(eventLog1);
View Full Code Here


   public Cache<String, String> init(boolean passivation) throws Exception
   {
      CacheLoaderConfig cacheLoaderConfig = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(passivation, "", DummyInMemoryCacheLoader.class.getName(), "", false, true, false, false, false);
      Configuration cfg = new Configuration();
      cfg.setNodeLockingScheme(getNodeLockingScheme());
      cfg.setCacheLoaderConfig(cacheLoaderConfig);
      cfg.getRuntimeConfig().setTransactionManager(new DummyTransactionManager());
      Cache<String, String> cache = new UnitTestCacheFactory().createCache(cfg, getClass());
      cache.put(fqn, key, "value");

      // evict the node, so we have to go to the loader to do anything with it
      cache.evict(fqn);
View Full Code Here

   }

   private CacheSPI<String, String> createCache(boolean enableBatch)
   {
      UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
      Configuration c = new Configuration();
      c.setNodeLockingScheme(NodeLockingScheme.MVCC);
      c.setInvocationBatchingEnabled(enableBatch);
      return (CacheSPI<String, String>) cf.createCache(c, getClass());
   }
View Full Code Here

   @Override
   public CacheSPI<String, String> createCache()
   {
      UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
      Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL); // this should pick up any configured TM for the test
      c.setNodeLockingScheme(NodeLockingScheme.MVCC);
      c.setInvocationBatchingEnabled(true);
      assert c.getTransactionManagerLookupClass() != null : "Should have a transaction manager lookup class attached!!";
      return (CacheSPI<String, String>) cf.createCache(c, getClass());
   }
View Full Code Here

      TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
   }

   private CacheSPI<Object, Object> createCache(String name)
   {
      Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC);
      c.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
      c.setClusterName(name + "-" + Thread.currentThread().getName());
      // Use marshaller
      c.setUseLazyDeserialization(useMarshalledValues);
      c.setUseRegionBasedMarshalling(!useMarshalledValues);
      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());

      cache.create();
      cache.start();
      return cache;
View Full Code Here

      new Random().nextBytes(b);
      Cache<String, byte[]> cache1 = null, cache2 = null;

      try
      {
         Configuration c = new Configuration();
         c.setCacheMode(CacheMode.REPL_SYNC);
         c.setNodeLockingScheme(NodeLockingScheme.MVCC);
         cache1 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone(), getClass());
         cache2 = new UnitTestCacheFactory<String, byte[]>().createCache(c.clone(), getClass());

         TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);

         cache1.put(Fqn.fromString("/a"), "test", b);
         byte[] bytesBack = cache2.get(Fqn.fromString("/a"), "test");
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.Configuration

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.