[jbosscache-commits] JBoss Cache SVN: r7645 - in core/trunk: src/main/java/org/jboss/cache and 12 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Feb 4 12:46:08 EST 2009


Author: jason.greene at jboss.com
Date: 2009-02-04 12:46:08 -0500 (Wed, 04 Feb 2009)
New Revision: 7645

Removed:
   core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java
Modified:
   core/trunk/pom.xml
   core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
   core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
   core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
   core/trunk/src/main/java/org/jboss/cache/Version.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
   core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
   core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
   core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java
   core/trunk/src/test/java/org/jboss/cache/integration/websession/BuddyReplicationFailoverTest.java
   core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionManager.java
   core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionMetadata.java
   core/trunk/src/test/java/org/jboss/cache/integration/websession/util/WebSessionTestBase.java
   core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
   core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java
   core/trunk/src/test/resources/configs/integration/web-session-cache-configs.xml
Log:
Revert everything after 7632, it all breaks the testsuite!

Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/pom.xml	2009-02-04 17:46:08 UTC (rev 7645)
@@ -4,7 +4,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <properties>
-      <jbosscache-core-version>3.1.0-SNAPSHOT</jbosscache-core-version>
+      <jbosscache-core-version>3.0.3-SNAPSHOT</jbosscache-core-version>
       <!-- By default only run tests in the "unit" group -->
       <defaultTestGroup>unit</defaultTestGroup>
       <!-- By default only generate Javadocs when we install the module. -->

Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -30,11 +30,9 @@
 import org.jboss.cache.factories.annotations.NonVolatile;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;
-import org.jboss.cache.jmx.annotations.MBean;
 import org.jboss.cache.jmx.annotations.ManagedOperation;
 import org.jboss.cache.lock.LockManager;
 import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.util.CachePrinter;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -50,7 +48,6 @@
  * @since 2.2
  */
 @NonVolatile
- at MBean(objectName = "DataContainer", description = "Core container for all cached items")
 public class DataContainerImpl implements DataContainer
 {
    private static final Log log = LogFactory.getLog(DataContainerImpl.class);
@@ -196,10 +193,7 @@
 
    public NodeSPI peek(Fqn fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
    {
-      if (trace)
-      {
-         log.trace("peek " + fqn + ", includeDeletedNodes:" + includeDeletedNodes + ", includeInvalidNodes:" + includeInvalidNodes);
-      }
+      if (trace) log.trace("peek " + fqn + ", includeDeletedNodes:" +includeDeletedNodes + ", includeInvalidNodes:"  + includeInvalidNodes);
       if (fqn == null || fqn.size() == 0) return getRoot();
       NodeSPI n = getRoot();
       int fqnSize = fqn.size();
@@ -489,13 +483,7 @@
       return sb.toString();
    }
 
-   @ManagedOperation(description = "Prints details of the data container, formatted as an HTML String")
-   public String printDetailsAsHtml()
-   {
-      return CachePrinter.formatHtml(printDetails());
-   }
 
-
    /**
     * Returns lock information.
     *

Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -81,7 +81,7 @@
  *
  * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik AT jboss DOT org)</a>
  */
- at MBean(objectName = "RPCManager", description = "Manages RPC connections to remote caches")
+ at MBean(objectName = "RPCManager")
 public class RPCManagerImpl implements RPCManager
 {
    private Channel channel;
@@ -177,9 +177,7 @@
                   if (getMembers().size() > 1) messageListener.waitForState();
 
                   if (log.isDebugEnabled())
-                  {
                      log.debug("connected, state was retrieved successfully (in " + (System.currentTimeMillis() - start) + " milliseconds)");
-                  }
                }
                catch (StateTransferException ste)
                {
@@ -273,9 +271,7 @@
             ReflectionUtil.setValue(configuration, "accessible", true);
             configuration.setUsingMultiplexer(true);
             if (log.isDebugEnabled())
-            {
                log.debug("Created Multiplexer Channel for cache cluster " + configuration.getClusterName() + " using stack " + configuration.getMultiplexerStack());
-            }
          }
          else
          {
@@ -451,13 +447,9 @@
          int modeToUse = mode;
          int preferredMode;
          if ((preferredMode = spi.getInvocationContext().getOptionOverrides().getGroupRequestMode()) > -1)
-         {
             modeToUse = preferredMode;
-         }
          if (trace)
-         {
             log.trace("callRemoteMethods(): valid members are " + recipients + " methods: " + command + " Using OOB? " + useOutOfBandMessage + " modeToUse: " + modeToUse);
-         }
          if (channel.flushSupported() && !flushBlockGate.await(configuration.getStateRetrievalTimeout(), TimeUnit.MILLISECONDS))
          {
             throw new TimeoutException("State retrieval timed out waiting for flush unblock. (timeout = " + configuration.getStateRetrievalTimeout() + " millis) ");
@@ -466,9 +458,7 @@
          RspList rsps = rpcDispatcher.invokeRemoteCommands(recipients, command, modeToUse, timeout, isUsingBuddyReplication, useOutOfBandMessage, responseFilter);
          if (mode == GroupRequest.GET_NONE) return Collections.emptyList();// async case
          if (trace)
-         {
             log.trace("(" + getLocalAddress() + "): responses for method " + command.getClass().getSimpleName() + ":\n" + rsps);
-         }
          // short-circuit no-return-value calls.
          if (rsps == null) return Collections.emptyList();
          List<Object> retval = new ArrayList<Object>(rsps.size());
@@ -539,9 +529,7 @@
          // Yes -- cache is configured LOCAL but app doesn't know it -- Brian
          //throw new IllegalArgumentException("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
          if (log.isWarnEnabled())
-         {
             log.warn("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
-         }
          return;
       }
 
@@ -559,18 +547,14 @@
       }
 
       if (log.isDebugEnabled())
-      {
          log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from members " + targets);
-      }
       boolean successfulTransfer = false;
       for (Address target : targets)
       {
          try
          {
             if (log.isDebugEnabled())
-            {
                log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target);
-            }
             messageListener.setStateSet(false);
             successfulTransfer = channel.getState(target, stateId, configuration.getStateRetrievalTimeout());
             if (successfulTransfer)
@@ -586,18 +570,14 @@
                }
             }
             if (log.isDebugEnabled())
-            {
                log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target + (successfulTransfer ? " successful" : " failed"));
-            }
             if (successfulTransfer) break;
          }
          catch (IllegalStateException ise)
          {
             // thrown by the JGroups channel if state retrieval fails.
             if (log.isInfoEnabled())
-            {
                log.info("Channel problems fetching state.  Continuing on to next provider. ", ise);
-            }
          }
       }
 
@@ -612,10 +592,10 @@
 
    // ------------ START: Informational methods ------------
 
-   @ManagedAttribute(description = "Local address")
+   @ManagedAttribute (description = "Local address")
    public String getLocalAddressString()
    {
-      Address address = getLocalAddress();
+      Address address = getLocalAddress();      
       return address == null ? "null" : address.toString();
    }
 
@@ -624,7 +604,7 @@
       return channel != null ? channel.getLocalAddress() : null;
    }
 
-   @ManagedAttribute(description = "Cluster view")
+   @ManagedAttribute (description = "Cluster view")
    public String getMembersString()
    {
       List l = getMembers();
@@ -635,13 +615,9 @@
    {
       if (isInLocalMode) return null;
       if (members == null)
-      {
          return Collections.emptyList();
-      }
       else
-      {
          return members;
-      }
    }
 
    public boolean isCoordinator()
@@ -739,7 +715,7 @@
          catch (Throwable e)
          {
             //do not rethrow! jgroups might behave funny, resulting even in deadlock
-            log.error("Error found while processing view accepted!!!", e);
+            log.error("Error found while processing view accepted!!!", e);            
          }
       }
 
