[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/eviction ...

Brian Stansberry brian.stansberry at jboss.com
Mon Oct 23 01:47:30 EDT 2006


  User: bstansberry
  Date: 06/10/23 01:47:30

  Modified:    tests/functional/org/jboss/cache/eviction  
                        RegionManagerTest.java
                        ProgrammaticLRUPolicyTest.java
  Log:
  [JBCACHE-809] Pojo-style configuration for use by Microcontainer
  
  Revision  Changes    Path
  1.13      +6 -43     JBossCache/tests/functional/org/jboss/cache/eviction/RegionManagerTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RegionManagerTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/RegionManagerTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- RegionManagerTest.java	12 Oct 2006 23:03:58 -0000	1.12
  +++ RegionManagerTest.java	23 Oct 2006 05:47:30 -0000	1.13
  @@ -4,6 +4,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.TreeCache;
  +import org.jboss.cache.config.EvictionConfig.EvictionRegionConfig;
   import org.jboss.cache.xml.XmlHelper;
   import org.w3c.dom.Element;
   
  @@ -12,7 +13,7 @@
    *
    * @author Ben Wang, Feb 11, 2004
    * @author Daniel Huang (dhuang at jboss.org)
  - * @version $Revision: 1.12 $
  + * @version $Revision: 1.13 $
    */
   public class RegionManagerTest extends TestCase
   {
  @@ -203,7 +204,8 @@
                 "</region>";
         Element element = XmlHelper.stringToElement(xml);
         RegionManager regionManager = new RegionManager();
  -      Region region = regionManager.createRegion("/test", element);
  +      EvictionRegionConfig erc = new EvictionRegionConfig(element, regionManager.getEvictionConfig().getDefaultEvictionPolicyClass());
  +      Region region = regionManager.createRegion(erc);
   
         assertTrue(region.getEvictionPolicy() instanceof LFUPolicy);
         assertTrue(region.getEvictionConfiguration() instanceof LFUConfiguration);
  @@ -223,7 +225,8 @@
         element = XmlHelper.stringToElement(xml);
         regionManager = new RegionManager();
         regionManager.setTreeCache(cache);
  -      region = regionManager.createRegion("/abc/", element);
  +      erc = new EvictionRegionConfig(element, regionManager.getEvictionConfig().getDefaultEvictionPolicyClass());
  +      region = regionManager.createRegion(erc);
   
         assertTrue(region.getEvictionPolicy() instanceof LFUPolicy);
         assertTrue(region.getEvictionConfiguration() instanceof LFUConfiguration);
  @@ -233,46 +236,6 @@
         assertEquals("/abc/", region.getFqn());
      }
   
  -   public void testIsUsingNewStyleConfiguration() throws Exception
  -   {
  -      String xml = "<config>\n" +
  -              "  <attribute name=\"wakeUpIntervalSeconds\">5</attribute>\n" +
  -              "  <region name=\"/_default_\">\n" +
  -              "    <attribute name=\"maxNodes\">5000</attribute>\n" +
  -              "    <attribute name=\"minNodes\">10</attribute>\n" +
  -              "  </region>\n" +
  -              "  <region name=\"/org/jboss/data\">\n" +
  -              "    <attribute name=\"maxNodes\">5000</attribute>\n" +
  -              "    <attribute name=\"minNodes\">4000</attribute>\n" +
  -              "  </region>\n" +
  -              "  <region name=\"/org/jboss/test/data\">\n" +
  -              "    <attribute name=\"minNodes\">5</attribute>\n" +
  -              "  </region>\n" +
  -              "</config>";
  -      Element element = XmlHelper.stringToElement(xml);
  -
  -      assertFalse(RegionManager.isUsingNewStyleConfiguration(element));
  -
  -      xml = "<config>\n" +
  -              "  <attribute name=\"wakeUpIntervalSeconds\">5</attribute>\n" +
  -              "  <region name=\"/_default_\">\n" +
  -              "    <attribute name=\"maxNodes\">5000</attribute>\n" +
  -              "    <attribute name=\"minNodes\">10</attribute>\n" +
  -              "  </region>\n" +
  -              "  <region name=\"/org/jboss/data\" policyClass=\"org.jboss.cache.eviction.MRUPolicy\">\n" +
  -              "    <attribute name=\"maxNodes\">5000</attribute>\n" +
  -              "    <attribute name=\"minNodes\">4000</attribute>\n" +
  -              "  </region>\n" +
  -              "  <region name=\"/org/jboss/test/data\">\n" +
  -              "    <attribute name=\"minNodes\">5</attribute>\n" +
  -              "  </region>\n" +
  -              "</config>";
  -
  -      element = XmlHelper.stringToElement(xml);
  -
  -      assertTrue(RegionManager.isUsingNewStyleConfiguration(element));
  -   }
  -
      public void testRegionOrdering() throws Exception
      {
         String fqn1 = DEFAULT_REGION;
  
  
  
  1.2       +6 -4      JBossCache/tests/functional/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ProgrammaticLRUPolicyTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ProgrammaticLRUPolicyTest.java	10 Oct 2006 02:46:36 -0000	1.1
  +++ ProgrammaticLRUPolicyTest.java	23 Oct 2006 05:47:30 -0000	1.2
  @@ -30,6 +30,7 @@
   import org.jboss.cache.xml.XmlHelper;
   import org.jboss.cache.misc.TestingUtil;
   import org.jboss.cache.lock.IsolationLevel;
  +import org.jboss.cache.config.EvictionConfig.EvictionRegionConfig;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.w3c.dom.Element;
   
  @@ -37,7 +38,7 @@
    * Unit tests for programmatic configuration of LRU policy
    *
    * @author Ben Wang, Oct, 2006
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class ProgrammaticLRUPolicyTest extends TestCase
   {
  @@ -86,9 +87,9 @@
               "</region>";
         Element element = XmlHelper.stringToElement(xml);
         RegionManager regionManager = cache_.getEvictionRegionManager();
  +      EvictionRegionConfig erc = new EvictionRegionConfig(element, regionManager.getEvictionConfig().getDefaultEvictionPolicyClass());
         // Fqn is the region name
  -      Fqn fqn = Fqn.fromString("/programmatic");
  -      Region region = regionManager.createRegion("/programmatic", element);
  +      regionManager.createRegion("/programmatic", erc);
      }
   
      public void testStringBasedFqnEviction() throws Exception
  @@ -146,10 +147,11 @@
               "</region>";
         Element element = XmlHelper.stringToElement(xml);
         RegionManager regionManager = cache_.getEvictionRegionManager();
  +      EvictionRegionConfig erc = new EvictionRegionConfig(element, regionManager.getEvictionConfig().getDefaultEvictionPolicyClass());
         // Fqn is the region name
         Integer ii = new Integer(1);
         Fqn fqn = new Fqn(ii);
  -      Region region = regionManager.createRegion(fqn, element);
  +      regionManager.createRegion(fqn, erc);
      }
   
      public void testObjectBasedFqnEviction1() throws Exception
  
  
  



More information about the jboss-cvs-commits mailing list