Package org.jboss.cache.config

Examples of org.jboss.cache.config.Configuration


   }

   public void testSingleLoaderNoPurge() throws Exception
   {
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(false);
      Configuration c = cache.getConfiguration();

      c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false));
      cache.start();

      cache.put(fqn, key, value);

      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
View Full Code Here


   }

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

      cache.put(fqn, key, value);

      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
View Full Code Here

                  "                <properties>bin=bin2</properties>\n" +
                  "         </loader>" +
                  "      </loaders>";
      LoadersElementParser parser = new LoadersElementParser();
      CacheLoaderConfig cacheLoaderConfig = parser.parseLoadersElement(XmlConfigHelper.stringToElementInCoreNS(xml));
      Configuration c = cache.getConfiguration();
      c.setCacheLoaderConfig(cacheLoaderConfig);
      cache.start();

      cache.put(fqn, key, value);

      CacheLoader loader[] = ((ChainingCacheLoader) cache.getCacheLoaderManager().getCacheLoader()).getCacheLoaders().toArray(new CacheLoader[]{});
View Full Code Here

      isTrue = true;
   }

   void initCaches() throws Exception
   {
      Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new FIFOAlgorithmConfig(maxNodes), 2000000), 200);
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new FIFOAlgorithmConfig(5)));
      config.setEvictionConfig(evConfig);
      config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true);// read in generic local xml
   }
View Full Code Here

   }


   public void testUsingEvictionPolicy()
   {
      Configuration c = new Configuration();
      c.setEvictionConfig(new EvictionConfig());
      EvictionConfig evConfig = c.getEvictionConfig();
      evConfig.setWakeupIntervalSeconds(3);
      evConfig.setDefaultEventQueueSize(20000);
      evConfig.setDefaultEvictionPolicyClass(FIFOPolicy.class.getName());
      List<EvictionRegionConfig> erConfigs = new ArrayList<EvictionRegionConfig>();
      erConfigs.add(createEvictionRegionConfig("/_default_", 2, new FIFOConfiguration()));
View Full Code Here

   public void testUsingCustomEvictionPolicy()
   {
      try
      {
         Configuration c = new Configuration();
         c.setEvictionConfig(new EvictionConfig());
         EvictionConfig evConfig = c.getEvictionConfig();
         evConfig.setWakeupIntervalSeconds(3);
         evConfig.setDefaultEventQueueSize(20000);
         evConfig.setDefaultEvictionPolicyClass(MyPolicy.class.getName());
         List<EvictionRegionConfig> erConfigs = new ArrayList<EvictionRegionConfig>();
         erConfigs.add(createEvictionRegionConfig("/_default_", 2, new MyPolicyConfig()));
View Full Code Here

   public void testUsingCustomEvictionPolicyNonDefault()
   {
      try
      {
         Configuration c = new Configuration();
         c.setEvictionConfig(new EvictionConfig());
         EvictionConfig evConfig = c.getEvictionConfig();
         evConfig.setWakeupIntervalSeconds(3);
         evConfig.setDefaultEventQueueSize(20000);
         evConfig.setDefaultEvictionPolicyClass(FIFOPolicy.class.getName());
         List<EvictionRegionConfig> erConfigs = new ArrayList<EvictionRegionConfig>();
         erConfigs.add(createEvictionRegionConfig("/_default_", 2, new FIFOConfiguration()));
View Full Code Here

      }
   }

   public void testControl()
   {
      Configuration c = new Configuration();
      c.setEvictionConfig(new EvictionConfig());
      EvictionRegionConfig defaultRegion = c.getEvictionConfig().getDefaultEvictionRegionConfig();
      defaultRegion.setEvictionAlgorithmConfig(new FIFOAlgorithmConfig(2));
      doTest(c);
   }
View Full Code Here

   private void doTest(String xml, boolean legacy) throws Exception
   {
      if (legacy)
      {
         EvictionConfig ec = XmlConfigurationParser2x.parseEvictionConfig(XmlConfigHelper.stringToElementInCoreNS(xml));
         Configuration c = new Configuration();
         c.setEvictionConfig(ec);
         doTest(c);
      }
      else
      {
         doTest(new XmlConfigurationParser().parseElement(XmlConfigHelper.stringToElementInCoreNS(xml)));
View Full Code Here

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

      Configuration c1 = new Configuration();
      c1.setCacheMode("repl_sync");
      c1.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
      c1.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
      c1.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
      // cache1.setReplQueueInterval(3000);
     
      cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c1, false);
      cache1.create();
      cache1.start();

      Configuration c2 = new Configuration();
      c2.setCacheMode("repl_sync");
      c2.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
      c2.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
      c2.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
      c2.setLockAcquisitionTimeout(2000);
      // cache2.setReplQueueInterval(3000);

      cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c2, false);
      cache2.create();
      cache2.start();
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.