@@ -836,12 +812,6 @@
       return statisticsEnabled;
    }
 
-   @ManagedAttribute(description = "whether or not the RPCManager is used in this cache instance")
-   public boolean isEnabled()
-   {
-      return !isInLocalMode;
-   }
-
    @ManagedAttribute
    public void setStatisticsEnabled(boolean statisticsEnabled)
    {
@@ -867,9 +837,7 @@
    {
       //if we use a shared transport do not log any warn message
       if (configuration.getMultiplexerStack() != null)
-      {
          return;
-      }
       //bundling is not good for sync caches
       Configuration.CacheMode cacheMode = configuration.getCacheMode();
       if (!cacheMode.equals(Configuration.CacheMode.LOCAL) && configuration.getCacheMode().isSynchronous())

Modified: core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -24,9 +24,7 @@
 import net.jcip.annotations.ThreadSafe;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import static org.jboss.cache.Region.Type.ANY;
-import static org.jboss.cache.Region.Type.EVICTION;
-import static org.jboss.cache.Region.Type.MARSHALLING;
+import static org.jboss.cache.Region.Type.*;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.config.Configuration;
@@ -38,7 +36,6 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;
-import org.jboss.cache.jmx.annotations.MBean;
 import org.jboss.cache.jmx.annotations.ManagedAttribute;
 import org.jboss.cache.jmx.annotations.ManagedOperation;
 import org.jboss.cache.lock.LockManager;
@@ -58,7 +55,6 @@
  * @since 3.0.0
  */
 @ThreadSafe
- at MBean(objectName = "RegionManager", description = "Manages eviction and marshalling regions")
 public class RegionManagerImpl implements RegionManager
 {
    /**
@@ -145,9 +141,7 @@
       setDefaultInactive(configuration.isInactiveOnStartup());
 
       if (isUsingEvictions())
-      {
          evictionTimerTask.init(evictionConfig.getWakeupInterval(), configuration.getRuntimeConfig().getEvictionTimerThreadFactory(), regionsRegistry);
-      }
    }
 
    @Stop
@@ -426,9 +420,7 @@
 
             // Don't bother trying to fetch state if we are in LOCAL mode
             if (members != null && !members.isEmpty())
-            {
                rpcManager.fetchPartialState(members, subtreeRoot.getFqn());
-            }
          }
          else if (!buddyFqnTransformer.isBackupFqn(fqn))
          {
@@ -439,9 +431,7 @@
             {
                List<Address> sources = new ArrayList<Address>(1);
                if (!cache.getMembers().contains(buddy))
-               {
                   continue;
-               }
                sources.add(buddy);
                Fqn buddyRoot = buddyFqnTransformer.getBackupFqn(buddy, fqn);
                subtreeRoot = cache.peek(buddyRoot, false, false);
@@ -652,9 +642,7 @@
          {
             if ((type == EVICTION && r.getEvictionRegionConfig() != null) ||
                   (type == MARSHALLING && r.isActive() && r.getClassLoader() != null))
-            {
                regions.add(r);
-            }
          }
       }
       else
@@ -685,9 +673,7 @@
 //      needDefault = ercs.size() == 0;
       if (evictionConfig.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig() != null &&
             !ercs.contains(evictionConfig.getDefaultEvictionRegionConfig())) // then the default is a real region too; not just a template for others
-      {
          ercs.add(0, evictionConfig.getDefaultEvictionRegionConfig());
-      }
 
       // create regions for the regions defined in the evictionConfig.
       // scan to be sure the _default_ region isn't added twice
@@ -760,7 +746,7 @@
       evictionTimerTask.stop();
    }
 
-   @ManagedAttribute(name = "numRegions", description = "A count of all regions")
+   @ManagedAttribute(name="numRegions", description = "A count of all regions")
    public int getNumRegions()
    {
       return regionsRegistry.size();

Modified: core/trunk/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Version.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/Version.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -32,10 +32,10 @@
 @Immutable
 public class Version
 {
-   public static final String version = "3.1.0-SNAPSHOT";
-   public static final String codename = "Cascabel";
+   public static final String version = "3.0.3-SNAPSHOT";
+   public static final String codename = "Naga";
    //public static final String cvs = "$Id$";
-   static final byte[] version_id = {'0', '3', '1', '0', 'S'};
+   static final byte[] version_id = {'0', '3', '0', '3', 'S'};
 
    private static final int MAJOR_SHIFT = 11;
    private static final int MINOR_SHIFT = 6;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -86,13 +86,17 @@
     * See {@link org.jboss.cache.interceptors.EvictionInterceptor#visitEvictFqnCommand(org.jboss.cache.InvocationContext , EvictCommand)}
     * which is where the return value is used
     *
-    * @return true if the node is now absent from the cache.  Returns false if the node still exists; i.e. was only data removed because it still has children.
+    * @return true if the node was removed from the tree or if it is resident.  Returns false if the node still exists; i.e. was only data removed because it still has children.
     */
    public Object perform(InvocationContext ctx)
    {
       NodeSPI node = lookupForEviction(ctx, fqn);
-      if (node == null || node.isDeleted() || node.isResident())
+      if (node == null || node.isDeleted())
       {
+         return false;
+      }
+      else if (node.isResident())
+      {
          return true;
       }
       else if (recursive)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -152,9 +152,7 @@
    {
       double total = hits + misses;
       if (total == 0)
-      {
          return 0;
-      }
       return (hits / total);
    }
 
@@ -162,9 +160,7 @@
    public double getReadWriteRatio()
    {
       if (stores == 0)
-      {
          return 0;
-      }
       return (((double) (hits + misses) / (double) stores));
    }
 
@@ -173,9 +169,7 @@
    {
       long total = hits + misses;
       if (total == 0)
-      {
          return 0;
-      }
       return (hitTimes + missTimes) / total;
    }
 
@@ -183,19 +177,17 @@
    public long getAverageWriteTime()
    {
       if (stores == 0)
-      {
          return 0;
-      }
       return (storeTimes) / stores;
    }
 
-   @ManagedAttribute(description = "number of cache attributes")
+   @ManagedAttribute(description = "number of cache eviction operations")
    public int getNumberOfAttributes()
    {
       return dataContainer.getNumberOfAttributes();
    }
 
-   @ManagedAttribute(description = "number of nodes in the cache")
+   @ManagedAttribute
    public int getNumberOfNodes()
    {
       return dataContainer.getNumberOfNodes();

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -81,8 +81,8 @@
       // See if the node still exists; i.e. was only data removed
       // because it still has children.
       // If yes, put an ADD event in the queue so the node gets revisited
-      boolean nodeIsNowAbsent = (retVal != null && (Boolean) retVal);
-      if (!nodeIsNowAbsent)
+      boolean complete = (retVal != null && (Boolean) retVal);
+      if (!complete)
       {
          Region r;
          if (fqn != null && (r = getRegion(fqn)) != null)
@@ -244,10 +244,10 @@
    private void registerEvictionEventToRegionManager(Fqn fqn, EvictionEvent.Type type, int elementDifference, Region region)
    {
       //we do not trigger eviction events for resident nodes
-      if (dataContainer.isResident(fqn))
+      if (dataContainer.isResident(fqn)) 
       {
-         if (trace) log.trace("Ignoring Fqn " + fqn + " as it is marked as resident");
-         return;
+        if (trace) log.trace("Ignoring Fqn " + fqn + " as it is marked as resident");	
+	return;
       }
       region.registerEvictionEvent(fqn, type, elementDifference);
 

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -30,8 +30,6 @@
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
 import org.jboss.cache.invocation.InvocationContextContainer;
-import org.jboss.cache.jmx.annotations.MBean;
-import org.jboss.cache.jmx.annotations.ManagedOperation;
 import org.jboss.cache.util.CachePrinter;
 
 import java.util.ArrayList;
@@ -47,7 +45,6 @@
  *        todo - if you add the same interceptor instance twice, things get really dirty.
  *        -- this should be treated as an missuse and an exception should be thrown
  */
- at MBean(description = "InterceptorChain")
 public class InterceptorChain
 {
    /**
@@ -154,25 +151,6 @@
 
    }
 
-   @ManagedOperation(description = "Retrieves a list of the interceptors in the chain")
-   public String getInterceptorDetails()
-   {
-      StringBuilder sb = new StringBuilder("Interceptor chain: \n");
-      int count = 0;
-      for (CommandInterceptor i : asList())
-      {
-         count++;
-         sb.append("   ").append(count).append(". ").append(i).append("\n");
-      }
-      return sb.toString();
-   }
-
-   @ManagedOperation(description = "Retrieves a list of the interceptors in the chain, formatted as HTML")
-   public String getInterceptorDetailsAsHtml()
-   {
-      return CachePrinter.formatHtml(getInterceptorDetails());
-   }
-
    /**
     * Returns an unmofiable list with all the interceptors in sequence.
     * If first in chain is null an empty list is returned.

Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -48,7 +48,16 @@
 import org.jgroups.jmx.JChannelFactoryMBean;
 import org.w3c.dom.Element;
 
-import javax.management.*;
+import javax.management.AttributeChangeNotification;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
 import javax.transaction.TransactionManager;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -137,7 +146,7 @@
    public String printConfigurationAsHtmlString()
    {
       Configuration cfg = getConfiguration();
-      return cfg == null ? "Configuration is null" : CachePrinter.formatHtml(cfg.toString());
+      return cfg == null ? "Configuration is null" : formatHtml(cfg.toString());
    }
 
    public String printCacheDetails()
@@ -147,7 +156,7 @@
 
    public String printCacheDetailsAsHtml()
    {
-      return cache == null ? "Cache is null" : CachePrinter.formatHtml(CachePrinter.printCacheDetails(cache));
+      return cache == null ? "Cache is null" : formatHtml(CachePrinter.printCacheDetails(cache));
    }
 
    public CacheStatus getCacheStatus()
@@ -208,7 +217,7 @@
 
    public String printLockInfoAsHtml()
    {
-      return cache == null ? "Cache is null" : CachePrinter.formatHtml(CachePrinter.printCacheLockingInfo(cache));
+      return cache == null ? "Cache is null" : formatHtml(CachePrinter.printCacheLockingInfo(cache));
    }
 
    public boolean getRegisterJmxResource()
@@ -590,13 +599,9 @@
       if (!cacheStatus.createAllowed())
       {
          if (cacheStatus.needToDestroyFailedCache())
-         {
             destroy();
-         }
          else
-         {
             return;
-         }
       }
 
       try
@@ -628,18 +633,12 @@
       if (!cacheStatus.startAllowed())
       {
          if (cacheStatus.needToDestroyFailedCache())
-         {
             destroy(); // this will take us back to DESTROYED
-         }
 
          if (cacheStatus.needCreateBeforeStart())
-         {
             create();
-         }
          else
-         {
             return;
-         }
       }
 
       try
@@ -719,9 +718,7 @@
             }
          }
          else
-         {
             return;
-         }
       }
 
       try
@@ -733,9 +730,7 @@
          unregisterJmxResources();
 
          if (cache != null)
-         {
             cache.destroy();
-         }
       }
       finally
       {
@@ -906,6 +901,22 @@
       return server;
    }
 
+   /**
+    * Formats a given String for display as an HTML snippet.
+    *
+    * @param s string to format
+    * @return formatted string
+    */
+   public static String formatHtml(String s)
+   {
+      s = s.replaceAll("\r\n", "<br/>");
+      s = s.replaceAll("\r", "<br/>");
+      s = s.replaceAll("\n", "<br/>");
+      s = s.replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
+      s = s.replaceAll(" ", "&nbsp;");
+      return s;
+   }
+
    public String getNotificationServiceName()
    {
       return notificationServiceName;
@@ -1038,18 +1049,14 @@
          {
             listenerCount.incrementAndGet();
             if (cache != null)
-            {
                cache.addCacheListener(cacheNotificationListener);
-            }
          }
          else
          {
             if (listenerCount.decrementAndGet() <= 0)
             {
                if (cache != null)
-               {
                   cache.removeCacheListener(cacheNotificationListener);
-               }
 
                listenerCount.set(0);
             }
@@ -1075,21 +1082,13 @@
       sendStateChangeNotification(oldState, getState(), getClass().getSimpleName() + " failed", t);
 
       if (t instanceof CacheException)
-      {
          throw (CacheException) t;
-      }
       else if (t instanceof RuntimeException)
-      {
          throw (RuntimeException) t;
-      }
       else if (t instanceof Error)
-      {
          throw (Error) t;
-      }
       else
-      {
          throw new CacheException(t);
-      }
    }
 
    /**
@@ -1098,9 +1097,7 @@
    private void sendStateChangeNotification(int oldState, int newState, String msg, Throwable t)
    {
       if (isDisableStateChangeNotifications())
-      {
          return;
-      }
 
       long now = System.currentTimeMillis();
 

Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -93,20 +93,4 @@
       }
       return sb.toString();
    }
-
-   /**
-    * Formats a given String for display as an HTML snippet.
-    *
-    * @param s string to format
-    * @return formatted string
-    */
-   public static String formatHtml(String s)
-   {
-      s = s.replaceAll("\r\n", "<br/>");
-      s = s.replaceAll("\r", "<br/>");
-      s = s.replaceAll("\n", "<br/>");
-      s = s.replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
-      s = s.replaceAll(" ", "&nbsp;");
-      return s;
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -47,14 +47,6 @@
       control.verify();
    }
 
-   public void testShouldReturnTrueIndicatingNodeIsAbsentIfNodeDoesntExist()
-   {
-      expect(container.peek(testFqn, false, true)).andReturn(null);
-      control.replay();
-      assert Boolean.TRUE == command.perform(ctx);
-      control.verify();
-   }
-
    public void testSimpleEviction()
    {
       expect(container.peek(testFqn, false, true)).andReturn(nodes.abNode);

Modified: core/trunk/src/test/java/org/jboss/cache/integration/websession/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/websession/BuddyReplicationFailoverTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/integration/websession/BuddyReplicationFailoverTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -48,27 +48,8 @@
 /**
  * @author Brian Stansberry
  *
- * This test is disabled because of following:
- * There seem to be some assumptions in the above tests that do not look right to me.
- * I have an example I've investigated(logs etc), haven't studied all possible failure scenarios, though I can imagine some others.
- * One of them is the next one, on testInvalidateOnFailoverToBackup:
-
- * This is the code I am talking about:
- *     InvalidationServlet invs = new InvalidationServlet();
- *     MultipleActionServlet mas = new MultipleActionServlet(sas, invs);
- *     (....)
- *     req = new Request(mgr0, sessionId, mas);
- *     *1+2* req.execute();          (...)
- *     *3*BuddyReplicationAssertions.assertUnrelated(contextHostName, sessionId, mgr0.getCache());
-
- *And some explanation
-
- *1) manager0.invalidatesSession (i.e. cache0.remove)
- *2) manager0 tries to data gravitate session (i.e. cache0.get with forceDataGrav set to true). This is done last line in Request.execute().
- *3) asserts that session is no longer present on cache0
-
- *Now, the assumption at 3 is not necessarily valid. With some funny threading and using ASYNC replication, you might have the remote removeNode command originated from cache0 to run *after* gravitateData originated at step2. I.e. RemoveNodeCommand being executed after GravitateDataCommand on cache*1* (buddy of cache0).
  */
+//todo - fix intermitent failures
 @Test(groups = "integration",enabled = false, testName = "integration.websession.BuddyReplicationFailoverTest")
 public class BuddyReplicationFailoverTest extends WebSessionTestBase
 {
@@ -540,7 +521,7 @@
 
       // Create the session
       SetAttributesServlet sas = new SetAttributesServlet(Collections.singletonMap(KEY, getAttributeValue(attr++)));
-      ReplicationListener replListener0 = replListeners[0];
+      ReplicationListener replListener0 = getReplicationListener(mgr0.getCache());
       replListener0.expectWithTx(PutDataMapCommand.class);
       
       Request req = new Request(mgr3, null, sas);
@@ -578,7 +559,7 @@
       sas = new SetAttributesServlet(Collections.singletonMap(KEY, getAttributeValue(attr++)));
       InvalidationServlet invs = new InvalidationServlet();
       MultipleActionServlet mas = new MultipleActionServlet(sas, invs);
-      ReplicationListener replListener1 = replListeners[1];
+      ReplicationListener replListener1 = getReplicationListener(mgr1.getCache());
       replListener1.expectWithTx(PutDataMapCommand.class, RemoveNodeCommand.class); 
       replListener1.expect(DataGravitationCleanupCommand.class); 
 

Modified: core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionManager.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionManager.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionManager.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -35,7 +35,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.*;
-import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.integration.websession.util.WebAppMetadata.Granularity;
@@ -132,38 +131,13 @@
             cache.removeCacheListener(this);
             
             // FIXME see if we need more sophisticated cache cleanup
-            removeInMemoryData((CacheSPI)cache);
-            clearCacheLoader((CacheSPI)cache);
+            cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+            cache.removeNode(baseFqn);
             cacheManager.releaseCache(appMetadata.cacheConfigName);
             cache = null;
          }
       }
    }
-
-   private void clearCacheLoader(CacheSPI cache)
-   {
-      CacheLoaderManager cacheLoaderManager = cache.getCacheLoaderManager();
-      if (cacheLoaderManager != null && cacheLoaderManager.getCacheLoader() != null)
-      {
-         try
-         {
-            cacheLoaderManager.getCacheLoader().remove(Fqn.ROOT);
-         } catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-   }
-
-   private void removeInMemoryData(CacheSPI cache)
-   {
-      if (cache.getRoot() != null)
-      {
-         cache.getRoot().clearDataDirect();
-         cache.getRoot().removeChildrenDirect();
-      }
-   }
-
    
    /**
     * Allows test driver to mock Tomcat background processes' expiration
@@ -391,7 +365,6 @@
          {
             cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
          }
-         log("cache.removeNode(" + getSessionFqn(id) + ") locally? " + localOnly);
          cache.removeNode(getSessionFqn(id));
       }
       
@@ -451,8 +424,7 @@
       {
          data.put(ATTRIBUTES, attributes);         
       }
-
-      log("cache.put(" + fqn +"," + data +")");
+      
       cache.put(fqn, data);
    }
    
@@ -466,8 +438,7 @@
       Fqn<String> fqn = getSessionFqn(id);
       
       if (modifiedAttributes != null)
-      {
-         log("cache.put(" + fqn+"," + modifiedAttributes+ ")");
+      {      
          cache.put(fqn, modifiedAttributes);
       }
       
@@ -475,7 +446,6 @@
       {
          for (String key : removedAttributes)
          {
-            log("cache.remove(" + fqn + "," + key + ")");
             cache.remove(fqn, key);
          }
       }
@@ -520,7 +490,6 @@
          {
             cache.getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
          }
-         log ("cache.getData(" + getSessionFqn(id) + ") with ForceDataGravitation(true)");
          data = cache.getData(getSessionFqn(id));
       }
       finally
@@ -575,7 +544,6 @@
             Fqn<String> backupFqn = Fqn.fromRelativeFqn(child.getFqn(), mainFqn);
             if (evict)
             {
-               log("cache.evict(" + backupFqn + ", true)");
                cache.evict(backupFqn, true);
             }
             else
@@ -588,9 +556,4 @@
       
    }
 
-   private void log(String what)
-   {
-      System.out.println("[" + cache.getLocalAddress() + "] " + what);
-   }
-
 }

Modified: core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionMetadata.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionMetadata.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/integration/websession/util/SessionMetadata.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -39,15 +39,4 @@
    public final String id = String.valueOf(++counter);
    public final long creationTime =  System.currentTimeMillis();
    public boolean valid = true;
-
-
-   @Override
-   public String toString()
-   {
-      return "SessionMetadata{" +
-            "id='" + id + '\'' +
-            ", creationTime=" + creationTime +
-            ", valid=" + valid +
-            '}';
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/integration/websession/util/WebSessionTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/websession/util/WebSessionTestBase.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/integration/websession/util/WebSessionTestBase.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -52,7 +52,7 @@
    private AtomicInteger testCount = new AtomicInteger();
    private List<CacheManager> cacheManagers;
    private List<SessionManager> sessionManagers;
-   protected ReplicationListener[] replListeners;
+   private Map<Cache<Object, Object>, ReplicationListener> replicationListeners = new HashMap<Cache<Object, Object>, ReplicationListener>();
    
    @BeforeClass(alwaysRun = true)
    public void beforeClass() throws Exception
@@ -61,10 +61,8 @@
       if (getStartCachesInBeforeClass() && getCacheConfigName() != null)
       {
          String inUseProtocolStack = UnitTestConfigurationFactory.getEmptyConfiguration().getClusterConfig();
-         replListeners = new ReplicationListener[getNumCacheManagers()];
-         for (int i =0; i < cacheManagers.size(); i++)
+         for (CacheManager cm : cacheManagers)
          {
-            CacheManager cm = cacheManagers.get(i);
             Cache<Object, Object> cache = cm.getCache(getCacheConfigName(), true);
             amendCacheBeforeStartup(cache);
             if (cache.getCacheStatus() != CacheStatus.STARTED)
@@ -72,7 +70,7 @@
                cache.getConfiguration().setClusterConfig(inUseProtocolStack);
                cache.start();
             }
-            replListeners[i] = ReplicationListener.getReplicationListener(cache);
+            replicationListeners.put(cache, ReplicationListener.getReplicationListener(cache));
          }
       }
    }
@@ -173,4 +171,9 @@
    {
       return Integer.valueOf(value);
    }
+   
+   protected ReplicationListener getReplicationListener(Cache<Object, Object> cache)
+   {
+      return replicationListeners.get(cache);
+   }
 }

Deleted: core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -1,76 +0,0 @@
-package org.jboss.cache.jmx;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.FIFOAlgorithmConfig;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-// do NOT enable this test in SVN as it will cause Hudson (or any other continuous integration test harness) to get
-
-// stuck.
- at Test(groups = "maual", enabled = false)
-public class JmxManualTest
-{
-   public void testLocal() throws IOException
-   {
-      Configuration c = new Configuration();
-      Cache cache = new DefaultCacheFactory().createCache(c);
-      cache.put("/a/b/c", "a", "b");
-      cache.put("/a/b/c", "c", "d");
-      cache.put("/a/b/d", "a", "b");
-      cache.put("/a/b/e", "c", "d");
-
-      System.in.read();
-   }
-
-   public void testLocalNoJMX() throws IOException
-   {
-      Configuration c = new Configuration();
-      c.setExposeManagementStatistics(false);
-      Cache cache = new DefaultCacheFactory().createCache(c);
-      cache.put("/a/b/c", "a", "b");
-      cache.put("/a/b/c", "c", "d");
-      cache.put("/a/b/d", "a", "b");
-      cache.put("/a/b/e", "c", "d");
-
-      System.in.read();
-   }
-
-   public void testLocalWithEviction() throws IOException
-   {
-      Configuration c = new Configuration();
-      EvictionConfig ec = new EvictionConfig();
-      ec.setWakeupInterval(250, TimeUnit.MILLISECONDS);
-      EvictionRegionConfig erc = new EvictionRegionConfig();
-      erc.setEvictionAlgorithmConfig(new FIFOAlgorithmConfig(2));
-      erc.setRegionFqn(Fqn.ROOT);
-      ec.setDefaultEvictionRegionConfig(erc);
-      c.setEvictionConfig(ec);
-      Cache cache = new DefaultCacheFactory().createCache(c);
-      cache.put("/a/b/c", "a", "b");
-      cache.put("/a/b/c", "c", "d");
-      cache.put("/a/b/d", "a", "b");
-      cache.put("/a/b/e", "c", "d");
-
-      System.in.read();
-   }
-
-   public void testLocalWithEvictionXML() throws IOException
-   {
-      Cache cache = new DefaultCacheFactory().createCache("config-samples/eviction-enabled.xml");
-      cache.put("/a/b/c", "a", "b");
-      cache.put("/a/b/c", "c", "d");
-      cache.put("/a/b/d", "a", "b");
-      cache.put("/a/b/e", "c", "d");
-
-      System.in.read();
-   }
-
-}

Modified: core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -16,6 +16,7 @@
 import org.jboss.cache.notifications.event.Event;
 import org.jboss.cache.transaction.DummyTransactionManagerLookup;
 import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
 import org.jgroups.Address;
 import org.jgroups.stack.IpAddress;
 import static org.testng.AssertJUnit.*;
@@ -70,9 +71,7 @@
       finally
       {
          if (registered)
-         {
             mBeanServer.unregisterMBean(on);
-         }
       }
    }
 
@@ -156,7 +155,7 @@
    {
       CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
       String cfgFromJmx = wrapper.printConfigurationAsHtmlString();
-      assertEquals(CachePrinter.formatHtml(cache.getConfiguration().toString()), cfgFromJmx);
+      assertEquals(CacheJmxWrapper.formatHtml(cache.getConfiguration().toString()), cfgFromJmx);
       checkHtml(cfgFromJmx, false);
    }
 
@@ -176,7 +175,7 @@
       wrapper.create();
       wrapper.start();
       String cfgFromJmx = wrapper.printConfigurationAsHtmlString();
-      assertEquals(CachePrinter.formatHtml(wrapper.getCache().getConfiguration().toString()), cfgFromJmx);
+      assertEquals(CacheJmxWrapper.formatHtml(wrapper.getCache().getConfiguration().toString()), cfgFromJmx);
       checkHtml(cfgFromJmx, false);
    }
 
@@ -397,9 +396,7 @@
    private void checkHtml(String html, boolean checkBR)
    {
       if (checkBR)
-      {
          assertTrue("Has <br", html.contains("<br"));
-      }
 
       assertTrue("No tabs", html.indexOf('\t') == -1);
 

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -47,11 +47,13 @@
  * @author Brian Stansberry
  * @version $Revision$
  */
- at Test(groups = {"functional"}, testName = "statetransfer.FailedStateTransferTest")
+ at Test(groups = {"functional"}, enabled=false, testName = "statetransfer.FailedStateTransferTest")
 public class FailedStateTransferTest extends StateTransferTestBase
 {
+
    public void testFailedStateTransfer() throws Exception
    {
+      Map<String, Cache> caches = cachesTL.get();
       Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC);
       //c.setClusterName("VersionedTestBase");
       c.setReplVersionString(getReplicationVersion());

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -45,7 +45,8 @@
  * @author Brian Stansberry
  * @version $Revision$
  */
- at Test(groups = {"functional"}, enabled = false, testName = "statetransfer.ForcedStateTransferTest", description = "this has always been disabled since 1.4.x.  See JBCACHE-315")
+ at Test(groups = {"functional"}, enabled = false, testName = "statetransfer.ForcedStateTransferTest")
+// this has always been disabled since 1.4.x.  See JBCACHE-315
 public class ForcedStateTransferTest extends StateTransferTestBase
 {
    /**
@@ -780,7 +781,7 @@
                                                 boolean startCache)
          throws Exception
    {
-      CacheSPI<Object, Object> result = super.createCache(replSync,
+      CacheSPI<Object, Object> result = super.createCache(cacheID, replSync,
             useMarshalling, false, false, false, true);
       result.getConfiguration().setStateRetrievalTimeout(0);
       result.getConfiguration().setLockAcquisitionTimeout(1000);

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/PersistingTransientStateTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -4,7 +4,6 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.factories.UnitTestConfigurationFactory;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.config.Configuration;
@@ -25,7 +24,7 @@
  * Pertains to JBCACHE-131
  * <p/>
  */
- at Test(groups = "functional", testName = "statetransfer.PersistingTransientStateTest")
+ at Test(groups = "functional", enabled=false, testName = "statetransfer.PersistingTransientStateTest")
 public class PersistingTransientStateTest
 {
    protected NodeLockingScheme nls = NodeLockingScheme.PESSIMISTIC;
@@ -38,8 +37,9 @@
       try
       {
          UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
-         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+         Configuration cfg = new Configuration();
          cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+         cfg.setCacheMode(CacheMode.REPL_SYNC);
          cfg.setFetchInMemoryState(true);
          // configure with CL
          IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
@@ -72,8 +72,10 @@
       Cache<String, String> c1 = null, c2 = null;
       try
       {
-         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+         UnitTestCacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
+         Configuration cfg = new Configuration();
          cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+         cfg.setCacheMode(CacheMode.REPL_SYNC);
          cfg.setFetchInMemoryState(true);
          // configure with CL
          IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
@@ -86,13 +88,13 @@
          cfg.setCacheLoaderConfig(clc);
          cfg.setNodeLockingScheme(nls);
 
-         c1 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
+         c1 = cf.createCache(cfg.clone(), getClass());
          c1.put(fqn, k, v);
 
          assert c1.get(fqn, k).equals(v);
          assert getLoader(c1).get(fqn).get(k).equals(v);
 
-         c2 = new UnitTestCacheFactory<String, String>().createCache(cfg.clone(), getClass());
+         c2 = cf.createCache(cfg.clone(), getClass());
          assert c2.get(fqn, k).equals(v);
          assert getLoader(c2).get(fqn) == null;
       }

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -11,9 +11,9 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
+import org.jboss.cache.lock.LockManager;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.buddyreplication.BuddyReplicationTestsBase;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.marshall.MarshalledValue;
@@ -29,9 +29,10 @@
  * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  * @version $Revision$
  */
- at Test(groups = {"functional"}, testName = "statetransfer.StateTransfer200Test")
+ at Test(groups = {"functional"}, enabled = false, testName = "statetransfer.StateTransfer200Test")
 public class StateTransfer200Test extends StateTransferTestBase
 {
+
    protected String getReplicationVersion()
    {
       return "2.0.0.GA";
@@ -39,34 +40,46 @@
 
    public void testBuddyBackupExclusion() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCacheWithBr("testBuddyBackupExclusion_1");
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, false, false, false, true);
 
+
+      cache1.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
+
+      cache1.start();
+
       Fqn backup = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
       cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
       cache1.put(backup, "name", JOE);
       cache1.put(A_B, "age", TWENTY);
 
-      CacheSPI<Object, Object> cache2 = createCacheWithBr("StateTransferTestBase_2");
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, false);
+
       // Pause to give caches time to see each other
-      BuddyReplicationTestsBase.waitForSingleBuddy(cache1, cache2);
+      TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
+
       assertNull("_buddy_backup_ not transferred", cache2.get(backup, "test"));
       assertEquals("Correct age for /a/b", TWENTY, cache2.get(A_B, "age"));
    }
 
    public void testBuddyIntegration() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCacheWithBr("testBuddyIntegration_1");
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, false, false, false, true);
+      cache1.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
+      cache1.start();
 
       // cache 1 won't have a buddy at this stage.
+
       // put some state in cache 1
       cache1.put(A_B, "name", JOE);
       cache1.put(A_C, "name", JANE);
 
       // now start up cache 2
-      CacheSPI<Object, Object> cache2 = createCacheWithBr("testBuddyIntegration_2");
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, false, false, false, true);
+      cache2.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
+      cache2.start();
 
       // Pause to give caches time to see each other
-      BuddyReplicationTestsBase.waitForSingleBuddy(cache1, cache2);
+      TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
 
       BuddyFqnTransformer fqnTransformer = new BuddyFqnTransformer();
       // now peek into cache 2 to check that this state has been transferred into the backup subtree
@@ -80,7 +93,7 @@
    @SuppressWarnings("null")
    public void testCacheLoaderFailure() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, false, CorruptedFileCacheLoader.class.getName(), false, true, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, CorruptedFileCacheLoader.class.getName(), false, true, true);
 
       cache1.put(A_B, "name", JOE);
       cache1.put(A_B, "age", TWENTY);
@@ -90,7 +103,8 @@
       CacheSPI cache2 = null;
       try
       {
-         cache2 = createCache(false, false, true, false, false, true);
+         cache2 = createCache("cache2", false, false, true, false, false, true);
+         cache2.create();
          cache2.start();
 
          //Vladimir  October 5th 2007
@@ -108,7 +122,7 @@
 
    public void testLoadEntireStateAfterStart() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, true, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, true);
 
       createAndActivateRegion(cache1, Fqn.ROOT);
 
@@ -117,7 +131,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object> cache2 = createCache(false, true, true);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, true);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -147,14 +161,14 @@
 
    public void testInitialStateTransfer() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, false, false);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, false);
 
       cache1.put(A_B, "name", JOE);
       cache1.put(A_B, "age", TWENTY);
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object> cache2 = createCache(false, false, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, false);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -177,12 +191,13 @@
 
    protected void initialStateTferWithLoaderTest(boolean asyncLoader) throws Exception
    {
-      initialStateTferWithLoaderTest(getDefaultCacheLoader(), getDefaultCacheLoader() , asyncLoader);
+      initialStateTferWithLoaderTest("org.jboss.cache.loader.FileCacheLoader",
+            "org.jboss.cache.loader.FileCacheLoader", asyncLoader);
    }
 
    public void testPartialStateTransfer() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, true, false);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, false);
 
       createAndActivateRegion(cache1, A);
 
@@ -191,7 +206,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object> cache2 = createCache(false, true, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, false);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -244,18 +259,20 @@
 
    public void testLocksAndStateTransfer() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, true, false);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, false);
       createAndActivateRegion(cache1, A);
       cache1.put(A_B, "name", JOE);
-      CacheSPI<Object, Object> cache2 = createCache(false, true, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, false);
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
       createAndActivateRegion(cache2, A_B);
       assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
 
-      assert cache1.getNumberOfLocksHeld() == 0;
+      LockManager lockManager = cache1.getComponentRegistry().getComponent(LockManager.class);
+      assert  !lockManager.isLocked(A_B);
       cache1.getRegion(A, false).deactivate();
-      assert cache1.getNumberOfLocksHeld() == 0;
+      assert  !lockManager.isLocked(A);
+      assert  !lockManager.isLocked(A_B);
       createAndActivateRegion(cache1, A_B);
       assertEquals("Incorrect name for /a/b", JOE, cache1.get(A_B, "name"));
    }
@@ -263,7 +280,7 @@
 
    public void testPartialStateTferWithLoader() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, true, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, true);
 
       createAndActivateRegion(cache1, A);
 
