Author: gbayon
Date: Tue May 13 11:56:24 2008
New Revision: 655973

URL: http://svn.apache.org/viewvc?rev=655973&view=rev
Log:
Add LRU cache test

Modified:
    
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
    
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
    
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config

Modified: 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml?rev=655973&r1=655972&r2=655973&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
 (original)
+++ 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
 Tue May 13 11:56:24 2008
@@ -63,18 +63,16 @@
                        <flushInterval hours="24"/>
                        <flushOnExecute 
statement="UpdateAccountViaInlineParameters"/>
                </cacheModel>
-  
-               <!-- <cacheModel name="account-cache" implementation="LRU" >
-                       <flushInterval hours="24"/>
-                       <flushOnExecute 
statement="UpdateAccountViaInlineParameters"/>
-                       <flushOnExecute 
statement="UpdateAccountViaParameterMap"/>
-                       <property name="CacheSize" value="50"/>
-               </cacheModel> -->
-               
-    </cacheModels>
 
-       
-       <resultMaps>
+    <cacheModel id="lru-account-cache" implementation="LRU" >
+      <flushInterval minutes="5"/>
+      <property name="CacheSize" value="2"/>
+    </cacheModel>
+
+  </cacheModels>
+
+
+  <resultMaps>
     
     <resultMap id="Category-result" class="Category2">
       <result property="Id" column="Category_ID"/>
@@ -177,6 +175,14 @@
     -->
   <statements>
 
+    <select id="GetLruCachedAccountsViaResultMap"
+      resultMap="account-result"
+      cacheModel="lru-account-cache" >
+      select *
+      from Accounts
+      order by Account_ID
+    </select>
+    
     <select id="JIRA260" parameterClass="Integer"
       resultMap="account-extends-constructor">
       select *

Modified: 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs?rev=655973&r1=655972&r2=655973&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs 
(original)
+++ 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs 
Tue May 13 11:56:24 2008
@@ -39,6 +39,26 @@
 
                #region Test cache
 
+        [Test]
+        public void LRU_cache_should_work()
+        {
+            IList list = 
sqlMap.QueryForList("GetLruCachedAccountsViaResultMap", null);
+
+            int firstId = HashCodeProvider.GetIdentityHashCode(list);
+
+            list = sqlMap.QueryForList("GetLruCachedAccountsViaResultMap", 
null);
+
+            int secondId = HashCodeProvider.GetIdentityHashCode(list);
+
+            Assert.AreEqual(firstId, secondId);
+
+            list = sqlMap.QueryForList("GetLruCachedAccountsViaResultMap", 
null);
+
+            int thirdId = HashCodeProvider.GetIdentityHashCode(list);
+
+            Assert.AreEqual(firstId, thirdId);
+        }
+
                /// <summary>
                /// Test for JIRA 29
                /// </summary>

Modified: 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config?rev=655973&r1=655972&r2=655973&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config
 (original)
+++ 
ibatis/trunk/cs/V1/src/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config
 Tue May 13 11:56:24 2008
@@ -30,22 +30,22 @@
 
        <iBATIS>
                <logging>
-<!-- 
+
        <logFactoryAdapter 
type="IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA, IBatisNet.Common">
                                <arg key="showLogName" value="true" />
                                <arg key="showDataTime" value="true" />
                                <arg key="level" value="ALL" />
                                <arg key="dateTimeFormat" value="yyyy/MM/dd 
HH:mm:ss:SSS" />
                        </logFactoryAdapter>    
-  --> 
+   
  <!--      <logFactoryAdapter 
type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, 
IBatisNet.Common.Logging.Log4Net">
         <arg key="configType" value="inline" />
       </logFactoryAdapter> 
 -->
 
-     
+<!--      
      <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.NoOpLoggerFA, 
IBatisNet.Common" />
-
+-->
       
                </logging>
        </iBATIS>


Reply via email to