[jbosscache-commits] JBoss Cache SVN: r7034 - in core/trunk/src: test/java/org/jboss/cache/config and 1 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Oct 30 13:10:26 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-10-30 13:10:26 -0400 (Thu, 30 Oct 2008)
New Revision: 7034

Modified:
   core/trunk/src/main/resources/config2to3.xslt
   core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
   core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml
Log:
Updated to take into account new meanings of 0 in eviction config and translate old 0's to -1's to denote no limit.

Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt	2008-10-30 16:57:53 UTC (rev 7033)
+++ core/trunk/src/main/resources/config2to3.xslt	2008-10-30 17:10:26 UTC (rev 7034)
@@ -374,11 +374,14 @@
                </xsl:attribute>
                <xsl:attribute name="value">
 	               <xsl:choose>
-               		<xsl:when test="$attr = '0'">
+               		<xsl:when test="$attr &lt; 1">
                			<xsl:value-of select="-1"/>
                		</xsl:when>
+               		<xsl:when test="$attr &gt; 0">
+               			<xsl:value-of select="concat($attr,'000')"/>
+               		</xsl:when>
                		<xsl:otherwise>
-               			<xsl:value-of select="concat($attr,'000')"/>
+               			<xsl:value-of select="$attr"/>
                		</xsl:otherwise>
                	</xsl:choose>
                </xsl:attribute>
@@ -395,6 +398,9 @@
                      <xsl:when test="$attr/@name = 'minNodes' and $attr = '0'">
                         <xsl:value-of select="-1"/>
                      </xsl:when>
+                     <xsl:when test="$attr &lt; 0">
+                        <xsl:value-of select="-1"/>
+                     </xsl:when>
                      <xsl:otherwise>
                         <xsl:value-of select="$attr"/>
                      </xsl:otherwise>

Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java	2008-10-30 16:57:53 UTC (rev 7033)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java	2008-10-30 17:10:26 UTC (rev 7034)
@@ -133,10 +133,10 @@
    private void correctUnlimitedValues(EvictionRegionConfig erc)
    {
       LRUAlgorithmConfig eac = (LRUAlgorithmConfig) erc.getEvictionAlgorithmConfig();
-      if (eac.getMaxAge() == 0) eac.setMaxAge(-1);
-      if (eac.getMaxNodes() == 0) eac.setMaxNodes(-1);
-      if (eac.getMinTimeToLive() == 0) eac.setMinTimeToLive(-1);
-      if (eac.getTimeToLive() == 0) eac.setTimeToLive(-1);
+      if (eac.getMaxAge() <= 0) eac.setMaxAge(-1);
+      if (eac.getMaxNodes() <= 0) eac.setMaxNodes(-1);
+      if (eac.getMinTimeToLive() <= 0) eac.setMinTimeToLive(-1);
+      if (eac.getTimeToLive() <= 0) eac.setTimeToLive(-1);
    }
 
    private String getFileName(String s)

Modified: core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml	2008-10-30 16:57:53 UTC (rev 7033)
+++ core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml	2008-10-30 17:10:26 UTC (rev 7034)
@@ -32,6 +32,16 @@
                <attribute name="minTimeToLiveSeconds">1000</attribute>
                <attribute name="maxNodes">0</attribute>
             </region>
+            <!-- already set to -1 -->
+            <region name="/org/jboss/data2">
+               <attribute name="minTimeToLiveSeconds">1000</attribute>
+               <attribute name="maxNodes">-1</attribute>
+            </region>
+            <!-- already set to -10 -->
+            <region name="/org/jboss/data3">
+               <attribute name="minTimeToLiveSeconds">1000</attribute>
+               <attribute name="maxNodes">-10</attribute>
+            </region>
          </config>
       </attribute>
    </mbean>




More information about the jbosscache-commits mailing list