@@ -272,7 +289,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object> cache2 = createCache(false, true, true);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, true);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -360,7 +377,7 @@
       // Set the TCL to a classloader that can't see Person/Address
       Thread.currentThread().setContextClassLoader(getNotFoundClassLoader());
 
-      CacheSPI<Object, Object> cache1 = createCache(
+      CacheSPI<Object, Object> cache1 = createCache("cache1",
             false, // async
             true, // use marshaller
             true, // use cacheloader
@@ -376,7 +393,7 @@
       cache1.put(A_B, "person", ben);
 
       // For cache 2 we won't register loader until later
-      CacheSPI<Object, Object> cache2 = createCache(
+      CacheSPI<Object, Object> cache2 = createCache("cache2",
             false, // async
             true, // use marshalling
             true, // use cacheloader
@@ -412,7 +429,7 @@
 
    public void testStalePersistentState() throws Exception
    {
-      CacheSPI c1 = createCache(true, false, true, true);
+      CacheSPI c1 = createCache("1", true, false, true, true);
       c1.put(A, "K", "V");
 
       assert c1.get(A, "K").equals("V");
@@ -428,7 +445,7 @@
       assert l1.exists(A);
       assert l1.get(A).get("K").equals("V");
 
-      Cache c2 = createCache(true, false, true, true);
+      Cache c2 = createCache("2", true, false, true, true);
 
       c2.put(B, "K", "V");
 
@@ -438,6 +455,7 @@
 
       assert c1.get(B, "K").equals("V");
       assert c1.get(A, "K") == null;
+      assert !l1.exists(A);
    }
 
    private Object createBen(ClassLoader loader) throws Exception
@@ -469,12 +487,4 @@
       brc.setBuddyPoolName("TEST");
       return brc;
    }
-
-   private CacheSPI<Object, Object> createCacheWithBr(String cacheName) throws Exception
-   {
-      CacheSPI<Object, Object> cache1 = createCache(false, false, false, false, false, true);
-      cache1.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
-      cache1.start();
-      return cache1;
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -2,14 +2,16 @@
 
 import org.testng.annotations.Test;
 
- at Test(groups = {"functional"}, testName = "statetransfer.StateTransferCompatibilityTest")
+ at Test(groups = {"functional"}, enabled = false, testName = "statetransfer.StateTransferCompatibilityTest")
 public class StateTransferCompatibilityTest extends StateTransferTestBase
 {
+
    protected String getReplicationVersion()
    {
       return "2.0.0.GA";
    }
 
+
    /**
     * These tests ensure that http://jira.jboss.com/jira/browse/JBCACHE-738
     * compatibility between non-delegating cacheloaders is maintained. In the tests
@@ -56,6 +58,7 @@
 
    public void testCompatibilityBetweenJDBCAndBdjeCacheLoaders() throws Exception
    {
+
       initialStateTferWithLoaderTest("org.jboss.cache.loader.JDBCCacheLoader",
               "org.jboss.cache.loader.bdbje.BdbjeCacheLoader", false);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -7,6 +7,7 @@
 
 package org.jboss.cache.statetransfer;
 
+import java.util.Map;
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
@@ -356,7 +357,7 @@
       {
 
          // The first cache we create is inactivated.
-         CacheSPI<Object, Object> cacheA = createCache(sync, true, false);
+         CacheSPI<Object, Object> cacheA = createCache("cacheA", sync, true, false);
 
          CacheSPI[] caches = new CacheSPI[count + 1];
          caches[0] = cacheA;
@@ -467,6 +468,8 @@
     */
    public void testEvictionSeesStateTransfer() throws Exception
    {
+      Map<String, Cache> caches = cachesTL.get();
+
       Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
       additionalConfiguration(c);
       Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
@@ -500,6 +503,7 @@
       Configuration c = UnitTestConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true);
       additionalConfiguration(c);
       Cache<Object, Object> cache1 = new UnitTestCacheFactory<Object, Object>().createCache(c, getClass());
+      Map<String, Cache> caches = cachesTL.get();      
       caches.put("evict1", cache1);
 
       for (int i = 0; i < 25000; i++)

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -33,7 +33,6 @@
 import org.jboss.cache.config.Configuration.NodeLockingScheme;
 import org.jboss.cache.factories.UnitTestConfigurationFactory;
 import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.loader.FileCacheLoader;
 import org.jboss.cache.marshall.SelectedClassnameClassLoader;
 import org.jboss.cache.util.TestingUtil;
 import org.jboss.cache.util.UnitTestDatabaseManager;
@@ -78,44 +77,52 @@
    public static final Integer TWENTY = 20;
    public static final Integer FORTY = 40;
 
-   protected Map<String, Cache> caches = new HashMap<String, Cache>();
-   ClassLoader orig_TCL;
-   private static int cacheCount = 0;
+   protected ThreadLocal<Map<String, Cache>> cachesTL = new ThreadLocal<Map<String, Cache>>();
+   private ThreadLocal<ClassLoader> orig_TCL_TL = new ThreadLocal<ClassLoader>();
 
 
    protected abstract String getReplicationVersion();
 
-   protected CacheSPI<Object, Object> createCache(boolean sync, boolean useMarshalling, boolean useCacheLoader)
+   protected CacheSPI<Object, Object> createCache(String cacheID,
+                                                  boolean sync,
+                                                  boolean useMarshalling,
+                                                  boolean useCacheLoader)
          throws Exception
    {
-      return createCache(sync, useMarshalling, useCacheLoader, false, true, true);
+      return createCache(cacheID, sync, useMarshalling, useCacheLoader, false, true, true);
    }
 
-   protected CacheSPI<Object, Object> createCache(boolean sync, boolean useMarshalling, boolean useCacheLoader, boolean fetchPersistentState)
+   protected CacheSPI<Object, Object> createCache(String cacheID,
+                                                  boolean sync,
+                                                  boolean useMarshalling,
+                                                  boolean useCacheLoader, boolean fetchPersistentState)
          throws Exception
    {
-      return createCache(sync, useMarshalling, useCacheLoader, false, true, fetchPersistentState);
+      return createCache(cacheID, sync, useMarshalling, useCacheLoader, false, true, fetchPersistentState);
    }
 
-   protected CacheSPI<Object, Object> createCache(boolean sync, boolean useMarshalling, boolean useCacheLoader,
-                                                  boolean cacheLoaderAsync, boolean startCache, boolean fetchPersistentState)
+   protected CacheSPI<Object, Object> createCache(String cacheID,
+                                                  boolean sync,
+                                                  boolean useMarshalling,
+                                                  boolean useCacheLoader,
+                                                  boolean cacheLoaderAsync,
+                                                  boolean startCache, boolean fetchPersistentState)
          throws Exception
    {
       if (useCacheLoader)
       {
-         return createCache(sync, useMarshalling, getDefaultCacheLoader(), cacheLoaderAsync, startCache, fetchPersistentState);
+         return createCache(cacheID, sync, useMarshalling, "org.jboss.cache.loader.FileCacheLoader", cacheLoaderAsync, startCache, fetchPersistentState);
       }
       else
       {
-         return createCache(sync, useMarshalling, null, cacheLoaderAsync, startCache, fetchPersistentState);
+         return createCache(cacheID, sync, useMarshalling, null, cacheLoaderAsync, startCache, fetchPersistentState);
       }
    }
 
-
-   protected CacheSPI<Object, Object> createCache(boolean sync, boolean useMarshalling, String cacheLoaderClass,
+   protected CacheSPI<Object, Object> createCache(String cacheID, boolean sync, boolean useMarshalling, String cacheLoaderClass,
                                                   boolean cacheLoaderAsync, boolean startCache, boolean fetchPersistentState) throws Exception
    {
-      String cacheID = getNextUniqueCacheName();
+      Map<String, Cache> caches = cachesTL.get();
       if (caches.get(cacheID) != null)
       {
          throw new IllegalStateException(cacheID + " already created");
@@ -129,6 +136,7 @@
          c.setSyncRollbackPhase(true);
          c.setSyncCommitPhase(true);
       }
+      //c.setClusterName("VersionedTestBase");
       c.setReplVersionString(getReplicationVersion());
       // Use a long timeout to facilitate setting debugger breakpoints
       c.setStateRetrievalTimeout(60000);
@@ -152,6 +160,7 @@
 
       if (startCache)
       {
+         tree.create();
          tree.start();
       }
 
@@ -203,9 +212,12 @@
       validateMultiplexer(cache);
    }
 
-   protected void configureCacheLoader(Configuration c, String cacheID, boolean async) throws Exception
+   protected void configureCacheLoader(Configuration c,
+                                       String cacheID,
+                                       boolean async)
+         throws Exception
    {
-      configureCacheLoader(c, getDefaultCacheLoader(), cacheID, async, true);
+      configureCacheLoader(c, "org.jboss.cache.loader.FileCacheLoader", cacheID, async, true);
    }
 
    protected void configureCacheLoader(Configuration c, String cacheloaderClass, String cacheID,
@@ -216,40 +228,47 @@
          if (cacheloaderClass.equals("org.jboss.cache.loader.JDBCCacheLoader"))
          {
             Properties prop = UnitTestDatabaseManager.getTestDbProperties();
+            String props = "cache.jdbc.driver =" + prop.getProperty("cache.jdbc.driver") + "\n" + "cache.jdbc.url="
+                  + prop.getProperty("cache.jdbc.url") + "\n" + "cache.jdbc.user="
+                  + prop.getProperty("cache.jdbc.user") + "\n" + "cache.jdbc.password="
+                  + prop.getProperty("cache.jdbc.password") + "\n" + "cache.jdbc.node.type="
+                  + prop.getProperty("cache.jdbc.node.type") + "\n" + "cache.jdbc.table.name="
+                  + prop.getProperty("cache.jdbc.table.name");
+
             CacheLoaderConfig clc = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", "org.jboss.cache.loader.JDBCCacheLoader",
-                  prop, false, true, false, false, false);
+                  props, false, true, false, false, false);
             clc.getFirstCacheLoaderConfig().setPurgeOnStartup(true);
             c.setCacheLoaderConfig(clc);
-         } else if (cacheloaderClass.equals(FileCacheLoader.class.getName()))
+         }
+         else
          {
-            String tmpLocation = getTempLocation(cacheID);
-            File file = new File(tmpLocation);
+
+            String tmp_location = getTempLocation(cacheID);
+
+            // Do cleanup in case it failed before
+            File file = new File(tmp_location);
             cleanFile(file);
+
             file.mkdir();
-            tmpLocation = escapeWindowsPath(tmpLocation);
-            String props = "location = " + tmpLocation + "\n";
+
+            tmp_location = escapeWindowsPath(tmp_location);
+            String props = "location = " + tmp_location + "\n";
             c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", cacheloaderClass,
                   props, async, fetchPersistentState, false, false, false));
          }
-         else
-         {
-            assert !cacheloaderClass.equals(FileCacheLoader.class.getName());
-            c.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", cacheloaderClass,
-                  "", async, fetchPersistentState, false, false, false));
-         }
       }
    }
 
    protected void initialStateTferWithLoaderTest(String cacheLoaderClass1, String cacheLoaderClass2, boolean asyncLoader) throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache(false, false, cacheLoaderClass1, false, true, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, cacheLoaderClass1, false, true, true);
 
       cache1.put(A_B, "name", JOE);
       cache1.put(A_B, "age", TWENTY);
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object> cache2 = createCache(false, false, cacheLoaderClass2, asyncLoader, true, true);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, cacheLoaderClass2, asyncLoader, true, true);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -258,24 +277,6 @@
 
       CacheLoader loader = cache2.getCacheLoaderManager().getCacheLoader();
 
