geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r917401 - in /geronimo/server/branches/2.1/plugins: clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/ tomcat/geronimo-tomcat6-clustering-wadi/ tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/ap...
Date Mon, 01 Mar 2010 06:23:46 GMT
Author: genspring
Date: Mon Mar  1 06:23:46 2010
New Revision: 917401

URL: http://svn.apache.org/viewvc?rev=917401&view=rev
Log:
GERONIMO-4940 CLONE -Tomcat Clustering with WADI - JSESSIONID with jvmRoute to support mod_jk
routing (G. 2.1.5)

Added:
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/JkRouter.java
      - copied unchanged from r775575, geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/JkRouter.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/Router.java
      - copied unchanged from r775575, geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/Router.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/JkRouterTest.java
      - copied unchanged from r775575, geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/JkRouterTest.java
Modified:
    geronimo/server/branches/2.1/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManager.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/   (props
changed)
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/AnAbstractClusteredValveTest.java
    geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java

Modified: geronimo/server/branches/2.1/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManager.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManager.java
(original)
+++ geronimo/server/branches/2.1/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManager.java
Mon Mar  1 06:23:46 2010
@@ -16,12 +16,13 @@
  */
 package org.apache.geronimo.clustering.wadi;
 
+import org.apache.geronimo.clustering.SessionManager;
 import org.codehaus.wadi.core.manager.Manager;
 
 /**
  * 
  * @version $Rev$ $Date$
  */
