[jboss-cvs] JBossAS SVN: r95441 - in branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster: web/jvmroute and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 22 16:02:11 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-10-22 16:02:11 -0400 (Thu, 22 Oct 2009)
New Revision: 95441

Added:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockClusteredManager.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManager.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManagerFactory.java
Removed:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockDistributedCacheManager.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockJBossManager.java
Modified:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JvmRouteValveUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockSession.java
Log:
Rearrange clustered web test mock classes

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JvmRouteValveUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JvmRouteValveUnitTestCase.java	2009-10-22 19:46:31 UTC (rev 95440)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JvmRouteValveUnitTestCase.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -27,8 +27,8 @@
 import org.apache.catalina.Session;
 import org.apache.catalina.connector.Response;
 import org.jboss.logging.Logger;
-import org.jboss.test.cluster.web.jvmroute.MockJBossManager;
 import org.jboss.test.cluster.web.jvmroute.MockRequest;
+import org.jboss.test.cluster.web.mocks.MockClusteredManager;
 import org.jboss.test.cluster.web.mocks.MockValve;
 import org.jboss.web.tomcat.service.session.JvmRouteValve;
 
@@ -64,7 +64,7 @@
    {
       log.info("Enter testNonFailover");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -92,7 +92,7 @@
    {
       log.info("Enter testFailover");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -121,7 +121,7 @@
    {
       log.info("Enter testFailoverFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -150,7 +150,7 @@
    {
       log.info("Enter testFailoverMismatchBadReq");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -178,7 +178,7 @@
    {
       log.info("Enter testFailoverMismatchBadReqFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -207,7 +207,7 @@
    {
       log.info("Enter testFailoverMismatchBadSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -235,7 +235,7 @@
    {
       log.info("Enter testFailoverMismatchBadSessionFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -264,7 +264,7 @@
    {
       log.info("Enter testNoSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -290,7 +290,7 @@
    {
       log.info("Enter testNoSessionFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -317,7 +317,7 @@
    {
       log.info("Enter testFailoverNoSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -344,7 +344,7 @@
    {
       log.info("Enter testNoSessionNoRequestedSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -370,7 +370,7 @@
    {
       log.info("Enter testSessionNoRequestedSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -397,7 +397,7 @@
    {
       log.info("Enter testSessionNoRequestedSessionFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -425,7 +425,7 @@
    {
       log.info("Enter testFailoverSessionNoRequestedSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -452,7 +452,7 @@
    {
       log.info("Enter testFailoverSessionNoRequestedSessionFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -480,7 +480,7 @@
    {
       log.info("Enter testNoJvmRouteSession");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -508,7 +508,7 @@
    {
       log.info("Enter testNoJvmRouteSessionFromURL");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -537,7 +537,7 @@
    {
       log.info("Enter testNoJvmRouteRequest");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -565,7 +565,7 @@
    {
       log.info("Enter testNoJvmRouteRequest");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);
@@ -594,7 +594,7 @@
    {
       log.info("Enter testJvmRouteIncludesDomain");
       
-      MockJBossManager mgr = new MockJBossManager();
+      MockClusteredManager mgr = new MockClusteredManager();
       mgr.setJvmRoute(DOMAIN_JVM_ROUTE);
        
       JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockDistributedCacheManager.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockDistributedCacheManager.java	2009-10-22 19:46:31 UTC (rev 95440)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockDistributedCacheManager.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.test.cluster.web.jvmroute;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockDistributedCacheManager implements DistributedCacheManager<OutgoingDistributableSessionData>
-{
-   public static final MockDistributedCacheManager INSTANCE = new MockDistributedCacheManager();
-   
-
-   public void evictSession(String realId)
-   {
-      // no-op
-   }
-
-   public void evictSession(String realId, String dataOwner)
-   {
-      // no-op
-   }
-
-   public Object getAttribute(String realId, String key)
-   {
-      return null;
-   }
-
-   public Set<String> getAttributeKeys(String realId)
-   {
-      return Collections.emptySet();
-   }
-
-   public Map<String, Object> getAttributes(String realId)
-   {
-      return Collections.emptyMap();
-   }
-
-   public BatchingManager getBatchingManager()
-   {
-      return null;
-   }
-
-   public IncomingDistributableSessionData getSessionData(String realId, boolean initialLoad)
-   {
-      return null;
-   }
-
-   public IncomingDistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes)
-   {
-      return null;
-   }
-
-   public Map<String, String> getSessionIds()
-   {
-      return Collections.emptyMap();
-   }
-
-   public boolean isPassivationEnabled()
-   {
-      return false;
-   }
-
-   public void putAttribute(String realId, Map<String, Object> map)
-   {
-      // no-op
-   }
-
-   public void putAttribute(String realId, String key, Object value)
-   {
-      // no-op
-   }
-   
-   
-
-   public Object removeAttribute(String realId, String key)
-   {
-      return null;
-   }
-
-   public void removeAttributeLocal(String realId, String key)
-   {
-   // no-op
-   }
-
-   public void removeAttributes(String realId)
-   {
-      // no-op
-   }
-
-   public void removeAttributesLocal(String realId)
-   {
-      // no-op
-   }
-
-   public void removeSession(String realId)
-   {
-      // no-op
-   }
-
-   public void removeSessionLocal(String realId)
-   {
-      // no-op
-   }
-
-   public void removeSessionLocal(String realId, String dataOwner)
-   {
-      // no-op
-   }
-
-   public void start()
-   {
-      // no-op
-   }
-
-   public void stop()
-   {
-      // no-op
-   }
-
-   public boolean getSupportsAttributeOperations()
-   {
-      return true;
-   }
-
-   public void sessionCreated(String realId)
-   {
-      // no-op
-   }
-
-   public void storeSessionData(OutgoingDistributableSessionData sessionData)
-   {
-      // no-op      
-   }
-
-}

Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockJBossManager.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockJBossManager.java	2009-10-22 19:46:31 UTC (rev 95440)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockJBossManager.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -1,276 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.test.cluster.web.jvmroute;
-
-import java.beans.PropertyChangeListener;
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.catalina.Container;
-import org.apache.catalina.Session;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.jboss.ReplicationTrigger;
-import org.jboss.web.tomcat.service.session.ClusteredManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
-import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy;
-import org.jboss.web.tomcat.service.session.notification.LegacyClusteredSessionNotificationPolicy;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockJBossManager implements ClusteredManager<OutgoingDistributableSessionData>
-{
-   private String jvmRoute = null;
-   private String newCookieIdSession = null;
-   private Session session = null;
-   
-   /**
-    * Create a new MockJBossManager.
-    * 
-    */
-   public MockJBossManager()
-   {      
-   }
-
-   public String getJvmRoute()
-   {
-      return jvmRoute;
-   }
-   
-   public void setJvmRoute(String jvmRoute)
-   {
-      this.jvmRoute = jvmRoute;
-   }
-
-   public void setNewSessionCookie(String sessionId, HttpServletResponse response)
-   {
-      newCookieIdSession = sessionId;
-   }
-   
-   public String getNewCookieIdSession()
-   {
-      return newCookieIdSession;
-   }
-
-   public Session createSession(String s)
-   {
-      Session session = new MockSession(this);
-      session.setId(s);
-      return session;
-   }
-
-   public Session findSession(String s) throws IOException
-   {
-      return session;
-   }
-   
-   public void add(Session session)
-   {
-      this.session = session;
-   }
-
-   public ReplicationTrigger getReplicationTrigger()
-   {
-      return ReplicationTrigger.SET_AND_NON_PRIMITIVE_GET;
-   }
-
-   public void init(String name, JBossWebMetaData webMetaData) throws ClusteringNotSupportedException
-   {      
-
-   }
-
-   public void removeLocal(Session session)
-   {
-   }
-
-   public boolean storeSession(Session session)
-   {
-      return false;
-   }
-
-   public void addPropertyChangeListener(PropertyChangeListener propertychangelistener)
-   {
-   }
-
-   public void backgroundProcess()
-   {
-   }
-
-   public Session createEmptySession()
-   {
-      return null;
-   }
-
-   public Session createSession()
-   {
-      return null;
-   }
-
-   public Session[] findSessions()
-   {
-      return null;
-   }
-
-   public int getActiveSessions()
-   {
-      return 0;
-   }
-
-   public Container getContainer()
-   {
-      return null;
-   }
-
-   public boolean getDistributable()
-   {
-      return false;
-   }
-
-   public int getExpiredSessions()
-   {
-      return 0;
-   }
-
-   public String getInfo()
-   {
-      return null;
-   }
-
-   public int getMaxActive()
-   {
-      return 0;
-   }
-
-   public int getMaxInactiveInterval()
-   {
-      return 0;
-   }
-
-   public int getRejectedSessions()
-   {
-      return 0;
-   }
-
-   public int getSessionAverageAliveTime()
-   {
-      return 0;
-   }
-
-   public int getSessionCounter()
-   {
-      return 0;
-   }
-
-   public int getSessionIdLength()
-   {
-      return 0;
-   }
-
-   public int getSessionMaxAliveTime()
-   {
-      return 0;
-   }
-
-   public void load() throws ClassNotFoundException, IOException
-   {
-   }
-
-   public void remove(Session session)
-   {
-   }
-
-   public void removePropertyChangeListener(PropertyChangeListener propertychangelistener)
-   {
-   }
-
-   public void setContainer(Container container)
-   {
-   }
-
-   public void setDistributable(boolean flag)
-   {
-   }
-
-   public void setExpiredSessions(int i)
-   {
-   }
-
-   public void setMaxActive(int i)
-   {
-   }
-   
-   public void setMaxInactiveInterval(int i)
-   {
-   }
-
-   public void setRejectedSessions(int i)
-   {
-   }
-
-   public void setSessionAverageAliveTime(int i)
-   {
-   }
-
-   public void setSessionCounter(int i)
-   {
-   }
-
-   public void setSessionIdLength(int i)
-   {
-   }
-
-   public void setSessionMaxAliveTime(int i)
-   {
-   }
-
-   public void unload() throws IOException
-   {
-   }
-
-   public DistributedCacheManager getDistributedCacheManager()
-   {
-      return MockDistributedCacheManager.INSTANCE;
-   }
-
-   public int getMaxUnreplicatedInterval()
-   {
-      return -1;
-   }
-
-   public ClusteredSessionNotificationPolicy getNotificationPolicy()
-   {
-      return new LegacyClusteredSessionNotificationPolicy();
-   }
-
-   public boolean getUseJK()
-   {
-      return true;
-   }
-   
-   
-
-}

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockSession.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockSession.java	2009-10-22 19:46:31 UTC (rev 95440)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockSession.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -25,6 +25,7 @@
 import javax.servlet.http.HttpSession;
 
 import org.apache.catalina.session.StandardSessionFacade;
+import org.jboss.test.cluster.web.mocks.MockClusteredManager;
 import org.jboss.web.tomcat.service.session.ClusteredSession;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
 import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause;
@@ -43,7 +44,7 @@
     * 
     * @param manager
     */
-   public MockSession(MockJBossManager manager)
+   public MockSession(MockClusteredManager manager)
    {
       super(manager);
    }

Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockClusteredManager.java (from rev 94983, branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockJBossManager.java)
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockClusteredManager.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockClusteredManager.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -0,0 +1,277 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.cluster.web.mocks;
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Session;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
+import org.jboss.test.cluster.web.jvmroute.MockSession;
+import org.jboss.web.tomcat.service.session.ClusteredManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy;
+import org.jboss.web.tomcat.service.session.notification.LegacyClusteredSessionNotificationPolicy;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockClusteredManager implements ClusteredManager<OutgoingDistributableSessionData>
+{
+   private String jvmRoute = null;
+   private String newCookieIdSession = null;
+   private Session session = null;
+   
+   /**
+    * Create a new MockJBossManager.
+    * 
+    */
+   public MockClusteredManager()
+   {      
+   }
+
+   public String getJvmRoute()
+   {
+      return jvmRoute;
+   }
+   
+   public void setJvmRoute(String jvmRoute)
+   {
+      this.jvmRoute = jvmRoute;
+   }
+
+   public void setNewSessionCookie(String sessionId, HttpServletResponse response)
+   {
+      newCookieIdSession = sessionId;
+   }
+   
+   public String getNewCookieIdSession()
+   {
+      return newCookieIdSession;
+   }
+
+   public Session createSession(String s)
+   {
+      Session session = new MockSession(this);
+      session.setId(s);
+      return session;
+   }
+
+   public Session findSession(String s) throws IOException
+   {
+      return session;
+   }
+   
+   public void add(Session session)
+   {
+      this.session = session;
+   }
+
+   public ReplicationTrigger getReplicationTrigger()
+   {
+      return ReplicationTrigger.SET_AND_NON_PRIMITIVE_GET;
+   }
+
+   public void init(String name, JBossWebMetaData webMetaData) throws ClusteringNotSupportedException
+   {      
+
+   }
+
+   public void removeLocal(Session session)
+   {
+   }
+
+   public boolean storeSession(Session session)
+   {
+      return false;
+   }
+
+   public void addPropertyChangeListener(PropertyChangeListener propertychangelistener)
+   {
+   }
+
+   public void backgroundProcess()
+   {
+   }
+
+   public Session createEmptySession()
+   {
+      return null;
+   }
+
+   public Session createSession()
+   {
+      return null;
+   }
+
+   public Session[] findSessions()
+   {
+      return null;
+   }
+
+   public int getActiveSessions()
+   {
+      return 0;
+   }
+
+   public Container getContainer()
+   {
+      return null;
+   }
+
+   public boolean getDistributable()
+   {
+      return false;
+   }
+
+   public int getExpiredSessions()
+   {
+      return 0;
+   }
+
+   public String getInfo()
+   {
+      return null;
+   }
+
+   public int getMaxActive()
+   {
+      return 0;
+   }
+
+   public int getMaxInactiveInterval()
+   {
+      return 0;
+   }
+
+   public int getRejectedSessions()
+   {
+      return 0;
+   }
+
+   public int getSessionAverageAliveTime()
+   {
+      return 0;
+   }
+
+   public int getSessionCounter()
+   {
+      return 0;
+   }
+
+   public int getSessionIdLength()
+   {
+      return 0;
+   }
+
+   public int getSessionMaxAliveTime()
+   {
+      return 0;
+   }
+
+   public void load() throws ClassNotFoundException, IOException
+   {
+   }
+
+   public void remove(Session session)
+   {
+   }
+
+   public void removePropertyChangeListener(PropertyChangeListener propertychangelistener)
+   {
+   }
+
+   public void setContainer(Container container)
+   {
+   }
+
+   public void setDistributable(boolean flag)
+   {
+   }
+
+   public void setExpiredSessions(int i)
+   {
+   }
+
+   public void setMaxActive(int i)
+   {
+   }
+   
+   public void setMaxInactiveInterval(int i)
+   {
+   }
+
+   public void setRejectedSessions(int i)
+   {
+   }
+
+   public void setSessionAverageAliveTime(int i)
+   {
+   }
+
+   public void setSessionCounter(int i)
+   {
+   }
+
+   public void setSessionIdLength(int i)
+   {
+   }
+
+   public void setSessionMaxAliveTime(int i)
+   {
+   }
+
+   public void unload() throws IOException
+   {
+   }
+
+   public DistributedCacheManager getDistributedCacheManager()
+   {
+      return MockDistributedCacheManager.INSTANCE;
+   }
+
+   public int getMaxUnreplicatedInterval()
+   {
+      return -1;
+   }
+
+   public ClusteredSessionNotificationPolicy getNotificationPolicy()
+   {
+      return new LegacyClusteredSessionNotificationPolicy();
+   }
+
+   public boolean getUseJK()
+   {
+      return true;
+   }
+   
+   
+
+}

Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManager.java (from rev 94983, branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/jvmroute/MockDistributedCacheManager.java)
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManager.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManager.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -0,0 +1,195 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.cluster.web.mocks;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockDistributedCacheManager implements DistributedCacheManager<OutgoingDistributableSessionData>
+{
+   public static final MockDistributedCacheManager INSTANCE = new MockDistributedCacheManager();
+   
+
+   public void evictSession(String realId)
+   {
+      // no-op
+   }
+
+   public void evictSession(String realId, String dataOwner)
+   {
+      // no-op
+   }
+
+   public Object getAttribute(String realId, String key)
+   {
+      return null;
+   }
+
+   public Set<String> getAttributeKeys(String realId)
+   {
+      return Collections.emptySet();
+   }
+
+   public Map<String, Object> getAttributes(String realId)
+   {
+      return Collections.emptyMap();
+   }
+
+   public BatchingManager getBatchingManager()
+   {
+      return MockBatchingManager.INSTANCE;
+   }
+
+   public IncomingDistributableSessionData getSessionData(String realId, boolean initialLoad)
+   {
+      return null;
+   }
+
+   public IncomingDistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes)
+   {
+      return null;
+   }
+
+   public Map<String, String> getSessionIds()
+   {
+      return Collections.emptyMap();
+   }
+
+   public boolean isPassivationEnabled()
+   {
+      return false;
+   }
+
+   public void putAttribute(String realId, Map<String, Object> map)
+   {
+      // no-op
+   }
+
+   public void putAttribute(String realId, String key, Object value)
+   {
+      // no-op
+   }
+   
+   
+
+   public Object removeAttribute(String realId, String key)
+   {
+      return null;
+   }
+
+   public void removeAttributeLocal(String realId, String key)
+   {
+   // no-op
+   }
+
+   public void removeAttributes(String realId)
+   {
+      // no-op
+   }
+
+   public void removeAttributesLocal(String realId)
+   {
+      // no-op
+   }
+
+   public void removeSession(String realId)
+   {
+      // no-op
+   }
+
+   public void removeSessionLocal(String realId)
+   {
+      // no-op
+   }
+
+   public void removeSessionLocal(String realId, String dataOwner)
+   {
+      // no-op
+   }
+
+   public void start()
+   {
+      // no-op
+   }
+
+   public void stop()
+   {
+      // no-op
+   }
+
+   public boolean getSupportsAttributeOperations()
+   {
+      return true;
+   }
+
+   public void sessionCreated(String realId)
+   {
+      // no-op
+   }
+
+   public void storeSessionData(OutgoingDistributableSessionData sessionData)
+   {
+      // no-op      
+   }
+   
+   private static class MockBatchingManager implements BatchingManager
+   {
+      private static final MockBatchingManager INSTANCE = new MockBatchingManager();
+      
+      public void endBatch()
+      {
+         // TODO Auto-generated method stub
+         
+      }
+
+      public boolean isBatchInProgress() throws Exception
+      {
+         // TODO Auto-generated method stub
+         return false;
+      }
+
+      public void setBatchRollbackOnly() throws Exception
+      {
+         // TODO Auto-generated method stub
+         
+      }
+
+      public void startBatch() throws Exception
+      {
+         // TODO Auto-generated method stub
+         
+      }
+      
+   }
+
+}

Added: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManagerFactory.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManagerFactory.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManagerFactory.java	2009-10-22 20:02:11 UTC (rev 95441)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009 Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.cluster.web.mocks;
+
+import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
+
+/**
+ *
+ *
+ * @author Brian Stansberry
+ * 
+ * @version $Revision: $
+ */
+public class MockDistributedCacheManagerFactory implements DistributedCacheManagerFactory
+{
+
+   public <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(
+         LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException
+   {
+      return (DistributedCacheManager<T>) MockDistributedCacheManager.INSTANCE;
+   }
+
+}


Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockDistributedCacheManagerFactory.java
___________________________________________________________________
Name: svn:keywords
   + 




More information about the jboss-cvs-commits mailing list