-      long start = System.currentTimeMillis();
-      while (asyncLoader && System.currentTimeMillis() - start < 10000)
-      {
-         try
-         {
-            doAssertion(cache2, loader);
-            break;
-         } catch (Throwable ae)
-         {
-            //allow this within the timeout
-         }
-      }
-      doAssertion(cache2, loader);
-   }
-
-   private void doAssertion(CacheSPI<Object, Object> cache2, CacheLoader loader)
-         throws Exception
-   {
       assertEquals("Incorrect loader name for /a/b", JOE, loader.get(A_B).get("name"));
       assertEquals("Incorrect loader age for /a/b", TWENTY, loader.get(A_B).get("age"));
       assertEquals("Incorrect loader name for /a/c", BOB, loader.get(A_C).get("name"));
@@ -317,17 +318,22 @@
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
-   {caches = new HashMap<String, Cache>();
+   {
+      Map<String, Cache> caches = new HashMap<String, Cache>();
+      cachesTL.set(caches);
 
       // Save the TCL in case a test changes it
-       orig_TCL = Thread.currentThread().getContextClassLoader();
+      ClassLoader orig_TCL = Thread.currentThread().getContextClassLoader();
+      orig_TCL_TL.set(orig_TCL);
    }
 
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
    {
+      Map<String, Cache> caches = cachesTL.get();
+
       // Restore the TCL in case a test changed it
-      Thread.currentThread().setContextClassLoader(orig_TCL);
+      Thread.currentThread().setContextClassLoader(orig_TCL_TL.get());
 
       for (String cacheID : caches.keySet())
       {
@@ -350,6 +356,7 @@
       {
          TestingUtil.killCaches(c);
       }
+      cachesTL.set(null);
    }
 
    protected void stopCache(Cache cache)
@@ -423,7 +430,7 @@
                 boolean activateRoot)
             throws Exception
       {
-         this.cache = createCache(sync, true, false);
+         this.cache = createCache(name, sync, true, false);
          this.semaphore = semaphore;
          this.name = name;
 
@@ -439,7 +446,7 @@
                 boolean activateRoot, long stateRetrievalTimeout)
             throws Exception
       {
-         cache = createCache(sync, true, false, false, false, true);
+         cache = createCache(name, sync, true, false, false, false, true);
          cache.getConfiguration().setStateRetrievalTimeout(stateRetrievalTimeout);
          cache.start();
          this.semaphore = semaphore;
@@ -513,14 +520,4 @@
          }
       }
    }