-public interface WADISessionManager {
+public interface WADISessionManager extends SessionManager {
     Manager getManager();
 }
\ No newline at end of file

Propchange: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Mar  1 06:23:46 2010
@@ -0,0 +1,2 @@
+/geronimo/server/branches/2.1.4/plugins/tomcat/geronimo-tomcat6-clustering-wadi:756973
+/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi:695597,695602,774775-775575

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java
Mon Mar  1 06:23:46 2010
@@ -34,9 +34,26 @@
  * @version $Rev:$ $Date:$
  */
 public abstract class AbstractClusteredValve extends ValveBase {
+    private final Router router;
+    
+    public AbstractClusteredValve(String nodeName) {
+        if (null == nodeName) {
+            throw new IllegalArgumentException("nodeName is required");
+        }
+        router = newRouter(nodeName);
+    }
+
+    protected Router newRouter(String nodeName) {
+        return new JkRouter(nodeName);
+    }
 
     @Override
     public void invoke(Request request, Response response) throws IOException, ServletException
{
+        if (null == request) {
+            next.invoke(request, response);
+            return;
+        }
+        
         ClusteredInvocation invocation = newClusteredInvocation(request, response);
         try {
             invocation.invoke();
@@ -64,13 +81,18 @@
         }
 
         protected void invokeLocally() throws ClusteredInvocationException {
+            String oldRequestedSessionId = router.replaceRoutingInfoInRequestedSessionId(request);
             try {
                 next.invoke(request, response);
             } catch (IOException e) {
                 throw new ClusteredInvocationException(e);
             } catch (ServletException e) {
                 throw new ClusteredInvocationException(e);
+            } finally {
+                request.setRequestedSessionId(oldRequestedSessionId);
             }
+            
+            router.writeSessionIdWithRoutingInfo(request, response);
         }
 
         public String getRequestedSessionId() {

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java
Mon Mar  1 06:23:46 2010
@@ -19,8 +19,7 @@
 
 package org.apache.geronimo.tomcat.cluster;
 
-import java.io.IOException;
-
+import org.apache.catalina.LifecycleException;
 import org.apache.catalina.Session;
 import org.apache.catalina.session.StandardManager;
 import org.apache.catalina.session.StandardSession;
@@ -34,27 +33,38 @@
  */
 public class ClusteredManager extends StandardManager {
     private final SessionManager sessionManager;
+    private final String nodeName;
+    private final Router router;
 
     public ClusteredManager(SessionManager sessionManager) {
         if (null == sessionManager) {
             throw new IllegalArgumentException("sessionManager is required");
         }
         this.sessionManager = sessionManager;
+        
+        nodeName = sessionManager.getNode().getName();
+        router = newRouter(nodeName);
 
         sessionManager.registerListener(new MigrationListener());
     }
+    
+    protected Router newRouter(String nodeName) {
+        return new JkRouter(nodeName);
+    }
 
     @Override
-    public Session createEmptySession() {
-        return new ClusteredSession();
+    public String getJvmRoute() {
+        return nodeName;
     }
-
+    
     @Override
-    protected void doLoad() throws ClassNotFoundException, IOException {
+    public void stop() throws LifecycleException {
+        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
     }
-
+    
     @Override
-    protected void doUnload() throws IOException {
+    public Session createEmptySession() {
+        return new ClusteredSession();
     }
 
     @Override
@@ -81,10 +91,12 @@
         }
         
         protected ClusteredSession getClusteredSession(org.apache.geronimo.clustering.Session
session) {
-            return (ClusteredSession) ClusteredManager.this.sessions.get(session.getSessionId());
+            String sessionId = session.getSessionId();
+            sessionId = router.transformGlobalSessionIdToSessionId(sessionId);
+            return (ClusteredSession) ClusteredManager.this.sessions.get(sessionId);
         }
     }
-
+    
     public class ClusteredSession extends StandardSession {
         private org.apache.geronimo.clustering.Session session;
 
@@ -97,8 +109,9 @@
             this.session = session;
             
             attributes = session.getState();
-
-            super.setId(session.getSessionId());
+            
+            String sessionId = router.transformGlobalSessionIdToSessionId(session.getSessionId());
+            super.setId(sessionId);
             setValid(true);
             setNew(false);
         }
@@ -106,15 +119,22 @@
         @Override
         public void setId(String id) {
             super.setId(id);
+            
+            newUnderlyingSession(id);
+            
+            attributes = session.getState();
+        }
+
+        protected void newUnderlyingSession(String id) {
+            String globalSessionId = router.transformSessionIdToGlobalSessionId(id);
+            
             try {
-                session = sessionManager.createSession(id);
+                session = sessionManager.createSession(globalSessionId);
             } catch (SessionAlreadyExistException e) {
                 throw (IllegalStateException) new IllegalStateException().initCause(e);
             }
-            
-            attributes = session.getState();
         }
-        
+
         @Override
         public void invalidate() throws IllegalStateException {
             super.invalidate();

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java
Mon Mar  1 06:23:46 2010
@@ -19,28 +19,18 @@
 
 package org.apache.geronimo.tomcat.cluster.wadi;
 
-import java.io.BufferedReader;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
 
 import javax.servlet.FilterChain;
-import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
 
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.geronimo.clustering.ClusteredInvocation;
 import org.apache.geronimo.clustering.ClusteredInvocationException;
+import org.apache.geronimo.clustering.wadi.WADISessionManager;
 import org.apache.geronimo.tomcat.cluster.AbstractClusteredValve;
 import org.codehaus.wadi.core.contextualiser.InvocationException;
 import org.codehaus.wadi.core.manager.Manager;
@@ -54,8 +44,9 @@
 public class WADIClusteredValve extends AbstractClusteredValve {
     private final Manager wadiManager;
 
-    public WADIClusteredValve(Manager wadiManager) {
-        this.wadiManager = wadiManager;
+    public WADIClusteredValve(WADISessionManager sessionManager) {
+        super(sessionManager.getNode().getName());
+        this.wadiManager = sessionManager.getManager();
     }
     
     protected ClusteredInvocation newClusteredInvocation(Request request, Response response)
{
@@ -79,7 +70,7 @@
                     }
                 }
             };
-            invocation.init(null == request? NoOpHttpServletRequest.SINGLETON: request, response,
chainAdapter);
+            invocation.init(request, response, chainAdapter);
             try {
                 wadiManager.contextualise(invocation);
             } catch (InvocationException e) {
@@ -94,226 +85,5 @@
             }
         }
     }
-
-    protected static class NoOpHttpServletRequest implements HttpServletRequest {
-        public static final NoOpHttpServletRequest SINGLETON = new NoOpHttpServletRequest();
-
-        public String getAuthType() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getContextPath() {
-            throw new UnsupportedOperationException();
-        }
-
-        public Cookie[] getCookies() {
-            throw new UnsupportedOperationException();
-        }
-
-        public long getDateHeader(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getHeader(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Enumeration getHeaderNames() {
-            throw new UnsupportedOperationException();
-        }
-
-        public Enumeration getHeaders(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public int getIntHeader(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getMethod() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getPathInfo() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getPathTranslated() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getQueryString() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getRemoteUser() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getRequestURI() {
-            throw new UnsupportedOperationException();
-        }
-
-        public StringBuffer getRequestURL() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getRequestedSessionId() {
-            return null;
-        }
-
-        public String getServletPath() {
-            throw new UnsupportedOperationException();
-        }
-
-        public HttpSession getSession() {
-            throw new UnsupportedOperationException();
-        }
-
-        public HttpSession getSession(boolean arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Principal getUserPrincipal() {
-            throw new UnsupportedOperationException();
-        }
-
-        public boolean isRequestedSessionIdFromCookie() {
-            throw new UnsupportedOperationException();
-        }
-
-        public boolean isRequestedSessionIdFromURL() {
-            throw new UnsupportedOperationException();
-        }
-
-        public boolean isRequestedSessionIdFromUrl() {
-            throw new UnsupportedOperationException();
-        }
-
-        public boolean isRequestedSessionIdValid() {
-            throw new UnsupportedOperationException();
-        }
-
-        public boolean isUserInRole(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Object getAttribute(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Enumeration getAttributeNames() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getCharacterEncoding() {
-            throw new UnsupportedOperationException();
-        }
-
-        public int getContentLength() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getContentType() {
-            throw new UnsupportedOperationException();
-        }
-
-        public ServletInputStream getInputStream() throws IOException {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getLocalAddr() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getLocalName() {
-            throw new UnsupportedOperationException();
-        }
-
-        public int getLocalPort() {
-            throw new UnsupportedOperationException();
-        }
-
-        public Locale getLocale() {
-            throw new UnsupportedOperationException();
-        }
-
-        public Enumeration getLocales() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getParameter(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Map getParameterMap() {
-            throw new UnsupportedOperationException();
-        }
-
-        public Enumeration getParameterNames() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String[] getParameterValues(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getProtocol() {
-            throw new UnsupportedOperationException();
-        }
-
-        public BufferedReader getReader() throws IOException {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getRealPath(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getRemoteAddr() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getRemoteHost() {
-            throw new UnsupportedOperationException();
-        }
-
-        public int getRemotePort() {
-            throw new UnsupportedOperationException();
-        }
-
-        public RequestDispatcher getRequestDispatcher(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getScheme() {
-            throw new UnsupportedOperationException();
-        }
-
-        public String getServerName() {
-            throw new UnsupportedOperationException();
-        }
-
-        public int getServerPort() {
-            throw new UnsupportedOperationException();
-        }
-
-        public boolean isSecure() {
-            throw new UnsupportedOperationException();
-        }
-
-        public void removeAttribute(String arg0) {
-            throw new UnsupportedOperationException();
-        }
-
-        public void setAttribute(String arg0, Object arg1) {
-            throw new UnsupportedOperationException();
-        }
-
-        public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException
{
-            throw new UnsupportedOperationException();
-        }
-        
-    }
     
 }

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java
Mon Mar  1 06:23:46 2010
@@ -25,7 +25,6 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.tomcat.ObjectRetriever;
-import org.codehaus.wadi.core.manager.Manager;
 
 
 /**
@@ -34,18 +33,16 @@
  */
 public class WADIClusteredValveRetriever implements ObjectRetriever, GBeanLifecycle {
     private final WADISessionManager sessionManager;
-    private Manager wadiManager;
 
     public WADIClusteredValveRetriever(WADISessionManager sessionManager) {
         this.sessionManager = sessionManager;
     }
     
     public Object getInternalObject() {
-        return new WADIClusteredValve(wadiManager);
+        return new WADIClusteredValve(sessionManager);
     }
 
     public void doStart() throws Exception {
-        wadiManager = sessionManager.getManager();
     }
     
     public void doStop() throws Exception {

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/AnAbstractClusteredValveTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/AnAbstractClusteredValveTest.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/AnAbstractClusteredValveTest.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/AnAbstractClusteredValveTest.java
Mon Mar  1 06:23:46 2010
@@ -44,7 +44,7 @@
 
     @Override
     protected void setUp() throws Exception {
-        valve = new AbstractClusteredValve() {
+        valve = new AbstractClusteredValve("NODE") {
             @Override
             protected ClusteredInvocation newClusteredInvocation(Request request, Response
response) {
                 return new WebClusteredInvocation(request, response) {
@@ -100,7 +100,7 @@
     
     public void testCIEIsWrappedAsIOE() throws Exception {
         final ClusteredInvocationException expected = new ClusteredInvocationException();
-        valve = new AbstractClusteredValve() {
+        valve = new AbstractClusteredValve("NODE") {
             @Override
             protected ClusteredInvocation newClusteredInvocation(Request request, Response
response) {
                 return new WebClusteredInvocation(request, response) {

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java?rev=917401&r1=917400&r2=917401&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java
Mon Mar  1 06:23:46 2010
@@ -43,12 +43,16 @@
 public class ClusteredManagerTest extends RMockTestCase {
     private SessionManager sessionManager;
     private SessionListener sessionListener;
+    private String globalSessionId;
     private String sessionId;
     private Context context;
+    private String nodeName;
 
     @Override
     protected void setUp() throws Exception {
-        sessionId = "sessionId";
+        globalSessionId = "sessionId";
+        nodeName = "NODE";
+        sessionId = globalSessionId + "." + nodeName;
 
         sessionManager = (SessionManager) mock(SessionManager.class);
         sessionManager.registerListener(null);
@@ -62,6 +66,9 @@
             }
         });
 
+        sessionManager.getNode().getName();
+        modify().returnValue(nodeName);
+        
         context = (Context) mock(Context.class);
         
         context.getSessionTimeout();
@@ -172,7 +179,7 @@
     }
     
     private org.apache.geronimo.clustering.Session recordCreateUnderlyingSession() throws
Exception {
-        org.apache.geronimo.clustering.Session underlyingSession = sessionManager.createSession(sessionId);
+        org.apache.geronimo.clustering.Session underlyingSession = sessionManager.createSession(globalSessionId);
         recordUnderlyingSessionState(underlyingSession);
         
         return underlyingSession;
@@ -180,7 +187,7 @@
 
     private void recordUnderlyingSessionState(org.apache.geronimo.clustering.Session underlyingSession)
{
         underlyingSession.getSessionId();
-        modify().multiplicity(expect.from(0)).returnValue(sessionId);
+        modify().multiplicity(expect.from(0)).returnValue(globalSessionId);
         
         underlyingSession.getState();
         Map attributes = new HashMap();



Mime
View raw message