Package org.jboss.cache

Examples of org.jboss.cache.DefaultCacheFactory


      assertEquals(value, loader.get(fqn).get(key));
   }

   public void testSingleLoaderPurge() throws Exception
   {
      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      Configuration c = cache.getConfiguration();
      c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false, true));
      cache.start();

      cache.put(fqn, key, value);
View Full Code Here


      assertNull(loader.get(fqn));
   }

   public void testTwoLoadersPurge() throws Exception
   {
      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);

      String xml = "<config>\n" +
            "<passivation>false</passivation>\n" +
            "<preload></preload>\n" +
            "<cacheloader>\n" +
View Full Code Here

   private long evictionWaitTime = 2100;

   @BeforeMethod
   public void setUp() throws Exception
   {
      c1 = (CacheSPI) new DefaultCacheFactory().createCache(false);

      // the FIFO policy cfg
      FIFOConfiguration cfg = new FIFOConfiguration();
      cfg.setMaxNodes(1);
      cfg.setMinTimeToLiveSeconds(0);

      // the region configuration
      EvictionRegionConfig regionCfg = new EvictionRegionConfig();
      regionCfg.setRegionFqn(dummy.getParent());
      regionCfg.setRegionName(dummy.getParent().toString());
      regionCfg.setEvictionPolicyConfig(cfg);

      // set regions in a list
      List<EvictionRegionConfig> evictionRegionConfigs = new ArrayList<EvictionRegionConfig>();
      evictionRegionConfigs.add(regionCfg);


      EvictionConfig ec = new EvictionConfig();
      ec.setWakeupIntervalSeconds(1);
      ec.setEvictionRegionConfigs(evictionRegionConfigs);

      c1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
      c1.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
      c1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      c1.getConfiguration().setEvictionConfig(ec);

      c2 = (CacheSPI) new DefaultCacheFactory().createCache(c1.getConfiguration().clone(), false);

      c1.start();
      c2.start();

      TestingUtil.blockUntilViewsReceived(60000, c1, c2);
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {

      cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      cache1.getConfiguration().setCacheMode("repl_sync");
      cache1.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());

      cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
      // cache1.setReplQueueInterval(3000);
      cache1.create();
      cache1.start();

      cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      cache2.getConfiguration().setCacheMode("repl_sync");
      cache2.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
      cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
      cache2.getConfiguration().setLockAcquisitionTimeout(2000);
      // cache2.setReplQueueInterval(3000);
View Full Code Here

   {
      CacheSPI<Object, Object> cache1 = createCacheWithCacheLoader(true, true, passivation, true, false);
      Configuration cfg1 = cache1.getConfiguration();
      configureEviction(cfg1);
      Configuration cfg0 = cfg1.clone();
      CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cfg0, false);

      // Store them for the teardown method
      if (caches == null)
         caches = new ArrayList<CacheSPI<Object, Object>>();
      caches.add(cache0);
View Full Code Here

   {
      CacheSPI<Object, Object> cache0 = createCacheWithCacheLoader(true, true, passivation, true, false);
      Configuration cfg0 = cache0.getConfiguration();
      configureEviction(cfg0);
      Configuration cfg1 = cfg0.clone();
      CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cfg1, false);
      Configuration cfg2 = cfg0.clone();
      CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(cfg2, false);

      // Store them for the teardown method
      if (caches == null)
         caches = new ArrayList<CacheSPI<Object, Object>>();
      caches.add(cache0);
View Full Code Here

      configureCache("");
   }

   protected void configureCache(String props) throws Exception
   {
      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
      // cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader",
      cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", props, true, false, true));
      cache.create();
      cache.start();
View Full Code Here

   @BeforeTest
   public void setUp()
   {
      Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
      cache = new DefaultCacheFactory().createCache(cfg, false);
   }
View Full Code Here

   private Fqn node = Fqn.fromString("/a");

   @BeforeTest
   public void setUp()
   {
      cache1 = new DefaultCacheFactory().createCache(false);
      cache2 = new DefaultCacheFactory().createCache(false);

      cache1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
      cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);

      cache1.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      if (cache != null)
         tearDown();
      CacheFactory<String, String> instance = new DefaultCacheFactory();
      cache = (CacheSPI<String, String>) instance.createCache(false);
      cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
      cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache.start();
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.DefaultCacheFactory

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.