Package org.jboss.cache.config

Examples of org.jboss.cache.config.Configuration


      caches = null;
   }

   private CacheSPI<Object, Object> createCache()
   {
      Configuration c = new Configuration();
      c.setCacheMode("REPL_SYNC");
      c.setUseRegionBasedMarshalling(true);
      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
      cache.start();
      return cache;
   }
View Full Code Here


   private EvictionController ec2;


   protected void createCaches() throws Throwable
   {
      Configuration c = new Configuration();

      // the FIFO policy cfg
      FIFOAlgorithmConfig cfg = new FIFOAlgorithmConfig();
      cfg.setMaxNodes(1);
      cfg.setMinTimeToLive(0);

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

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


      EvictionConfig ec = new EvictionConfig();
      ec.setWakeupInterval(-1);
      ec.setEvictionRegionConfigs(evictionRegionConfigs);

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

      c1 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
      c2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(c.clone(), false, getClass());

      c1.start();
      c2.start();
      ec1 = new EvictionController(c1);
      ec2 = new EvictionController(c2);
View Full Code Here

   {
      mcl_exception = null;
      //m_contextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);

      Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
      c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false, getClass());
   }
View Full Code Here

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

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      Configuration c = new Configuration();
      c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());

      CacheLoaderConfig clc = new CacheLoaderConfig();
      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
      iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
      clc.addIndividualCacheLoaderConfig(iclc);
      clc.setPassivation(true);

      c.setCacheLoaderConfig(clc);
      cache = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
      eventLog.events.clear();
      cache.addCacheListener(eventLog);
      tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
   }
View Full Code Here

      if (second != null) TestingUtil.killCaches(second);
   }

   private Configuration getConfiguration(Properties props) throws Exception
   {
      Configuration c = new Configuration();
      c.setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
      CacheLoaderConfig clc = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "/", JDBCCacheLoader.class.getName(), props, false, true, false, false, false);
      clc.setPassivation(false);
      clc.getFirstCacheLoaderConfig().setPurgeOnStartup(true);
      c.setCacheLoaderConfig(clc);
      c.setCacheMode(CacheMode.REPL_SYNC);
      c.setStateRetrievalTimeout(1000 * 120);//allow 2 minutes for before state transfer timeouts
      return c;
   }
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp()
   {
      n = new NotifierImpl();
      n.injectDependencies(createNiceMock(CacheSPI.class), new Configuration());
      n.start();
   }
View Full Code Here

   }

   private void initCaches(Configuration.CacheMode caching_mode)
   {
      UnitTestCacheFactory<String, ContainerData> instance = new UnitTestCacheFactory<String, ContainerData>();
      Configuration conf1 = new Configuration();
      Configuration conf2 = new Configuration();
     
      conf1.setCacheMode(caching_mode);
      conf2.setCacheMode(caching_mode);
      conf1.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      conf2.setIsolationLevel(IsolationLevel.SERIALIZABLE);

      conf1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      conf2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      /*
       cache1.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
       cache2.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
       */
      conf1.setLockAcquisitionTimeout(5000);
      conf2.setLockAcquisitionTimeout(5000);
     
      cache1 = (CacheSPI<String, ContainerData>) instance.createCache(conf1, false, getClass());
      cache2 = (CacheSPI<String, ContainerData>) instance.createCache(conf2, false, getClass());
     
     
View Full Code Here

   }

   public void testGetConfiguration1() throws Exception
   {
      CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
      Configuration cfgFromJmx = wrapper.getConfiguration();
      assertNotNull("Got a configuration", cfgFromJmx);
      assertSame(cache.getConfiguration(), cfgFromJmx);
   }
View Full Code Here

      assertSame(cache.getConfiguration(), cfgFromJmx);
   }

   public void testGetConfiguration2() throws Exception
   {
      Configuration cfg = createConfiguration();
      CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
      Configuration cfgFromJmx = wrapper.getConfiguration();
      assertNotNull("Got a configuration", cfgFromJmx);
      assertSame(cfg, cfgFromJmx);
   }
View Full Code Here

    *
    * @throws Exception
    */
   public void testPrintConfigurationAsString2() throws Exception
   {
      Configuration cfg = createConfiguration();
      CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
      wrapper.create();
      wrapper.start();
      String cfgFromJmx = wrapper.printConfigurationAsString();
      assertEquals(wrapper.getCache().getConfiguration().toString(), cfgFromJmx);
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.