-
-   protected String getDefaultCacheLoader()
-   {
-      return org.jboss.cache.loader.testloaders.DummyInMemoryCacheLoader.class.getName();
-   }
-
-   private String getNextUniqueCacheName()
-   {
-      return getClass().getSimpleName() + cacheCount++;
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -4,7 +4,6 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.UnitTestCacheFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.factories.UnitTestConfigurationFactory;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.util.TestingUtil;
@@ -86,8 +85,8 @@
    {
       Writer writer;
       Configuration cfg1, cfg2;
-      cfg1 = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
-      cfg2 = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
+      cfg1 = new Configuration();
+      cfg2 = new Configuration();
       cfg1.setCacheMode(Configuration.CacheMode.REPL_SYNC);
       cfg2.setCacheMode(Configuration.CacheMode.REPL_SYNC);
 

Modified: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java	2009-02-04 17:46:08 UTC (rev 7645)
@@ -159,15 +159,13 @@
          Class<? extends ReplicableCommand> replicableCommandClass = it.next();
          if (realOne.containsCommandType(replicableCommandClass))
          {
-            it.remove();//only remove once
-            break;
+            it.remove();
          } else if (realOne.getSingleModification() instanceof PrepareCommand) //explicit transaction
          {
             PrepareCommand prepareCommand = (PrepareCommand) realOne.getSingleModification();
             if (prepareCommand.containsModificationType(replicableCommandClass))
             {
                it.remove();
-               break;//only remove once
             }
          }
       }
@@ -256,5 +254,3 @@
       return cache;
    }
 }
