[jboss-cvs] JBossAS SVN: r108019 - in projects/cluster/ha-server-cache-ispn/trunk: src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 7 15:27:31 EDT 2010


Author: pferraro
Date: 2010-09-07 15:27:30 -0400 (Tue, 07 Sep 2010)
New Revision: 108019

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/pom.xml
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java
Log:
Upgrade ha-server-cache-spi to 3.0.0.Alpha6.
Create cache name from LocalDistributableSessionManager.getName() instead of obsolete getHostName()/getContextName().

Modified: projects/cluster/ha-server-cache-ispn/trunk/pom.xml
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/pom.xml	2010-09-07 19:22:25 UTC (rev 108018)
+++ projects/cluster/ha-server-cache-ispn/trunk/pom.xml	2010-09-07 19:27:30 UTC (rev 108019)
@@ -30,7 +30,7 @@
   </scm>
   
   <properties>
-    <version.jboss.ha.server.cache.spi>3.0.0.Alpha5</version.jboss.ha.server.cache.spi>
+    <version.jboss.ha.server.cache.spi>3.0.0.Alpha6</version.jboss.ha.server.cache.spi>
     <version.jboss.ha.server.core>1.0.0.Alpha5</version.jboss.ha.server.core>
     <version.jboss.ha.server.ispn>1.0.0.Alpha11</version.jboss.ha.server.ispn>
     <version.junit>4.8.1</version.junit>

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java	2010-09-07 19:22:25 UTC (rev 108018)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java	2010-09-07 19:27:30 UTC (rev 108019)
@@ -61,14 +61,8 @@
          }
       }
       
-      String hostName = manager.getHostName();
-      String host = (hostName == null) || hostName.isEmpty() ? "localhost" : hostName;
+      String cacheName = manager.getName();
       
-      String context = manager.getContextName();
-      String path = context.isEmpty() || context.equals("/") ? "ROOT" : context.startsWith("/") ? context.substring(1) : context;
-      
-      String cacheName = host + "/" + path;
-      
       EmbeddedCacheManager container = this.registry.getCacheContainer(containerName);
       
       this.applyOverrides(container.defineConfiguration(cacheName, templateCacheName, new Configuration()), config);

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java	2010-09-07 19:22:25 UTC (rev 108018)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java	2010-09-07 19:27:30 UTC (rev 108019)
@@ -64,62 +64,55 @@
       config.setReplicationMode(null);
       config.setBackups(null);
       
-      // Validate host contribution to cache name
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
-      this.getCache("standard-session-cache", null, "", "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
-      this.getCache("standard-session-cache", null, "host1", "", "host1/ROOT", config, configuration, CacheMode.REPL_ASYNC);
-
-      // Validate context path contribution to cache name
-      this.getCache("standard-session-cache", null, null, "/", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
-      this.getCache("standard-session-cache", null, null, "/context1", "localhost/context1", config, configuration, CacheMode.REPL_ASYNC);
-      this.getCache("standard-session-cache", null, null, "/path/context1", "localhost/path/context1", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context1", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context2", config, configuration, CacheMode.REPL_ASYNC);
       
       // Validate cache container qualified cache name
       config.setCacheName("default/session-cache");
-      this.getCache("default", "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache("default", "session-cache", "//host/context", config, configuration, CacheMode.REPL_ASYNC);
       
       config.setCacheName(null);
-      this.getCache(null, null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache(null, null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
       
       config.setCacheName("standard-session-cache");
       config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_SYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_SYNC);
       
       config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
       
       config.setBackups(Integer.valueOf(-1));
       config.setReplicationMode(null);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
       
       config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_SYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_SYNC);
       
       config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.REPL_ASYNC);
       
       config.setBackups(Integer.valueOf(0));
       config.setReplicationMode(null);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.LOCAL);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL);
       
       config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.LOCAL);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL);
       
       config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.LOCAL);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.LOCAL);
       
       config.setBackups(Integer.valueOf(1));
       config.setReplicationMode(null);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.DIST_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_ASYNC);
       
       config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.DIST_SYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_SYNC);
       
       config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.getCache("standard-session-cache", null, null, "", "localhost/ROOT", config, configuration, CacheMode.DIST_ASYNC);
+      this.getCache("standard-session-cache", null, "//host/context", config, configuration, CacheMode.DIST_ASYNC);
    }
    
-   private void getCache(String containerName, String templateCacheName, String hostName, String contextName, String cacheName, ReplicationConfig config, Configuration configuration, CacheMode mode)
+   private void getCache(String containerName, String templateCacheName, String cacheName, ReplicationConfig config, Configuration configuration, CacheMode mode)
    {
       @SuppressWarnings("unchecked")
       Cache<Object, Object> cache = this.control.createMock(Cache.class);
@@ -130,8 +123,7 @@
       EasyMock.expect(manager.getReplicationConfig()).andReturn(config);
       
       EasyMock.expect(registry.getCacheContainer(containerName)).andReturn(container);
-      EasyMock.expect(manager.getHostName()).andReturn(hostName);
-      EasyMock.expect(manager.getContextName()).andReturn(contextName);
+      EasyMock.expect(manager.getName()).andReturn(cacheName);
       EasyMock.expect(container.defineConfiguration(cacheName, templateCacheName, new Configuration())).andReturn(cacheConfiguration);
       EasyMock.expect(container.getCache(cacheName)).andReturn(cache);
       



More information about the jboss-cvs-commits mailing list