[jboss-cvs] JBossAS SVN: r69078 - in trunk/testsuite/src/main/org/jboss/test/cluster: testutil and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 17 13:59:06 EST 2008


Author: bstansberry at jboss.com
Date: 2008-01-17 13:59:06 -0500 (Thu, 17 Jan 2008)
New Revision: 69078

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/testutil/DelegatingMockCacheSPI.java
Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java
Log:
[JBAS-5087] Upgrade to JBoss Cache 2.1.0.CR3

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java	2008-01-17 18:47:17 UTC (rev 69077)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java	2008-01-17 18:59:06 UTC (rev 69078)
@@ -32,7 +32,10 @@
 import org.apache.catalina.Session;
 import org.apache.catalina.session.StandardManager;
 import org.apache.catalina.session.StandardSession;
+import org.jboss.cache.Cache;
 import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.buddyreplication.NextMemberBuddyLocatorConfig;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
@@ -41,7 +44,9 @@
 import org.jboss.cache.notifications.event.EventImpl;
 import org.jboss.cache.notifications.event.Event.Type;
 import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper;
+import org.jboss.cache.transaction.BatchModeTransactionManager;
 import org.jboss.test.JBossTestCase;
+import org.jboss.test.cluster.testutil.DelegatingMockCacheSPI;
 import org.jboss.test.cluster.testutil.MockTransactionManagerLookup;
 import org.jboss.util.threadpool.BasicThreadPool;
 import org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn;
@@ -253,11 +258,12 @@
       try 
       {
          // Register a cache
-         MockTreeCache cache = new MockTreeCache();
+         CacheSPI delegate = (CacheSPI) new DefaultCacheFactory().createCache(false);
+         MockTreeCache cache = new MockTreeCache(delegate);
          // JBAS-4097 -- don't use a TransactionManagerLookup that will
          // bind DummyTransactionManager into JNDI, as that will screw
          // up other tests
-         cache.setTransactionManagerLookup(new MockTransactionManagerLookup());
+         cache.getConfiguration().getRuntimeConfig().setTransactionManager(new BatchModeTransactionManager());
          CacheJmxWrapper wrapper = new CacheJmxWrapper(cache);
          mbeanServer.registerMBean(wrapper, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME));
          wrapper.create();
@@ -378,13 +384,13 @@
    }
    
    