-//[127.0.0.1:7900] Processed command: ReplicateCommand{cmds=PrepareCommand{globalTransaction=GlobalTransaction:<127.0.0.1:7903>:481, modifications=[PutDataMapCommand{fqn=/_BUDDY_BACKUP_/127.0.0.1_7903/JSESSION/BuddyReplicationFailoverTest54_localhost/160, dataVersion=null, data={2=org.jboss.cache.integration.websession.util.SessionMetadata at 93a0d8, 1=1233588409000, 3={key=2}, 0=3}, globalTransaction=null, erase=false}], localAddress=127.0.0.1:7903, onePhaseCommit=true}}
-//[127.0.0.1:7900] skipping  command  ReplicateCommand{cmds=PrepareCommand{globalTransaction=GlobalTransaction:<127.0.0.1:7903>:482, modifications=[PutDataMapCommand{fqn=/_BUDDY_BACKUP_/127.0.0.1_7903/JSESSION/BuddyReplicationFailoverTest54_localhost/160, dataVersion=null, data={1=1233588409031, 3={key=3}, 0=4}, globalTransaction=null, erase=false}], localAddress=127.0.0.1:7903, onePhaseCommit=true}}

Modified: core/trunk/src/test/resources/configs/integration/web-session-cache-configs.xml
===================================================================
--- core/trunk/src/test/resources/configs/integration/web-session-cache-configs.xml	2009-02-04 17:33:49 UTC (rev 7644)
+++ core/trunk/src/test/resources/configs/integration/web-session-cache-configs.xml	2009-02-04 17:46:08 UTC (rev 7645)
@@ -263,7 +263,7 @@
         <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
 
         <!-- Valid modes are REPL_ASYNC and REPL_SYNC -->
