Package org.jboss.cache

Examples of org.jboss.cache.RegionManager


      assertEquals("Region ", DEFAULT_REGION, region.getFqn());
   }

   public void testNoDefaultRegion()
   {
      RegionManager regionManager = new RegionManager();
      regionManager.setUsingEvictions(true);
      regionManager.getRegion(A_B_C, true).setEvictionPolicy(config);
      regionManager.getRegion(A_B, true).setEvictionPolicy(config);

      regionManager.getRegion(Fqn.fromString("/a"), Region.Type.EVICTION, false);
   }
View Full Code Here


      regionManager.getRegion(Fqn.fromString("/a"), Region.Type.EVICTION, false);
   }

   public void testGetRegion()
   {
      RegionManager regionManager = new RegionManager();
      regionManager.setUsingEvictions(true);
      regionManager.getRegion(DEFAULT_REGION, true).setEvictionPolicy(config);
      regionManager.getRegion(A_BC, true).setEvictionPolicy(config);
      regionManager.getRegion(A_B, true).setEvictionPolicy(config);

      Region region = regionManager.getRegion(A_BC, true);
      assertNotSame("Region ", DEFAULT_REGION, region.getFqn());
   }
View Full Code Here

      String xml = "<region name=\"/test/\" policyClass=\"org.jboss.cache.eviction.LFUPolicy\">" +
            "<attribute name=\"minNodes\">10</attribute>" +
            "<attribute name=\"maxNodes\">20</attribute>" +
            "</region>";
      Element element = XmlHelper.stringToElement(xml);
      RegionManager regionManager = new RegionManager();
      regionManager.setUsingEvictions(true);
      EvictionRegionConfig erc = XmlConfigurationParser.parseEvictionRegionConfig(element, null, EvictionConfig.EVENT_QUEUE_SIZE_DEFAULT);
      Region region = regionManager.getRegion(erc.getRegionFqn(), true);
      region.setEvictionPolicy(erc.getEvictionPolicyConfig());

      assertTrue(region.getEvictionPolicy() instanceof LFUPolicy);
      assertTrue(region.getEvictionPolicyConfig() instanceof LFUConfiguration);
      LFUConfiguration config = (LFUConfiguration) region.getEvictionPolicyConfig();
      assertEquals(20, config.getMaxNodes());
      assertEquals(10, config.getMinNodes());
      assertEquals(Fqn.fromString("/test/"), region.getFqn());

      // test the 1.2.x style configuration
      xml = "<region name=\"abc\">" +
            "<attribute name=\"minNodes\">10</attribute>" +
            "<attribute name=\"maxNodes\">20</attribute>" +
            "</region>";
      element = XmlHelper.stringToElement(xml);
      erc = XmlConfigurationParser.parseEvictionRegionConfig(element, "org.jboss.cache.eviction.LFUPolicy", EvictionConfig.EVENT_QUEUE_SIZE_DEFAULT);
      regionManager = new RegionManager();
      regionManager.setUsingEvictions(true);
      region = regionManager.getRegion(erc.getRegionFqn(), true);
      region.setEvictionPolicy(erc.getEvictionPolicyConfig());

      assertTrue(region.getEvictionPolicy() instanceof LFUPolicy);
      assertTrue(region.getEvictionPolicyConfig() instanceof LFUConfiguration);
      config = (LFUConfiguration) region.getEvictionPolicyConfig();
View Full Code Here

   public void testRegionOrdering() throws Exception
   {
      Fqn A_B_C_D_E = Fqn.fromString("/a/b/c/d/e/");
      Fqn A_B_C_D = Fqn.fromString("/a/b/c/d/");

      RegionManager rm = new RegionManager();
      rm.setUsingEvictions(true);
      rm.getRegion(DEFAULT_REGION, true).setEvictionPolicy(config);
      rm.getRegion(A_B_C_D_E, true).setEvictionPolicy(config);
      rm.getRegion(A_B_C_D, true).setEvictionPolicy(config);
      rm.getRegion(A_B_C, true).setEvictionPolicy(config);

      Region region = rm.getRegion("/a/b/c/d/e/f", false);
      Region region2 = rm.getRegion("/e/f/g", false);

      assertEquals(A_B_C_D_E, region.getFqn());
      assertEquals(DEFAULT_REGION, region2.getFqn());

      List<Region> regions = rm.getAllRegions(Region.Type.ANY);
      for (int i = 0; i < regions.size(); i++)
      {
         switch (i)
         {
            case 0:
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      algo = new ElementSizeAlgorithm();
      regionManager = new RegionManager();
      ElementSizeConfiguration config = new ElementSizeConfiguration();
      // We have to setCache maxElementsPerNode!!
      config.setMaxElementsPerNode(0);
      config.setEvictionPolicyClass(DummyEvictionPolicy.class.getName());
      regionManager.getRegion("/a/b", true).setEvictionPolicy(config);
View Full Code Here

      algorithm = new MRUAlgorithm();
      MRUConfiguration config = new MRUConfiguration();
      // We have to setCache maxNodes!!
      config.setMaxNodes(0);
      config.setEvictionPolicyClass(DummyEvictionPolicy.class.getName());
      regionManager = new RegionManager();
      regionManager.getRegion("/a/b", true).setEvictionPolicy(config);
   }
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      algorithm = new LRUAlgorithm();
      regionManager_ = new RegionManager();
      regionManager_.getRegion("/a/b", true).setEvictionPolicy(new DummyEvictionConfiguration());
   }
View Full Code Here

   {
      algo = new FIFOAlgorithm();
      FIFOConfiguration config = new FIFOConfiguration();
      // We have to setCache maxNodes!!
      config.setMaxNodes(0);
      regionManager = new RegionManager();
      config.setEvictionPolicyClass(DummyEvictionPolicy.class.getName());
      regionManager.getRegion("/a/b", true).setEvictionPolicy(config);
   }
View Full Code Here

      config = new LRUConfiguration();
      config.setEvictionPolicyClass(DummyEvictionPolicy.class.getName());
      // We have to setCache timeToLiveSeconds!!
      config.setTimeToLiveSeconds(0);

      regionManager = new RegionManager();
      regionManager.getRegion("/a/b", true).setEvictionPolicy(config);
   }
View Full Code Here

      assert stm != null;

      RPCManager rpcm = (RPCManager) TestingUtil.extractField(bm, "rpcManager");
      assert rpcm != null;

      RegionManager rm = (RegionManager) TestingUtil.extractField(bm, "regionManager");
      assert rm != null;

      Configuration cfg = (Configuration) TestingUtil.extractField(bm, "configuration");
      assert cfg == configuration;
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.RegionManager

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.