ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1573540 - in /webservices/wss4j/trunk/ws-security-common/src/test: java/org/apache/wss4j/common/cache/EHCacheManagerHolderTest.java resources/test-ehcache2.xml
Date Mon, 03 Mar 2014 12:31:19 GMT
Author: coheigea
Date: Mon Mar  3 12:31:19 2014
New Revision: 1573540

URL: http://svn.apache.org/r1573540
Log:
Added a caching test

Added:
    webservices/wss4j/trunk/ws-security-common/src/test/resources/test-ehcache2.xml
Modified:
    webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/cache/EHCacheManagerHolderTest.java

Modified: webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/cache/EHCacheManagerHolderTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/cache/EHCacheManagerHolderTest.java?rev=1573540&r1=1573539&r2=1573540&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/cache/EHCacheManagerHolderTest.java
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/cache/EHCacheManagerHolderTest.java
Mon Mar  3 12:31:19 2014
@@ -21,7 +21,7 @@ package org.apache.wss4j.common.cache;
 
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Status;
-
+import net.sf.ehcache.config.CacheConfiguration;
 import net.sf.ehcache.config.Configuration;
 import net.sf.ehcache.config.ConfigurationFactory;
 
@@ -55,4 +55,27 @@ public class EHCacheManagerHolderTest ex
         assertEquals(Status.STATUS_SHUTDOWN, manager2.getStatus());
         
     }
+    
+    @Test
+    public void testCacheNames() {
+        CacheManager cacheManager = 
+            EHCacheManagerHolder.getCacheManager("testCache2", 
+                                                 EHCacheManagerHolder.class.getResource("/test-ehcache2.xml"));
+        
+        String key = "org.apache.wss4j.TokenStore";
+        CacheConfiguration cacheConfig = 
+            EHCacheManagerHolder.getCacheConfiguration(key, cacheManager);
+        assertEquals(3600, cacheConfig.getTimeToIdleSeconds());
+        
+        key = "org.apache.wss4j.TokenStore-{http://ws.apache.org}wss4j";
+        CacheConfiguration cacheConfig2 = 
+            EHCacheManagerHolder.getCacheConfiguration(key, cacheManager);
+        assertEquals(360000, cacheConfig2.getTimeToIdleSeconds());
+        
+        key = "org.apache.wss4j.TokenStore-{http://ws.apache.org}wss4junknown";
+        CacheConfiguration cacheConfig3 = 
+            EHCacheManagerHolder.getCacheConfiguration(key, cacheManager);
+        assertEquals(3600, cacheConfig3.getTimeToIdleSeconds());
+        
+    }
 }

Added: webservices/wss4j/trunk/ws-security-common/src/test/resources/test-ehcache2.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/test/resources/test-ehcache2.xml?rev=1573540&view=auto
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/test/resources/test-ehcache2.xml (added)
+++ webservices/wss4j/trunk/ws-security-common/src/test/resources/test-ehcache2.xml Mon Mar
 3 12:31:19 2014
@@ -0,0 +1,11 @@
+<ehcache xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false" monitoring="autodetect"
dynamicConfig="true">
+
+    <diskStore path="java.io.tmpdir"/>
+
+    <cache name="org.apache.wss4j.TokenStore" overflowToDisk="false" maxEntriesLocalHeap="10000"

+           timeToIdleSeconds="3600" timeToLiveSeconds="3600"/>
+           
+    <cache name="org.apache.wss4j.TokenStore-{http://ws.apache.org}wss4j" overflowToDisk="false"
maxEntriesLocalHeap="10000" 
+           timeToIdleSeconds="360000" timeToLiveSeconds="3600"/>
+           
+</ehcache>



Mime
View raw message