-        <attribute name="CacheMode">REPL_SYNC</attribute>
+        <attribute name="CacheMode">REPL_ASYNC</attribute>
 
         <!-- Name of cluster. Needs to be the same for all members, in order
              to find each other -->
@@ -341,26 +341,26 @@
         </attribute>
         
         <!-- Cache Loader for session passivation --> 
-        <attribute name="CacheLoaderConfig">
-          <config>
-            <passivation>true</passivation>
-            <shared>false</shared>
+        <!--<attribute name="CacheLoaderConfig">-->
+          <!--<config>-->
+            <!--<passivation>true</passivation>-->
+            <!--<shared>false</shared>-->
 
-            <purgeOnStartup>true</purgeOnStartup>
+            <!--<purgeOnStartup>true</purgeOnStartup>-->
 
-            <cacheloader>
-               <class>org.jboss.cache.loader.FileCacheLoader</class>
-               <properties>
-                  location=${java.io.tmpdir}${/}session
-               </properties>
-               <async>false</async>
-               <fetchPersistentState>true</fetchPersistentState>
-               <ignoreModifications>false</ignoreModifications>
-               <checkCharacterPortability>false</checkCharacterPortability>
-            </cacheloader>
+            <!--<cacheloader>-->
+               <!--<class>org.jboss.cache.loader.FileCacheLoader</class>-->
+               <!--<properties>-->
+                  <!--location=${java.io.tmpdir}${/}session-->
+               <!--</properties>-->
+               <!--<async>false</async>-->
+               <!--<fetchPersistentState>true</fetchPersistentState>-->
+               <!--<ignoreModifications>false</ignoreModifications>-->
+               <!--<checkCharacterPortability>false</checkCharacterPortability>-->
+            <!--</cacheloader>-->
 
-          </config>
-        </attribute>
+          <!--</config>-->
+        <!--</attribute>-->
 
         <!-- 
            JBoss Cache eviction is not needed; webapp or SFSB container 




More information about the jbosscache-commits mailing list