-   static class MockTreeCache extends CacheImpl
+   static class MockTreeCache extends DelegatingMockCacheSPI
    {
       private IpAddress ourAddress = LOCAL_ADDRESS;
       
-      public MockTreeCache() throws Exception
+      public MockTreeCache(CacheSPI delegate) throws Exception
       {
-         super();
+         super(delegate);
          getConfiguration().setCacheMode(CacheMode.LOCAL);
       }
 

Added: trunk/testsuite/src/main/org/jboss/test/cluster/testutil/DelegatingMockCacheSPI.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/testutil/DelegatingMockCacheSPI.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/testutil/DelegatingMockCacheSPI.java	2008-01-17 18:59:06 UTC (rev 69078)
@@ -0,0 +1,436 @@
+/*
+ * 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.testutil;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.RPCManager;
+import org.jboss.cache.Region;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.buddyreplication.GravitateResult;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.interceptors.Interceptor;
+import org.jboss.cache.loader.CacheLoaderManager;
+import org.jboss.cache.marshall.Marshaller;
+import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.TransactionTable;
+import org.jgroups.Address;
+
+/**
+ * CacheSPI impl that delegates all calls to a passed in object.
+ * Meant to provide a base for overriding methods.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class DelegatingMockCacheSPI implements CacheSPI
+{
+   private final CacheSPI delegate;
+   
+   public DelegatingMockCacheSPI(CacheSPI delegate) 
+   {
+      super();
+      this.delegate = delegate;
+   }
+   
+   public void addInterceptor(Interceptor arg0, int arg1)
+   {
+      delegate.addInterceptor(arg0, arg1);
+   }
+
+   public void addInterceptor(Interceptor arg0, Class arg1)
+   {
+      delegate.addInterceptor(arg0, arg1);
+   }
+
+   public boolean exists(Fqn arg0)
+   {
+      return delegate.exists(arg0);
+   }
+
+   public boolean exists(String arg0)
+   {
+      return delegate.exists(arg0);
+   }
+
+   public void fetchPartialState(List arg0, Fqn arg1) throws Exception
+   {
+      delegate.fetchPartialState(arg0, arg1);
+   }
+
+   public void fetchPartialState(List arg0, Fqn arg1, Fqn arg2) throws Exception
+   {
+      delegate.fetchPartialState(arg0, arg1, arg2);
+   }
+
+   public BuddyManager getBuddyManager()
+   {
+      return delegate.getBuddyManager();
+   }
+
+   public CacheLoaderManager getCacheLoaderManager()
+   {
+      return delegate.getCacheLoaderManager();
+   }
+
+   public Set getChildrenNames(Fqn arg0)
+   {
+      return delegate.getChildrenNames(arg0);
+   }
+
+   public Set getChildrenNames(String arg0)
+   {
+      return delegate.getChildrenNames(arg0);
+   }
+
+   public String getClusterName()
+   {
+      return delegate.getClusterName();
+   }
+
+   public GlobalTransaction getCurrentTransaction()
+   {
+      return delegate.getCurrentTransaction();
+   }
+
+   public GlobalTransaction getCurrentTransaction(Transaction arg0, boolean arg1)
+   {
+      return delegate.getCurrentTransaction(arg0, arg1);
+   }
+
+   public List getInterceptorChain()
+   {
+      return delegate.getInterceptorChain();
+   }
+
+   public Set getInternalFqns()
+   {
+      return delegate.getInternalFqns();
+   }
+
+   public Map getLockTable()
+   {
+      return delegate.getLockTable();
+   }
+
+   public Marshaller getMarshaller()
+   {
+      return delegate.getMarshaller();
+   }
+
+   public Notifier getNotifier()
+   {
+      return delegate.getNotifier();
+   }
+
+   public int getNumberOfAttributes()
+   {
+      return delegate.getNumberOfAttributes();
+   }
+
+   public int getNumberOfLocksHeld()
+   {
+      return delegate.getNumberOfLocksHeld();
+   }
+
+   public int getNumberOfNodes()
+   {
+      return delegate.getNumberOfNodes();
+   }
+
+   public RPCManager getRPCManager()
+   {
+      return delegate.getRPCManager();
+   }
+
+   public RegionManager getRegionManager()
+   {
+      return delegate.getRegionManager();
+   }
+
+   public NodeSPI getRoot()
+   {
+      return delegate.getRoot();
+   }
+
+   public StateTransferManager getStateTransferManager()
+   {
+      return delegate.getStateTransferManager();
+   }
+
+   public TransactionManager getTransactionManager()
+   {
+      return delegate.getTransactionManager();
+   }
+
+   public TransactionTable getTransactionTable()
+   {
+      return delegate.getTransactionTable();
+   }
+
+   public GravitateResult gravitateData(Fqn arg0, boolean arg1)
+   {
+      return delegate.gravitateData(arg0, arg1);
+   }
+
+   public NodeSPI peek(Fqn arg0, boolean arg1)
+   {
+      return delegate.peek(arg0, arg1);
+   }
+
+   public NodeSPI peek(Fqn arg0, boolean arg1, boolean arg2)
+   {
+      return delegate.peek(arg0, arg1, arg2);
+   }
+
+   public void removeInterceptor(int arg0)
+   {
+      delegate.removeInterceptor(arg0);
+   }
+
+   public void removeInterceptor(Class arg0)
+   {
+      delegate.removeInterceptor(arg0);
+   }
+
+   public void addCacheListener(Object arg0)
+   {
+      delegate.addCacheListener(arg0);
+   }
+
+   public void addCacheListener(Fqn arg0, Object arg1)
+   {
+      delegate.addCacheListener(arg0, arg1);
+   }
+
+   public void clearData(String arg0)
+   {
+      delegate.clearData(arg0);
+   }
+
+   public void clearData(Fqn arg0)
+   {
+      delegate.clearData(arg0);
+   }
+
+   public void create() throws CacheException
+   {
+      delegate.create();
+   }
+
+   public void destroy()
+   {
+      delegate.destroy();
+   }
+
+   public void evict(Fqn arg0)
+   {
+      delegate.evict(arg0);
+   }
+
+   public void evict(Fqn arg0, boolean arg1)
+   {
+      delegate.evict(arg0, arg1);
+   }
+
+   public Object get(Fqn arg0, Object arg1)
+   {
+      return delegate.get(arg0, arg1);
+   }
+
+   public Object get(String arg0, Object arg1)
+   {
+      return delegate.get(arg0, arg1);
+   }
+
+   public Set getCacheListeners()
+   {
+      return delegate.getCacheListeners();
+   }
+
+   public Set getCacheListeners(Fqn arg0)
+   {
+      return delegate.getCacheListeners(arg0);
+   }
+
+   public CacheStatus getCacheStatus()
+   {
+      return delegate.getCacheStatus();
+   }
+
+   public Configuration getConfiguration()
+   {
+      return delegate.getConfiguration();
+   }
+
+   public Map getData(Fqn arg0)
+   {
+      return delegate.getData(arg0);
+   }
+
+   public InvocationContext getInvocationContext()
+   {
+      return delegate.getInvocationContext();
+   }
+
+   public Set getKeys(String arg0)
+   {
+      return delegate.getKeys(arg0);
+   }
+
+   public Set getKeys(Fqn arg0)
+   {
+      return delegate.getKeys(arg0);
+   }
+
+   public Address getLocalAddress()
+   {
+      return delegate.getLocalAddress();
+   }
+
+   public List getMembers()
+   {
+      return delegate.getMembers();
+   }
+
+   public Node getNode(Fqn arg0)
+   {
+      return delegate.getNode(arg0);
+   }
+
+   public Node getNode(String arg0)
+   {
+      return delegate.getNode(arg0);
+   }
+
+   public Region getRegion(Fqn arg0, boolean arg1)
+   {
+      return delegate.getRegion(arg0, arg1);
+   }
+
+   public String getVersion()
+   {
+      return delegate.getVersion();
+   }
+
+   public void move(Fqn arg0, Fqn arg1) throws NodeNotExistsException
+   {
+      delegate.move(arg0, arg1);
+   }
+
+   public void move(String arg0, String arg1) throws NodeNotExistsException
+   {
+      delegate.move(arg0, arg1);
+   }
+
+   public void put(Fqn arg0, Map arg1)
+   {
+      delegate.put(arg0, arg1);
+   }
+
+   public void put(String arg0, Map arg1)
+   {
+      delegate.put(arg0, arg1);
+   }
+
+   public Object put(Fqn arg0, Object arg1, Object arg2)
+   {
+      return delegate.put(arg0, arg1, arg2);
+   }
+
+   public Object put(String arg0, Object arg1, Object arg2)
+   {
+      return delegate.put(arg0, arg1, arg2);
+   }
+
+   public void putForExternalRead(Fqn arg0, Object arg1, Object arg2)
+   {
+      delegate.putForExternalRead(arg0, arg1, arg2);
+   }
+
+   public Object remove(Fqn arg0, Object arg1)
+   {
+      return delegate.remove(arg0, arg1);
+   }
+
+   public Object remove(String arg0, Object arg1)
+   {
+      return delegate.remove(arg0, arg1);
+   }
+
+   public void removeCacheListener(Object arg0)
+   {
+      delegate.removeCacheListener(arg0);
+   }
+
+   public void removeCacheListener(Fqn arg0, Object arg1)
+   {
+      delegate.removeCacheListener(arg0, arg1);
+   }
+
+   public boolean removeNode(Fqn arg0)
+   {
+      return delegate.removeNode(arg0);
+   }
+
+   public boolean removeNode(String arg0)
+   {
+      return delegate.removeNode(arg0);
+   }
+
+   public boolean removeRegion(Fqn arg0)
+   {
+      return delegate.removeRegion(arg0);
+   }
+
+   public void setInvocationContext(InvocationContext arg0)
+   {
+      delegate.setInvocationContext(arg0);
+   }
+
+   public void start() throws CacheException
+   {
+      delegate.start();
+   }
+
+   public void stop()
+   {
+      delegate.stop();
+   }
+
+}




More information about the jboss-cvs-commits mailing list