Package org.jboss.cache.config

Examples of org.jboss.cache.config.Configuration


@Test(groups = {"functional"}, testName = "statetransfer.FailedStateTransferTest")
public class FailedStateTransferTest extends StateTransferTestBase
{
   public void testFailedStateTransfer() throws Exception
   {
      Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC);
      //c.setClusterName("VersionedTestBase");
      c.setReplVersionString(getReplicationVersion());
      // Use a long timeout to facilitate setting debugger breakpoints
      c.setStateRetrievalTimeout(60000);
      CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());

      // Put the cache in the map before starting, so if it fails in
      // start it can still be destroyed later
      caches.put("secretive", cache);

      // inject our own message listener and re-wire deps
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
//      cr.unregisterComponent(ChannelMessageListener.class);
      cr.registerComponent(new SecretiveStateCacheMessageListener(), ChannelMessageListener.class);
//      cr.updateDependencies();

      cache.start();


      c= UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC);
      //c.setClusterName("VersionedTestBase");
      c.setReplVersionString(getReplicationVersion());
      // Use a long timeout to facilitate setting debugger breakpoints
      c.setStateRetrievalTimeout(60000);
      CacheSPI recipient = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());

      //Put the cache in the map before starting, so if it fails in
      // start it can still be destroyed later
      caches.put("secretive2", recipient);
View Full Code Here


   {
      writerFailed = false;
      writerError = null;

      UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
      Configuration c = new Configuration();
      c.setCacheMode("LOCAL");
      c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
      c.setLockAcquisitionTimeout(1000);
      cache = (CacheSPI<String, String>) instance.createCache(c, false, getClass());
      cache.start();
   }
View Full Code Here

      cache = null;
   }

   public void testPreload() throws Exception
   {
      Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL);
      String props = "bin=" + getClass().getName();
      c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "/a", DummySharedInMemoryCacheLoader.class.getName(),
            props, false, false, false, false, false));
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
      cache.put(fqn, key, value);
      assertExists();

      cache.destroy();

      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
      assertExists();
   }
View Full Code Here

      assertExists();
   }

   public void testPreloadMultiRegions() throws Exception
   {
      Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL);
      String props = "bin=" + getClass().getName();
      c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "/a", DummySharedInMemoryCacheLoader.class.getName(),
            props, false, false, false, false, false));
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
      cache.put(fqn, key, value);
      assertExists();

      cache.destroy();

      c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "/c,/a,/b", DummySharedInMemoryCacheLoader.class.getName(),
            props, false, false, false, false, false));
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
      assertExists();

      c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "/c, /a, /b", DummySharedInMemoryCacheLoader.class.getName(),
            props, false, false, false, false, false));
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
      assertExists();

      c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "  /c,   /a,   /b", DummySharedInMemoryCacheLoader.class.getName(),
            props, false, false, false, false, false));
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), getClass());
      assertExists();
   }
View Full Code Here

   public void setUp() throws Exception
   {
      // need 2 caches to test viewChange notifications

      UnitTestCacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
      Configuration conf1 = new Configuration();
      Configuration conf2 = new Configuration();

      conf1.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      conf2.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      conf1.setSyncCommitPhase(true);
      conf2.setSyncCommitPhase(true);
      conf1.setSyncRollbackPhase(true);
      conf2.setSyncRollbackPhase(true);
      conf1.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      conf2.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      conf1.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", DummyInMemoryCacheLoader.class.getName(), (Properties) null, false, false, false, false, false));
     
      cache1 = instance.createCache(conf1, false, getClass());
      cache2 = instance.createCache(conf2, false, getClass());
View Full Code Here

            try
            {
               cacheServer = new TcpCacheServer();
               cacheServer.setBindAddress(TCP_CACHE_SERVER_HOST);
               cacheServer.setPort(TCP_CACHE_SERVER_PORT);
               Configuration config = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
               // disable eviction!!
               config.setEvictionConfig(null);
               CacheSPI cache = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(config, getClass());
               cacheServer.setCache(cache);
               cacheServer.create();
               cacheServer.start();
               START_COUNT++;
View Full Code Here

   }

   private CacheSPI<Object, Object> setupCache(String configurationName)
   {
      UnitTestCacheFactory<Object, Object> testCacheFactory = new UnitTestCacheFactory<Object, Object>();
      Configuration config = testCacheFactory.getConfigurationFromFile(configurationName);
      config.setCacheMode(Configuration.CacheMode.LOCAL);
      config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      return (CacheSPI<Object, Object>) testCacheFactory.createCache(config, getClass());
   }
View Full Code Here

      isTrue = true;
   }

   void initCaches() throws Exception
   {
      Configuration config = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new LFUAlgorithmConfig(maxNodesDefault, minNodesDefault), 200000), 0);
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/data"), new LFUAlgorithmConfig(maxNodesR1, minNodesR1)));
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new LFUAlgorithmConfig(maxNodesR2, minNodesR2)));
      config.setEvictionConfig(evConfig);
      config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());
      evController = new EvictionController(cache);
   }
View Full Code Here


   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      Configuration conf = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = conf.getEvictionConfig();
      evConfig.setWakeupInterval(wakeupIntervalMillis);
      List<EvictionRegionConfig> regionConfigs = new ArrayList<EvictionRegionConfig>();
      regionConfigs.add(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new LRUAlgorithmConfig(dataRegionTTLMillis, -1, 5)));
      regionConfigs.add(new EvictionRegionConfig(Fqn.fromString("/test"), new LRUAlgorithmConfig(testRegionTTLMillis, 10000)));
      regionConfigs.add(new EvictionRegionConfig(Fqn.fromString("/base"), new LRUAlgorithmConfig(baseRegionTTLMillis, -1, baseRegionMaxNodes)));
      evConfig.setEvictionRegionConfigs(regionConfigs);
      conf.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      conf.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());

      wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
      if (wakeupIntervalMillis < 0)
      {
View Full Code Here

   public void testDisabledEvictionTimer()
   {
      Cache<String, String> c = null;
      try
      {
         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
         cfg.getEvictionConfig().setWakeupInterval(0);
         c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
         ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
         RegionManager rm = cr.getComponent(RegionManager.class);
         EvictionTimerTask ett = rm.getEvictionTimerTask();
         assert ett.scheduledExecutor == null;
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.