[jbosscache-commits] JBoss Cache SVN: r4836 - in core/trunk/src/test/java/org/jboss/cache: api and 24 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Dec 11 12:34:06 EST 2007


Author: manik.surtani at jboss.com
Date: 2007-12-11 12:34:04 -0500 (Tue, 11 Dec 2007)
New Revision: 4836

Added:
   core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java
   core/trunk/src/test/java/org/jboss/cache/factories/annotations/
   core/trunk/src/test/java/org/jboss/cache/factories/annotations/ClasspathScannerTest.java
Modified:
   core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
   core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
   core/trunk/src/test/java/org/jboss/cache/FqnTest.java
   core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
   core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
   core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
   core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
   core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
   core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
   core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
   core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
   core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java
   core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
   core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java
   core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
   core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
   core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/SelectedClassnameClassLoader.java
   core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/data/Address.java
   core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java
   core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
   core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
   core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
   core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
   core/trunk/src/test/java/org/jboss/cache/multiplexer/MultiplexerTestHelper.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java
   core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
   core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
   core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
   core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java
   core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
   core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToJDBCCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/CorruptedFileCacheLoader.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
Log:
Updated tests to deal with new API

Modified: core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/CacheFactoryTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -9,7 +9,9 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.lock.IsolationLevel;
-import static org.testng.AssertJUnit.*;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -19,12 +21,12 @@
 /**
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test (groups = {"functional"})
+ at Test(groups = {"functional"})
 public class CacheFactoryTest
 {
    Configuration expected;
    String configFile = "META-INF/replSync-service.xml";
-   private CacheImpl cache;
+   private CacheSPI cache;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp()
@@ -44,39 +46,38 @@
 
    public void testFromConfigFileStarted()
    {
-      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(configFile);
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(configFile);
       // can't test for this anymore since the RuntimeConfig is attached to the running cache
       //assertEquals(expected, cache.getConfiguration());
-
-      assertTrue("Should have started", cache.isStarted());
+      assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
       doSimpleConfTests(cache.getConfiguration());
    }
 
    public void testFromConfigFileUnstarted()
    {
-      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(configFile, false);
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(configFile, false);
       // can't test for this anymore since the RuntimeConfig is attached to the running cache
 //      assertEquals(expected, cache.getConfiguration());
 
-      assertFalse("Should not have started", cache.isStarted());
+      assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
 
       doSimpleConfTests(cache.getConfiguration());
    }
 
    public void testFromConfigObjStarted()
    {
-      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(expected);
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected);
 
-      assertTrue("Should have started", cache.isStarted());
+      assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
 
       doSimpleConfTests(cache.getConfiguration());
    }
 
    public void testFromConfigObjUnstarted()
    {
-      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(expected, false);
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected, false);
 
-      assertFalse("Should not have started", cache.isStarted());
+      assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
 
       doSimpleConfTests(cache.getConfiguration());
    }
@@ -93,29 +94,45 @@
 
    public void testLifecycle() throws Exception
    {
-      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(expected, false);
-      assertFalse(cache.isStarted());
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(expected, false);
+      assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
       cache.start();
-      assertTrue(cache.isStarted());
+      assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
       cache.stop();
-      assertFalse(cache.isStarted());
+      assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
    }
 
    public void testCreationFromStreamStarted() throws Exception
    {
       InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
       CacheFactory cf = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl) cf.createCache(is);
-      assertTrue("Should have started", cache.isStarted());
+      cache = (CacheSPI) cf.createCache(is);
+      assert cache.getCacheStatus() == CacheStatus.STARTED : "Should have started";
       doSimpleConfTests(cache.getConfiguration());
    }
-   
+
    public void testCreationFromStream() throws Exception
    {
       InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
       CacheFactory cf = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl) cf.createCache(is, false);
-      assertFalse("Should not have started", cache.isStarted());
+      cache = (CacheSPI) cf.createCache(is, false);
+      assert cache.getCacheStatus() != CacheStatus.STARTED : "Should not have started";
       doSimpleConfTests(cache.getConfiguration());
    }
+
+   public void testComponentsInjected() throws Exception
+   {
+      CacheFactory cf = DefaultCacheFactory.getInstance();
+      Configuration c = new Configuration();
+      c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
+      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+      cache = (CacheSPI) cf.createCache(c);
+
+      assert TestingUtil.extractField(cache, "regionManager") != null;
+      assert TestingUtil.extractField(cache, "notifier") != null;
+      assert TestingUtil.extractField(cache, "marshaller") != null;
+      assert TestingUtil.extractField(cache, "transactionManager") != null;
+      assert TestingUtil.extractField(cache, "transactionTable") != null;
+      assert TestingUtil.extractField(cache, "stateTransferManager") != null;
+   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,22 +1,17 @@
 package org.jboss.cache;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeCreated;
 import org.jboss.cache.notifications.event.Event;
+import org.jboss.cache.util.CachePrinter;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
+
+import javax.transaction.TransactionManager;
+
 /**
  * Tests whether modifications within callbacks (TreeCacheListener) are handled correctly
  *
@@ -25,7 +20,7 @@
  */
 public class CallbackTest
 {
-   CacheImpl<Object, Object> cache = null, cache2;
+   CacheSPI<Object, Object> cache = null, cache2;
    final Fqn<String> FQN_A = Fqn.fromString("/a");
    final Fqn<String> FQN_B = Fqn.fromString("/b");
    static final String KEY = "key";
@@ -43,7 +38,7 @@
    }
 
    @Test(groups = {"functional"})
-   public void testLocalPutCallbackWithoutTransaction() throws Exception, NotSupportedException
+   public void testLocalPutCallbackWithoutTransaction() throws Exception
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.addCacheListener(new PutListener(cache));
@@ -52,12 +47,12 @@
       assertTrue(cache.exists(FQN_A));
       assertTrue(cache.exists(FQN_B));//created by callback
       assertEquals(cache.getLockTable().size(), 0);
-      System.out.println("cache locks:\n" + cache.printLockInfo());
+      System.out.println("cache locks:\n" + CachePrinter.printCacheLockingInfo(cache));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
    @Test(groups = {"functional"})
-   public void testLocalGetCallbackSameFqnWithoutTransaction() throws Exception, NotSupportedException
+   public void testLocalGetCallbackSameFqnWithoutTransaction() throws Exception
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.getNotifier().addCacheListener(new GetListener(cache, FQN_A));
@@ -65,12 +60,12 @@
       cache.put(FQN_A, null);
       assertTrue(cache.exists(FQN_A));
       assertEquals(cache.getLockTable().size(), 0);
-      System.out.println("cache locks:\n" + cache.printLockInfo());
+      System.out.println("cache locks:\n" + CachePrinter.printCacheLockingInfo(cache));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
    @Test(groups = {"functional"})
-   public void testLocalGetCallbackDifferentFqnWithoutTransaction() throws Exception, NotSupportedException
+   public void testLocalGetCallbackDifferentFqnWithoutTransaction() throws Exception
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.put(FQN_B, null);
@@ -80,12 +75,12 @@
       assertTrue(cache.exists(FQN_A));
       assertTrue(cache.exists(FQN_B));
       assertEquals(cache.getLockTable().size(), 0);
-      System.out.println("cache locks:\n" + cache.printLockInfo());
+      System.out.println("cache locks:\n" + CachePrinter.printCacheLockingInfo(cache));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
    @Test(groups = {"functional"})
-   public void testLocalCallbackWithTransaction() throws Exception, NotSupportedException
+   public void testLocalCallbackWithTransaction() throws Exception
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.getNotifier().addCacheListener(new PutListener(cache));
@@ -98,7 +93,7 @@
    }
 
    @Test(groups = {"functional"})
-   public void testLocalCallbackWithException() throws Exception, NotSupportedException
+   public void testLocalCallbackWithException() throws Exception
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.getNotifier().addCacheListener(new ExceptionListener());
@@ -116,13 +111,13 @@
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
-   private CacheImpl<Object, Object> createCache(Configuration.CacheMode mode, IsolationLevel level) throws Exception
+   private CacheSPI<Object, Object> createCache(Configuration.CacheMode mode, IsolationLevel level)
    {
       Configuration c = new Configuration();
       c.setCacheMode(mode);
       c.setIsolationLevel(level);
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      return (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
+      return (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
    }
 
    private TransactionManager startTransaction()
@@ -153,10 +148,10 @@
    @CacheListener
    public class GetListener
    {
-      CacheImpl<Object, Object> c;
+      CacheSPI<Object, Object> c;
       Fqn<?> my_fqn;
 
-      public GetListener(CacheImpl<Object, Object> c, Fqn<?> my_fqn)
+      public GetListener(CacheSPI<Object, Object> c, Fqn<?> my_fqn)
       {
          this.c = c;
          this.my_fqn = my_fqn;
@@ -169,7 +164,7 @@
          {
             try
             {
-               Node<?,?> n = c.get(this.my_fqn);
+               Node<?, ?> n = c.getNode(this.my_fqn);
                assertNotNull(n);
             }
             catch (CacheException ex)
@@ -184,9 +179,9 @@
    @CacheListener
    public class PutListener
    {
-      CacheImpl<Object, Object> c;
+      CacheSPI<Object, Object> c;
 
-      public PutListener(CacheImpl<Object, Object> c)
+      public PutListener(CacheSPI<Object, Object> c)
       {
          this.c = c;
       }

Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,14 +7,14 @@
 package org.jboss.cache;
 
 
-import java.util.HashMap;
-
 import org.jboss.cache.config.Configuration;
 import org.jgroups.util.Util;
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
+import java.util.HashMap;
+
 /**
  * Tests {@link Fqn}.
  *
@@ -174,7 +174,7 @@
    public void testEquals3()
    {
       Fqn<Object> f1;
-      Fqn<? extends Object> f2;
+      Fqn<?> f2;
       f1 = new Fqn<Object>("a", 322649, Boolean.TRUE);
       f2 = new Fqn<String>();
       assert !f1.equals(f2);
@@ -364,7 +364,7 @@
    }
 
    @SuppressWarnings("unchecked")
-   <T> Fqn<T> marshalAndUnmarshal(Fqn<T> fqn) throws Exception
+         <T> Fqn<T> marshalAndUnmarshal(Fqn<T> fqn) throws Exception
    {
       byte[] buf = Util.objectToByteBuffer(fqn);
       return (Fqn<T>) Util.objectFromByteBuffer(buf);

Modified: core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,30 +7,29 @@
 package org.jboss.cache;
 
 import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
 
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectOutputStream;
 import java.util.Set;
 
-import org.testng.annotations.Test;
-
 /**
  * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
  * @version $Id$
  */
 public class GetKeysTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
 
    @Test(groups = {"functional"})
    public void testGetKeys() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
       cache.put("/a/b/c", "name", "Bela Ban");
       cache.put("/a/b/c", "age", 40);
       cache.put("/a/b/c", "city", "Kreuzlingen");
 
-      Set keys = cache.getKeys("/a/b/c");
+      Set keys = cache.getNode("/a/b/c").getKeys();
       log("keys are " + keys);
       assertNotNull(keys);
       assertEquals(3, keys.size());
@@ -43,13 +42,13 @@
    @Test(groups = {"functional"})
    public void testGetChildren() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
       cache.put("/a/b/c", null);
       cache.put("/a/b/c/1", null);
       cache.put("/a/b/c/2", null);
       cache.put("/a/b/c/3", null);
 
-      Set children = cache.getChildrenNames("/a/b/c");
+      Set children = cache.getNode("/a/b/c").getChildrenNames();
       log("children are " + children);
       assertNotNull(children);
       assertEquals(3, children.size());
@@ -62,7 +61,7 @@
    @Test(groups = {"functional"})
    public void testGetKeysOnNode()
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
       cache.put("/a/b/c", "key", "value");
       Node node = cache.getRoot().getChild(Fqn.fromString("/a/b/c"));
       Set keySet = node.getKeys();
@@ -71,7 +70,8 @@
 
          keySet.add("asd");
          fail();
-      } catch (Exception e)
+      }
+      catch (Exception e)
       {
          //expected
       }

Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,18 +1,5 @@
 package org.jboss.cache;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.config.Configuration;
@@ -21,11 +8,19 @@
 import org.jboss.cache.notifications.annotation.CacheStarted;
 import org.jboss.cache.notifications.annotation.CacheStopped;
 import org.jboss.cache.notifications.event.Event;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.util.LinkedList;
+import java.util.List;
+
 /**
- * Tests restart (stop-destroy-create-start) of CacheImpl
+ * Tests restart (stop-destroy-create-start) of CacheSPI
  *
  * @author Bela Ban
  * @version $Id$
@@ -34,7 +29,7 @@
 public class LifeCycleTest
 {
    private static Log log = LogFactory.getLog(LifeCycleTest.class);
-   private CacheImpl[] c;
+   private CacheSPI[] c;
 
    @AfterMethod
    public void tearDown()
@@ -65,7 +60,7 @@
       List<Cache> caches = new LinkedList<Cache>();
       if (c != null) for (Cache existingCache : c) caches.add(existingCache);
       caches.add(cache);
-      c = caches.toArray(new CacheImpl[]{});
+      c = caches.toArray(new CacheSPI[]{});
       if (start)
       {
          cache.start();
@@ -82,9 +77,7 @@
       assertTrue(c[0].getNumberOfNodes() > 0);
       assertEquals(0, c[0].getNumberOfLocksHeld());
 
-      System.out.println("cache locks before restart:\n" + c[0].printLockInfo());
       restartCache(c[0]);
-      System.out.println("cache locks after restart:\n" + c[0].printLockInfo());
 
       assertEquals(0, c[0].getNumberOfNodes());
       assertEquals(0, c[0].getNumberOfLocksHeld());
@@ -97,12 +90,10 @@
       TransactionManager tm = beginTransaction();
 
       c[0].put("/a/b/c", null);
-      log.debug("cache locks before restart:\n" + c[0].printLockInfo());
       assertTrue(c[0].getNumberOfNodes() > 0);
       assertEquals(4, c[0].getNumberOfLocksHeld());
 
       restartCache(c[0]);
-      log.debug("cache locks after restart:\n" + c[0].printLockInfo());
 
       //assertEquals(4, cache.getNumberOfLocksHeld());
       assertEquals(0, c[0].getNumberOfNodes());
@@ -120,9 +111,7 @@
       assertTrue(c[0].getNumberOfNodes() > 0);
       assertEquals(0, c[0].getNumberOfLocksHeld());
 
-      System.out.println("cache locks before restart:\n" + c[0].printLockInfo());
       restartCache(c[0]);
-      System.out.println("cache locks after restart:\n" + c[0].printLockInfo());
 
       assertEquals(0, c[0].getNumberOfNodes());
       assertEquals(0, c[0].getNumberOfLocksHeld());
@@ -139,9 +128,7 @@
       assertTrue(c[0].getNumberOfNodes() > 0);
       assertEquals(0, c[0].getNumberOfLocksHeld());
 
-      System.out.println("cache locks before restart:\n" + c[0].printLockInfo());
       restartCache(c[0]);
-      System.out.println("cache locks after restart:\n" + c[0].printLockInfo());
 
       assertEquals(0, c[0].getNumberOfNodes());
       assertEquals(0, c[0].getNumberOfLocksHeld());
@@ -159,9 +146,7 @@
       assertTrue(c[0].getNumberOfNodes() > 0);
       assertEquals(0, c[0].getNumberOfLocksHeld());
 
-      System.out.println("cache locks before restart:\n" + c[0].printLockInfo());
       restartCache(c[0]);
-      System.out.println("cache locks after restart:\n" + c[0].printLockInfo());
 
       assertEquals(0, c[0].getNumberOfNodes());
       assertEquals(0, c[0].getNumberOfLocksHeld());
@@ -285,7 +270,8 @@
       {
          // now DIRECTLY change the status of c2.
          // emulate the race condition where the remote cache is stopping but hasn't disconnected from the channel.
-         c[1].cacheStatus = CacheStatus.STOPPING;
+         CacheImpl ci1 = (CacheImpl) TestingUtil.extractField(c[1], "cache");
+         ci1.cacheStatus = CacheStatus.STOPPING;
 
          // Thanks to JBCACHE-1179, this should only log a warning and not throw an exception
          c[0].put(Fqn.ROOT, "k", "v");
@@ -293,11 +279,13 @@
       finally
       {
          // reset c[1] to running so the tearDown method can clean it up
-         c[1].cacheStatus = CacheStatus.STARTED;
+         CacheImpl ci1 = (CacheImpl) TestingUtil.extractField(c[1], "cache");
+         ci1.cacheStatus = CacheStatus.STARTED;
       }
    }
 
-   @Test (enabled = false) // TODO: needs investigation ... !
+   @Test(enabled = false)
+   // TODO: needs investigation ... !
    public void testRemoteInvalidStateInvocations2() throws Exception
    {
       createAndRegisterCache(Configuration.CacheMode.REPL_SYNC, true);
@@ -306,7 +294,8 @@
       {
          // now DIRECTLY change the status of c2.
          // emulate the race condition where the remote cache is stopping but hasn't disconnected from the channel.
-         c[1].cacheStatus = CacheStatus.STARTING;
+         CacheImpl ci1 = (CacheImpl) TestingUtil.extractField(c[1], "cache");
+         ci1.cacheStatus = CacheStatus.STARTING;
 
          try
          {
@@ -326,7 +315,8 @@
             public void run()
             {
                TestingUtil.sleepThread(sleepTime);
-               c[1].cacheStatus = CacheStatus.STARTED;
+               CacheImpl ci1 = (CacheImpl) TestingUtil.extractField(c[1], "cache");
+               ci1.cacheStatus = CacheStatus.STARTED;
             }
          }.start();
 
@@ -339,7 +329,8 @@
       finally
       {
          // reset c[1] to running so the tearDown method can clean it up
-         c[1].cacheStatus = CacheStatus.STARTED;
+         CacheImpl ci1 = (CacheImpl) TestingUtil.extractField(c[1], "cache");
+         ci1.cacheStatus = CacheStatus.STARTED;
       }
    }
 
@@ -351,7 +342,8 @@
       c[0].put(Fqn.ROOT, "k2", "v2");
 
       // now DIRECTLY change the status of c.
-      c[0].cacheStatus = CacheStatus.STOPPING;
+      CacheImpl ci0 = (CacheImpl) TestingUtil.extractField(c[0], "cache");
+      ci0.cacheStatus = CacheStatus.STOPPING;
 
       try
       {
@@ -385,7 +377,7 @@
       {
          public void run()
          {
-            int i=0;
+            int i = 0;
             while (running.get(0))
             {
                try
@@ -425,16 +417,17 @@
       c[0].put(Fqn.ROOT, "k2", "v2");
 
       // now DIRECTLY change the status of c.
-      c[0].cacheStatus = CacheStatus.STOPPING;
+      CacheImpl ci0 = (CacheImpl) TestingUtil.extractField(c[0], "cache");
+      ci0.cacheStatus = CacheStatus.STOPPING;
 
       // rollbacks should just log a message
       c[0].getTransactionManager().rollback();
    }
 
 
-   private CacheImpl<Object, Object> createCache(Configuration.CacheMode cache_mode) throws Exception
+   private CacheSPI<Object, Object> createCache(Configuration.CacheMode cache_mode)
    {
-      CacheImpl<Object, Object> retval = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI<Object, Object> retval = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       retval.getConfiguration().setCacheMode(cache_mode);
       retval.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       return retval;
@@ -449,19 +442,19 @@
    }
 
 
-   private void startCache(CacheImpl c) throws Exception
+   private void startCache(CacheSPI c)
    {
       c.create();
       c.start();
    }
 
-   private void stopCache(CacheImpl c)
+   private void stopCache(CacheSPI c)
    {
       c.stop();
       c.destroy();
    }
 
-   private void restartCache(CacheImpl c) throws Exception
+   private void restartCache(CacheSPI c) throws Exception
    {
       stopCache(c);
       startCache(c);

Modified: core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/TreeCacheFunctionalTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,17 +1,17 @@
 package org.jboss.cache;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.util.HashMap;
-
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.HashMap;
+
 /**
- * Simple functional tests for CacheImpl
+ * Simple functional tests for CacheSPI
  *
  * @author Bela Ban
  * @version $Id$
@@ -19,13 +19,13 @@
 @Test(groups = {"functional"})
 public class TreeCacheFunctionalTest
 {
-   CacheImpl<Object, Object> cache = null;
+   CacheSPI<Object, Object> cache = null;
    final Fqn FQN = Fqn.fromString("/myNode");
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
@@ -48,7 +48,7 @@
    {
       cache.put("/a/b/c", "age", 38);
       assertEquals(cache.get("/a/b/c", "age"), 38);
-      assertNotNull(cache.get("/a/b/c"));
+      assertNotNull(cache.getNode("/a/b/c"));
       assertEquals(0, cache.getNumberOfLocksHeld());
       assertEquals(0, cache.getLockTable().size());
    }
@@ -58,32 +58,28 @@
    {
       Object key = null;
       cache.put("/a/b/c", key, "val");
-      System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
    }
 
    public void testPutNullValue() throws CacheException
    {
       Object val = null;
       cache.put("/a/b/c", "key", val);
-      System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
    }
 
    public void testPutNullKeyAndValues() throws CacheException
    {
       Object key = null, val = null;
       cache.put("/a/b/c", key, val);
-      System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
    }
 
    public void testPutMapsWithNullValues() throws CacheException
    {
-      HashMap<String, String> map = new HashMap<String, String>();
+      HashMap<Object, Object> map = new HashMap<Object, Object>();
       map.put("key", null);
       map.put(null, "val");
       map.put("a", "b");
       map.put(null, null);
       cache.put("/a/b/c", map);
-      System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
    }
 
    public void testPutKeys() throws CacheException
@@ -91,8 +87,8 @@
       cache.put("/a/b/c", "age", 38);
       cache.put("/a/b/c", "name", "Bela");
       assertEquals(cache.get("/a/b/c", "age"), 38);
-      assertNotNull(cache.get("/a/b/c"));
-      assertEquals(cache.getKeys("/a/b/c").size(), 2);
+      assertNotNull(cache.getNode("/a/b/c"));
+      assertEquals(cache.getNode("/a/b/c").getKeys().size(), 2);
       assertEquals(cache.exists("/a/b/c"), true);
       assertEquals(0, cache.getNumberOfLocksHeld());
       assertEquals(0, cache.getLockTable().size());
@@ -106,7 +102,7 @@
       cache.put("/a/b/c/3", null);
       cache.put("/a/b/c/3/a/b/c", null);
 
-      cache.remove("/a/b/c");
+      cache.removeNode("/a/b/c");
       assertEquals(0, cache.getNumberOfLocksHeld());
       assertEquals(0, cache.getLockTable().size());
    }

Modified: core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -2,26 +2,25 @@
 
 import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertTrue;
-
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 /**
- * Tests restart (stop-destroy-create-start) of CacheImpl
+ * Tests restart (stop-destroy-create-start) of CacheSPI
  *
  * @author Bela Ban
  * @version $Id$
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class TreeNodeTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
    }
 
    @AfterMethod(alwaysRun = true)
@@ -35,13 +34,13 @@
    {
       Object key = 1;
       cache.put(Fqn.fromString("/a/b/c"), key, "test");
-      Node<Object, Object> node = cache.get(Fqn.fromString("/a/b"));
+      Node<Object, Object> node = cache.getNode(Fqn.fromString("/a/b"));
       assertFalse(node.getChildren().isEmpty());
       assertTrue(node.getChild(new Fqn<String>("c")) != null);
 
       Fqn fqn = Fqn.fromString("/e/f");
       cache.put(fqn, "1", "1");
-      node = cache.get(Fqn.fromString("/e"));
+      node = cache.getNode(Fqn.fromString("/e"));
       assertFalse(node.getChildren().isEmpty());
       assertTrue(node.getChild(new Fqn<String>("f")) != null);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,22 +1,7 @@
 package org.jboss.cache.api;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNotSame;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
@@ -27,9 +12,16 @@
 import org.jboss.cache.notifications.annotation.NodeCreated;
 import org.jboss.cache.notifications.event.Event;
 import org.jboss.cache.transaction.GenericTransactionManagerLookup;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Tests the {@link org.jboss.cache.Cache} public API at a high level
  *
@@ -74,7 +66,7 @@
       try
       {
          c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
-         fail("Should have thrown an Exception");
+         assert false : "Should have thrown an Exception";
       }
       catch (ConfigurationException e)
       {
@@ -175,8 +167,6 @@
 
       cache.put(fqn, data);
 
-      System.out.println(((CacheImpl) cache).printDetails());
-
       assertEquals(value, cache.get(fqn, key));
    }
 
@@ -194,7 +184,7 @@
       assertEquals(true, cache.removeNode(fqn));
       assertFalse(cache.getRoot().hasChild(fqn));
       assertEquals(false, cache.removeNode(fqn));
-      
+
       // Check that it's removed if it has a child
       Fqn<String> child = Fqn.fromString("/test/fqn/child");
       cache.getRoot().addChild(child);

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,6 +1,6 @@
 package org.jboss.cache.api;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
@@ -30,12 +30,12 @@
 {
    private Node<Object, Object> rootNode;
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
 
    private TransactionManager tm;
 
    private static final Fqn<String> A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn
-           .fromString("/d");
+         .fromString("/d");
 
    protected boolean optimistic = false;
 
@@ -43,7 +43,7 @@
    public void setUp() throws Exception
    {
       // start a single cache instance
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml", false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml", false);
       cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
       cache.start();
       rootNode = cache.getRoot();

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,20 +1,8 @@
 package org.jboss.cache.api;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.CountDownLatch;
-
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
@@ -25,10 +13,17 @@
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
+
+import javax.transaction.TransactionManager;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
 /**
  * Excercises and tests the new move() api
  *
@@ -40,7 +35,7 @@
    protected final Log log = LogFactory.getLog(getClass());
 
    protected Node<Object, Object> rootNode, nodeA, nodeB, nodeC, nodeD, nodeE;
-   protected CacheImpl<Object, Object> cache;
+   protected CacheSPI<Object, Object> cache;
    protected TransactionManager tm;
    protected static final Fqn<String> A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn.fromString("/d"), E = Fqn.fromString("/e");
    protected Object k = "key", vA = "valueA", vB = "valueB", vC = "valueC", vD = "valueD", vE = "valueE";
@@ -51,7 +46,7 @@
    public void setUp() throws Exception
    {
       // start a single cache instance
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml", false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-tx-service.xml", false);
       cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
       cache.start();
       rootNode = cache.getRoot();
@@ -97,7 +92,7 @@
       cache.move(nodeC.getFqn(), nodeB.getFqn());
 
       // re-fetch nodeC
-      nodeC = cache.get(new Fqn<String>(genericize(nodeB.getFqn()), C));
+      nodeC = cache.getNode(new Fqn<String>(genericize(nodeB.getFqn()), C));
 
       log.info("POST MOVE " + cache);
       log.info("HC " + nodeC + " " + System.identityHashCode(nodeC));
@@ -182,8 +177,6 @@
       nodeD = nodeC.getChild(D);
       nodeE = nodeD.getChild(E);
 
-      System.out.println("Tree " + cache.printLockInfo());
-
       assertTrue(rootNode.hasChild(A));
       assertTrue(rootNode.hasChild(B));
       assertFalse(rootNode.hasChild(C));
@@ -355,12 +348,8 @@
 
       System.out.println("Loader" + loader);
 
-      log.info("Current tree is " + cache.printDetails());
-
       cache.evict(Fqn.ROOT, true);
 
-      log.info("POST EVICT tree is " + cache.printDetails());
-
       // move
       if (useTx) tm.begin();
       cache.move(nodeC.getFqn(), nodeB.getFqn());
@@ -380,21 +369,15 @@
       //         System.out.println("  Contents in loader: " + loader.get(f));
       //      }
 
-      log.info("Post commit tree is " + cache.printDetails());
-
       // after eviction, the node objects we hold are probably stale.
       nodeA = rootNode.getChild(A);
       nodeB = rootNode.getChild(B);
       nodeC = nodeB.getChild(C);
-      log.info("Current tree is " + cache.printDetails());
       log.info("nodeC get child B ");
       nodeD = nodeC.getChild(D);
-      log.info("Current tree is " + cache.printDetails());
       log.info("nodeD get child E ");
       nodeE = nodeD.getChild(E);
 
-      log.info("Current tree is " + cache.printDetails());
-
       Fqn<String> old_C = new Fqn<String>(C);
       Fqn<String> old_D = new Fqn<String>(old_C, D);
       Fqn<String> old_E = new Fqn<String>(old_D, E);
@@ -450,11 +433,8 @@
       cache.move(nodeC.getFqn(), nodeB.getFqn());
       //       nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL
 
-      System.out.println("LOCKS: " + cache.printLockInfo());
-
       assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL", 5, cache.getNumberOfLocksHeld());
 
-
       tm.commit();
 
       assertEquals(0, cache.getNumberOfLocksHeld());
@@ -471,13 +451,8 @@
 
       cache.move(nodeC.getFqn(), nodeB.getFqn());
 
-      //       nodeC should have a RL, nodeA should have a RL, nodeB should have a WL
-
-      System.out.println("LOCKS: " + cache.printLockInfo());
-
       assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL", 4, cache.getNumberOfLocksHeld());
 
-
       tm.commit();
 
       assertEquals(0, cache.getNumberOfLocksHeld());
@@ -507,8 +482,8 @@
 
       // set up the initial structure.
       final Node[] NODES = {
-              rootNode.addChild(FQN_A), rootNode.addChild(FQN_B),
-              rootNode.addChild(FQN_C), rootNode.addChild(FQN_D), rootNode.addChild(FQN_E)
+            rootNode.addChild(FQN_A), rootNode.addChild(FQN_B),
+            rootNode.addChild(FQN_C), rootNode.addChild(FQN_D), rootNode.addChild(FQN_E)
       };
 
       final Node<Object, Object> NODE_X = genericize(NODES[0]).addChild(FQN_X);
@@ -616,17 +591,17 @@
    protected CacheLoaderConfig getSingleCacheLoaderConfig(boolean passivation, String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared, boolean purgeOnStartup) throws Exception
    {
       String xml = "<config>\n" +
-              "<passivation>" + passivation + "</passivation>\n" +
-              "<preload>" + preload + "</preload>\n" +
-              "<cacheloader>\n" +
-              "<class>" + cacheloaderClass + "</class>\n" +
-              "<properties>" + properties + "</properties>\n" +
-              "<async>" + async + "</async>\n" +
-              "<shared>" + shared + "</shared>\n" +
-              "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
-              "<purgeOnStartup>" + purgeOnStartup + "</purgeOnStartup>\n" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<passivation>" + passivation + "</passivation>\n" +
+            "<preload>" + preload + "</preload>\n" +
+            "<cacheloader>\n" +
+            "<class>" + cacheloaderClass + "</class>\n" +
+            "<properties>" + properties + "</properties>\n" +
+            "<async>" + async + "</async>\n" +
+            "<shared>" + shared + "</shared>\n" +
+            "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
+            "<purgeOnStartup>" + purgeOnStartup + "</purgeOnStartup>\n" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,26 +1,21 @@
 package org.jboss.cache.api;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.AfterMethod;
-import static org.testng.Assert.*;
-import static org.testng.Assert.assertNotNull;
-import org.jboss.cache.*;
-import org.jboss.cache.eviction.LRUConfiguration;
-import org.jboss.cache.transaction.DummyTransactionManagerLookup;
-import org.jboss.cache.misc.TestingUtil;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
-import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheSPI;
+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.loader.DummyInMemoryCacheLoader;
-import org.jboss.cache.loader.DummyCacheLoader;
-import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.eviction.LRUConfiguration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.misc.TestingUtil;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
-import javax.transaction.*;
-import java.util.List;
-import java.util.ArrayList;
+import javax.transaction.TransactionManager;
 
 /**
  * Tester class for Node.isResident functionality.
@@ -32,18 +27,17 @@
 public class ResidentNodesTest
 {
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
 
    private final String TEST_NODES_ROOT = "residentNodesTest";
-   private Configuration cacheConfig;
    private Cache[] caches = {};
 
    @BeforeMethod(alwaysRun = true)
    public void setUp()
    {
-      cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
+      Configuration cacheConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
       cacheConfig.setCacheMode(Configuration.CacheMode.LOCAL);
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(cacheConfig, false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(cacheConfig, false);
       cache.getConfiguration().getEvictionConfig().setWakeupIntervalSeconds(1);
       createNewRegion();
       cache.start();
@@ -87,9 +81,9 @@
    public void testHappyFlow() throws InterruptedException
    {
       cache.put(getSubFqn("/a"), "k_a", "v_a");
-      cache.get(getSubFqn("/a")).setResident(true);
+      cache.getNode(getSubFqn("/a")).setResident(true);
       cache.put(getSubFqn("/b"), "k_b", "v_b");
-      cache.get(getSubFqn("/b")).setResident(true);
+      cache.getNode(getSubFqn("/b")).setResident(true);
       cache.put(getSubFqn("/c"), "k_c", "v_c");
       cache.put(getSubFqn("/d"), "k_d", "v_d");
       cache.put(getSubFqn("/e"), "k_e", "v_e");
@@ -124,8 +118,8 @@
       cache.put(getSubFqn("/a"), "k_a", "v_a");
       cache.put(getSubFqn("/b"), "k_b", "v_b");
 
-      cache.get(getSubFqn("/a")).setResident(true);
-      cache.get(getSubFqn("/b")).setResident(true);
+      cache.getNode(getSubFqn("/a")).setResident(true);
+      cache.getNode(getSubFqn("/b")).setResident(true);
 
       cache.put(getSubFqn("/c"), "k_c", "v_c");
       cache.put(getSubFqn("/d"), "k_d", "v_d");
@@ -136,8 +130,8 @@
 
       //at this point the oldest nodes are /a and /b so. There are eviction events in the queue corresponding
       // to those nodes
-      cache.get(getSubFqn("/a"));
-      cache.get(getSubFqn("/b"));
+      cache.getNode(getSubFqn("/a"));
+      cache.getNode(getSubFqn("/b"));
 
       TestingUtil.sleepThread(3000);//so that eviction is activated
 
@@ -167,7 +161,7 @@
       Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
       config.setCacheMode(Configuration.CacheMode.LOCAL);
       config.setNodeLockingOptimistic(true);
-      CacheImpl cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(config, true);
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(config, true);
 
       cache.put(Fqn.fromString("/a/b"), "key", "value");
       TransactionManager txManager = cache.getTransactionManager();
@@ -192,7 +186,8 @@
          {
             cache.getTransactionManager().rollback();
          }
-      } finally
+      }
+      finally
       {
          cache.stop();
       }

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,7 +7,6 @@
 package org.jboss.cache.buddyreplication;
 
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -49,8 +48,8 @@
 
    public void testBuddyBackupActivation() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache("cache1", true, true, true);
-      CacheSPI<Object, Object> cache2 = createCache("cache2", true, true, true);
+      CacheSPI cache1 = createCache("cache1", true, true, true);
+      CacheSPI cache2 = createCache("cache2", true, true, true);
       Fqn A = Fqn.fromString("/a");
       TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
 
@@ -83,8 +82,8 @@
 
    public void testReplToInactiveRegion() throws Exception
    {
-      CacheSPI<Object, Object> cache1 = createCache("cache1", true, true, true);
-      CacheSPI<Object, Object> cache2 = createCache("cache2", true, true, true);
+      CacheSPI cache1 = createCache("cache1", true, true, true);
+      CacheSPI cache2 = createCache("cache2", true, true, true);
 
       TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
       Fqn backupFqn = BuddyManager.getBackupFqn(cache1.getLocalAddress(), A_B);
@@ -109,7 +108,7 @@
 
    public void testBuddyBackupInactivation() throws Exception
    {
-      CacheImpl<Object, Object> cache1 = createCache("cache1", true, true, true);
+      CacheSPI cache1 = createCache("cache1", true, true, true);
       Fqn<String> A = Fqn.fromString("/a");
       Region regionA = cache1.getRegion(A, true);
       regionA.registerContextClassLoader(getClass().getClassLoader());
@@ -127,23 +126,22 @@
       assertNull("Inactivation should have cleared region", cache1.get(fqn, "name"));
    }
 
-   protected CacheImpl<Object, Object> createCache(String cacheID,
-                                                   boolean sync,
-                                                   boolean useMarshalling,
-                                                   boolean startCache)
-           throws Exception
+   protected CacheSPI<?, ?> createCache(String cacheID,
+                                        boolean sync,
+                                        boolean useMarshalling,
+                                        boolean startCache)
+         throws Exception
    {
       if (caches.get(cacheID) != null)
       {
          throw new IllegalStateException(cacheID + " already created");
       }
 
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-
       CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
       Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);
 
-      cache.setConfiguration(c);
+      CacheSPI<?, ?> cache = (CacheSPI<?, ?>) DefaultCacheFactory.getInstance().createCache(c, false);
+
       cache.getConfiguration().setClusterName("TestCluster");
       if (useMarshalling)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,19 +6,18 @@
  */
 package org.jboss.cache.buddyreplication;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.AfterMethod;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.misc.TestingUtil;
-import org.testng.annotations.AfterMethod;
-
 /**
  * Tests basic group membership semantics
  *
@@ -28,7 +27,7 @@
 {
    private Log log = LogFactory.getLog(BuddyPoolBroadcastTest.class);
 
-   private void checkConsistentPoolState(List<CacheImpl<Object, Object>> caches)
+   private void checkConsistentPoolState(List<CacheSPI<Object, Object>> caches)
    {
       for (int i = 0; i < caches.size(); i++)
       {
@@ -38,7 +37,7 @@
             if (i != j)
             {
                Map groupMap2 = caches.get(j).getBuddyManager().buddyPool;
-               for (CacheImpl cache : caches)
+               for (CacheSPI cache : caches)
                {
                   assertEquals("Comparing contents of cache " + (i + 1) + " pool map with cache " + (j + 1), groupMap.get(cache), groupMap2.get(cache));
                }
@@ -119,7 +118,7 @@
       caches.get(1).stop();
       caches.set(1, createCache(1, "Z"));
 
-      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheImpl[0]), VIEW_BLOCK_TIMEOUT);
+      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheSPI[0]), VIEW_BLOCK_TIMEOUT);
       TestingUtil.sleepThread(getSleepTimeout());
 
       // first test the values
@@ -135,7 +134,7 @@
    {
       log.debug("Running testConcurrency");
       int numCaches = 4;
-      caches = new ArrayList<CacheImpl<Object, Object>>(4);
+      caches = new ArrayList<CacheSPI<Object, Object>>(4);
       CountDownLatch latch = new CountDownLatch(1);
       CacheStarter[] starters = new CacheStarter[numCaches];
 
@@ -151,7 +150,7 @@
       latch.countDown();
 
       // allow a generous sleep time
-      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheImpl[0]), 240000);
+      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheSPI[0]), 240000);
       TestingUtil.sleepThread(1000 * numCaches); // the max timeout we can expect is 2500ms * 10 nodes
 
       // and now look at the state of things.
@@ -171,9 +170,9 @@
    public class CacheStarter extends Thread
    {
       private CountDownLatch latch;
-      private CacheImpl cache;
+      private CacheSPI cache;
 
-      public CacheStarter(String name, CountDownLatch latch, CacheImpl cache)
+      public CacheStarter(String name, CountDownLatch latch, CacheSPI cache)
       {
          super(name);
          this.latch = latch;

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,12 +6,6 @@
  */
 package org.jboss.cache.buddyreplication;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.BuddyReplicationConfig;
@@ -20,9 +14,11 @@
 import org.jboss.cache.interceptors.DataGravitatorInterceptor;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
+
 /**
  * Tests basic configuration options by passing stuff into the CacheImpl.
  *
@@ -79,8 +75,7 @@
 
    public void testXmlConfig() throws Exception
    {
-      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      ((CacheImpl) cache).setConfiguration(new XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"));
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(new XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"), false);
       cache.create();
       cache.start();
       BuddyManager bm = cache.getBuddyManager();

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -8,7 +8,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.notifications.annotation.CacheBlocked;
@@ -27,7 +27,7 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test (groups = {"functional"})
+ at Test(groups = {"functional"})
 public class BuddyReplicationContentTest extends BuddyReplicationTestsBase
 {
    private String key = "key";
@@ -35,14 +35,14 @@
    private Log log = LogFactory.getLog(BuddyGroupAssignmentTest.class);
 
 
-   private void assertNoStaleLocks(List<CacheImpl<Object, Object>> caches)
+   private void assertNoStaleLocks(List<CacheSPI<Object, Object>> caches)
    {
-      for (CacheImpl<Object, Object> cache : caches) assertNoStaleLocks(cache);
+      for (CacheSPI<Object, Object> cache : caches) assertNoStaleLocks(cache);
    }
 
-   private void assertNoStaleLocks(CacheImpl<Object, Object> cache)
+   private void assertNoStaleLocks(CacheSPI<Object, Object> cache)
    {
-      assertEquals("Number of locks in cache instance " + cache.toString(true) + " should be 0", 0, cache.getNumberOfLocksHeld());
+      assertEquals("Number of locks in cache instance " + cache + " should be 0", 0, cache.getNumberOfLocksHeld());
    }
 
    public void testSimplePut() throws Exception
@@ -101,7 +101,7 @@
       assertNoStaleLocks(caches);
 
       // now remove
-      caches.get(0).remove(fqn);
+      caches.get(0).removeNode(fqn);
       assertNoStaleLocks(caches);
 
 
@@ -146,7 +146,7 @@
       assertNoStaleLocks(caches);
 
       // now remove
-      caches.get(0).remove(fqn);
+      caches.get(0).removeNode(fqn);
       assertNoStaleLocks(caches);
 
       assertNull("Should be null", caches.get(0).get(fqn, key));
@@ -167,7 +167,7 @@
    {
       log.debug("Running testBuddyJoin");
       caches = createCaches(2, false);
-      CacheImpl<Object, Object> cache2 = null;
+      CacheSPI<Object, Object> cache2 = null;
 
       try
       {
@@ -198,7 +198,7 @@
 
          TestingUtil.sleepThread(2000); // allow buddy group reorg
 
-         List<CacheImpl<Object, Object>> dump = new ArrayList<CacheImpl<Object,Object>>(caches);
+         List<CacheSPI<Object, Object>> dump = new ArrayList<CacheSPI<Object, Object>>(caches);
          dump.add(cache2);
          dumpCacheContents(dump);
 
@@ -215,7 +215,7 @@
          // while cache2 should now posess this backup (due to a state transfer)
          assertEquals("Backup state should have been transferred to this new cache instance", value, cache2.get(backupFqn, key));
 
-         caches.get(1).remove(fqn);
+         caches.get(1).removeNode(fqn);
          assertNoStaleLocks(caches);
 
 
@@ -261,28 +261,13 @@
       log.info("stopping 2");
       caches.get(2).stop();
 
-      log.info("0 ** " + caches.get(0).printLockInfo());
-      log.info("1 ** " + caches.get(1).printLockInfo());
-      log.info("2 ** " + caches.get(2).printLockInfo());
-
-//      TestingUtil.sleepThread(getSleepTimeout());
-//      TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
       blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 5);
 
       assertEquals("value", caches.get(0).get("/2", "key"));
 
-      log.info("0 ** " + caches.get(0).printLockInfo());
-      log.info("1 ** " + caches.get(1).printLockInfo());
-      log.info("2 ** " + caches.get(2).printLockInfo());
-
-//      TestingUtil.sleepThread(getSleepTimeout());
-//      TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
       blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 5);
 
       caches.get(1).stop();
-      log.info("0 ** " + caches.get(0).printLockInfo());
-      log.info("1 ** " + caches.get(1).printLockInfo());
-      log.info("2 ** " + caches.get(2).printLockInfo());
 
       // cache[0] is all thats left!!
 
@@ -310,6 +295,7 @@
    public static class CacheBlockListener
    {
       private int blocks = 0;
+
       @CacheBlocked
       public void processBlock(Event e)
       {
@@ -318,7 +304,7 @@
             System.out.println(">>>>>>>> Got BLOCK on cache " + e.getCache().getLocalAddress());
             synchronized (this)
             {
-               blocks ++;
+               blocks++;
                notifyAll();
             }
          }
@@ -332,7 +318,7 @@
             System.out.println(">>>>>>>> Got UNBLOCK on cache " + e.getCache().getLocalAddress());
             synchronized (this)
             {
-               blocks --;
+               blocks--;
                notifyAll();
             }
          }

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,13 +6,10 @@
  */
 package org.jboss.cache.buddyreplication;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 
 /**
  * Tests behaviour when data owners fail - essentially this tests data gravitation
@@ -174,7 +171,7 @@
       assertNoLocks(caches);
 
       // gravitate to 2:
-      caches.get(2).get(fqn);  // expect entire subtree to gravitate.
+      caches.get(2).getNode(fqn);  // expect entire subtree to gravitate.
 
       Fqn<String> newBackupFqn = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + BuddyManager.getGroupNameFromAddress(caches.get(2).getLocalAddress()) + "/test");
       Fqn<String> newBackupFqn2 = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + BuddyManager.getGroupNameFromAddress(caches.get(2).getLocalAddress()) + "/test/subtree");
@@ -193,7 +190,7 @@
       assertTrue(!caches.get(1).exists(newBackupFqn));
       assertTrue(!caches.get(1).exists(newBackupFqn2));
 
-      for (CacheImpl<Object, Object> cache : caches)
+      for (CacheSPI<Object, Object> cache : caches)
       {
          assertTrue(!cache.exists(backupFqn));
          assertTrue(!cache.exists(backupFqn2));

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,7 +7,6 @@
 package org.jboss.cache.buddyreplication;
 
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -21,6 +20,7 @@
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.util.CachePrinter;
 import org.jboss.cache.xml.XmlHelper;
 import org.jgroups.Address;
 import static org.testng.AssertJUnit.*;
@@ -40,7 +40,7 @@
 @Test(groups = {"functional", "jgroups"})
 public abstract class BuddyReplicationTestsBase
 {
-   protected List<CacheImpl<Object, Object>> caches;
+   protected List<CacheSPI<Object, Object>> caches;
 
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
@@ -100,42 +100,42 @@
 
    protected final static int VIEW_BLOCK_TIMEOUT = 5000;
 
-   protected CacheImpl<Object, Object> createCache(int numBuddies, String buddyPoolName) throws Exception
+   protected CacheSPI<Object, Object> createCache(int numBuddies, String buddyPoolName) throws Exception
    {
       return createCache(numBuddies, buddyPoolName, false, true);
    }
 
-   protected CacheImpl<Object, Object> createCache(int numBuddies, String buddyPoolName, boolean useDataGravitation) throws Exception
+   protected CacheSPI<?, ?> createCache(int numBuddies, String buddyPoolName, boolean useDataGravitation) throws Exception
    {
       return createCache(numBuddies, buddyPoolName, useDataGravitation, true);
    }
 
-   protected CacheImpl<Object, Object> createCache(int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean start) throws Exception
+   protected CacheSPI<Object, Object> createCache(int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean start) throws Exception
    {
       return createCache(false, numBuddies, buddyPoolName, useDataGravitation, true, start);
    }
 
-   protected CacheImpl<Object, Object> createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean start) throws Exception
+   protected CacheSPI<Object, Object> createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean start) throws Exception
    {
       return createCache(optimisticLocks, numBuddies, buddyPoolName, useDataGravitation, true, start);
    }
 
-   protected CacheImpl<Object, Object> createCache(int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
+   protected CacheSPI<?, ?> createCache(int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
    {
       return createCache(false, numBuddies, buddyPoolName, useDataGravitation, removeOnFind, start);
    }
 
-   protected CacheImpl<Object, Object> createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
+   protected CacheSPI<Object, Object> createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
    {
-      CacheImpl<Object, Object> c = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+      CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
       c.getConfiguration().setClusterName("BuddyReplicationTest");
       // basic config
       String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
-              "<buddyCommunicationTimeout>500</buddyCommunicationTimeout>\n" +
-              "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
-              "          <autoDataGravitation>" + useDataGravitation + "</autoDataGravitation>\n" +
-              "          <dataGravitationRemoveOnFind>" + removeOnFind + "</dataGravitationRemoveOnFind>\n" +
-              "          <buddyLocatorProperties>numBuddies = " + numBuddies + "</buddyLocatorProperties>\n";
+            "<buddyCommunicationTimeout>500</buddyCommunicationTimeout>\n" +
+            "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
+            "          <autoDataGravitation>" + useDataGravitation + "</autoDataGravitation>\n" +
+            "          <dataGravitationRemoveOnFind>" + removeOnFind + "</dataGravitationRemoveOnFind>\n" +
+            "          <buddyLocatorProperties>numBuddies = " + numBuddies + "</buddyLocatorProperties>\n";
 
       if (buddyPoolName != null) xmlString += "<buddyPoolName>" + buddyPoolName + "</buddyPoolName>";
       xmlString += "</config>";
@@ -186,55 +186,55 @@
       assertFalse("Cache is not using multiplexer", cache.getConfiguration().isUsingMultiplexer());
    }
 
-   protected List<CacheImpl<Object, Object>> createCaches(int numCaches, boolean useBuddyPool) throws Exception
+   protected List<CacheSPI<Object, Object>> createCaches(int numCaches, boolean useBuddyPool) throws Exception
    {
       return createCaches(1, numCaches, useBuddyPool, false);
    }
 
-   protected List<CacheImpl<Object, Object>> createCaches(int numCaches, boolean useBuddyPool, boolean useDataGravitation, boolean optimisticLocks) throws Exception
+   protected List<CacheSPI<Object, Object>> createCaches(int numCaches, boolean useBuddyPool, boolean useDataGravitation, boolean optimisticLocks) throws Exception
    {
       return createCaches(1, numCaches, useBuddyPool, useDataGravitation, optimisticLocks);
    }
 
-   protected List<CacheImpl<Object, Object>> createCaches(int numCaches, boolean useBuddyPool, boolean useDataGravitation) throws Exception
+   protected List<CacheSPI<Object, Object>> createCaches(int numCaches, boolean useBuddyPool, boolean useDataGravitation) throws Exception
    {
       return createCaches(1, numCaches, useBuddyPool, useDataGravitation);
    }
 
-   protected List<CacheImpl<Object, Object>> createCachesWithCacheLoader(int numCaches, boolean useDataGravitation, boolean removeOnFind, boolean passivation) throws Exception
+   protected List<CacheSPI<Object, Object>> createCachesWithCacheLoader(int numCaches, boolean useDataGravitation, boolean removeOnFind, boolean passivation) throws Exception
    {
       return this.createCachesWithCacheLoader(numCaches, useDataGravitation, removeOnFind, passivation, false);
    }
 
-   protected List<CacheImpl<Object, Object>> createCachesWithCacheLoader(int numCaches, boolean useDataGravitation, boolean removeOnFind, boolean passivation, boolean fetchPersistent) throws Exception
+   protected List<CacheSPI<Object, Object>> createCachesWithCacheLoader(int numCaches, boolean useDataGravitation, boolean removeOnFind, boolean passivation, boolean fetchPersistent) throws Exception
    {
-      List<CacheImpl<Object, Object>> caches = new ArrayList<CacheImpl<Object, Object>>();
+      List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>();
       for (int i = 0; i < numCaches; i++)
       {
          caches.add(createCacheWithCacheLoader(useDataGravitation, removeOnFind, passivation, fetchPersistent, true));
       }
 
       // allow some time for the caches to start up and discover each other
-      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheImpl[0]), VIEW_BLOCK_TIMEOUT);
+      TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), VIEW_BLOCK_TIMEOUT);
       TestingUtil.sleepThread(getSleepTimeout());
       return caches;
    }
 
-   protected CacheImpl<Object, Object> createCacheWithCacheLoader(boolean useDataGravitation, boolean removeOnFind, boolean passivation, boolean fetchPersistent, boolean start) throws Exception
+   protected CacheSPI createCacheWithCacheLoader(boolean useDataGravitation, boolean removeOnFind, boolean passivation, boolean fetchPersistent, boolean start) throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache(1, null, useDataGravitation, removeOnFind, false);
+      CacheSPI cache = createCache(1, null, useDataGravitation, removeOnFind, false);
 
       String cloader = "<config>\n" +
-              "<passivation>" + passivation + "</passivation>\n" +
-              "<preload></preload>\n" +
+            "<passivation>" + passivation + "</passivation>\n" +
+            "<preload></preload>\n" +
 
-              "<cacheloader>\n" +
-              "<class>"+ DummyInMemoryCacheLoader.class.getName() +"</class>\n" +
-              "<async>false</async>\n" +
-              "<shared>false</shared>\n" +
-              "<fetchPersistentState>" + fetchPersistent + "</fetchPersistentState>\n" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<cacheloader>\n" +
+            "<class>" + DummyInMemoryCacheLoader.class.getName() + "</class>\n" +
+            "<async>false</async>\n" +
+            "<shared>false</shared>\n" +
+            "<fetchPersistentState>" + fetchPersistent + "</fetchPersistentState>\n" +
+            "</cacheloader>\n" +
+            "</config>";
 
       Element element = XmlHelper.stringToElement(cloader);
       CacheLoaderConfig cfg = XmlConfigurationParser.parseCacheLoaderConfig(element);
@@ -247,24 +247,24 @@
       return cache;
    }
 
-   protected List<CacheImpl<Object, Object>> createCaches(int numBuddies, int numCaches, boolean useBuddyPool) throws Exception
+   protected List<CacheSPI<Object, Object>> createCaches(int numBuddies, int numCaches, boolean useBuddyPool) throws Exception
    {
       return createCaches(numBuddies, numCaches, useBuddyPool, false);
    }
 
-   protected List<CacheImpl<Object, Object>> createCaches(int numBuddies, int numCaches, boolean useBuddyPool, boolean useDataGravitation) throws Exception
+   protected List<CacheSPI<Object, Object>> createCaches(int numBuddies, int numCaches, boolean useBuddyPool, boolean useDataGravitation) throws Exception
    {
       return createCaches(numBuddies, numCaches, useBuddyPool, useDataGravitation, false);
    }
 
-   protected List<CacheImpl<Object, Object>> createCaches(int numBuddies, int numCaches, boolean useBuddyPool, boolean useDataGravitation, boolean optimisticLocks) throws Exception
+   protected List<CacheSPI<Object, Object>> createCaches(int numBuddies, int numCaches, boolean useBuddyPool, boolean useDataGravitation, boolean optimisticLocks) throws Exception
    {
-      List<CacheImpl<Object, Object>> caches = new ArrayList<CacheImpl<Object, Object>>(numCaches);
+      List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>(numCaches);
       for (int i = 0; i < numCaches; i++)
          caches.add(createCache(optimisticLocks, numBuddies, useBuddyPool ? Character.toString((char) ('A' + i)) : null, useDataGravitation, true));
 
       // allow some time for the caches to start up and discover each other
-      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheImpl[0]), VIEW_BLOCK_TIMEOUT);
+      TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[0]), VIEW_BLOCK_TIMEOUT);
       TestingUtil.sleepThread(getSleepTimeout());
 
       return caches;
@@ -312,7 +312,7 @@
       assertTrue(buddyLocalAddress + " should be a buddy to " + group.getGroupName(), group.getBuddies().contains(buddyLocalAddress));
    }
 
-   protected void dumpCacheContents(List<CacheImpl<Object, Object>> caches)
+   protected void dumpCacheContents(List<CacheSPI<Object, Object>> caches)
    {
       System.out.println("**** START: Cache Contents ****");
       for (int i = 0; i < caches.size(); i++)
@@ -324,17 +324,17 @@
          else
          {
             System.out.println("  ** Cache " + i + " is " + caches.get(i).getLocalAddress());
-            System.out.println("    " + caches.get(i).printLockInfo());
+            System.out.println("    " + CachePrinter.printCacheLockingInfo(caches.get(i)));
          }
       }
       System.out.println("**** END: Cache Contents ****");
    }
 
-   protected void assertNoLocks(List<CacheImpl<Object, Object>> caches)
+   protected void assertNoLocks(List<CacheSPI<Object, Object>> caches)
    {
       for (Cache cache : caches)
       {
-         if (cache != null) assertEquals(0, ((CacheImpl) cache).getNumberOfLocksHeld());
+         if (cache != null) assertEquals(0, ((CacheSPI) cache).getNumberOfLocksHeld());
       }
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,15 +6,8 @@
  */
 package org.jboss.cache.buddyreplication;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -23,14 +16,20 @@
 import org.jboss.cache.eviction.LRUConfiguration;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Tests use of the data gravitator alongside other cache loaders as well as data gravitator options such as removeOnFind.
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test (groups = {"functional"})
+ at Test(groups = {"functional"})
 public class BuddyReplicationWithCacheLoaderTest extends BuddyReplicationTestsBase
 {
 
@@ -40,7 +39,7 @@
    protected boolean passivation = false;
 
 
-   private CacheLoader[] getLoaders(List<CacheImpl<Object, Object>> caches)
+   private CacheLoader[] getLoaders(List<CacheSPI<Object, Object>> caches)
    {
       CacheLoader[] retVal = new CacheLoader[caches.size()];
 
@@ -90,6 +89,7 @@
       // request data from cache2
       if (!autoGravitate)
          caches.get(2).getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
+
       assertEquals(value, caches.get(2).get(fqn, key));
       assertNoLocks(caches);
 
@@ -146,7 +146,7 @@
    /**
     * Tests data gravitation when "removeOnFind=false"; i.e. nodes
     * from which data is gravitated evict it instead of removing it.
-    * 
+    *
     * @throws Exception
     */
    public void testWithDataGravitationEvictOnFind() throws Exception
@@ -155,10 +155,10 @@
    }
 
    /**
-    * Tests data gravitation when auto-gravitation is disabled and 
-    * "removeOnFind=false"; i.e. nodes from which data is gravitated 
+    * Tests data gravitation when auto-gravitation is disabled and
+    * "removeOnFind=false"; i.e. nodes from which data is gravitated
     * evict it instead of removing it.
-    * 
+    *
     * @throws Exception
     */
    public void testWithDataGravitationEvictOnFindNoAuto() throws Exception
@@ -228,30 +228,30 @@
       assertTrue("should not exist in loaders2", !loaders[2].exists(b1));
       assertTrue("should not exist in loaders2", !loaders[2].exists(b2));
    }
-   
+
    /**
     * Tests whether nodes that have been evicted can successfully be
     * gravitated.
-    * 
+    *
     * @throws Exception
     */
    public void testLocalGravitationOfEvictedNodes() throws Exception
    {
-      CacheImpl<Object,Object> cache1 = createCacheWithCacheLoader(true, true, passivation, true, false);
+      CacheSPI<Object, Object> cache1 = createCacheWithCacheLoader(true, true, passivation, true, false);
       Configuration cfg1 = cache1.getConfiguration();
       configureEviction(cfg1);
       Configuration cfg0 = cfg1.clone();
-      CacheImpl<Object,Object> cache0 = (CacheImpl<Object,Object>) DefaultCacheFactory.getInstance().createCache(cfg0, false);
-      
+      CacheSPI<Object, Object> cache0 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(cfg0, false);
+
       // Store them for the teardown method
       if (caches == null)
-         caches = new ArrayList<CacheImpl<Object,Object>>();
+         caches = new ArrayList<CacheSPI<Object, Object>>();
       caches.add(cache0);
       caches.add(cache1);
-      
+
       cache0.start();
       cache1.start();
-      
+
       TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[caches.size()]), VIEW_BLOCK_TIMEOUT * caches.size());
       TestingUtil.sleepThread(getSleepTimeout());
 
@@ -271,69 +271,68 @@
       assert !cache1.exists(backupFoo) : "Buddy should have data evicted";
 
       // now test that this exists in both loaders.
-      assert cache0.getCacheLoader().get(foo) != null : "Should exist in data owner's cache loader";
-      assert cache1.getCacheLoader().get(backupFoo) != null : "Should exist in buddy's loader";
+      assert cache0.getCacheLoaderManager().getCacheLoader().get(foo) != null : "Should exist in data owner's cache loader";
+      assert cache1.getCacheLoaderManager().getCacheLoader().get(backupFoo) != null : "Should exist in buddy's loader";
 
-
       // a local gravitation should occur since cache1 has foo in it's backup tree.
       assertEquals("Passivated value available from buddy", "value", cache1.get(foo, "key"));
    }
 
    /**
-       * Tests whether nodes that have been evicted can successfully be
-       * gravitated.
-       *
-       * @throws Exception
-       */
-      public void testRemoteGravitationOfEvictedNodes() throws Exception
-      {
-         CacheImpl<Object,Object> cache0 = createCacheWithCacheLoader(true, true, passivation, true, false);
-         Configuration cfg0 = cache0.getConfiguration();
-         configureEviction(cfg0);
-         Configuration cfg1 = cfg0.clone();
-         CacheImpl<Object,Object> cache1 = (CacheImpl<Object,Object>) DefaultCacheFactory.getInstance().createCache(cfg1, false);
-         Configuration cfg2 = cfg0.clone();
-         CacheImpl<Object,Object> cache2 = (CacheImpl<Object,Object>) DefaultCacheFactory.getInstance().createCache(cfg2, false);
+    * Tests whether nodes that have been evicted can successfully be
+    * gravitated.
+    *
+    * @throws Exception
+    */
+   public void testRemoteGravitationOfEvictedNodes() throws Exception
+   {
+      CacheSPI<Object, Object> cache0 = createCacheWithCacheLoader(true, true, passivation, true, false);
+      Configuration cfg0 = cache0.getConfiguration();
+      configureEviction(cfg0);
+      Configuration cfg1 = cfg0.clone();
+      CacheSPI<Object, Object> cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(cfg1, false);
+      Configuration cfg2 = cfg0.clone();
+      CacheSPI<Object, Object> cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(cfg2, false);
 
-         // Store them for the teardown method
-         if (caches == null)
-            caches = new ArrayList<CacheImpl<Object,Object>>();
-         caches.add(cache0);
-         caches.add(cache1);
-         caches.add(cache2);
+      // Store them for the teardown method
+      if (caches == null)
+         caches = new ArrayList<CacheSPI<Object, Object>>();
+      caches.add(cache0);
+      caches.add(cache1);
+      caches.add(cache2);
 
-         cache0.start();
-         cache1.start();
-         cache2.start();
+      cache0.start();
+      cache1.start();
+      cache2.start();
 
-         TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[caches.size()]), 600000);
-         TestingUtil.sleepThread(getSleepTimeout());
+      TestingUtil.blockUntilViewsReceived(caches.toArray(new Cache[caches.size()]), 600000);
+      TestingUtil.sleepThread(getSleepTimeout());
 
 
-         assert (cache0.getBuddyManager().getBuddyAddresses().contains(cache1.getLocalAddress())) : "Cache1 should be cache0's buddy!";
+      assert (cache0.getBuddyManager().getBuddyAddresses().contains(cache1.getLocalAddress())) : "Cache1 should be cache0's buddy!";
 
-         Fqn foo = Fqn.fromString("/foo");
-         Fqn backupFoo = BuddyManager.getBackupFqn(cache0.getLocalAddress(), foo);
-         cache0.put(foo, "key", "value");
+      Fqn foo = Fqn.fromString("/foo");
+      Fqn backupFoo = BuddyManager.getBackupFqn(cache0.getLocalAddress(), foo);
+      cache0.put(foo, "key", "value");
 
-         // test that the data exists in both the data owner and the buddy
-         assert cache0.exists(foo) : "Data should exist in data owner";
-         assert cache1.exists(backupFoo) : "Buddy should have data";
+      // test that the data exists in both the data owner and the buddy
+      assert cache0.exists(foo) : "Data should exist in data owner";
+      assert cache1.exists(backupFoo) : "Buddy should have data";
 
-         // Sleep long enough for eviction to run twice plus a bit
-         TestingUtil.sleepThread(3050);
+      // Sleep long enough for eviction to run twice plus a bit
+      TestingUtil.sleepThread(3050);
 
-         // test that the data we're looking for has been evicted in both the data owner and the buddy.
-         assert !cache0.exists(foo) : "Data should have evicted in data owner";
-         assert !cache1.exists(backupFoo) : "Buddy should have data evicted";
+      // test that the data we're looking for has been evicted in both the data owner and the buddy.
+      assert !cache0.exists(foo) : "Data should have evicted in data owner";
+      assert !cache1.exists(backupFoo) : "Buddy should have data evicted";
 
-         // now test that this exists in both loaders.
-         assert cache0.getCacheLoader().get(foo) != null : "Should exist in data owner's loader";
-         assert cache1.getCacheLoader().get(backupFoo) != null : "Should exist in buddy's loader";
+      // now test that this exists in both loaders.
+      assert cache0.getCacheLoaderManager().getCacheLoader().get(foo) != null : "Should exist in data owner's loader";
+      assert cache1.getCacheLoaderManager().getCacheLoader().get(backupFoo) != null : "Should exist in buddy's loader";
 
-         // doing a get on cache2 will guarantee a remote data gravitation.
-         assertEquals("Passivated value available from buddy", "value", cache2.get(foo, "key"));
-      }
+      // doing a get on cache2 will guarantee a remote data gravitation.
+      assertEquals("Passivated value available from buddy", "value", cache2.get(foo, "key"));
+   }
 
    private void configureEviction(Configuration cfg)
    {

Modified: core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/config/ChannelInjectionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,19 +1,18 @@
 package org.jboss.cache.config;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.HashSet;
-import java.util.Set;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.misc.TestingUtil;
 import org.jgroups.JChannel;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * Tests that JBC prefers an injected Channel to creating one via
  * a configured JChannelFactory and stack name.
@@ -21,7 +20,7 @@
  * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  * @version $Revision$
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class ChannelInjectionTest
 {
    private Set<Cache<String, String>> caches = new HashSet<Cache<String, String>>();
@@ -63,7 +62,7 @@
       assertEquals("Value replicated", "value", cache2.get(fqn, "key"));
    }
 
-   private Cache<String, String> createCache() throws Exception
+   private Cache<String, String> createCache()
    {
       Configuration config = new Configuration();
       config.setCacheMode(Configuration.CacheMode.REPL_SYNC);

Modified: core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -187,7 +187,6 @@
                {
                   log.trace("clicked on node in GUI");
                }
-               ;
 
                Runnable r = new Runnable()
                {
@@ -206,8 +205,8 @@
                      catch (TimeoutException te)
                      {
                         String message = "Unable to update GUI due to a timeout trying to acquire lock on a node." +
-                                         "This might be due to clicking on a node which is currently locked by an ongoing " +
-                                         "transaction: ";
+                              "This might be due to clicking on a node which is currently locked by an ongoing " +
+                              "transaction: ";
                         printAndLogStacktrace(message, te);
                      }
                      catch (Exception e)
@@ -396,8 +395,8 @@
             catch (TimeoutException te)
             {
                String message = "Unable to update GUI due to a timeout trying to acquire lock on a node." +
-                                "This might be due to clicking on a node which is currently locked by an ongoing " +
-                                "transaction: ";
+                     "This might be due to clicking on a node which is currently locked by an ongoing " +
+                     "transaction: ";
                printAndLogStacktrace(message, te);
             }
             catch (Exception e)
@@ -417,14 +416,14 @@
    protected String getWelcomeMessage()
    {
       return "Welcome to the BeanShell console.\n\n" +
-             "This console gives you a direct shell interface to the GUI above and allows you to manipulate the cache directly. " +
-             "Some of the variables initialised in this shell session are:\n\n" +
-             "// an instance of org.jboss.cache\n" +
-             "    Cache<String, String> cache;\n" +
-             "// a reference to the root node\n" +
-             "    Node<String, String> root;\n" +
-             "// the transaction manager registered with the cache\n" +
-             "    TransactionManager transactionManager;\n";
+            "This console gives you a direct shell interface to the GUI above and allows you to manipulate the cache directly. " +
+            "Some of the variables initialised in this shell session are:\n\n" +
+            "// an instance of org.jboss.cache\n" +
+            "    Cache<String, String> cache;\n" +
+            "// a reference to the root node\n" +
+            "    Node<String, String> root;\n" +
+            "// the transaction manager registered with the cache\n" +
+            "    TransactionManager transactionManager;\n";
    }
 
    protected void configureInterpreter(Interpreter interpreter, CacheModelDelegate cacheDelegate) throws EvalError
@@ -885,18 +884,18 @@
             fqnTextField.setText(Fqn.SEPARATOR);
          }
          Object[] information = {"Enter fully qualified name",
-                                 fqnTextField};
+               fqnTextField};
          final String btnString1 = "OK";
          final String btnString2 = "Cancel";
          Object[] options = {btnString1, btnString2};
          int userChoice = JOptionPane.showOptionDialog(null,
-                                                       information,
-                                                       "Add DataNode",
-                                                       JOptionPane.YES_NO_OPTION,
-                                                       JOptionPane.PLAIN_MESSAGE,
-                                                       null,
-                                                       options,
-                                                       options[0]);
+               information,
+               "Add DataNode",
+               JOptionPane.YES_NO_OPTION,
+               JOptionPane.PLAIN_MESSAGE,
+               null,
+               options,
+               options[0]);
          if (userChoice == 0)
          {
             String userInput = fqnTextField.getText();
@@ -922,18 +921,18 @@
          }
 
          Object[] information = {"Enter fully qualified name",
-                                 fqnTextField};
+               fqnTextField};
          final String btnString1 = "OK";
          final String btnString2 = "Cancel";
          Object[] options = {btnString1, btnString2};
          int userChoice = JOptionPane.showOptionDialog(null,
-                                                       information,
-                                                       "Load DataNode",
-                                                       JOptionPane.YES_NO_OPTION,
-                                                       JOptionPane.PLAIN_MESSAGE,
-                                                       null,
-                                                       options,
-                                                       options[0]);
+               information,
+               "Load DataNode",
+               JOptionPane.YES_NO_OPTION,
+               JOptionPane.PLAIN_MESSAGE,
+               null,
+               options,
+               options[0]);
          if (userChoice == 0)
          {
             String userInput = fqnTextField.getText();
@@ -958,18 +957,18 @@
             fqnTextField.setText(Fqn.SEPARATOR);
          }
          Object[] information = {"Enter fully qualified name",
-                                 fqnTextField};
+               fqnTextField};
          final String btnString1 = "OK";
          final String btnString2 = "Cancel";
          Object[] options = {btnString1, btnString2};
          int userChoice = JOptionPane.showOptionDialog(null,
-                                                       information,
-                                                       "Evict DataNode",
-                                                       JOptionPane.YES_NO_OPTION,
-                                                       JOptionPane.PLAIN_MESSAGE,
-                                                       null,
-                                                       options,
-                                                       options[0]);
+               information,
+               "Evict DataNode",
+               JOptionPane.YES_NO_OPTION,
+               JOptionPane.PLAIN_MESSAGE,
+               null,
+               options,
+               options[0]);
          if (userChoice == 0)
          {
             String userInput = fqnTextField.getText();

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizePolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,19 +6,17 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.lock.IsolationLevel;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
 /**
  * @author Daniel Huang
  * @version $Revison: $
@@ -26,7 +24,7 @@
 @Test(groups = {"functional"})
 public class ElementSizePolicyTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    int wakeupIntervalMillis = 0;
    final String ROOT_STR = "/test";
    Throwable t1_ex, t2_ex;
@@ -50,7 +48,7 @@
 
    void initCaches() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-elementsize-eviction-service.xml", false);// read in generic local xml
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-elementsize-eviction-service.xml", false);// read in generic local xml
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache.start();
@@ -93,7 +91,7 @@
 
       for (int i = 0; i < 10; i++)
       {
-         Node node = cache.get("/org/jboss/test/data/" + Integer.toString(i));
+         Node node = cache.getNode("/org/jboss/test/data/" + Integer.toString(i));
          System.out.println(node);
          if (i % 2 == 0)
          {
@@ -128,18 +126,13 @@
          }
       }
 
-      System.out.println(cache.toString(true));
       _sleep(wakeupIntervalMillis + 500);
-      System.out.println(cache.toString(true));
 
-      System.out.println("*******");
-      System.out.println(cache.printLockInfo());
-
       for (int i = 0; i < 20; i++)
       {
          String str = rootStr + Integer.toString(i);
          Fqn fqn = Fqn.fromString(str);
-         Node node = cache.get(fqn);
+         Node node = cache.getNode(fqn);
          System.out.println(i + " " + node);
          if (i > 9)
          {
@@ -156,11 +149,11 @@
          cache.put("/org/jboss/data/" + Integer.toString(3), 100 + i, "value");
       }
 
-      Node node = cache.get("/org/jboss/data/" + Integer.toString(3));
+      Node node = cache.getNode("/org/jboss/data/" + Integer.toString(3));
       assertEquals(21, node.getData().size());
       _sleep(wakeupIntervalMillis + 500);
 
-      assertNull(cache.get("/org/jboss/data/" + Integer.toString(3)));
+      assertNull(cache.getNode("/org/jboss/data/" + Integer.toString(3)));
    }
 
    class MyPutter extends Thread

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,16 +6,15 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
 import org.jboss.cache.config.EvictionPolicyConfig;
 import org.jboss.cache.lock.IsolationLevel;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.Test;
 
 /**
@@ -27,7 +26,7 @@
 @Test(groups = {"functional"})
 public class EvictionConfigurationTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    RegionManager regionManager;
 
    public void testPolicyPerRegion() throws Exception
@@ -194,14 +193,14 @@
 
    public void testNoEviction() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
       regionManager = cache.getRegionManager();
       assertEquals(0, regionManager.getAllRegions(Region.Type.ANY).size());
    }
 
-   private void setupCache(String configurationName) throws Exception
+   private void setupCache(String configurationName)
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(configurationName, false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(configurationName, false);
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache.start();

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,13 +6,9 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
@@ -20,6 +16,7 @@
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.config.EvictionPolicyConfig;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -35,7 +32,7 @@
 {
    private static final Log log = LogFactory.getLog(ExpirationPolicyTest.class);
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
 
    Fqn fqn1 = Fqn.fromString("/node/1");
    Fqn fqn2 = Fqn.fromString("/node/2");
@@ -48,12 +45,11 @@
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       Configuration conf = cache.getConfiguration();
       EvictionConfig econf = new EvictionConfig(ExpirationPolicy.class.getName());
       econf.setWakeupIntervalSeconds(1);
       conf.setEvictionConfig(econf);
-      cache.setConfiguration(conf);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(conf, false);
       cache.start();
 
       future = System.currentTimeMillis() + 4000;
@@ -73,27 +69,27 @@
       cache.put(fqn3, ExpirationConfiguration.EXPIRATION_KEY, future);
       cache.put(fqn4, "foo", "bar");
       TestingUtil.sleepThread(2000);
-      assertNotNull(cache.get(fqn1));
-      assertNull(cache.get(fqn2));
-      assertNotNull(cache.get(fqn3));
-      assertNotNull(cache.get(fqn4));
+      assertNotNull(cache.getNode(fqn1));
+      assertNull(cache.getNode(fqn2));
+      assertNotNull(cache.getNode(fqn3));
+      assertNotNull(cache.getNode(fqn4));
 
       log.info("should remove 1 and 3 now");
       TestingUtil.sleepThread(3000);
-      assertNull(cache.get(fqn1));
-      assertNull(cache.get(fqn3));
+      assertNull(cache.getNode(fqn1));
+      assertNull(cache.getNode(fqn3));
    }
 
    public void testUpdate() throws Exception
    {
       log.info("update 1 from future to past");
       cache.put(fqn1, ExpirationConfiguration.EXPIRATION_KEY, future);
-      assertNotNull(cache.get(fqn1));
+      assertNotNull(cache.getNode(fqn1));
       TestingUtil.sleepThread(1500);
       cache.put(fqn1, ExpirationConfiguration.EXPIRATION_KEY, past);
       TestingUtil.sleepThread(1500);
-      assertNull(cache.get(fqn1));
-      cache.remove(Fqn.ROOT);
+      assertNull(cache.getNode(fqn1));
+      cache.removeNode(Fqn.ROOT);
 
    }
 
@@ -103,13 +99,13 @@
       Long future2 = future + 2000;
       cache.put(fqn1, ExpirationConfiguration.EXPIRATION_KEY, future);
       TestingUtil.sleepThread(2000);
-      assertNotNull(cache.get(fqn1));
+      assertNotNull(cache.getNode(fqn1));
       cache.put(fqn1, ExpirationConfiguration.EXPIRATION_KEY, future2);
       TestingUtil.sleepThread(3000);
-      assertNotNull(cache.get(fqn1));
+      assertNotNull(cache.getNode(fqn1));
       TestingUtil.sleepThread(3000);
-      assertNull(cache.get(fqn1));
-      cache.remove(Fqn.ROOT);
+      assertNull(cache.getNode(fqn1));
+      cache.removeNode(Fqn.ROOT);
    }
 
    public void testMaxNodes() throws Exception
@@ -125,10 +121,10 @@
       cache.put(fqn4, ExpirationConfiguration.EXPIRATION_KEY, past);
       assertEquals(5, cache.getNumberOfNodes());
       Thread.sleep(2000);
-      assertNotNull(cache.get(fqn1));
-      assertNotNull(cache.get(fqn2));
-      assertNull(cache.get(fqn3));
-      assertNull(cache.get(fqn4));
+      assertNotNull(cache.getNode(fqn1));
+      assertNotNull(cache.getNode(fqn2));
+      assertNull(cache.getNode(fqn3));
+      assertNull(cache.getNode(fqn4));
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,16 +6,12 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -29,7 +25,7 @@
 @Test(groups = {"functional"})
 public class FIFOPolicyTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    int wakeupIntervalMillis = 0;
    final String ROOT_STR = "/test";
    Throwable t1_ex, t2_ex;
@@ -53,7 +49,7 @@
 
    void initCaches() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-fifo-eviction-service.xml", false);// read in generic local xml
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-fifo-eviction-service.xml", false);// read in generic local xml
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache.start();
@@ -83,10 +79,7 @@
          }
       }
 
-      System.out.println(cache.toString(true));
       TestingUtil.sleepThread(wakeupIntervalMillis + 500);
-
-      System.out.println(cache.toString(true));
       try
       {
          String val = (String) cache.get(rootStr + "3", rootStr + "3");
@@ -121,8 +114,8 @@
       for (int i = 0; i < maxNodes; i++)
       {
          String n = rootStr + i;
-         assertNull("DataNode should be empty " + cache.get(n) + " " + n,
-                 cache.get(n, n));
+         assertNull("DataNode should be empty " + cache.getNode(n) + " " + n,
+               cache.get(n, n));
       }
 
       for (int i = maxNodes; i < maxNodes * 2; i++)
@@ -157,7 +150,6 @@
             e.printStackTrace();
          }
       }
-      System.out.println("cache is:\n" + cache.toString(true));
 
       int period = wakeupIntervalMillis + 500;
 
@@ -227,11 +219,11 @@
       {
          assertNotNull(cache.get(fqn2, str2));
          assertNotNull(cache.get(fqn1, str1));
-         cache.remove(fqn2);
+         cache.removeNode(fqn2);
          TestingUtil.sleepThread(period);
          assertNull(cache.get(fqn2, str2));
          assertNotNull(cache.get(fqn1, str1));
-         cache.remove(fqn1);
+         cache.removeNode(fqn1);
          TestingUtil.sleepThread(period);
          assertNull(cache.get(fqn1, str1));
          assertNull(cache.get(fqn2, str2));
@@ -246,7 +238,7 @@
          TestingUtil.sleepThread(period);
 
          // remove the node above fqn4 /org/jboss/test/5 will cascade the delete into /org/jboss/test/5/5
-         cache.remove(fqn4);
+         cache.removeNode(fqn4);
 
          TestingUtil.sleepThread(period);
          assertNull(cache.get(fqn3, str3));

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUAlgorithmTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,19 +6,15 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Iterator;
-
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.Iterator;
+
 /**
  * Unit test for LFUAlgorithm.
  *
@@ -36,7 +32,7 @@
    {
       algo = new LFUAlgorithm();
       LFUConfiguration config = new LFUConfiguration();
-      regionManager = new RegionManager((CacheImpl) DefaultCacheFactory.getInstance().createCache(false));
+      regionManager = new RegionManager();
       config.setEvictionPolicyClass(DummyEvictionPolicy.class.getName());
       regionManager.getRegion("/a/b", true).setEvictionPolicy(config);
       // doesn't this need a cache?!?? :-/

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,15 +6,12 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -28,7 +25,7 @@
 @Test(groups = {"functional"})
 public class LFUPolicyTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    int wakeupIntervalMillis = 0;
    final String ROOT_STR = "/test";
    Throwable t1_ex, t2_ex;
@@ -52,7 +49,7 @@
 
    void initCaches() throws Exception
    {
-      cache = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache("META-INF/local-lfu-eviction-service.xml", false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-lfu-eviction-service.xml", false);
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache.start();
@@ -124,15 +121,12 @@
             e.printStackTrace();
          }
       }
-      System.out.println("cache is:\n" + cache.toString(true));
 
       int period = wakeupIntervalMillis + 500;
 
       log("sleeping for " + period + "ms");
       TestingUtil.sleepThread(period);// it really depends the eviction thread time.
 
-      System.out.println("cache is:\n" + cache.toString(true));
-
       try
       {
          for (int i = 0; i < 5; i++)
@@ -150,8 +144,6 @@
 
          TestingUtil.sleepThread(period);
 
-         System.out.println(cache.toString(true));
-
          // since min is 5 the cache won't deplete past 5 nodes left in the cache.
          for (int i = 5; i < 10; i++)
          {
@@ -185,8 +177,6 @@
 
          TestingUtil.sleepThread(period);
 
-         System.out.println(cache.toString(true));
-
          // now make sure we still only have 5 nodes and they are the ones we expect based on LFU
          for (int i = 5; i < 7; i++)
          {
@@ -259,7 +249,7 @@
          {
             String str = rootStr + i;
             Fqn fqn = Fqn.fromString(str);
-            cache.remove(fqn);
+            cache.removeNode(fqn);
          }
       }
 
@@ -272,7 +262,7 @@
          {
             String str = rootStr + i;
             Fqn fqn = Fqn.fromString(str);
-            assertNull(cache.get(fqn));
+            assertNull(cache.getNode(fqn));
          }
       }
    }

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,16 +1,12 @@
 package org.jboss.cache.eviction;
 
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -25,7 +21,7 @@
 @Test(groups = {"functional"})
 public class LRUPolicyTest
 {
-   CacheImpl<Object, Object> cache_;
+   CacheSPI<Object, Object> cache_;
    int wakeupIntervalMillis_ = 0;
    final String ROOT_STR = "/test";
    Throwable t1_ex, t2_ex;
@@ -49,7 +45,7 @@
 
    public void initCaches() throws Exception
    {
-      cache_ = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml", false);// read in generic local xml
+      cache_ = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml", false);// read in generic local xml
       cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache_.start();
@@ -90,18 +86,18 @@
 
       for (int i = 0; i < 5; i++)
       {
-         assertNull(cache_.get(Fqn.fromString(rootStr + i)));
+         assertNull(cache_.getNode(Fqn.fromString(rootStr + i)));
       }
 
-      assertNotNull(cache_.get(Fqn.fromString(rootStr + 5)));
+      assertNotNull(cache_.getNode(Fqn.fromString(rootStr + 5)));
 
       for (int i = 6; i < 11; i++)
       {
-         assertNull(cache_.get(Fqn.fromString(rootStr + i)));
+         assertNull(cache_.getNode(Fqn.fromString(rootStr + i)));
       }
       for (int i = 11; i < 15; i++)
       {
-         assertNotNull(cache_.get(Fqn.fromString(rootStr + i)));
+         assertNotNull(cache_.getNode(Fqn.fromString(rootStr + i)));
       }
    }
 
@@ -157,7 +153,6 @@
             e.printStackTrace();
          }
       }
-      System.out.println("cache is:\n" + cache_.toString(true));
 
       int period = (wakeupIntervalMillis_ / 2 + 500);
       log("sleeping for " + period + "ms");
@@ -226,7 +221,7 @@
          TestingUtil.sleepThread(period);// it really depends the eviction thread time.
          String val = (String) cache_.get(rootStr + "7/7", rootStr + "7/7");
          assertNotNull("DataNode should not be empty ", val);
-         cache_.remove(fqn1);
+         cache_.removeNode(fqn1);
          TestingUtil.sleepThread(wakeupIntervalMillis_ + 500);
          val = (String) cache_.get(rootStr + "7/7", rootStr + "7/7");
          assertNull("DataNode should be empty ", val);
@@ -364,8 +359,7 @@
          }
 
          // clear the root
-         Fqn root = cache_.get("/").getFqn();
-         cache_.remove(root);
+         cache_.removeNode(Fqn.ROOT);
 
          // wait for an eviction
          TestingUtil.sleepThread(2 * wakeupIntervalMillis_ + 1000);

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,14 +6,11 @@
  */
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -27,7 +24,7 @@
 @Test(groups = {"functional"})
 public class MRUPolicyTest
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    int wakeupIntervalMillis = 0;
    final String ROOT_STR = "/test";
    Throwable t1_ex, t2_ex;
@@ -55,9 +52,9 @@
       cache.stop();
    }
 
-   private void initCaches() throws Exception
+   private void initCaches()
    {
-      cache = (CacheImpl<Object,Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-mru-eviction-service.xml", false);// read in generic local xml
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-mru-eviction-service.xml", false);// read in generic local xml
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache.start();
@@ -73,8 +70,6 @@
 
       TestingUtil.sleepThread(wakeupIntervalMillis + 500);
 
-      System.out.println(cache.toString(true));
-
       cache.put("/org/jboss/test/data/f", "/org/jboss/test/data/f", "/org/jboss/test/data/f");
       cache.put("/org/jboss/test/data/g", "/org/jboss/test/data/g", "/org/jboss/test/data/g");
       cache.put("/org/jboss/test/data/h", "/org/jboss/test/data/h", "/org/jboss/test/data/h");
@@ -83,8 +78,6 @@
 
       TestingUtil.sleepThread(wakeupIntervalMillis + 500);
 
-      System.out.println(cache.toString(true));
-
       assertNull(cache.get("/org/jboss/test/data/a", "/org/jboss/test/data/a"));
       assertNull(cache.get("/org/jboss/test/data/b", "/org/jboss/test/data/b"));
    }
@@ -99,8 +92,8 @@
 
       TestingUtil.sleepThread(wakeupIntervalMillis + 500);
 
-      cache.remove("/org/jboss/test/data/d");
-      cache.remove("/org/jboss/test/data/e");
+      cache.removeNode("/org/jboss/test/data/d");
+      cache.removeNode("/org/jboss/test/data/e");
       cache.put("/org/jboss/test/data/f", "/org/jboss/test/data/f", "/org/jboss/test/data/f");
       cache.put("/org/jboss/test/data/g", "/org/jboss/test/data/g", "/org/jboss/test/data/g");
 

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,23 +1,21 @@
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.EvictionInterceptor;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * Tests the eviction and the possible lack of locking nodes.
  * The configuration is with an aggressive eviction policy, 100 objects 2 seconds interval.
@@ -37,13 +35,13 @@
 
    private Fqn<Object> region = new Fqn<Object>("testingRegion");
    private TransactionManager txManager;
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
       txManager = new DummyTransactionManagerLookup().getTransactionManager();
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/optimistic-eviction.xml");
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/optimistic-eviction.xml");
    }
 
    @AfterMethod(alwaysRun = true)
@@ -98,7 +96,7 @@
 
    public void testInterceptorChain() throws Exception
    {
-      List interceptors = cache.getInterceptors();
+      List interceptors = cache.getInterceptorChain();
       System.out.println(interceptors);
       Iterator i = interceptors.iterator();
       boolean found = false;

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -23,11 +23,7 @@
 package org.jboss.cache.eviction;
 
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.RegionManager;
@@ -37,6 +33,7 @@
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -51,7 +48,7 @@
 @Test(groups = {"functional"})
 public class ProgrammaticLRUPolicyTest
 {
-   CacheImpl<Object, Object> cache_;
+   CacheSPI<Object, Object> cache_;
    int wakeupIntervalMillis_ = 0;
 
    @BeforeMethod(alwaysRun = true)
@@ -67,9 +64,9 @@
 
    }
 
-   private void initCaches() throws Exception
+   private void initCaches()
    {
-      cache_ = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml", false);// read in generic local xml
+      cache_ = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml", false);// read in generic local xml
       cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
 
@@ -87,9 +84,9 @@
    {
       // region name is ignored here.
       String xml = "<region name=\"/dummy\">" +
-              "<attribute name=\"maxNodes\">10000</attribute>" +
-              "<attribute name=\"timeToLiveSeconds\">4</attribute>" +
-              "</region>";
+            "<attribute name=\"maxNodes\">10000</attribute>" +
+            "<attribute name=\"timeToLiveSeconds\">4</attribute>" +
+            "</region>";
       Element element = XmlHelper.stringToElement(xml);
       RegionManager regionManager = cache_.getRegionManager();
       EvictionConfig topConfig = cache_.getConfiguration().getEvictionConfig();
@@ -125,15 +122,15 @@
    {
       // region name is ignored here.
       String xml = "<region name=\"/dummy\">" +
-              "<attribute name=\"maxNodes\">10000</attribute>" +
-              "<attribute name=\"timeToLiveSeconds\">4</attribute>" +
-              "</region>";
+            "<attribute name=\"maxNodes\">10000</attribute>" +
+            "<attribute name=\"timeToLiveSeconds\">4</attribute>" +
+            "</region>";
       Element element = XmlHelper.stringToElement(xml);
       RegionManager regionManager = cache_.getRegionManager();
       EvictionConfig topEC = cache_.getConfiguration().getEvictionConfig();
       EvictionRegionConfig erc = XmlConfigurationParser.parseEvictionRegionConfig(element,
-              topEC.getDefaultEvictionPolicyClass(),
-              topEC.getDefaultEventQueueSize());
+            topEC.getDefaultEvictionPolicyClass(),
+            topEC.getDefaultEventQueueSize());
       // Fqn is the region name
       Integer ii = 1;
       Fqn fqn = new Fqn<Integer>(ii);

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,11 +1,6 @@
 package org.jboss.cache.eviction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration.CacheMode;
@@ -14,6 +9,8 @@
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeEvicted;
 import org.jboss.cache.notifications.event.Event;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -24,22 +21,21 @@
 @Test(groups = {"functional"})
 public class ReplicatedLRUPolicyTest
 {
-   CacheImpl<Object, Object> cache_, cache1_, cache2_;
+   CacheSPI<Object, Object> cache_, cache1_, cache2_;
    int wakeupIntervalMillis_ = 0;
    EvictionListener listener_ = new EvictionListener();
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache_ = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      initCaches(cache_);
+      cache_ = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true), false);
+      cache_.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       cache_.getConfiguration().setUseRegionBasedMarshalling(true);
       cache_.start();
       cache_.getNotifier().addCacheListener(listener_);
       listener_.resetCounter();
 
-      cache2_ = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      cache2_.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));// read in generic local xml
+      cache2_ = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
       cache2_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache2_.getConfiguration().setUseRegionBasedMarshalling(true);
       cache2_.start();
@@ -52,12 +48,6 @@
       }
    }
 
-   void initCaches(CacheImpl cache) throws Exception
-   {
-      cache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, true));
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-   }
-
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
    {

Added: core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -0,0 +1,171 @@
+package org.jboss.cache.factories;
+
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.RPCManager;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.buddyreplication.NextMemberBuddyLocator;
+import org.jboss.cache.config.BuddyReplicationConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.invocation.CacheInvocationDelegate;
+import org.jboss.cache.marshall.CacheMarshaller200;
+import org.jboss.cache.marshall.CacheMarshaller210;
+import org.jboss.cache.marshall.Marshaller;
+import org.jboss.cache.marshall.VersionAwareMarshaller;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.statetransfer.StateTransferManager;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.lang.reflect.Constructor;
+
+/**
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 2.1.0
+ */
+ at Test(groups = {"functional"})
+public class ComponentRegistryTest
+{
+   private ComponentFactory cf;
+   private ComponentRegistry cr;
+   private Configuration configuration;
+
+   @BeforeMethod
+   public void setUp() throws Exception
+   {
+      cf = (ComponentFactory) DefaultCacheFactory.getInstance();
+
+      CacheSPI spi = new CacheInvocationDelegate();
+      Constructor ctor = CacheImpl.class.getDeclaredConstructor();
+      ctor.setAccessible(true);
+      CacheImpl ci = (CacheImpl) ctor.newInstance();
+
+      configuration = ci.getConfiguration();
+      cr = TestingUtil.extractComponentRegistry(ci);
+
+      cr.registerComponent(ci);
+      cr.registerComponent(spi);
+      cr.registerComponent(cr); // register self
+      cr.registerComponent(configuration);
+
+      cr.wireDependencies(cf);
+      cr.wireDependencies(ci);
+      cr.wireDependencies(spi);
+   }
+
+   public void testWiringDependenciesInFactory()
+   {
+      assert cf.componentRegistry == cr;
+      assert cf.configuration == configuration;
+   }
+
+   public void testDefaultFactoryScanning()
+   {
+      cr.scanDefaultFactories();
+
+      assert cr.defaultFactories != null : "Should be populated";
+
+      // at very least, expecting a Marshaller factory and a DefaultCacheFactory.
+
+      assert cr.defaultFactories.containsKey(CacheSPI.class);
+      assert cr.defaultFactories.get(CacheSPI.class).equals(DefaultCacheFactory.class);
+      assert cr.defaultFactories.containsKey(Marshaller.class);
+      assert cr.defaultFactories.get(Marshaller.class).equals(CacheMarshallerFactory.class);
+   }
+
+   /**
+    * Case 1:
+    * nothing injected, nothing specified in Configuration.  Should use default factory.
+    */
+   public void testConstructionOrder1()
+   {
+      Class<Marshaller> componentToTest = Marshaller.class;
+      Marshaller m = cr.getOrCreateComponent(null, componentToTest);
+      assert m instanceof VersionAwareMarshaller;
+      VersionAwareMarshaller vam = (VersionAwareMarshaller) m;
+      m = (Marshaller) TestingUtil.extractField(vam, "defaultMarshaller");
+      assert m instanceof CacheMarshaller210;
+   }
+
+   /**
+    * Case 2:
+    * instance injected, class specified in Configuration.  Should use injected.
+    */
+   public void testConstructionOrder2()
+   {
+      Class<Marshaller> componentToTest = Marshaller.class;
+      configuration.setMarshallerClass(CacheMarshaller200.class.getName());
+      Marshaller instance = new CacheMarshaller210(null, false, false);
+      configuration.setCacheMarshaller(instance);
+
+      // the setup() would have wired the default marshaller.  Need to update deps.
+      cr.unregisterComponent(Marshaller.class);
+      cr.updateDependencies();
+
+      Marshaller m = cr.getOrCreateComponent(null, componentToTest);
+      assert m == instance : "m is " + m + " but expected " + instance;
+   }
+
+   /**
+    * Case 3:
+    * instance injected, no class specified in Configuration.  Should use injected.
+    */
+   public void testConstructionOrder3()
+   {
+      Class<Marshaller> componentToTest = Marshaller.class;
+      Marshaller instance = new CacheMarshaller210(null, false, false);
+      configuration.setCacheMarshaller(instance);
+
+      // the setup() would have wired the default marshaller.  Need to update deps.
+      cr.unregisterComponent(Marshaller.class);
+      cr.updateDependencies();
+
+      Marshaller m = cr.getOrCreateComponent(null, componentToTest);
+      assert m == instance : "m is " + m + " but expected " + instance;
+   }
+
+   /**
+    * Case 4:
+    * nothing injected, class specified in Configuration.  Should use class specified.
+    */
+   public void testConstructionOrder4()
+   {
+      Class<Marshaller> componentToTest = Marshaller.class;
+      configuration.setMarshallerClass(CacheMarshaller200.class.getName());
+      Marshaller m = cr.getOrCreateComponent(null, componentToTest);
+      assert m instanceof VersionAwareMarshaller;
+      VersionAwareMarshaller vam = (VersionAwareMarshaller) m;
+      m = (Marshaller) TestingUtil.extractField(vam, "defaultMarshaller");
+      assert m instanceof CacheMarshaller200;
+   }
+
+   public void testTransitiveDependencies()
+   {
+      Class<BuddyManager> componentToTest = BuddyManager.class;
+
+      // configure the cfg to use BR
+      BuddyReplicationConfig brc = new BuddyReplicationConfig();
+      brc.setEnabled(true);
+      BuddyReplicationConfig.BuddyLocatorConfig blc = new BuddyReplicationConfig.BuddyLocatorConfig();
+      blc.setBuddyLocatorClass(NextMemberBuddyLocator.class.getName());
+      brc.setBuddyLocatorConfig(blc);
+      configuration.setBuddyReplicationConfig(brc);
+
+      BuddyManager bm = cr.getOrCreateComponent(null, componentToTest);
+      assert bm != null;
+
+      StateTransferManager stm = (StateTransferManager) TestingUtil.extractField(bm, "stateTransferManager");
+      assert stm != null;
+
+      RPCManager rpcm = (RPCManager) TestingUtil.extractField(bm, "rpcManager");
+      assert rpcm != null;
+
+      RegionManager rm = (RegionManager) TestingUtil.extractField(bm, "regionManager");
+      assert rm != null;
+
+      Configuration cfg = (Configuration) TestingUtil.extractField(bm, "configuration");
+      assert cfg == configuration;
+   }
+}

Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,45 +1,23 @@
 package org.jboss.cache.factories;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.util.Iterator;
-import java.util.List;
-
 import junit.framework.Assert;
-
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.interceptors.ActivationInterceptor;
-import org.jboss.cache.interceptors.CacheLoaderInterceptor;
-import org.jboss.cache.interceptors.CacheMgmtInterceptor;
-import org.jboss.cache.interceptors.CacheStoreInterceptor;
-import org.jboss.cache.interceptors.CallInterceptor;
-import org.jboss.cache.interceptors.DataGravitatorInterceptor;
-import org.jboss.cache.interceptors.EvictionInterceptor;
-import org.jboss.cache.interceptors.Interceptor;
-import org.jboss.cache.interceptors.InvalidationInterceptor;
-import org.jboss.cache.interceptors.InvocationContextInterceptor;
-import org.jboss.cache.interceptors.NotificationInterceptor;
-import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
-import org.jboss.cache.interceptors.OptimisticLockingInterceptor;
-import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.OptimisticReplicationInterceptor;
-import org.jboss.cache.interceptors.OptimisticValidatorInterceptor;
-import org.jboss.cache.interceptors.PassivationInterceptor;
-import org.jboss.cache.interceptors.PessimisticLockInterceptor;
-import org.jboss.cache.interceptors.ReplicationInterceptor;
-import org.jboss.cache.interceptors.TxInterceptor;
-import org.jboss.cache.interceptors.UnlockInterceptor;
+import org.jboss.cache.interceptors.*;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
 
+import java.util.Iterator;
+import java.util.List;
+
 @Test(groups = {"functional"})
 public class InterceptorChainFactoryTest extends InterceptorChainTestBase
 {
@@ -65,7 +43,7 @@
    public void testBareConfig() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -89,7 +67,7 @@
       cache.getConfiguration().setExposeManagementStatistics(false);
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -110,21 +88,21 @@
    protected CacheLoaderConfig getCacheLoaderConfig(boolean pasv, boolean fetchPersistentState) throws Exception
    {
       String xml = "            <config>\n" +
-              "                \n" +
-              "                <passivation>" + pasv + "</passivation>\n" +
-              "                <preload></preload>\n" +
-              "\n" +
-              "                <cacheloader>\n" +
-              "                    <class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
-              "                    <properties>\n" +
-              "                        location=/tmp\n" +
-              "                    </properties>\n" +
-              "                    <async>false</async>\n" +
-              "                    <fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
-              "                    <ignoreModifications>false</ignoreModifications>\n" +
-              "                </cacheloader>\n" +
-              "                \n" +
-              "            </config>";
+            "                \n" +
+            "                <passivation>" + pasv + "</passivation>\n" +
+            "                <preload></preload>\n" +
+            "\n" +
+            "                <cacheloader>\n" +
+            "                    <class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
+            "                    <properties>\n" +
+            "                        location=/tmp\n" +
+            "                    </properties>\n" +
+            "                    <async>false</async>\n" +
+            "                    <fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
+            "                    <ignoreModifications>false</ignoreModifications>\n" +
+            "                </cacheloader>\n" +
+            "                \n" +
+            "            </config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
@@ -137,7 +115,7 @@
       cache.getConfiguration().setCacheMode("REPL_ASYNC");
       cache.getConfiguration().setFetchInMemoryState(false);
       cache.create();
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -167,7 +145,7 @@
       cache.getConfiguration().setCacheMode("REPL_ASYNC");
       cache.getConfiguration().setFetchInMemoryState(false);
       cache.create();
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -194,7 +172,7 @@
       cache.getConfiguration().setExposeManagementStatistics(false);
       cache.getConfiguration().setCacheMode("repl_sync");
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -221,7 +199,7 @@
       cache.getConfiguration().setExposeManagementStatistics(false);
       cache.getConfiguration().setNodeLockingOptimistic(true);
 
-      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       // test the chain size.
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(next);
@@ -248,7 +226,7 @@
       cache.getConfiguration().setNodeLockingOptimistic(true);
       cache.getConfiguration().setCacheMode("REPL_SYNC");
 
-      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       // test the chain size.
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(next);
@@ -276,7 +254,7 @@
       cache.getConfiguration().setNodeLockingOptimistic(true);
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
       cache.create();
-      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       // test the chain size.
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(next);
@@ -305,7 +283,7 @@
       cache.getConfiguration().setNodeLockingOptimistic(true);
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(true, false));
       cache.create();
-      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor next = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       // test the chain size.
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(next);
@@ -334,7 +312,7 @@
       cache.getConfiguration().setExposeManagementStatistics(false);
       cache.getConfiguration().setCacheMode("REPL_ASYNC");
 
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       // test the chain size.
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
@@ -356,7 +334,7 @@
       cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setExposeManagementStatistics(false);
       cache.getConfiguration().setCacheMode("INVALIDATION_ASYNC");
-      chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       // test the chain size.
       list = InterceptorChainFactory.getInstance().asList(chain);
@@ -378,7 +356,7 @@
    public void testCacheMgmtConfig() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(true);
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -410,7 +388,7 @@
          }
       }
       );
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
 
@@ -433,9 +411,9 @@
    public void testBuddyReplicationOptLocking() throws Exception
    {
       String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
-              "<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
-              "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
-              "          <buddyLocatorProperties>numBuddies = 1</buddyLocatorProperties>\n";
+            "<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
+            "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
+            "          <buddyLocatorProperties>numBuddies = 1</buddyLocatorProperties>\n";
 
       xmlString += "<buddyPoolName>buddyPoolName</buddyPoolName>";
       xmlString += "</config>";
@@ -446,7 +424,7 @@
       cache.getConfiguration().setCacheMode("REPL_SYNC");
       cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
       cache.create();// initialise various subsystems such as BRManager
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();
@@ -473,9 +451,9 @@
    public void testBuddyReplicationPessLocking() throws Exception
    {
       String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
-              "<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
-              "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
-              "          <buddyLocatorProperties>numBuddies = 1</buddyLocatorProperties>\n";
+            "<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
+            "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
+            "          <buddyLocatorProperties>numBuddies = 1</buddyLocatorProperties>\n";
 
       xmlString += "<buddyPoolName>buddyPoolName</buddyPoolName>";
       xmlString += "</config>";
@@ -485,7 +463,7 @@
 
       cache.getConfiguration().setCacheMode("REPL_SYNC");
       cache.create();// initialise various subsystems such as BRManager
-      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain(cache);
+      Interceptor chain = InterceptorChainFactory.getInstance().buildInterceptorChain();
 
       List<Interceptor> list = InterceptorChainFactory.getInstance().asList(chain);
       Iterator<Interceptor> interceptors = list.iterator();

Added: core/trunk/src/test/java/org/jboss/cache/factories/annotations/ClasspathScannerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/annotations/ClasspathScannerTest.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/factories/annotations/ClasspathScannerTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -0,0 +1,26 @@
+package org.jboss.cache.factories.annotations;
+
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.factories.CacheMarshallerFactory;
+import org.jboss.cache.factories.ComponentFactory;
+import org.testng.annotations.Test;
+
+import java.util.Set;
+
+/**
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 2.1.0
+ */
+ at Test(groups = {"functional"})
+public class ClasspathScannerTest
+{
+   public void testScanning()
+   {
+      ClasspathScanner cs = new ClasspathScanner();
+      Set<Class<? extends ComponentFactory>> sc = cs.scan(DefaultFactoryFor.class, ComponentFactory.class);
+
+      // should at least contain these 2.
+      assert sc.contains(DefaultCacheFactory.class);
+      assert sc.contains(CacheMarshallerFactory.class);
+   }
+}

Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,16 +6,7 @@
  */
 package org.jboss.cache.interceptors;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
@@ -26,14 +17,20 @@
 import org.jboss.cache.eviction.DummyEvictionConfiguration;
 import org.jboss.cache.eviction.EvictedEventNode;
 import org.jboss.cache.eviction.NodeEventType;
+import org.jboss.cache.factories.InterceptorChainFactory;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.marshall.MethodCall;
 import org.jboss.cache.marshall.MethodCallFactory;
 import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author Daniel Huang (dhuang at jboss.org)
  * @version $Revision: $
@@ -47,7 +44,7 @@
 
    private static final String fqn4 = "/d/e/f";
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private Interceptor interceptor;
    private RegionManager regionManager;
 
@@ -68,37 +65,31 @@
       regionManager.getRegion("/d/e/g", true).setEvictionPolicy(config);
       regionManager.getRegion("/d/e", true).setEvictionPolicy(config);
 
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
 
-      // make the interceptor chain (separate from the CacheImpl object.
+      // make the interceptor chain (separate from the CacheSPI object.
 
       interceptor = new CacheMgmtInterceptor();
-      interceptor.setCache(cache);
 
       TxInterceptor ti = new TxInterceptor();
-      ti.setCache(cache);
       interceptor.setNext(ti);
 
       UnlockInterceptor ui = new UnlockInterceptor();
-      ui.setCache(cache);
       ti.setNext(ui);
 
       PessimisticLockInterceptor pli = new PessimisticLockInterceptor();
-      pli.setCache(cache);
       ui.setNext(pli);
 
       EvictionInterceptor ei = new EvictionInterceptor();
-      ei.setCache(cache);
-      ei.setRegionManager(regionManager);
       pli.setNext(ei);
 
       CallInterceptor ci = new CallInterceptor();
-      ci.setCache(cache);
-      ci.setTreeCacheInstance(cache);
       ei.setNext(ci);
 
+      InterceptorChainFactory.getInstance().correctInterceptorChaining(interceptor, cache.getConfiguration(), TestingUtil.extractComponentRegistry(cache));
+
       cache.getConfiguration().setCacheMode("LOCAL");
       cache.start();
    }
@@ -106,7 +97,7 @@
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
    {
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
       cache.stop();
    }
 
@@ -121,26 +112,26 @@
       // make sure node that doesn't exist does not result in a node visit event.
 
       MethodCall mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
-              Fqn.fromString(fqn1));
+            Fqn.fromString(fqn1));
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       Region regionABC = regionManager.getRegion(fqn1, false);
       assertNull(regionABC.takeLastEventNode());
 
       cache.put(fqn1, "key", "value");
       assertEquals("value", cache.get(fqn1, "key"));
-      Node<Object, Object> node = cast(cache.get(fqn1));
+      Node<Object, Object> node = cast(cache.getNode(fqn1));
       assertNotNull(node);
       assertEquals("value", node.get("key"));
 
       cache.put(fqn3, "key", "value");
       assertEquals("value", cache.get(fqn3, "key"));
-      node = cast(cache.get(fqn3));
+      node = cast(cache.getNode(fqn3));
       assertNotNull(node);
       assertEquals("value", node.get("key"));
 
 
       mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
-              Fqn.fromString(fqn1));
+            Fqn.fromString(fqn1));
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       regionABC = regionManager.getRegion(fqn1, false);
@@ -150,7 +141,7 @@
       assertNull(regionABC.takeLastEventNode());
 
       mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
-              Fqn.fromString(fqn2));
+            Fqn.fromString(fqn2));
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       Region regionAB = regionManager.getRegion(fqn2, false);
@@ -266,7 +257,7 @@
       {
          key = i;
 
-         cache.put(fqn.toString(), key, "");
+         cache.put(fqn, key, "");
 
          mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
          interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -282,11 +273,11 @@
       assertNull(region.takeLastEventNode());
 
       // check null handling
-      mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, key, true);
+      mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, key, true);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       assertNull(region.takeLastEventNode());
 
-      mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, null, true);
+      mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, true);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       assertNull(region.takeLastEventNode());
 
@@ -306,7 +297,7 @@
       // this region is node granularity
       Fqn fqn = Fqn.fromString("/a/b/c");
 
-      MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
+      MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, fqn, data, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       Region region = regionManager.getRegion(fqn.toString(), false);
@@ -316,7 +307,7 @@
       assertEquals(fqn, event.getFqn());
       assertEquals(100, event.getElementDifference());
 
-      Node<Object, Object> node = cast(cache.get(fqn.toString()));
+      Node<Object, Object> node = cast(cache.getNode(fqn));
       assertNotNull(node);
 
       for (int i = 0; i < 100; i++)
@@ -327,11 +318,11 @@
 
       for (int i = 0; i < 100; i++)
       {
-         mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, fqn, i,
-                 "value", false);
+         mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn, i,
+               "value", false);
          interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
-         assertEquals("value", cache.get(fqn.toString(), i));
+         assertEquals("value", cache.get(fqn, i));
       }
 
       for (int i = 0; i < 100; i++)
@@ -345,7 +336,7 @@
       assertNull(region.takeLastEventNode());
 
       fqn = Fqn.fromString("/a/b");
-      mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, false);
+      mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, fqn, data, false, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       event = regionManager.getRegion(fqn.toString(), false).takeLastEventNode();
       assertFalse(event.isResetElementCount());
@@ -353,7 +344,7 @@
       assertEquals(fqn, event.getFqn());
       assertEquals(100, event.getElementDifference());
       assertNull(regionManager.getRegion(fqn.toString(), false).takeLastEventNode());
-      node = cast(cache.get(fqn.toString()));
+      node = cast(cache.getNode(fqn));
       assertEquals(100, node.getData().size());
 
       assertNotNull(node);
@@ -364,7 +355,7 @@
          assertEquals(i, node.get(i));
       }
 
-      mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, true);
+      mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, fqn, data, false, true);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       event = regionManager.getRegion(fqn.toString(), false).takeLastEventNode();
       assertEquals(NodeEventType.ADD_NODE_EVENT, event.getEventType());
@@ -374,7 +365,7 @@
       assertNull(regionManager.getRegion(fqn.toString(), false).takeLastEventNode());
 
 
-      node = cast(cache.get(fqn.toString()));
+      node = cast(cache.getNode(fqn));
       assertEquals(100, node.getData().size());
       assertNotNull(node);
 
@@ -394,7 +385,7 @@
       Object value = "value";
 
       MethodCall mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
-              null, fqn, key, value, false);
+            fqn, key, value, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       assertEquals("value", cache.get(fqn, key));
       EvictedEventNode event = region.takeLastEventNode();
@@ -405,7 +396,7 @@
       assertNull(region.takeLastEventNode());
 
       mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
-              null, fqn, key, value, false);
+            fqn, key, value, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       assertEquals("value", cache.get(fqn, key));
       event = region.takeLastEventNode();
@@ -423,20 +414,20 @@
       cache.put(fqn, "a", "b");
       cache.put(fqn, "b", "c");
 
-      MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, null, fqn, false);
+      MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, fqn, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
-      assertEquals(0, cache.get(fqn).getData().size());
+      assertEquals(0, cache.getNode(fqn).getData().size());
       Region region = regionManager.getRegion(fqn.toString(), false);
       EvictedEventNode event = region.takeLastEventNode();
       assertEquals(NodeEventType.REMOVE_NODE_EVENT, event.getEventType());
       assertEquals(fqn, event.getFqn());
       assertNull(region.takeLastEventNode());
 
-      mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
+      mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, fqn, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
-      assertNull(cache.get(fqn));
+      assertNull(cache.getNode(fqn));
       event = region.takeLastEventNode();
       assertEquals(NodeEventType.REMOVE_NODE_EVENT, event.getEventType());
       assertEquals(fqn, event.getFqn());
@@ -450,7 +441,7 @@
       cache.put(fqn, "b", "c");
 
       MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
-              null, fqn, "a", false);
+            fqn, "a", false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       assertNull(cache.get(fqn, "a"));
@@ -462,7 +453,7 @@
       assertNull(region.takeLastEventNode());
 
       mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
-              null, fqn, "b", false);
+            fqn, "b", false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       assertNull(cache.get(fqn, "b"));
@@ -473,7 +464,7 @@
       assertNull(region.takeLastEventNode());
 
       mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
-              null, fqn, "b", false);
+            fqn, "b", false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       event = region.takeLastEventNode();
@@ -491,7 +482,7 @@
       // this region is node granularity
       Fqn fqn = Fqn.fromString("/a/b/c");
 
-      MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
+      MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, fqn, data, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       Region region = regionManager.getRegion(fqn.toString(), false);
@@ -503,16 +494,16 @@
       assertNull(region.takeLastEventNode());
 
       mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
-              fqn);
+            fqn);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       event = region.takeLastEventNode();
       assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
       assertEquals(fqn, event.getFqn());
       assertNull(region.takeLastEventNode());
 
-      mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
+      mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, fqn, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
-      assertNull(cache.get(fqn));
+      assertNull(cache.getNode(fqn));
       event = region.takeLastEventNode();
       assertEquals(NodeEventType.REMOVE_NODE_EVENT, event.getEventType());
       assertEquals(fqn, event.getFqn());
@@ -521,7 +512,7 @@
       Object key = "key";
       Object value = "value";
       mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
-              null, fqn, key, value, false);
+            fqn, key, value, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
       assertEquals("value", cache.get(fqn, key));
       event = region.takeLastEventNode();
@@ -540,7 +531,7 @@
       assertNull(region.takeLastEventNode());
 
       mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
-              null, fqn, key, false);
+            fqn, key, false);
       interceptor.invoke(InvocationContext.fromMethodCall(mc));
 
       assertNull(cache.get(fqn, key));

Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/InterceptorCacheReferenceTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,12 +6,11 @@
  */
 package org.jboss.cache.interceptors;
 
-import static org.testng.AssertJUnit.assertSame;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.assertSame;
 import org.testng.annotations.Test;
 
 /**
@@ -44,7 +43,7 @@
       cache.stop();
    }
 
-   private void assertInterceptorsHaveSameCache(CacheSPI<?, ?> c) throws Exception
+   private void assertInterceptorsHaveSameCache(CacheSPI<?, ?> c)
    {
       for (Interceptor i : c.getInterceptorChain())
       {

Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -9,7 +9,6 @@
 import junit.framework.Assert;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -42,14 +41,14 @@
 public class InvalidationInterceptorTest
 {
    private static Log log = LogFactory.getLog(InvalidationInterceptorTest.class);
-   private CacheImpl<Object, Object> cache1, cache2;
-   private Set<CacheImpl> toClean = new HashSet<CacheImpl>();
+   private CacheSPI<Object, Object> cache1, cache2;
+   private Set<CacheSPI> toClean = new HashSet<CacheSPI>();
 
    @AfterMethod
    public void tearDown()
    {
       TestingUtil.killCaches(cache1, cache2);
-      for (CacheImpl c : toClean) TestingUtil.killCaches(c);
+      for (CacheSPI c : toClean) TestingUtil.killCaches(c);
       toClean.clear();
    }
 
@@ -64,7 +63,7 @@
 
       // test that this has NOT replicated, but rather has been invalidated:
       Assert.assertEquals("value", cache1.get(fqn, "key"));
-      Assert.assertNull("Should NOT have replicated!", cache2.get(fqn));
+      Assert.assertNull("Should NOT have replicated!", cache2.getNode(fqn));
 
       log.info("***** Node not replicated, as expected.");
 
@@ -72,14 +71,14 @@
       cache2.put(fqn, "key", "value");
 
       // since the node already exists even PL will not remove it - but will invalidate it's data
-      Node n = cache1.get(fqn);
+      Node n = cache1.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
       Assert.assertEquals("value", cache2.get(fqn, "key"));
 
       // now test the invalidation:
       cache1.put(fqn, "key2", "value2");
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
-      n = cache2.get(fqn);
+      n = cache2.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
    }
 
@@ -124,16 +123,14 @@
       TestingUtil.sleepThread(500);// give it time to broadcast the evict call
       // test that this has NOT replicated, but rather has been invalidated:
       Assert.assertEquals("value", cache1.get(fqn, "key"));
-      Assert.assertNull("Should NOT have replicated!", cache2.get(fqn));
+      Assert.assertNull("Should NOT have replicated!", cache2.getNode(fqn));
 
-      log.info("***** Node not replicated, as expected.");
-
       // now make sure cache2 is in sync with cache1:
       cache2.put(fqn, "key", "value");
       TestingUtil.sleepThread(500);// give it time to broadcast the evict call
 
-            // since the node already exists even PL will not remove it - but will invalidate it's data
-      Node n = cache1.get(fqn);
+      // since the node already exists even PL will not remove it - but will invalidate it's data
+      Node n = cache1.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
       Assert.assertEquals("value", cache2.get(fqn, "key"));
 
@@ -141,9 +138,9 @@
       cache1.put(fqn, "key2", "value2");
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
       TestingUtil.sleepThread(500);// give it time to broadcast the evict call
-      
+
       // since the node already exists even PL will not remove it - but will invalidate it's data
-      n = cache2.get(fqn);
+      n = cache2.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
    }
 
@@ -158,7 +155,7 @@
 
       // test that this has NOT replicated, but rather has been invalidated:
       Assert.assertEquals("value", cache1.get(fqn, "key"));
-      Assert.assertNull("Should NOT have replicated!", cache2.get(fqn));
+      Assert.assertNull("Should NOT have replicated!", cache2.getNode(fqn));
 
       log.info("***** Node not replicated, as expected.");
 
@@ -172,8 +169,8 @@
       Assert.assertEquals("value", cache2.get(fqn, "key"));
       txm.commit();
 
-            // since the node already exists even PL will not remove it - but will invalidate it's data
-      Node n = cache1.get(fqn);
+      // since the node already exists even PL will not remove it - but will invalidate it's data
+      Node n = cache1.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
       Assert.assertEquals("value", cache2.get(fqn, "key"));
 
@@ -188,7 +185,7 @@
 
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
       // since the node already exists even PL will not remove it - but will invalidate it's data
-      n = cache2.get(fqn);
+      n = cache2.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
 
       // test a rollback
@@ -201,7 +198,7 @@
       txm.rollback();
 
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
-      n = cache2.get(fqn);
+      n = cache2.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
    }
 
@@ -215,7 +212,7 @@
 
       cache2.put(fqn, "key", "value");
       Assert.assertEquals("value", cache2.get(fqn, "key"));
-      Node n = cache1.get(fqn);
+      Node n = cache1.getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
       assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");
 
@@ -262,7 +259,7 @@
 
       cache1.put("/a/b", "key", "value");
       Assert.assertEquals("value", cache1.get(fqn, "key"));
-      Assert.assertNull(cache2.get(fqn));
+      Assert.assertNull(cache2.getNode(fqn));
 
       // start a tx that cacahe1 will have to send out an evict ...
       TransactionManager mgr1 = cache1.getTransactionManager();
@@ -311,7 +308,7 @@
 
       cache1.put("/a/b", "key", "value");
       Assert.assertEquals("value", cache1.get(fqn, "key"));
-      Assert.assertNull(cache2.get(fqn));
+      Assert.assertNull(cache2.getNode(fqn));
 
       // start a tx that cacahe1 will have to send out an evict ...
       TransactionManager mgr1 = cache1.getTransactionManager();
@@ -356,7 +353,7 @@
    {
       nodeRemovalTest(true);
    }
-   
+
    @SuppressWarnings("unchecked")
    private void nodeRemovalTest(boolean optimistic) throws Exception
    {
@@ -395,7 +392,7 @@
       checkRemoteNodeIsRemoved(remoteNode);
       assertEquals(false, cache1.removeNode(fqn));
    }
-   
+
    private void checkRemoteNodeIsRemoved(Node<Object, Object> remoteNode)
    {
       assertHasBeenInvalidated(remoteNode, "Should have been removed");
@@ -408,15 +405,17 @@
          }
       }
    }
-   
-   public void testPessimisticNodeResurrection() throws Exception {
+
+   public void testPessimisticNodeResurrection() throws Exception
+   {
       nodeResurrectionTest(false);
    }
-   
-   public void testOptimisticNodeResurrection() throws Exception {
+
+   public void testOptimisticNodeResurrection() throws Exception
+   {
       nodeResurrectionTest(true);
    }
-   
+
    private void nodeResurrectionTest(boolean optimistic) throws Exception
    {
       cache1 = createCache(optimistic);
@@ -463,7 +462,7 @@
 
    private void dumpVersionInfo(CacheSPI c1, CacheSPI c2, Fqn fqn)
    {
-      System.out.println("**** Versin Info for Fqn ["+fqn+"] ****");
+      System.out.println("**** Versin Info for Fqn [" + fqn + "] ****");
       NodeSPI n1 = c1.getRoot().getChildDirect(fqn);
       System.out.println("  Cache 1: " + n1.getVersion() + " dataLoaded? " + n1.isDataLoaded());
 
@@ -484,7 +483,7 @@
 
       // test that this has NOT replicated, but rather has been invalidated:
       Assert.assertEquals("value", cache1.get(fqn, "key"));
-      Node n2 = cache2.get(fqn);
+      Node n2 = cache2.getNode(fqn);
       assertHasBeenInvalidated(n2, "Should have been invalidated");
       assertHasBeenInvalidated(cache2.peek(fqn, true, true), "Should have been invalidated");
 
@@ -493,7 +492,7 @@
 
       dumpVersionInfo(cache1, cache2, fqn);
 
-      Node n1 = cache1.get(fqn);
+      Node n1 = cache1.getNode(fqn);
       assertHasBeenInvalidated(n1, "Should have been invalidated");
       assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");
 
@@ -505,7 +504,7 @@
       dumpVersionInfo(cache1, cache2, fqn);
 
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
-      n2 = cache2.get(fqn);
+      n2 = cache2.getNode(fqn);
       assertHasBeenInvalidated(n2, "Should have been invalidated");
       assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
 
@@ -518,7 +517,7 @@
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
       txm.commit();
 
-      n1 = cache1.get(fqn);
+      n1 = cache1.getNode(fqn);
       assertHasBeenInvalidated(n1, "Should have been invalidated");
       assertHasBeenInvalidated(cache1.peek(fqn, false, false), "Should have been invalidated");
       Assert.assertEquals("value", cache2.get(fqn, "key"));
@@ -533,7 +532,7 @@
       txm.commit();
 
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
-      n2 = cache2.get(fqn);
+      n2 = cache2.getNode(fqn);
       assertHasBeenInvalidated(n2, "Should have been invalidated");
       assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
 
@@ -547,14 +546,14 @@
       txm.rollback();
 
       Assert.assertEquals("value2", cache1.get(fqn, "key2"));
-      n2 = cache2.get(fqn);
+      n2 = cache2.getNode(fqn);
       assertHasBeenInvalidated(n2, "Should have been invalidated");
-      assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");      
+      assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
    }
 
    public void testPessimisticNonTransactionalWithCacheLoader() throws Exception
    {
-      List<CacheImpl<Object, Object>> caches = createCachesWithSharedCL(false);
+      List<CacheSPI<Object, Object>> caches = createCachesWithSharedCL(false);
       cache1 = caches.get(0);
       cache2 = caches.get(1);
 
@@ -579,7 +578,7 @@
 
    public void testPessimisticTransactionalWithCacheLoader() throws Exception
    {
-      List<CacheImpl<Object,Object>> caches = createCachesWithSharedCL(false);
+      List<CacheSPI<Object, Object>> caches = createCachesWithSharedCL(false);
       cache1 = caches.get(0);
       cache2 = caches.get(1);
 
@@ -606,7 +605,7 @@
 
    public void testOptimisticWithCacheLoader() throws Exception
    {
-      List<CacheImpl<Object, Object>> caches = createCachesWithSharedCL(true);
+      List<CacheSPI<Object, Object>> caches = createCachesWithSharedCL(true);
       cache1 = caches.get(0);
       cache2 = caches.get(1);
 
@@ -616,7 +615,7 @@
       Assert.assertNull("Should be null", caches.get(1).get(fqn, "key"));
       mgr.begin();
       caches.get(0).put(fqn, "key", "value");
-      Assert.assertEquals("value", caches.get(0).get(fqn, "key"));      
+      Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
       Assert.assertNull("Should be null", caches.get(1).get(fqn, "key"));
       mgr.commit();
       Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
@@ -645,7 +644,7 @@
 
    protected void doRegionBasedTest(boolean optimistic) throws Exception
    {
-      List<CacheImpl<Object,Object>> caches = new ArrayList<CacheImpl<Object, Object>>();
+      List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>();
       caches.add(createUnstartedCache(false));
       caches.add(createUnstartedCache(false));
       cache1 = caches.get(0);
@@ -663,28 +662,28 @@
       caches.get(0).start();
       caches.get(1).start();
 
-      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheImpl[0]), 5000);
+      TestingUtil.blockUntilViewsReceived(caches.toArray(new CacheSPI[0]), 5000);
 
       Fqn fqn = Fqn.fromString("/a/b");
 
-      assertNull("Should be null", caches.get(0).get(fqn));
-      assertNull("Should be null", caches.get(1).get(fqn));
+      assertNull("Should be null", caches.get(0).getNode(fqn));
+      assertNull("Should be null", caches.get(1).getNode(fqn));
 
       caches.get(0).put(fqn, "key", "value");
       assertEquals("expecting value", "value", caches.get(0).get(fqn, "key"));
-      Node n = caches.get(1).get(fqn);
+      Node n = caches.get(1).getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
 
       // now put in caches.get(1), should fire an eviction
       caches.get(1).put(fqn, "key", "value2");
       assertEquals("expecting value2", "value2", caches.get(1).get(fqn, "key"));
-      n = caches.get(0).get(fqn);
+      n = caches.get(0).getNode(fqn);
       assertHasBeenInvalidated(n, "Should have been invalidated");
    }
 
-   protected CacheImpl<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
+   protected CacheSPI<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setClusterName("MyCluster");
       cache.getConfiguration().setStateRetrievalTimeout(3000);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
@@ -694,17 +693,17 @@
       return cache;
    }
 
-   protected CacheImpl<Object, Object> createCache(boolean optimistic) throws Exception
+   protected CacheSPI<Object, Object> createCache(boolean optimistic) throws Exception
    {
-      CacheImpl<Object, Object> cache = createUnstartedCache(optimistic);
+      CacheSPI<Object, Object> cache = createUnstartedCache(optimistic);
       cache.start();
       toClean.add(cache);
       return cache;
    }
 
-   protected List<CacheImpl<Object, Object>> createCachesWithSharedCL(boolean optimistic) throws Exception
+   protected List<CacheSPI<Object, Object>> createCachesWithSharedCL(boolean optimistic) throws Exception
    {
-      List<CacheImpl<Object, Object>> caches = new ArrayList<CacheImpl<Object, Object>>();
+      List<CacheSPI<Object, Object>> caches = new ArrayList<CacheSPI<Object, Object>>();
       caches.add(createUnstartedCache(optimistic));
       caches.add(createUnstartedCache(optimistic));
 
@@ -721,17 +720,17 @@
    protected CacheLoaderConfig getCacheLoaderConfig() throws Exception
    {
       String xml = "            <config>\n" +
-                   "                <shared>shared</shared>\n" +
-                   "                <passivation>false</passivation>\n" +
-                   "                <preload></preload>\n" +
-                   "                <cacheloader>\n" +
-                   "                    <class>org.jboss.cache.loader.DummySharedInMemoryCacheLoader</class>\n" +
-                   "                    <async>false</async>\n" +
-                   "                    <fetchPersistentState>false</fetchPersistentState>\n" +
-                   "                    <ignoreModifications>false</ignoreModifications>\n" +
-                   "                </cacheloader>\n" +
-                   "                \n" +
-                   "            </config>";
+            "                <shared>shared</shared>\n" +
+            "                <passivation>false</passivation>\n" +
+            "                <preload></preload>\n" +
+            "                <cacheloader>\n" +
+            "                    <class>org.jboss.cache.loader.DummySharedInMemoryCacheLoader</class>\n" +
+            "                    <async>false</async>\n" +
+            "                    <fetchPersistentState>false</fetchPersistentState>\n" +
+            "                    <ignoreModifications>false</ignoreModifications>\n" +
+            "                </cacheloader>\n" +
+            "                \n" +
+            "            </config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,6 +1,6 @@
 package org.jboss.cache.invalidation;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -22,10 +22,10 @@
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  * @since 2.1.0
  */
- at Test (groups = {"functional"})
+ at Test(groups = {"functional"})
 public class TombstoneEvictionTest
 {
-   private CacheImpl c1, c2;
+   private CacheSPI c1, c2;
    private Fqn fqn = Fqn.fromString("/data/test");
    private Fqn dummy = Fqn.fromString("/data/dummy");
    private long evictionWaitTime = 2100;
@@ -33,8 +33,7 @@
    @BeforeMethod
    public void setUp() throws Exception
    {
-      c1 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
-      c2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      c1 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
 
       // the FIFO policy cfg
       FIFOConfiguration cfg = new FIFOConfiguration();
@@ -60,7 +59,7 @@
       c1.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       c1.getConfiguration().setEvictionConfig(ec);
 
-      c2.setConfiguration(c1.getConfiguration().clone());
+      c2 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(c1.getConfiguration().clone(), false);
 
       c1.start();
       c2.start();
@@ -107,7 +106,7 @@
       assert c2.peek(fqn, false, true) == null : "Should have evicted";
       assert c2.peek(dummy, false, true) != null : "Node should exist";
    }
-   
+
    public void testWithTombstones()
    {
       c1.put(fqn, "k", "v");

Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -91,7 +91,7 @@
       assert val.equals("v-newer");
 
       // test node versions
-      NodeSPI n = (NodeSPI) ((CacheImpl) cache1).peek(node, true, true);
+      NodeSPI n = ((CacheImpl) cache1).peek(node, true, true);
       assert ((DefaultDataVersion) n.getVersion()).getRawVersion() == 1 : "Version should be 1";
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,23 +1,8 @@
 package org.jboss.cache.jmx;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.EnumSet;
-import java.util.HashMap;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
 import junit.framework.AssertionFailedError;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig;
@@ -27,18 +12,27 @@
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
 
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import java.util.EnumSet;
+import java.util.HashMap;
+
 /**
  * Functional tests for CacheJmxWrapper broadcast of cache event notifications
  *
  * @author Jerry Gauthier
  * @version $Id$
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class NotificationTest
 {
    protected static final String CLUSTER_NAME = "NotificationTestCluster";
@@ -59,7 +53,7 @@
    protected MBeanServer m_server;
    protected EnumSet<Type> events = EnumSet.noneOf(Type.class);
 
-   protected CacheImpl<Object, Object> cache = null;
+   protected CacheSPI<Object, Object> cache = null;
    protected boolean optimistic = false;
 
    @BeforeMethod(alwaysRun = true)
@@ -161,10 +155,10 @@
       assertNotNull("Retrieval error: expected to retrieve " + CURRENCY + " for " + key, cache.get(key, CURRENCY));
 
       // remove the node - this will trigger NodeRemoved and NodeRemove(pre/post)
-      cache.remove(key);
+      cache.removeNode(key);
 
       // clean up before stopping  the cache
-      CacheLoader cl = cache.getCacheLoader();
+      CacheLoader cl = cache.getCacheLoaderManager().getCacheLoader();
       cl.remove(Fqn.fromString(EUROPE_NODE));
 
       // stop the cache
@@ -235,7 +229,7 @@
          m_server.addNotificationListener(mgmt, listener, null, null);
 
          // add a node - this will trigger NodeCreated, NodeModify(pre/post) and NodeModified
-         HashMap<String, String> albania = new HashMap<String, String>(4);
+         HashMap<Object, Object> albania = new HashMap<Object, Object>(4);
          albania.put(CAPITAL, "Tirana");
          albania.put(CURRENCY, "Lek");
          cache.put("Europe/Albania", albania);
@@ -283,11 +277,11 @@
       }
    }
 
-   private CacheImpl<Object, Object> createCache(String clusterName) throws Exception
+   private CacheSPI<Object, Object> createCache(String clusterName) throws Exception
    {
       Configuration config = createConfiguration(clusterName);
       CacheFactory<Object, Object> factory = DefaultCacheFactory.getInstance();
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>)factory.createCache(config, false);
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) factory.createCache(config, false);
 
       cache.create();
       // start the cache after the listener has been registered
@@ -329,17 +323,17 @@
    protected static CacheLoaderConfig getCacheLoaderConfig(String properties) throws Exception
    {
       String xml = "<config>\n" +
-              "<passivation>true</passivation>\n" +
-              "<preload></preload>\n" +
-              "<shared>true</shared>\n" +
-              "<cacheloader>\n" +
-              "<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
-              "<properties>" + properties + "</properties>\n" +
-              "<async>false</async>\n" +
-              "<fetchPersistentState>false</fetchPersistentState>\n" +
-              "<ignoreModifications>false</ignoreModifications>\n" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<passivation>true</passivation>\n" +
+            "<preload></preload>\n" +
+            "<shared>true</shared>\n" +
+            "<cacheloader>\n" +
+            "<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
+            "<properties>" + properties + "</properties>\n" +
+            "<async>false</async>\n" +
+            "<fetchPersistentState>false</fetchPersistentState>\n" +
+            "<ignoreModifications>false</ignoreModifications>\n" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderCompatibilityTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,18 +1,6 @@
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Properties;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig;
@@ -22,11 +10,18 @@
 import org.jboss.cache.xml.XmlHelper;
 import org.jboss.util.stream.MarshalledValueInputStream;
 import org.jboss.util.stream.MarshalledValueOutputStream;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Properties;
+
 /**
  * Tests the compatibility between <tt>JDBCCacheLoader</tt> and <tt>JDBCCacheLoaderOld</tt>. More exactly,
  * it tests whether the new <tt>JDBCCacheLoader</tt> works fine on data previously created
@@ -57,8 +52,8 @@
    {
       newImpl = getNewCacheLoader();
       oldImpl = getOldLoader();
-      CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
-      CacheImpl cache2 = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI cache2 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       newImpl.setCache(cache);//this is needed for marshaller
       oldImpl.setCache(cache2);
       oldImpl.start();
@@ -207,17 +202,17 @@
    protected CacheLoaderConfig getSingleCacheLoaderConfig(String preload, String cacheloaderClass, String properties) throws Exception
    {
       String xml = "<config>\n" +
-              "<passivation>false</passivation>\n" +
-              "<preload>" + preload + "</preload>\n" +
-              "<cacheloader>\n" +
-              "<class>" + cacheloaderClass + "</class>\n" +
-              "<properties>" + properties + "</properties>\n" +
-              "<async>false</async>\n" +
-              "<shared>false</shared>\n" +
-              "<fetchPersistentState>true</fetchPersistentState>\n" +
-              "<purgeOnStartup>false</purgeOnStartup>\n" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<passivation>false</passivation>\n" +
+            "<preload>" + preload + "</preload>\n" +
+            "<cacheloader>\n" +
+            "<class>" + cacheloaderClass + "</class>\n" +
+            "<properties>" + properties + "</properties>\n" +
+            "<async>false</async>\n" +
+            "<shared>false</shared>\n" +
+            "<fetchPersistentState>true</fetchPersistentState>\n" +
+            "<purgeOnStartup>false</purgeOnStartup>\n" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
@@ -241,11 +236,11 @@
       Properties prop = getProperties();
 
       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.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat") + "\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.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat") + "\n";
 
 
       CacheLoaderConfig.IndividualCacheLoaderConfig base = getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props).getFirstCacheLoaderConfig();
@@ -261,11 +256,11 @@
       Properties prop = getProperties();
 
       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.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat");// + "\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.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat");// + "\n" +
 //                "cache.jdbc.connection.factory=org.jboss.cache.manualtests.cacheloader.OneConnectionFactory";
 
 

Modified: core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/AsyncFileCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,17 +1,8 @@
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.Collections;
-import java.util.HashMap;
-
 import junit.framework.Assert;
-
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Modification;
@@ -19,11 +10,18 @@
 import org.jboss.cache.statetransfer.StateTransferManager;
 import org.jboss.util.stream.MarshalledValueInputStream;
 import org.jboss.util.stream.MarshalledValueOutputStream;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Collections;
+import java.util.HashMap;
+
 public class AsyncFileCacheLoaderTest extends AbstractCacheLoaderTestBase
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
 
    protected void configureCache() throws Exception
    {
@@ -32,7 +30,7 @@
 
    protected void configureCache(String props) throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       // cache.setCacheLoaderConfiguration(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.jdbm.JdbmCacheLoader",
       cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", props, true, false, true));
@@ -80,9 +78,9 @@
    public void testPutImmediate() throws Exception
    {
       configureCache(
-              "cache.async.put=false\n" +
-                      "cache.async.pollWait=10000\n" +
-                      "");
+            "cache.async.put=false\n" +
+                  "cache.async.pollWait=10000\n" +
+                  "");
       CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
       Fqn fqn = Fqn.fromString("/a/b/c/d");
       HashMap<Object, Object> map = new HashMap<Object, Object>();
@@ -99,9 +97,9 @@
    public void testBounded() throws Exception
    {
       configureCache(
-              "cache.async.queueSize=1\n" +
-                      "cache.async.pollWait=10\n" +
-                      "");
+            "cache.async.queueSize=1\n" +
+                  "cache.async.pollWait=10\n" +
+                  "");
       CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
       Fqn fqn = Fqn.fromString("/bound");
       loader.remove(fqn);
@@ -118,9 +116,9 @@
    public void testNoReturnOld() throws Exception
    {
       configureCache(
-              "cache.async.returnOld=false\n" +
-                      "cache.async.pollWait=10\n" +
-                      "");
+            "cache.async.returnOld=false\n" +
+                  "cache.async.pollWait=10\n" +
+                  "");
       CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
       System.out.println("Loader " + loader);
       cache.put(Fqn.ROOT, "key1", "value1");

Modified: core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,23 +1,9 @@
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.cache.CacheImpl;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.DatabaseConfig;
+import com.sleepycat.je.DeadlockException;
+import com.sleepycat.je.Environment;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -26,15 +12,21 @@
 import org.jboss.cache.statetransfer.StateTransferManager;
 import org.jboss.util.stream.MarshalledValueInputStream;
 import org.jboss.util.stream.MarshalledValueOutputStream;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.sleepycat.je.Database;
-import com.sleepycat.je.DatabaseConfig;
-import com.sleepycat.je.DatabaseException;
-import com.sleepycat.je.DeadlockException;
-import com.sleepycat.je.Environment;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Tests BdbjeCacheLoader directly via the CacheLoader interface.
@@ -53,7 +45,7 @@
    private static final String envHome = ".";
    private static final Fqn<String> FQN = new Fqn<String>("key");
 
-   private CacheImpl cache;
+   private CacheSPI cache;
    private CacheLoader loader;
 
    /**
@@ -129,20 +121,20 @@
     * @param dbName        a database name, or null to default to the cluster name.
     */
    private void startLoader(boolean transactional, String dbName)
-           throws Exception
+         throws Exception
    {
 
       /*
-       * Create a dummy CacheImpl object.  This is used for setting the cluster
+       * Create a dummy CacheSPI object.  This is used for setting the cluster
        * name and TransactionManagerLookupClass (transactional) propertes only.
-       * the CacheImpl object is not used otherwise during testing.
+       * the CacheSPI object is not used otherwise during testing.
        */
-      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setClusterName("myCluster");
       if (transactional)
       {
          cache.getConfiguration().setTransactionManagerLookupClass(
-                 "org.jboss.cache.transaction.DummyTransactionManagerLookup");
+               "org.jboss.cache.transaction.DummyTransactionManagerLookup");
       }
       cache.start();
 
@@ -181,12 +173,12 @@
     * Creates the loader instance.
     */
    private void instantiateLoader()
-           throws Exception
+         throws Exception
    {
 
-      /* Create the cache loader as CacheImpl would. */
+      /* Create the cache loader as CacheSPI would. */
       Class cls =
-              Class.forName("org.jboss.cache.loader.bdbje.BdbjeCacheLoader");
+            Class.forName("org.jboss.cache.loader.bdbje.BdbjeCacheLoader");
       loader = (CacheLoader) cls.newInstance();
    }
 
@@ -194,7 +186,6 @@
     * Stops and destroys the loader.
     */
    private void stopLoader()
-           throws Exception
    {
 
       loader.stop();
@@ -205,7 +196,7 @@
     * Tests basic operations without a transaction.
     */
    public void testBasicOperations()
-           throws Exception
+         throws Exception
    {
 
       doTestBasicOperations(false);
@@ -215,7 +206,7 @@
     * Tests basic operations with a transaction.
     */
    public void testBasicOperationsTransactional()
-           throws Exception
+         throws Exception
    {
 
       doTestBasicOperations(true);
@@ -225,7 +216,7 @@
     * Tests basic operations.
     */
    private void doTestBasicOperations(boolean transactional)
-           throws Exception
+         throws Exception
    {
 
       startLoader(transactional, null);
@@ -267,7 +258,7 @@
     * Do basic put tests for a given FQN.
     */
    private void doPutTests(Fqn<String> fqn)
-           throws Exception
+         throws Exception
    {
 
       assertTrue(!loader.exists(fqn));
@@ -307,7 +298,7 @@
     * Do basic remove tests for a given FQN.
     */
    private void doRemoveTests(Fqn<String> fqn)
-           throws Exception
+         throws Exception
    {
 
       /* remove(Fqn,Object) */
@@ -337,7 +328,7 @@
     * and tests removing subtrees.
     */
    public void testMultiLevelTree()
-           throws Exception
+         throws Exception
    {
 
       startLoader(false, null);
@@ -486,7 +477,7 @@
     * Tests the getChildrenNames() method.
     */
    public void testGetChildrenNames()
-           throws Exception
+         throws Exception
    {
 
       startLoader(false, null);
@@ -510,13 +501,13 @@
       loader.put(Fqn.fromString("/key0/ab"), null);
       loader.put(Fqn.fromString("/key0/abc"), null);
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc"});
+            new String[]{"a", "ab", "abc"});
 
       loader.put(Fqn.fromString("/key0/xxx"), null);
       loader.put(Fqn.fromString("/key0/xx"), null);
       loader.put(Fqn.fromString("/key0/x"), null);
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
 
       loader.put(Fqn.fromString("/key0/a/1"), null);
       loader.put(Fqn.fromString("/key0/a/2"), null);
@@ -524,13 +515,13 @@
       checkChildren(Fqn.fromString("/key0/a/2"), new String[]{"1"});
       checkChildren(Fqn.fromString("/key0/a"), new String[]{"1", "2"});
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
 
       loader.put(Fqn.fromString("/key0/\u0000"), null);
       loader.put(Fqn.fromString("/key0/\u0001"), null);
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc", "x", "xx", "xxx",
-                      "\u0000", "\u0001"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx",
+                  "\u0000", "\u0001"});
 
       loader.put(Fqn.fromString("/\u0001"), null);
       checkChildren(new Fqn<String>(), new String[]{"key0", "key1", "\u0001"});
@@ -540,11 +531,11 @@
 
       loader.put(Fqn.fromString("/\u0001/\uFFFF"), null);
       checkChildren(Fqn.fromString("/\u0001"),
-              new String[]{"\u0001", "\uFFFF"});
+            new String[]{"\u0001", "\uFFFF"});
 
       loader.put(Fqn.fromString("/\u0001/\uFFFF/\u0001"), null);
       checkChildren(Fqn.fromString("/\u0001/\uFFFF"),
-              new String[]{"\u0001"});
+            new String[]{"\u0001"});
 
       stopLoader();
    }
@@ -553,7 +544,7 @@
     * Checks that the given list of children part names is returned.
     */
    private void checkChildren(Fqn<String> fqn, String[] names)
-           throws Exception
+         throws Exception
    {
 
       Set set = loader.getChildrenNames(fqn);
@@ -575,7 +566,7 @@
     * Tests basic operations without a transaction.
     */
    public void testModifications()
-           throws Exception
+         throws Exception
    {
 
       doTestModifications(false);
@@ -585,7 +576,7 @@
     * Tests basic operations with a transaction.
     */
    public void testModificationsTransactional()
-           throws Exception
+         throws Exception
    {
 
       doTestModifications(true);
@@ -595,7 +586,7 @@
     * Tests modifications.
     */
    private void doTestModifications(boolean transactional)
-           throws Exception
+         throws Exception
    {
 
       startLoader(transactional, null);
@@ -644,7 +635,7 @@
     * Tests a one-phase transaction.
     */
    public void testOnePhaseTransaction()
-           throws Exception
+         throws Exception
    {
 
       startLoader(true, null);
@@ -660,7 +651,7 @@
     * Tests a two-phase transaction.
     */
    public void testTwoPhaseTransaction()
-           throws Exception
+         throws Exception
    {
 
       startLoader(true, null);
@@ -686,7 +677,7 @@
     * Tests rollback of a two-phase transaction.
     */
    public void testTransactionRollback()
-           throws Exception
+         throws Exception
    {
 
       startLoader(true, null);
@@ -741,7 +732,7 @@
     * Checks that a list of modifications was applied.
     */
    private void checkModifications(List<Modification> list)
-           throws Exception
+         throws Exception
    {
 
       for (int i = 0; i < list.size(); i += 1)
@@ -783,7 +774,7 @@
     * Tests a non-transactional prepare.
     */
    public void testTransactionExceptions()
-           throws Exception
+         throws Exception
    {
 
       List<Modification> mods = createUpdates();
@@ -884,7 +875,7 @@
     * Tests that null keys and values work as for a standard Java Map.
     */
    public void testNullKeysAndValues()
-           throws Exception
+         throws Exception
    {
 
       startLoader(false, null);
@@ -934,7 +925,7 @@
     * Test non-default database name.
     */
    public void testDatabaseName()
-           throws Exception
+         throws Exception
    {
 
       startLoader(false, "nonDefaultDbName");
@@ -947,7 +938,7 @@
     * Test load/store state.
     */
    public void testLoadAndStore()
-           throws Exception
+         throws Exception
    {
 
       startLoader(false, null);
@@ -1056,7 +1047,7 @@
          {
             Complex x = (Complex) o;
             return (nested != null) ? nested.equals(x.nested)
-                    : (x.nested == null);
+                  : (x.nested == null);
          }
          catch (ClassCastException e)
          {

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,22 +6,16 @@
  */
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-import java.util.Properties;
-
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
 import org.w3c.dom.Element;
 
+import java.util.List;
+import java.util.Properties;
+
 /**
  * Tests the construction of a cache laoder based on an XML element passed in.
  *
@@ -37,7 +31,7 @@
       return cfg;
    }
 
-   private CacheLoaderConfig.IndividualCacheLoaderConfig createIndividualCacheLoaderConfig(CacheLoaderConfig parent, boolean async, String classname) throws Exception
+   private CacheLoaderConfig.IndividualCacheLoaderConfig createIndividualCacheLoaderConfig(CacheLoaderConfig parent, boolean async, String classname)
    {
       CacheLoaderConfig.IndividualCacheLoaderConfig cfg = new CacheLoaderConfig.IndividualCacheLoaderConfig();
       cfg.setAsync(async);
@@ -134,34 +128,34 @@
    {
       // without async
       String conf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-              "<config><passivation>true</passivation>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader></config>";
+            "<config><passivation>true</passivation>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader></config>";
       CacheLoaderConfig clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       CacheLoaderManager mgr = new CacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -171,33 +165,33 @@
 
       // with async
       conf = "<config><passivation>true</passivation>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>true</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>" +
-              "    <async>true</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
-              "    <async>true</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader></config>";
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>true</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.bdbje.BdbjeCacheLoader</class>" +
+            "    <async>true</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
+            "    <async>true</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader></config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr.setConfig(clc, null);
       cl = mgr.getCacheLoader();
@@ -241,24 +235,24 @@
    {
       // async = false
       String conf = "<config><passivation>false</passivation>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
-              "    </properties>" +
-              "</cacheloader></config>";
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
+            "    </properties>" +
+            "</cacheloader></config>";
 
       CacheLoaderConfig clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       CacheLoaderManager mgr = new CacheLoaderManager();
@@ -274,25 +268,25 @@
 
       // async = true
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
-              "    <async>true</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
-              "    </properties>" +
-              "</cacheloader></config>";
+            "<passivation>false</passivation>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
+            "    <async>true</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
+            "    </properties>" +
+            "</cacheloader></config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr.setConfig(clc, null);
       cl = mgr.getCacheLoader();
@@ -372,26 +366,26 @@
    {
 
       String conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
-              "    <async>true</async>" +
-              "    <fetchPersistentState>true</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
-              "    </properties>" +
-              "</cacheloader></config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
+            "    <async>true</async>" +
+            "    <fetchPersistentState>true</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
+            "    </properties>" +
+            "</cacheloader></config>";
       CacheLoaderConfig clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       CacheLoaderManager mgr = new CacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -420,26 +414,26 @@
 
       // fetch PersistentState shld be false now
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
-              "    <async>true</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>false</ignoreModifications>" +
-              "    <properties>" +
-              "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
-              "    </properties>" +
-              "</cacheloader></config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.JDBCCacheLoader</class>" +
+            "    <async>true</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>false</ignoreModifications>" +
+            "    <properties>" +
+            "cache.jdbc.driver=com.mysql.jdbc.Driver\ncache.jdbc.url=jdbc:mysql://localhost/test\ncache.jdbc.user=user\ncache.jdbc.password=pwd" +
+            "    </properties>" +
+            "</cacheloader></config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
 
       mgr = new CacheLoaderManager();
@@ -453,18 +447,18 @@
    public void testSingletonConfiguration() throws Exception
    {
       String conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "</cacheloader>" +
+            "</config>";
       CacheLoaderConfig clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       CacheLoaderManager mgr = new CacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -475,21 +469,21 @@
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>false</enabled>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>false</enabled>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new MockCacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -501,21 +495,21 @@
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new MockCacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -526,29 +520,29 @@
       assertEquals("Singleton class should be default", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());
       assertNotNull("Singleton properties should be not null", iclc.getSingletonStoreConfig().getSingletonStoreproperties());
       assertTrue("Singleton properties should be empty", iclc.getSingletonStoreConfig().getSingletonStoreproperties().keySet().isEmpty());
-      SingletonStoreDefaultConfig ssdc = ((SingletonStoreCacheLoader)mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
+      SingletonStoreDefaultConfig ssdc = ((SingletonStoreCacheLoader) mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
       assertTrue("Singleton pushStateWhenCoordinator should be true (default)", ssdc.isPushStateWhenCoordinator());
       assertEquals("Singleton pushStateWhenCoordinatorTimeout should be default value", 20000, ssdc.getPushStateWhenCoordinatorTimeout());
 
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "       <class>org.jboss.cache.loader.CacheLoaderManagerTest$MockSingletonStoreCacheLoader</class>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "       <class>org.jboss.cache.loader.CacheLoaderManagerTest$MockSingletonStoreCacheLoader</class>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new CacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -564,22 +558,22 @@
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>false</enabled>" +
-              "       <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>false</enabled>" +
+            "       <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new CacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -591,22 +585,22 @@
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "       <properties></properties>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "       <properties></properties>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new MockCacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -616,30 +610,30 @@
       assertTrue("Singleton should enabled", iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
       assertEquals("Singleton class should be default", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());
       assertNotNull("Singleton properties should be defined, but empty", iclc.getSingletonStoreConfig().getSingletonStoreproperties());
-      ssdc = ((SingletonStoreCacheLoader)mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
+      ssdc = ((SingletonStoreCacheLoader) mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
       assertTrue("Singleton pushStateWhenCoordinator should be true", ssdc.isPushStateWhenCoordinator());
 
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "       <properties>" +
-              "          pushStateWhenCoordinator = false" +
-              "       </properties>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "       <properties>" +
+            "          pushStateWhenCoordinator = false" +
+            "       </properties>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new MockCacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -649,31 +643,31 @@
       assertTrue("Singleton should enabled", iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
       assertEquals("Singleton class should be default", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());
       assertNotNull("Singleton properties should be defined", iclc.getSingletonStoreConfig().getSingletonStoreproperties());
-      ssdc = ((SingletonStoreCacheLoader)mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
+      ssdc = ((SingletonStoreCacheLoader) mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
       assertFalse("Singleton pushStateWhenCoordinator should be false", ssdc.isPushStateWhenCoordinator());
 
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "       <properties>" +
-              "          pushStateWhenCoordinator = true\n" +
-              "          pushStateWhenCoordinatorTimeout = 5000\n" +
-              "       </properties>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "       <properties>" +
+            "          pushStateWhenCoordinator = true\n" +
+            "          pushStateWhenCoordinatorTimeout = 5000\n" +
+            "       </properties>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new MockCacheLoaderManager();
       mgr.setConfig(clc, null);
@@ -683,29 +677,29 @@
       assertTrue("Singleton should enabled", iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
       assertEquals("Singleton class should be default", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());
       assertNotNull("Singleton properties should not be defined", iclc.getSingletonStoreConfig().getSingletonStoreproperties());
-      ssdc = ((SingletonStoreCacheLoader)mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
+      ssdc = ((SingletonStoreCacheLoader) mgr.getCacheLoader()).getSingletonStoreDefaultConfig();
       assertTrue("Singleton pushStateWhenCoordinator should be true", ssdc.isPushStateWhenCoordinator());
       assertEquals("Singleton pushStateWhenCoordinatorTimeout should be default value", 5000, ssdc.getPushStateWhenCoordinatorTimeout());
 
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<shared>true</shared>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<shared>true</shared>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new CacheLoaderManager();
       try
@@ -720,22 +714,22 @@
       /************************************************************************************************************/
 
       conf = "<config>" +
-              "<passivation>false</passivation>" +
-              "<preload>/, /blah, /blah2</preload>" +
-              "<cacheloader>" +
-              "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
-              "    <async>false</async>" +
-              "    <fetchPersistentState>false</fetchPersistentState>" +
-              "    <ignoreModifications>true</ignoreModifications>" +
-              "    <properties>" +
-              "        location=" + getTempDir() +
-              "    </properties>" +
-              "    <singletonStore>" +
-              "       <enabled>true</enabled>" +
-              "       <class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>" +
-              "    </singletonStore>" +
-              "</cacheloader>" +
-              "</config>";
+            "<passivation>false</passivation>" +
+            "<preload>/, /blah, /blah2</preload>" +
+            "<cacheloader>" +
+            "    <class>org.jboss.cache.loader.FileCacheLoader</class>" +
+            "    <async>false</async>" +
+            "    <fetchPersistentState>false</fetchPersistentState>" +
+            "    <ignoreModifications>true</ignoreModifications>" +
+            "    <properties>" +
+            "        location=" + getTempDir() +
+            "    </properties>" +
+            "    <singletonStore>" +
+            "       <enabled>true</enabled>" +
+            "       <class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>" +
+            "    </singletonStore>" +
+            "</cacheloader>" +
+            "</config>";
       clc = XmlConfigurationParser.parseCacheLoaderConfig(strToElement(conf));
       mgr = new CacheLoaderManager();
 

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderMethodCallCounterTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,10 +6,9 @@
  */
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
@@ -20,14 +19,14 @@
  */
 public class CacheLoaderMethodCallCounterTest extends AbstractCacheLoaderTestBase
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI cache;
    private DummyCacheLoader dummyLoader;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
       if (cache != null) tearDown();
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCacheLoader.class.getName(), "", false, false, false));
       cache.start();
       dummyLoader = (DummyCacheLoader) cache.getCacheLoaderManager().getCacheLoader();
@@ -45,19 +44,19 @@
    }
 
 
-   public void testPut() throws Exception
+   public void testPut()
    {
       cache.put("/node", "key", "value");
       printReport("putKeyValue", dummyLoader);
    }
 
-   public void testGet() throws Exception
+   public void testGet()
    {
       cache.get("/node", "key");
       printReport("getKey", dummyLoader);
    }
 
-   public void testRemove() throws Exception
+   public void testRemove()
    {
       cache.remove("/node", "key");
       printReport("removeKey", dummyLoader);
@@ -76,7 +75,7 @@
       System.out.println("------------------------------");
    }
 
-   public void testLoopedGets() throws Exception
+   public void testLoopedGets()
    {
       // put an object in cache
       cache.put("/test", "key", "value");
@@ -88,7 +87,7 @@
 
       for (int i = 0; i < 2000; i++)
       {
-         cache.get("/test");
+         cache.getNode("/test");
       }
 
       assertEquals(1, dummyLoader.getPutCount());

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderPurgingTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,7 +7,7 @@
 package org.jboss.cache.loader;
 
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -17,13 +17,14 @@
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
+
 /**
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
 @Test(groups = {"functional"})
 public class CacheLoaderPurgingTest extends AbstractCacheLoaderTestBase
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private String key = "key", value = "value";
    private Fqn fqn = Fqn.fromString("/a/b/c");
 
@@ -32,7 +33,7 @@
    {
       if (cache != null)
       {
-         cache.remove(Fqn.ROOT);
+         cache.removeNode(Fqn.ROOT);
          cache.stop();
          cache = null;
       }
@@ -40,9 +41,9 @@
 
    public void testSingleLoaderNoPurge() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
+
       c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false));
       cache.start();
 
@@ -64,9 +65,8 @@
 
    public void testSingleLoaderPurge() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
       c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, false, true));
       cache.start();
 
@@ -85,39 +85,38 @@
 
       assertTrue(cache.getCacheLoaderManager().getCacheLoaderConfig().getFirstCacheLoaderConfig().isPurgeOnStartup());
 
-      assertNull(cache.get(fqn));
+      assertNull(cache.getNode(fqn));
       assertNull(loader.get(fqn));
    }
 
    public void testTwoLoadersPurge() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
 
       String xml = "<config>\n" +
-              "<passivation>false</passivation>\n" +
-              "<preload></preload>\n" +
-              "<cacheloader>\n" +
-              "<class>" + DummySharedInMemoryCacheLoader.class.getName() + "</class>\n" +
-              "<properties>" +
-              " bin=bin1\n" +
-              "</properties>\n" +
-              "<async>false</async>\n" +
-              "<fetchPersistentState>true</fetchPersistentState>\n" +
-              "<purgeOnStartup>" + true + "</purgeOnStartup>\n" +
-              "</cacheloader>\n" +
-              "<cacheloader>\n" +
-              "<class>" + DummySharedInMemoryCacheLoader.class.getName() + "</class>\n" +
-              "<properties>" +
-              " bin=bin2\n" +
-              "</properties>\n" +
-              "<async>false</async>\n" +
-              "<fetchPersistentState>false</fetchPersistentState>\n" +
-              "<purgeOnStartup>" + false + "</purgeOnStartup>\n" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<passivation>false</passivation>\n" +
+            "<preload></preload>\n" +
+            "<cacheloader>\n" +
+            "<class>" + DummySharedInMemoryCacheLoader.class.getName() + "</class>\n" +
+            "<properties>" +
+            " bin=bin1\n" +
+            "</properties>\n" +
+            "<async>false</async>\n" +
+            "<fetchPersistentState>true</fetchPersistentState>\n" +
+            "<purgeOnStartup>" + true + "</purgeOnStartup>\n" +
+            "</cacheloader>\n" +
+            "<cacheloader>\n" +
+            "<class>" + DummySharedInMemoryCacheLoader.class.getName() + "</class>\n" +
+            "<properties>" +
+            " bin=bin2\n" +
+            "</properties>\n" +
+            "<async>false</async>\n" +
+            "<fetchPersistentState>false</fetchPersistentState>\n" +
+            "<purgeOnStartup>" + false + "</purgeOnStartup>\n" +
+            "</cacheloader>\n" +
+            "</config>";
 
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      Configuration c = cache.getConfiguration();
       Element element = XmlHelper.stringToElement(xml);
       c.setCacheLoaderConfig(XmlConfigurationParser.parseCacheLoaderConfig(element));
       cache.start();

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,46 +1,40 @@
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.CountDownLatch;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Modification;
 import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.statetransfer.StateTransferManager;
 import org.jboss.cache.transaction.TransactionSetup;
 import org.jboss.util.stream.MarshalledValueInputStream;
 import org.jboss.util.stream.MarshalledValueOutputStream;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.CountDownLatch;
+
 /**
  * Commons tests for all CacheLoaders
  *
@@ -52,7 +46,7 @@
 {
 
    private static final Log log = LogFactory.getLog(CacheLoaderTestsBase.class);
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    CacheLoader loader = null;
    static final Fqn<String> FQN = new Fqn<String>("key");
    private static final Fqn<String> SUBTREE_FQN = new Fqn<String>(FQN, "subtree");
@@ -66,9 +60,8 @@
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
       c.setCacheMode(Configuration.CacheMode.LOCAL);
       c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       configureCache();
@@ -90,7 +83,7 @@
       cleanup();
       try
       {
-         cache.remove("/");
+         cache.removeNode(Fqn.ROOT);
       }
       catch (Exception e)
       {
@@ -120,14 +113,27 @@
       // returns immediately in this case.  Subclasses may override where a delay is needed.
    }
 
+   /**
+    * Helper method to test the existence of a key
+    *
+    * @param fqn
+    * @param key
+    */
+   protected boolean exists(String fqn, String key)
+   {
+      NodeSPI n = cache.peek(Fqn.fromString(fqn), false, false);
+      if (key == null) return n != null;
+      return n != null && n.getKeysDirect().contains(key);
+   }
+
    public void testPrint() throws CacheException
    {
       final Fqn NODE = Fqn.fromString("/test");
       final String KEY = "key";
       cache.put(NODE, KEY, 10);
-      cache.evict(NODE);
+      cache.evict(NODE, false);
       addDelay();
-      String ret = cache.print(NODE);
+      Node ret = cache.getNode(NODE);
       assertNotNull(ret);
    }
 
@@ -136,14 +142,14 @@
       final String NODE = "/test";
       final String KEY = "key";
       Object retval;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       addDelay();
       retval = cache.put(NODE, KEY, 10);
       assertEquals(null, retval);
       retval = cache.put(NODE, KEY, 20);
       addDelay();
       assertEquals(10, retval);
-      cache.evict(Fqn.fromString(NODE));// evicts from memory, but *not* from store
+      cache.evict(Fqn.fromString(NODE), false);// evicts from memory, but *not* from store
       addDelay();
       log.debug("put 30, expect 20 back");
       retval = cache.put(NODE, KEY, 30);
@@ -157,7 +163,7 @@
       assertNull(loader.get(Fqn.fromString(NODE)));
       final String KEY = "key";
       Object retval;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       assertNull(loader.get(Fqn.fromString(NODE)));
       addDelay();
       retval = cache.put(NODE, KEY, 10);
@@ -165,9 +171,9 @@
       addDelay();
       retval = cache.put(NODE, KEY, 20);
       assertEquals(10, retval);
-      cache.evict(Fqn.fromString(NODE));// evicts from memory, but *not* from store
-      cache.evict(Fqn.fromString("/a/b"));
-      cache.evict(Fqn.fromString("/a"));
+      cache.evict(Fqn.fromString(NODE), false);// evicts from memory, but *not* from store
+      cache.evict(Fqn.fromString("/a/b"), false);
+      cache.evict(Fqn.fromString("/a"), false);
       addDelay();
       log.debug("replace KEY with 30, expect 20");
       retval = cache.put(NODE, KEY, 30);
@@ -181,7 +187,7 @@
    {
       final Fqn NODE = Fqn.fromString("/a/b/c");
 
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       addDelay();
       Map<Object, Object> m = new HashMap<Object, Object>();
       m.put("a", "b");
@@ -196,15 +202,15 @@
       cache.get(NODE, "X");
 
       assertEquals(m, loader.get(NODE));
-      assertEquals(m, cache.get(NODE).getData());
-      cache.evict(NODE);
+      assertEquals(m, cache.getNode(NODE).getData());
+      cache.evict(NODE, false);
       addDelay();
       cache.get(NODE, "X");
-      assertEquals(m, cache.get(NODE).getData());
-      cache.evict(NODE);
+      assertEquals(m, cache.getNode(NODE).getData());
+      cache.evict(NODE, false);
       cache.get(NODE, "X");
       cache.put(NODE, m2);
-      assertEquals("combined", 4, cache.get(NODE).getData().size());
+      assertEquals("combined", 4, cache.getNode(NODE).getData().size());
    }
 
    public void testShallowMove() throws Exception
@@ -277,40 +283,35 @@
    public void testPutRemoveCombos() throws Exception
    {
       final String NODE = "/a/b/c";
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       Fqn fqn = Fqn.fromString(NODE);
       addDelay();
       Map<Object, Object> m = new HashMap<Object, Object>();
       m.put("a", "b");
       m.put("c", "d");
       loader.put(fqn, m);
-      System.out.println("*** MANIK: LOADER " + loader.get(fqn));
       cache.put(NODE, "e", "f");
-      System.out.println("*** MANIK: CACHE " + cache.get(NODE).getData());
-      System.out.println("*** MANIK: LOADER " + loader.get(fqn));
       addDelay();
-      System.out.println("*** MANIK: CACHE " + cache.get(NODE));
       cache.get(NODE, "X");
-      System.out.println("*** MANIK: CACHE " + cache.get(NODE).getData());
-      assertEquals(3, cache.get(NODE).getData().size());
-      cache.evict(fqn);
+      assertEquals(3, cache.getNode(NODE).getData().size());
+      cache.evict(fqn, false);
       cache.get(NODE, "X");
       cache.remove(NODE, "e");
-      assertEquals(2, cache.get(NODE).getData().size());
+      assertEquals(2, cache.getNode(NODE).getData().size());
    }
 
    public void testGet() throws CacheException
    {
       final String NODE = "/a/b/c";
       Object retval;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       addDelay();
       retval = cache.put(NODE, "1", 10);
       assertNull(retval);
       addDelay();
       cache.put(NODE, "2", 20);
-      cache.evict(Fqn.fromString("/a/b/c"));
-      assertTrue("DataNode should not exisit ", !cache.exists("/a/b/c"));
+      cache.evict(Fqn.fromString("/a/b/c"), false);
+      assertNull("DataNode should not exisit ", cache.peek(Fqn.fromString("/a/b/c"), false, false));
       addDelay();
       retval = cache.get(NODE, "1");
       assertEquals(10, retval);
@@ -323,13 +324,13 @@
    {
       final String NODE = "/a/b/c";
       Object retval;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       addDelay();
       cache.put(NODE, "1", 10);
-      cache.evict(Fqn.fromString(NODE));
-      assertTrue("DataNode should not exisit ", !cache.exists("/a/b/c"));
+      cache.evict(Fqn.fromString(NODE), false);
+      assertNull("DataNode should not exisit ", cache.peek(Fqn.fromString("/a/b/c"), false, false));
       addDelay();
-      retval = cache.get(NODE);
+      retval = cache.getNode(NODE);
 
       assertNotNull("Should not be null", retval);
 
@@ -347,8 +348,8 @@
       cache.put("/mypojo", 322649, pojo);
       addDelay();
       assertNotNull(cache.get("/mypojo", 322649));
-      cache.evict(Fqn.fromString("/mypojo"));
-      assertFalse(cache.exists("/mypojo"));
+      cache.evict(Fqn.fromString("/mypojo"), false);
+      assertNull(cache.peek(Fqn.fromString("/mypojo"), false, false));
       SamplePojo pojo2 = (SamplePojo) cache.get("/mypojo", 322649);// should fetch from CacheLoader
       assertNotNull(pojo2);
       assertEquals(39, pojo2.getAge());
@@ -369,7 +370,10 @@
             m.put("key" + i, "val" + i);
          }
          cache.put("/a/b/c", m);
-         cache.load("/1/2/3/4/5");
+
+         // force preload on /1/2/3/4/5
+         cache.getCacheLoaderManager().preload(Fqn.fromString("/1/2/3/4/5"), true, true);
+
          cache.put("/1/2/3/4/5", null);
          cache.put("/1/2/3/4/5/a", null);
          cache.put("/1/2/3/4/5/b", null);
@@ -384,7 +388,7 @@
 
          assertTrue(cache.exists("/1/2/3/4"));
          assertTrue(cache.exists("/a/b/c"));
-         assertFalse(cache.exists("/a/b/c/d"));
+         assert (!exists("/a/b/c/d", null));
       }
       catch (Exception e)
       {
@@ -395,13 +399,13 @@
 
    public void testPreloading() throws CacheException
    {
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
       cache.put("1/2/3/4/5/d", "key", "val");
       cache.evict(Fqn.fromString("1/2/3/4/5/d"));
       System.out.println("-- checking for 1/2/3/4/5/d");
       addDelay();
-      assertFalse(cache.exists("1/2/3/4/5/d"));// exists() doesn't load
-      cache.get("1/2/3/4/5/d");// get *does* load
+      assert (!exists("1/2/3/4/5/d", null));// exists() doesn't load
+      cache.getNode("1/2/3/4/5/d");// get *does* load
       assertTrue(cache.exists("1/2/3/4/5/d"));
       System.out.println("-- 1/2/3/4/5/d exists");
    }
@@ -412,7 +416,7 @@
    {
       Set keys = null;
       cache.put("/a/b/c", "key", "val");
-      keys = cache.getKeys("/a/b/c");
+      keys = cache.getNode("/a/b/c").getKeys();
       assertNotNull(keys);
       assertEquals(1, keys.size());
       keys.add("myKey");
@@ -423,10 +427,10 @@
    {
       cache.put("/eins/zwei/drei", "key1", "val1");
       assertTrue(cache.exists("/eins/zwei/drei"));
-      assertTrue(cache.exists("/eins/zwei/drei", "key1"));
-      assertFalse(cache.exists("/eins/zwei/drei", "key2"));
-      assertFalse(cache.exists("/uno/due/tre"));
-      assertFalse(cache.exists("/une/due/tre", "key1"));
+      assert (exists("/eins/zwei/drei", "key1"));
+      assert (!exists("/eins/zwei/drei", "key2"));
+      assert (!exists("/uno/due/tre", null));
+      assert (!exists("/une/due/tre", "key1"));
    }
 
    public void testGetChildren()
@@ -436,7 +440,7 @@
          cache.put("/1/2/3/4/5/d/one", null);
          cache.put("/1/2/3/4/5/d/two", null);
          cache.put("/1/2/3/4/5/d/three", null);
-         Set children = cache.getChildrenNames("/1/2/3/4/5/d");
+         Set children = cache.getNode("/1/2/3/4/5/d").getChildrenNames();
          assertNotNull(children);
          assertEquals(3, children.size());
          assertTrue(children.contains("one"));
@@ -463,7 +467,7 @@
       cache.evict(Fqn.fromString("/a"));
       cache.evict(Fqn.fromString("/"));
       addDelay();
-      Set children = cache.getChildrenNames("/a/b/c");
+      Set children = cache.getNode("/a/b/c").getChildrenNames();
       assertNotNull(children);
       assertEquals(3, children.size());
       assertTrue(children.contains("1"));
@@ -477,7 +481,7 @@
       {
          cache.put("/1", null);
          cache.put("a", null);
-         Set children = cache.getChildrenNames("/");
+         Set children = cache.getRoot().getChildrenNames();
          assertNotNull(children);
          assertEquals(2, children.size());
          assertTrue(children.contains("1"));
@@ -495,7 +499,7 @@
       {
          cache.put("/1", null);
          cache.put("a", null);
-         Set children = cache.getChildrenNames("");
+         Set children = cache.getRoot().getChildrenNames();
          assertNotNull(children);
          assertEquals(2, children.size());
          assertTrue(children.contains("1"));
@@ -515,7 +519,7 @@
          {
             cache.put("/a/b/c", null);
          }
-         Set children = cache.getChildrenNames((Fqn<String>) null);
+         Set children = cache.getRoot().getChildrenNames();
          assertTrue(children.isEmpty());
       }
       catch (Exception e)
@@ -532,12 +536,11 @@
          cache.put("/a/1", null);
          cache.put("/a/2", null);
          cache.put("/a/3", null);
-         System.out.println("cache is " + cache.printLockInfo());
 
-         Node n = cache.get("/a");
+         Node n = cache.getNode("/a");
          assertNotNull(n);
 
-         Set children = cache.getChildrenNames("/a");
+         Set children = n.getChildrenNames();
          assertNotNull(children);
          assertEquals(3, children.size());
       }
@@ -555,16 +558,14 @@
          cache.put("/a/1", null);
          cache.put("/a/2", null);
          cache.put("/a/3", null);
-         System.out.println("cache is " + cache.printLockInfo());
          cache.evict(Fqn.fromString("/a/1"));
          cache.evict(Fqn.fromString("/a/2"));
          cache.evict(Fqn.fromString("/a/3"));
          cache.evict(Fqn.fromString("/a"));
-         System.out.println("cache is " + cache.printLockInfo());
          addDelay();
-         assertNotNull(cache.get("/a"));
+         assertNotNull(cache.getNode("/a"));
 
-         Set children = cache.getChildrenNames("/a");
+         Set children = cache.getNode("/a").getChildrenNames();
          assertNotNull("No children were loaded", children);
          System.out.println("children: " + children);
          assertEquals("3 children weren't loaded", 3, children.size());
@@ -583,17 +584,15 @@
          cache.put("/a/2", null);
          cache.put("/a/3", null);
          cache.put("/a", "test", "test");
-         System.out.println("cache is " + cache.printLockInfo());
          cache.evict(Fqn.fromString("/a/1"));
          cache.evict(Fqn.fromString("/a/2"));
          cache.evict(Fqn.fromString("/a/3"));
          cache.evict(Fqn.fromString("/a"));
-         System.out.println("cache is " + cache.printLockInfo());
          addDelay();
          Object val = cache.get("/a", "test");
          assertEquals("attributes weren't loaded", "test", val);
 
-         Set children = cache.getChildrenNames("/a");
+         Set children = cache.getNode("/a").getChildrenNames();
          assertNotNull("No children were loaded", children);
          System.out.println("children: " + children);
          assertEquals("3 children weren't loaded", 3, children.size());
@@ -609,17 +608,15 @@
       cache.put("/a/1", null);
       cache.put("/a/2", null);
       cache.put("/a/3", null);
-      System.out.println("cache is " + cache.printLockInfo());
       cache.evict(Fqn.fromString("/a/1"));
       cache.evict(Fqn.fromString("/a/2"));
       cache.evict(Fqn.fromString("/a/3"));
       cache.evict(Fqn.fromString("/a"));
-      System.out.println("cache is " + cache.printLockInfo());
       addDelay();
       assertNull(cache.get("/a", "test"));
 
-      cache.get("/a/1");
-      Set children = cache.getChildrenNames("/a");
+      cache.getNode("/a/1");
+      Set children = cache.getNode("/a").getChildrenNames();
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -632,17 +629,15 @@
          cache.put("/a/1", null);
          cache.put("/a/2", null);
          cache.put("/a/3", null);
-         System.out.println("cache is " + cache.printLockInfo());
          cache.evict(Fqn.fromString("/a/1"));
          cache.evict(Fqn.fromString("/a/2"));
          cache.evict(Fqn.fromString("/a/3"));
          cache.evict(Fqn.fromString("/a"));
-         System.out.println("cache is " + cache.printLockInfo());
          addDelay();
          assertNull(cache.get("/a", "test"));
 
-         cache.get("/a/1");
-         Set children = cache.getChildrenNames("/a");
+         cache.getNode("/a/1");
+         Set children = cache.getNode("/a").getChildrenNames();
          assertNotNull("No children were loaded", children);
          System.out.println("children: " + children);
          assertEquals("3 children weren't loaded", 3, children.size());
@@ -651,12 +646,11 @@
          cache.evict(Fqn.fromString("/a/2"));
          cache.evict(Fqn.fromString("/a/3"));
          cache.evict(Fqn.fromString("/a"));
-         System.out.println("cache is " + cache.printLockInfo());
 
          assertNull(cache.get("/a", "test"));
 
-         cache.get("/a/1");
-         children = cache.getChildrenNames("/a");
+         cache.getNode("/a/1");
+         children = cache.getNode("/a").getChildrenNames();
          assertNotNull("No children were loaded", children);
          System.out.println("children: " + children);
          assertEquals("3 children weren't loaded", 3, children.size());
@@ -675,22 +669,20 @@
          cache.put("/a/1", null);
          cache.put("/a/2", null);
          cache.put("/a/3", null);
-         System.out.println("cache is " + cache.printLockInfo());
          cache.evict(Fqn.fromString("/a/1"));
          cache.evict(Fqn.fromString("/a/2"));
          cache.evict(Fqn.fromString("/a/3"));
          cache.evict(Fqn.fromString("/a"));
-         System.out.println("cache is " + cache.printLockInfo());
          addDelay();
          assertNull(cache.get("/a", "test"));
 
-         cache.get("/a/1");
-         Set children = cache.getChildrenNames("/a");
+         cache.getNode("/a/1");
+         Set children = cache.getNode("/a").getChildrenNames();
          assertNotNull("No children were loaded", children);
          System.out.println("children: " + children);
          assertEquals("3 children weren't loaded", 3, children.size());
 
-         children = cache.getChildrenNames("/a");
+         children = cache.getNode("/a").getChildrenNames();
          assertNotNull("No children were loaded", children);
          System.out.println("children: " + children);
          assertEquals("3 children weren't loaded", 3, children.size());
@@ -722,7 +714,7 @@
          cache.evict(Fqn.fromString("/a/b/3"));
 
          // now load the children - this set childrenLoaded in /a/b to true
-         children = cache.getChildrenNames("/a/b");
+         children = cache.getNode("/a/b").getChildrenNames();
          assertEquals(3, children.size());
 
          cache.evict(Fqn.fromString("/a/b"));
@@ -734,7 +726,7 @@
          cache.evict(Fqn.fromString(("/a/b/3")));
          cache.evict(Fqn.fromString("/a"));
 
-         children = cache.getChildrenNames("/a/b");
+         children = cache.getNode("/a/b").getChildrenNames();
          assertEquals(3, children.size());
       }
       catch (Exception e)
@@ -753,7 +745,7 @@
          cache.put("/a/b/1", "key", "val");
          cache.put("/a/b/2", "key", "val");
          cache.put("/a/b/3", "key", "val");
-         children = cache.getChildrenNames("/a/b");
+         children = cache.getNode("/a/b").getChildrenNames();
          assertEquals(3, children.size());
 
          cache.evict(Fqn.fromString("/a/b/3"));
@@ -763,8 +755,8 @@
          cache.evict(Fqn.fromString("/a"));
 
          // now load the children - this set childrenLoaded in /a/b to true
-         cache.getChildrenNames("/a/b");
-         children = cache.getChildrenNames("/a/b");
+         cache.getNode("/a/b").getChildrenNames();
+         children = cache.getNode("/a/b").getChildrenNames();
          assertEquals(3, children.size());
 
          cache.evict(Fqn.fromString("/a/b/3"));
@@ -772,7 +764,7 @@
          // cache.evict(Fqn.fromString("/a/b/1"));
          cache.evict(Fqn.fromString("/a/b"));
          cache.evict(Fqn.fromString("/a"));
-         children = cache.getChildrenNames("/a/b");
+         children = cache.getNode("/a/b").getChildrenNames();
          assertEquals(3, children.size());
       }
       catch (Exception e)
@@ -821,11 +813,11 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      assertEquals(3, cache.getKeys(key).size());
-      cache.removeData(key);
-      Set keys = cache.getKeys(key);
+      assertEquals(3, cache.getNode(key).getKeys().size());
+      cache.getNode(key).clearData();
+      Set keys = cache.getNode(key).getKeys();
       assertEquals(0, keys.size());
-      cache.remove("/x");
+      cache.removeNode("/x");
       Object val = cache.get(key, "keyA");
       assertNull(val);
    }
@@ -839,12 +831,12 @@
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
       addDelay();
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertEquals(3, keys.size());
-      cache.removeData(key);
+      cache.getNode(key).clearData();
       cache.evict(key);
       addDelay();
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertNotNull(keys);
       assertEquals(0, keys.size());
    }
@@ -856,11 +848,11 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertEquals(3, keys.size());
       cache.evict(key);
-      cache.removeData(key);
-      keys = cache.getKeys(key);
+      cache.getNode(key).clearData();
+      keys = cache.getNode(key).getKeys();
       assertEquals("no more keys", 0, keys.size());
    }
 
@@ -871,7 +863,7 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertEquals(3, keys.size());
       cache.evict(key);
       Map<Object, Object> map = new HashMap<Object, Object>();
@@ -891,7 +883,7 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertEquals(3, keys.size());
       cache.evict(key);
 
@@ -913,14 +905,14 @@
    {
       String key = "/x/y/z/";
       cache.put(key, "keyA", "valA");
-      assertEquals(1, cache.getKeys(key).size());
+      assertEquals(1, cache.getNode(key).getKeys().size());
       cache.put(key, "keyB", "valB");
-      assertEquals(2, cache.getKeys(key).size());
+      assertEquals(2, cache.getNode(key).getKeys().size());
       cache.put(key, "keyC", "valC");
-      assertEquals(3, cache.getKeys(key).size());
+      assertEquals(3, cache.getNode(key).getKeys().size());
       cache.remove(key, "keyA");
-      assertEquals(2, cache.getKeys(key).size());
-      cache.remove("/x");
+      assertEquals(2, cache.getNode(key).getKeys().size());
+      cache.removeNode("/x");
    }
 
 
@@ -929,7 +921,7 @@
       final String NODE = "/test";
       final String KEY = "key";
       Object retval;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       retval = cache.put(NODE, KEY, 10);
       assertNull(retval);
       addDelay();
@@ -945,7 +937,7 @@
       final String NODE = "/test";
       final String KEY = "key";
       Object retval;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       retval = cache.put(NODE, KEY, 10);
       assertNull(retval);
 
@@ -967,25 +959,25 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      cache.remove("/x");
+      cache.removeNode("/x");
       assertNull(cache.get(key, "keyA"));
       addDelay();
-      Set keys = cache.getKeys(key);
+      Set keys = cache.getNode(key).getKeys();
       assertNull("got keys " + keys, keys);
-      cache.remove("/x");
+      cache.removeNode("/x");
    }
 
 
    public void testRemoveRoot()
    {
-      assertEquals(0, cache.getKeys("/").size());
+      assertEquals(0, cache.getRoot().getKeys().size());
       cache.put("/1/2/3/4/5", null);
       cache.put("uno/due/tre", null);
       cache.put("1/2/3/a", null);
       cache.put("/eins/zwei/drei", null);
       cache.put("/one/two/three", null);
-      cache.remove("/");
-      assertEquals(0, cache.getKeys("/").size());
+      cache.removeNode(Fqn.ROOT);
+      assertEquals(0, cache.getRoot().getKeys().size());
    }
 
    public void testLoaderRemoveRoot() throws Exception
@@ -1023,7 +1015,7 @@
       cache.put("/first/second/third", "key1", "val1");// stored in cache loader
       cache.evict(Fqn.fromString("/first/second/third"));// removes node, because there are no children
       addDelay();
-      assertFalse(cache.exists("/first/second/third"));
+      assert (!exists("/first/second/third", null));
       assertTrue(cache.exists("/first/second"));
       assertTrue(cache.exists("/first"));
       String val = (String) cache.get("/first/second/third", "key1");// should be loaded from cache loader
@@ -1049,7 +1041,7 @@
       TransactionManager mgr = getTransactionManager();
 
       mgr.begin();
-      Set children = cache.getChildrenNames("/a");
+      Set children = cache.getNode("/a").getChildrenNames();
 
       System.out.println("**** " + cache.getTransactionManager());
 
@@ -1058,8 +1050,6 @@
       assertTrue(children.contains("2"));
       assertTrue(children.contains("3"));
 
-      System.out.println("lock info " + cache.printLockInfo());
-
       assertEquals(5, cache.getNumberOfLocksHeld());
       mgr.commit();
 
@@ -1074,34 +1064,34 @@
       cache.put("/one/two/three", "key1", "val1");
       cache.put("/one/two/three/four", "key2", "val2");
       mgr.commit();
-      assertNotNull("Cache has node /one/two/three", cache.getKeys("/one/two/three"));
+      assertNotNull("Cache has node /one/two/three", cache.getNode("/one/two/three").getKeys());
       assertNotNull("Loader has node /one/two/three", loader.get(Fqn.fromString("/one/two/three")));
-      Set<?> children = cache.getChildrenNames("/one");
+      Set<?> children = cache.getNode("/one").getChildrenNames();
       assertEquals("Cache has correct number of children", 1, children.size());
       children = loader.getChildrenNames(Fqn.fromString("/one"));
       assertEquals("Loader has correct number of children", 1, children.size());
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
    }
 
    public void testTxPutRollback() throws Exception
    {
       TransactionManager mgr = getTransactionManager();
 
-      cache.remove("/one");
+      cache.removeNode("/one");
       addDelay();
       mgr.begin();
 
       cache.put("/one/two/three", "key1", "val1");
       cache.put("/one/two/three/four", "key2", "val2");
-      log.debug("NODE1 " + cache.get("/one/two/three").getData());
+      log.debug("NODE1 " + cache.getNode("/one/two/three").getData());
       mgr.rollback();
-      log.debug("NODE2 " + cache.get("/one/two/three"));
+      log.debug("NODE2 " + cache.getNode("/one/two/three"));
       assertEquals(null, cache.get("/one/two/three", "key1"));
       assertEquals(null, cache.get("/one/two/three/four", "key2"));
       addDelay();
       assertNull("Loader does not have node /one/two/three", loader.get(Fqn.fromString("/one/two/three")));
-      assertEquals("Cache does not have node /one/two/three", null, cache.getKeys("/one/two/three"));
-      Set<?> children = cache.getChildrenNames("/one");
+      assertEquals("Cache does not have node /one/two/three", null, cache.getNode("/one/two/three").getKeys());
+      Set<?> children = cache.getNode("/one").getChildrenNames();
       assertEquals("Cache has no children under /one", 0, children.size());
       children = loader.getChildrenNames(Fqn.fromString("/one"));
       assertEquals("Loader has no children under /one", null, children);
@@ -1433,14 +1423,14 @@
       loader.put(Fqn.fromString("/key0/abc"), null);
       addDelay();
       checkChildren(Fqn.fromString("/key0"),
-                    new String[]{"a", "ab", "abc"});
+            new String[]{"a", "ab", "abc"});
 
       loader.put(Fqn.fromString("/key0/xxx"), null);
       loader.put(Fqn.fromString("/key0/xx"), null);
       loader.put(Fqn.fromString("/key0/x"), null);
       addDelay();
       checkChildren(Fqn.fromString("/key0"),
-                    new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
 
       loader.put(Fqn.fromString("/key0/a/1"), null);
       loader.put(Fqn.fromString("/key0/a/2"), null);
@@ -1449,7 +1439,7 @@
       checkChildren(Fqn.fromString("/key0/a/2"), new String[]{"1"});
       checkChildren(Fqn.fromString("/key0/a"), new String[]{"1", "2"});
       checkChildren(Fqn.fromString("/key0"),
-                    new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
       //
       //      loader.put(Fqn.fromString("/key0/\u0000"), null);
       //      loader.put(Fqn.fromString("/key0/\u0001"), null);
@@ -1692,13 +1682,11 @@
    /**
     * Checks that a list of modifications was applied.
     */
-   private void checkModifications(List list)
-         throws Exception
+   private void checkModifications(List<Modification> list) throws Exception
    {
 
-      for (int i = 0; i < list.size(); i += 1)
+      for (Modification mod : list)
       {
-         Modification mod = (Modification) list.get(i);
          Fqn fqn = mod.getFqn();
          switch (mod.getType())
          {
@@ -1894,7 +1882,7 @@
          }
          Complex x = (Complex) o;
          return (nested != null) ? nested.equals(x.nested)
-                : (x.nested == null);
+               : (x.nested == null);
       }
 
       public int hashCode()
@@ -1924,9 +1912,9 @@
 
       cache.getTransactionManager().begin();
 
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
-      cache.get(fqn);// forces the node to be loaded from cache loader again
+      cache.getNode(fqn);// forces the node to be loaded from cache loader again
       cache.getTransactionManager().commit();
 
       log.debug("expect the cache and the loader to be null here.");
@@ -1950,8 +1938,8 @@
 
       cache.getTransactionManager().begin();
 
-      cache.remove(fqn);
-      cache.get(fqn);// forces a reload from cloader
+      cache.removeNode(fqn);
+      cache.getNode(fqn);// forces a reload from cloader
       cache.getTransactionManager().rollback();
 
       assertEquals(value, cache.get(fqn, key));
@@ -1976,7 +1964,7 @@
 
       cache.getTransactionManager().begin();
 
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       assertNull("Expecting a null since I have already called a remove() - see JBCACHE-352", cache.get(fqn, key));
       cache.getTransactionManager().rollback();
 
@@ -2105,15 +2093,13 @@
       cache.stop();
       cache.destroy();
 
-      assert cache.getCacheLoader() == null : "Should nullify cache loader in the cache";
       assert cache.getCacheLoaderManager() == null : "Should nullify cache loader manager in the cache";
 
       cache.getConfiguration().getCacheLoaderConfig().getIndividualCacheLoaderConfigs().get(0).setIgnoreModifications(true);
       cache.start();
-      loader = cache.getCacheLoader();
+      loader = cache.getCacheLoaderManager().getCacheLoader();
       postConfigure();
 
-
       // CCL uses it's own mechanisms to ensure read-only behaviour
       if (!(loader instanceof ChainingCacheLoader))
       {
@@ -2121,10 +2107,9 @@
          assert loader instanceof ReadOnlyDelegatingCacheLoader;
       }
 
-
       // old state should be persisted.
       assert "v".equals(loader.get(fqn).get("k"));
-      assert "v".equals(cache.get(fqn, "k"));      
+      assert "v".equals(cache.get(fqn, "k"));
 
       // the loader should now be read-only
       cache.put(fqn, "k", "v2");

Modified: core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderFullTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,7 +6,7 @@
  */
 package org.jboss.cache.loader;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig;
@@ -29,7 +29,7 @@
 @Test(groups = {"functional"})
 public class ChainingCacheLoaderFullTest
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private ChainingCacheLoader chainingCacheLoader;
    private CacheLoader loader1, loader2;
    private Fqn fqn = Fqn.fromString("/a/b");
@@ -39,7 +39,7 @@
 
    protected void startCache(boolean ignoreMods1, boolean ignoreMods2) throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(ignoreMods1, ignoreMods2));
 
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -51,13 +51,15 @@
       loader2 = chainingCacheLoader.getCacheLoaders().get(1);
 
       // we need to make sure we have the raw loaders - not the "ReadOnly.." wrapped versions.
-      while (loader1 instanceof AbstractDelegatingCacheLoader) loader1 = ((AbstractDelegatingCacheLoader) loader1).getCacheLoader();
-      while (loader2 instanceof AbstractDelegatingCacheLoader) loader2 = ((AbstractDelegatingCacheLoader) loader2).getCacheLoader();
+      while (loader1 instanceof AbstractDelegatingCacheLoader)
+         loader1 = ((AbstractDelegatingCacheLoader) loader1).getCacheLoader();
+      while (loader2 instanceof AbstractDelegatingCacheLoader)
+         loader2 = ((AbstractDelegatingCacheLoader) loader2).getCacheLoader();
    }
 
    protected void cleanup() throws Exception
    {
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
       cache.stop();
       cache = null;
    }
@@ -65,25 +67,25 @@
    protected CacheLoaderConfig getCacheLoaderConfig(boolean ignoreMods1, boolean ignoreMods2) throws Exception
    {
       String xml = "<config>\n" +
-                   "<passivation>false</passivation>\n" +
-                   "<preload></preload>\n" +
-                   "<cacheloader>\n" +
-                   "<class>"+ DummyInMemoryCacheLoader.class.getName() +"</class>\n" +
-                   "<properties>" +
-                   "</properties>\n" +
-                   "<async>false</async>\n" +
-                   "<fetchPersistentState>true</fetchPersistentState>\n" +
-                   "<ignoreModifications>" + ignoreMods1 + "</ignoreModifications>\n" +
-                   "</cacheloader>\n" +
-                   "<cacheloader>\n" +
-                   "<class>"+ DummyInMemoryCacheLoader.class.getName() +"</class>\n" +
-                   "<properties>" +
-                   "</properties>\n" +
-                   "<async>false</async>\n" +
-                   "<fetchPersistentState>false</fetchPersistentState>\n" +
-                   "<ignoreModifications>" + ignoreMods2 + "</ignoreModifications>\n" +
-                   "</cacheloader>\n" +
-                   "</config>";
+            "<passivation>false</passivation>\n" +
+            "<preload></preload>\n" +
+            "<cacheloader>\n" +
+            "<class>" + DummyInMemoryCacheLoader.class.getName() + "</class>\n" +
+            "<properties>" +
+            "</properties>\n" +
+            "<async>false</async>\n" +
+            "<fetchPersistentState>true</fetchPersistentState>\n" +
+            "<ignoreModifications>" + ignoreMods1 + "</ignoreModifications>\n" +
+            "</cacheloader>\n" +
+            "<cacheloader>\n" +
+            "<class>" + DummyInMemoryCacheLoader.class.getName() + "</class>\n" +
+            "<properties>" +
+            "</properties>\n" +
+            "<async>false</async>\n" +
+            "<fetchPersistentState>false</fetchPersistentState>\n" +
+            "<ignoreModifications>" + ignoreMods2 + "</ignoreModifications>\n" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
@@ -108,7 +110,7 @@
       assertEquals(value, cache.get(fqn, key));
 
       // remove
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       assertNull(value, cache.get(fqn, key));
       assertNull(value, chainingCacheLoader.get(fqn));
       assertNull(value, loader1.get(fqn));
@@ -131,7 +133,7 @@
       assertEquals(value + 2, chainingCacheLoader.get(fqn).get(key));
       assertEquals(value + 2, cache.get(fqn, key));
 
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
       cache.put(fqn, key, value);
 
       // test that loader2 is NOT checked if loader1 has the value
@@ -142,7 +144,7 @@
       assertEquals(value, chainingCacheLoader.get(fqn).get(key));
       assertEquals(value, cache.get(fqn, key));
 
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
       cache.put(fqn, key, value);
 
       // test that loader2 is checked if loader1 returns a null
@@ -178,7 +180,7 @@
       assertEquals(value, loader2.get(fqn).get(key));
 
       // remove
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       assertEquals(value, chainingCacheLoader.get(fqn).get(key));
       assertNull(loader1.get(fqn));
       assertEquals(value, loader2.get(fqn).get(key));
@@ -217,7 +219,7 @@
 
       // remove - not in a tx, see http://jira.jboss.com/jira/browse/JBCACHE-352
       //        mgr.begin();
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
       //        assertNull(cache.get(fqn, key));
       //        assertEquals(value + 2, chainingCacheLoader.get(fqn).get(key));
@@ -265,7 +267,7 @@
 
       // remove - not in a tx, see http://jira.jboss.com/jira/browse/JBCACHE-352
       //        mgr.begin();
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       //        assertEquals(value, chainingCacheLoader.get(fqn).get(key));
       //        assertEquals(value, loader1.get(fqn).get(key));
       //        assertEquals(value, loader2.get(fqn).get(key));

Modified: core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -9,13 +9,13 @@
 import junit.framework.Assert;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
-import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.TimeoutException;
+import org.jboss.cache.misc.TestingUtil;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -37,7 +37,7 @@
 public class ClusteredCacheLoaderTest extends AbstractCacheLoaderTestBase
 {
    private static Log log = LogFactory.getLog(ClusteredCacheLoaderTest.class);
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
    private CacheLoader loader1, loader2;
    private Fqn<String> fqn = Fqn.fromString("/a");
    private String key = "key";
@@ -49,8 +49,8 @@
    public void setUp() throws Exception
    {
       if (cache1 != null || cache2 != null) tearDown();
-      cache1 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      cache2 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
 
       cache1.getConfiguration().setClusterName("CCL-Test");
       cache1.getConfiguration().setStateRetrievalTimeout(2000);

Modified: core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/InterceptorSynchronizationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,6 +1,14 @@
 package org.jboss.cache.loader;
 
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Modification;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
 
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -11,14 +19,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.testng.annotations.Test;
-
 /**
  * Test case that proves that the CacheImpl is serialized inside the CacheLoaderInterceptor
  * when the node is empty.  ANY call to retrieve a node that is not loaded will lock
@@ -39,8 +39,13 @@
    public void testBlockingProblem() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      cache.setCacheLoader(new TestSlowCacheLoader());
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      //setCacheLoader(new TestSlowCacheLoader());
+      CacheLoaderConfig clc = new CacheLoaderConfig();
+      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
+      iclc.setClassName(TestSlowCacheLoader.class.getName());
+      clc.addIndividualCacheLoaderConfig(iclc);
+      cache.getConfiguration().setCacheLoaderConfig(clc);
       cache.start();
 
       long begin = System.currentTimeMillis();
@@ -101,7 +106,7 @@
          return null;
       }
 
-      public Object get(Fqn arg0, Object arg1) throws Exception
+      public Object get(Fqn arg0, Object arg1)
       {
          return null;
       }
@@ -109,7 +114,7 @@
       public Map<Object, Object> get(Fqn arg0) throws Exception
       {
          Thread.sleep(CACHELOADER_WAITTIME);
-         return Collections.singletonMap((Object)"foo", (Object)"bar");
+         return Collections.singletonMap((Object) "foo", (Object) "bar");
       }
 
       public boolean exists(Fqn arg0) throws Exception
@@ -159,23 +164,6 @@
       {
       }
 
-      /*public byte[] loadEntireState() throws Exception {
-          return null;
-      }
-
-      public void storeEntireState(byte[] arg0) throws Exception {
-
-      }
-
-      public byte[] loadState(Fqn subtree) throws Exception
-      {
-          return new byte[0];
-      }
-
-      public void storeState(byte[] state, Fqn subtree) throws Exception
-      {
-      }*/
-
       public void loadEntireState(ObjectOutputStream os) throws Exception
       {
          // nothing to do here
@@ -222,9 +210,9 @@
    private static class Retriever implements Runnable
    {
       private final String fqn;
-      private CacheImpl<Object, Object> cache;
+      private CacheSPI<Object, Object> cache;
 
-      private Retriever(CacheImpl<Object, Object> cache, String fqn)
+      private Retriever(CacheSPI<Object, Object> cache, String fqn)
       {
          this.fqn = fqn;
          this.cache = cache;

Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderDerbyDSTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,23 +6,18 @@
  */
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-
 import org.apache.derby.jdbc.EmbeddedXADataSource;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.transaction.DummyTransactionManager;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import java.util.Properties;
+
 /**
  * This test runs cache loader tests using Database as the cache loader store.
  * The default test is configured using MySQL.
@@ -37,7 +32,7 @@
  */
 @Test(groups = {"functional"})
 public class JDBCCacheLoaderDerbyDSTest
-        extends CacheLoaderTestsBase
+      extends CacheLoaderTestsBase
 {
    private String old_factory = null;
    private final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
@@ -75,13 +70,12 @@
       ds.setDatabaseName("jbossdb");
       ds.setCreateDatabase("create");
       ds.setUser(prop.getProperty("cache.jdbc.user"));
-      ;
       ds.setPassword(prop.getProperty("cache.jdbc.password"));
 
 
       String props = "cache.jdbc.datasource =" + JNDI_NAME + "\n" +
-              "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type") + "\n" +
-              "cache.jdbc.sql-concat= 1 || 2";
+            "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type") + "\n" +
+            "cache.jdbc.sql-concat= 1 || 2";
 
 
       cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props, false, true, false));

Modified: core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,8 +1,9 @@
 package org.jboss.cache.loader;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.misc.TestingUtil;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
@@ -14,12 +15,12 @@
  */
 public class LocalDelegatingCacheLoaderTest extends CacheLoaderTestsBase
 {
-   CacheImpl delegating_cache;
+   CacheSPI delegating_cache;
 
    @SuppressWarnings("deprecation")
    protected void configureCache() throws Exception
    {
-      delegating_cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      delegating_cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       delegating_cache.create();
       delegating_cache.start();
@@ -29,7 +30,9 @@
 
       // force our own cache loader instance
       LocalDelegatingCacheLoader cacheLoader = new LocalDelegatingCacheLoader(delegating_cache);
-      cache.setCacheLoader(cacheLoader);
+
+      // don't actually alter the interceptor chain, but this will force a re-injection of all deps in all components.
+      TestingUtil.replaceInterceptorChain(cache, cache.getInterceptorChain().get(0));
    }
 
    protected void postConfigure()

Modified: core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,17 +6,17 @@
  */
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.Iterator;
-
 import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.interceptors.CacheStoreInterceptor;
 import org.jboss.cache.interceptors.Interceptor;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
+import java.util.Iterator;
+
 /**
  * See http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3919374#3919374
  *
@@ -24,7 +24,7 @@
  */
 public class SharedCacheLoaderTest extends AbstractCacheLoaderTestBase
 {
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
    private DummyCacheLoader dummyCacheLoader;
 
    @BeforeMethod(alwaysRun = true)
@@ -34,25 +34,25 @@
       if (cache1 != null || cache2 != null) tearDown();
 
       // set up 2 instances of CacheImpl with shared CacheLoaders.
-      cache1 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      cache2 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
 
       cache1.getConfiguration().setCacheMode("REPL_SYNC");
       cache2.getConfiguration().setCacheMode("REPL_SYNC");
 
-      cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCacheLoader.class.getName(), "", false, false, true));
-      cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyCacheLoader.class.getName(), "", false, false, true));
+      cache1.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, true));
+      cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "", false, false, true));
 
       cache1.start();
       cache2.start();
 
       // force setting up the same cache loader class
-      dummyCacheLoader = new DummyCacheLoader();
-
-      cache1.setCacheLoader(dummyCacheLoader);
-      cache2.setCacheLoader(dummyCacheLoader);
-      findCacheStoreInterceptor(cache1).setCache(cache1);
-      findCacheStoreInterceptor(cache2).setCache(cache2);
+//      dummyCacheLoader = new DummyCacheLoader();
+//
+//      cache1.setCacheLoader(dummyCacheLoader);
+//      cache2.setCacheLoader(dummyCacheLoader);
+//      findCacheStoreInterceptor(cache1).setCache(cache1);
+//      findCacheStoreInterceptor(cache2).setCache(cache2);
    }
 
    protected CacheStoreInterceptor findCacheStoreInterceptor(CacheImpl cache)
@@ -80,7 +80,7 @@
       cache2 = null;
    }
 
-   public void testReplicationWithSharedCL() throws Exception
+   public void testReplicationWithSharedCL()
    {
       cache1.put("/test", "one", "two");
 

Modified: core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SingletonStoreCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -8,7 +8,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -31,6 +30,7 @@
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+
 /**
  * Unit test class for SingletonStoreCacheLoader
  *
@@ -46,9 +46,9 @@
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache1 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
-      cache2 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
-      cache3 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+      cache3 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
    }
 
    public void testPutCacheLoaderWithNoPush() throws Exception
@@ -244,14 +244,14 @@
 
    }
 
-   private void createCaches() throws Exception
+   private void createCaches()
    {
       cache1.create();
       cache2.create();
       cache3.create();
    }
 
-   private void statCaches() throws Exception
+   private void statCaches()
    {
       cache1.start();
       cache2.start();
@@ -276,20 +276,20 @@
                                                                   int pushStateWhenCoordinatorTimeout) throws Exception
    {
       String xml = "<config>\n" +
-              "<passivation>false</passivation>\n" +
-              "<preload></preload>\n" +
-              "<cacheloader>\n" +
-              "  <class>" + cacheloaderClass + "</class>\n" +
-              "  <properties></properties>\n" +
-              "  <singletonStore>" +
-              "     <enabled>true</enabled>" +
-              "     <properties>" +
-              "        pushStateWhenCoordinator = true\n" +
-              "        pushStateWhenCoordinatorTimeout = 5000\n" +
-              "     </properties>" +
-              "  </singletonStore>" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<passivation>false</passivation>\n" +
+            "<preload></preload>\n" +
+            "<cacheloader>\n" +
+            "  <class>" + cacheloaderClass + "</class>\n" +
+            "  <properties></properties>\n" +
+            "  <singletonStore>" +
+            "     <enabled>true</enabled>" +
+            "     <properties>" +
+            "        pushStateWhenCoordinator = true\n" +
+            "        pushStateWhenCoordinatorTimeout = 5000\n" +
+            "     </properties>" +
+            "  </singletonStore>" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
@@ -297,13 +297,13 @@
    private void initSingletonNonPushCache(CacheSPI cache) throws Exception
    {
       cache.getConfiguration().setCacheLoaderConfig(getSingletonStoreCacheLoaderConfig(
-              DummyInMemoryCacheLoader.class.getName(), true, false, 1000));
+            DummyInMemoryCacheLoader.class.getName(), true, false, 1000));
    }
 
    private void initSingletonWithPushCache(CacheSPI cache) throws Exception
    {
       cache.getConfiguration().setCacheLoaderConfig(getSingletonStoreCacheLoaderConfig(
-              DummyInMemoryCacheLoader.class.getName(), true, true, 1000));
+            DummyInMemoryCacheLoader.class.getName(), true, true, 1000));
    }
 
    private CacheLoader getDelegatingCacheLoader(CacheSPI cache)

Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,29 +1,23 @@
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.UnknownHostException;
-
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.jmx.CacheJmxWrapper;
 import org.jboss.cache.loader.tcp.TcpCacheServer;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
+
+import java.net.UnknownHostException;
+
 /**
  * Tests various ways of setting up the TcpCacheServer
  *
@@ -37,7 +31,7 @@
 
    static TcpCacheServer cache_server = null;
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private CacheLoader loader;
 
    static
@@ -55,13 +49,13 @@
       });
    }
 
-   private void createCacheAndLoader() throws Exception, ConfigurationException, CacheException
+   private void createCacheAndLoader() throws Exception
    {
       Configuration c = new Configuration();
       c.setCacheMode(Configuration.CacheMode.LOCAL);
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       c.setCacheLoaderConfig(getCacheLoaderConfig());
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
 
       cache.start();
       loader = cache.getCacheLoaderManager().getCacheLoader();
@@ -70,17 +64,17 @@
    protected CacheLoaderConfig getCacheLoaderConfig() throws Exception
    {
       String xml = "<config>\n" +
-                   "<passivation>false</passivation>\n" +
-                   "<preload></preload>\n" +
-                   "<cacheloader>\n" +
-                   "<class>org.jboss.cache.loader.TcpDelegatingCacheLoader</class>\n" +
-                   "<properties>host=127.0.0.1\nport=12121</properties>\n" +
-                   "<async>false</async>\n" +
-                   "<shared>true</shared>\n" +
-                   "<fetchPersistentState>true</fetchPersistentState>\n" +
-                   "<purgeOnStartup>false</purgeOnStartup>\n" +
-                   "</cacheloader>\n" +
-                   "</config>";
+            "<passivation>false</passivation>\n" +
+            "<preload></preload>\n" +
+            "<cacheloader>\n" +
+            "<class>org.jboss.cache.loader.TcpDelegatingCacheLoader</class>\n" +
+            "<properties>host=127.0.0.1\nport=12121</properties>\n" +
+            "<async>false</async>\n" +
+            "<shared>true</shared>\n" +
+            "<fetchPersistentState>true</fetchPersistentState>\n" +
+            "<purgeOnStartup>false</purgeOnStartup>\n" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,30 +1,21 @@
 package org.jboss.cache.loader;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.File;
-import java.util.Set;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.TransactionSetup;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.Set;
+
 /**
  * @author Bela Ban
  * @version $Id$
@@ -32,14 +23,14 @@
 @Test(groups = {"functional", "transaction"})
 public class TxCacheLoaderTest extends AbstractCacheLoaderTestBase
 {
-   CacheImpl<Object, Object> cache1, cache2;
+   CacheSPI<Object, Object> cache1, cache2;
    private Fqn<String> fqn = Fqn.fromString("/one/two/three");
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
 
-      cache1 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache1.getConfiguration().setCacheMode("repl_sync");
       cache1.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
 
@@ -48,7 +39,7 @@
       cache1.create();
       cache1.start();
 
-      cache2 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache2.getConfiguration().setCacheMode("repl_sync");
       cache2.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       cache2.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false));
@@ -62,7 +53,7 @@
    public void tearDown() throws Exception
    {
       // clean up cache loaders!!
-      cache1.remove(Fqn.ROOT);
+      cache1.removeNode(Fqn.ROOT);
 
       cache1.stop();
       cache1.destroy();
@@ -71,7 +62,7 @@
    }
 
 
-   public void testTxPutCommit() throws Exception, NotSupportedException
+   public void testTxPutCommit() throws Exception
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
@@ -82,8 +73,8 @@
       assertNull(cache2.get(fqn, "key1"));
       assertNull(cache2.get("/one/two/three/four", "key2"));
       mgr.commit();
-      assertNotNull(cache1.getKeys(fqn));
-      Set<?> children = cache1.getChildrenNames("/one");
+      assertNotNull(cache1.getNode(fqn).getKeys());
+      Set<?> children = cache1.getNode("/one").getChildrenNames();
       assertEquals(1, children.size());
       TestingUtil.sleepThread(2000);
       assertEquals("val1", cache2.get(fqn, "key1"));
@@ -91,7 +82,7 @@
    }
 
 
-   public void testTxPrepareAndRollback() throws Exception, NotSupportedException
+   public void testTxPrepareAndRollback() throws Exception
    {
       final TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
@@ -157,7 +148,7 @@
    }
 
 
-   public void testPutAfterTxCommit() throws Exception, NotSupportedException
+   public void testPutAfterTxCommit() throws Exception
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
@@ -170,7 +161,7 @@
       assertTrue(cache1.exists("/a/b/c"));
    }
 
-   public void testPutAfterTxRollback() throws Exception, NotSupportedException
+   public void testPutAfterTxRollback() throws Exception
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
@@ -178,7 +169,7 @@
       cache1.put(fqn, "key1", "val1");
       assertTrue(cache1.exists(fqn));
       mgr.rollback();
-      assertFalse(cache1.getCacheLoader().exists(fqn));
+      assertFalse(cache1.getCacheLoaderManager().getCacheLoader().exists(fqn));
       assertFalse(cache1.exists(fqn));
       cache1.put("/a/b/c", null);// should be run outside a TX !
       assertTrue(cache1.exists("/a/b/c"));

Modified: core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/UnnecessaryLoadingTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,31 +1,24 @@
 package org.jboss.cache.loader;
 
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
 import org.easymock.EasyMock;
+import static org.easymock.EasyMock.*;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.factories.InterceptorChainFactory;
-import org.jboss.cache.interceptors.Interceptor;
+import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * //TODO: MANIK: Javadoc this class
  *
@@ -55,7 +48,7 @@
 
       cache.getCacheLoaderManager().setCacheLoader(mockCacheLoader);
       // re-set the cache so that the mock CL is registered with the inerceptors.
-      InterceptorChainFactory.getInstance().initialiseInterceptors((Interceptor) cache.getInterceptorChain().get(0), cache);
+      InterceptorChainFactory.getInstance().correctInterceptorChaining(cache.getInterceptorChain(), cache.getConfiguration(), TestingUtil.extractComponentRegistry(cache));
 
       // lifecycle stuff
       mockCacheLoader.stop();
@@ -169,7 +162,7 @@
       // expecting a put on child
       mockCacheLoader.put(eq(child), eq(m));
       expect(mockCacheLoader.get(eq(child))).andReturn(null);
-      expect((Set<String>)mockCacheLoader.getChildrenNames(eq(parent))).andReturn(Collections.singleton(child.getLastElementAsString()));
+      expect((Set<String>) mockCacheLoader.getChildrenNames(eq(parent))).andReturn(Collections.singleton(child.getLastElementAsString()));
       replay(mockCacheLoader);
 
       cache.put(child, m);
@@ -253,7 +246,7 @@
       expect(mockCacheLoader.get(eq(parent))).andReturn(null);
       expect(mockCacheLoader.exists(eq(parent))).andReturn(true);
       mockCacheLoader.removeData(eq(parent));
-      mockCacheLoader.put(eq(parent), eq(Collections.singletonMap((Object)"hello", (Object)"world")));
+      mockCacheLoader.put(eq(parent), eq(Collections.singletonMap((Object) "hello", (Object) "world")));
       replay(mockCacheLoader);
 
       cache.put(parent, k, v);
@@ -271,7 +264,7 @@
       // will trigger a put() though
       // for the moment this does a get as well - which while unnecessary is the best we can do for now until we bring in
       // an AOP framework to work on nodes directly.
-      n.replaceAll(Collections.singletonMap((Object)"hello", (Object)"world"));
+      n.replaceAll(Collections.singletonMap((Object) "hello", (Object) "world"));
 
       assertDataLoaded(parent);
       verify(mockCacheLoader);
@@ -282,7 +275,7 @@
       expect(mockCacheLoader.put(eq(parent), eq(k), eq(v))).andReturn(null);
       expect(mockCacheLoader.get(eq(parent))).andReturn(null);
       expect(mockCacheLoader.exists(eq(parent))).andReturn(true);
-      expect(mockCacheLoader.get(eq(parent))).andReturn(Collections.singletonMap((Object)k, (Object)v));
+      expect(mockCacheLoader.get(eq(parent))).andReturn(Collections.singletonMap((Object) k, (Object) v));
       replay(mockCacheLoader);
 
       cache.put(parent, k, v);
@@ -312,7 +305,7 @@
       expect(mockCacheLoader.get(eq(parent))).andReturn(null);
       expect(mockCacheLoader.put(eq(parent), eq(k), eq(v))).andReturn(null);
       mockCacheLoader.put(eq(parent), eq(m));
-      expect(mockCacheLoader.get(eq(parent))).andReturn(Collections.singletonMap((Object)k, (Object)v));
+      expect(mockCacheLoader.get(eq(parent))).andReturn(Collections.singletonMap((Object) k, (Object) v));
       replay(mockCacheLoader);
       cache.put(parent, k, v);
       assertDataLoaded(parent);

Modified: core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,6 +1,6 @@
 package org.jboss.cache.loader.deadlock;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -62,7 +62,8 @@
  * CacheLoader/StoreInterceptor's...</li>
  * </ul>
  */
- at Test (groups = {"functional"}, enabled = false) // Disabling since this has issues with ReadWriteWithUpgradeLock.  See JBCACHE-461
+ at Test(groups = {"functional"}, enabled = false)
+// Disabling since this has issues with ReadWriteWithUpgradeLock.  See JBCACHE-461
 public class ConcurrentCreationDeadlockTest extends AbstractCacheLoaderTestBase
 {
    /**
@@ -100,13 +101,13 @@
    /**
     * The cache under test.
     */
-   private CacheImpl<Object, Object> cache = null;
+   private CacheSPI<Object, Object> cache = null;
 
    static
    {
       PROPERTIES = new Properties();
       PROPERTIES.put(Context.INITIAL_CONTEXT_FACTORY,
-                     "org.jboss.cache.transaction.DummyContextFactory");
+            "org.jboss.cache.transaction.DummyContextFactory");
    }
 
    /**
@@ -118,10 +119,10 @@
       mcl_exception = null;
       m_contextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
       System.setProperty(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+
       Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      cache.setConfiguration(c);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c, false);
    }
 
    /**
@@ -136,7 +137,7 @@
       if (m_contextFactory != null)
       {
          System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
-                            m_contextFactory);
+               m_contextFactory);
          m_contextFactory = null;
       }
    }
@@ -346,7 +347,7 @@
          for (int j = 0; j < t.length; j++)
          {
             t[j] = new Worker(latch, NUM_FQNS_PER_RUN * i,
-                              NUM_FQNS_PER_RUN, modificationsPerTx);
+                  NUM_FQNS_PER_RUN, modificationsPerTx);
             t[j].start();
          }
          // fire the workers to start processing
@@ -379,7 +380,7 @@
    private void log(String msg)
    {
       System.out.println(System.currentTimeMillis() + " "
-                         + Thread.currentThread() + " " + msg);
+            + Thread.currentThread() + " " + msg);
    }
 
    /**

Modified: core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/lock/AcquireAllTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,12 +1,11 @@
 package org.jboss.cache.lock;
 
-import static org.testng.AssertJUnit.assertEquals;
-
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
@@ -83,7 +82,7 @@
    }
 
 
-   private CacheImpl createCache(Configuration.CacheMode mode, IsolationLevel level) throws Exception
+   private CacheImpl createCache(Configuration.CacheMode mode, IsolationLevel level)
    {
       CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
       c.getConfiguration().setCacheMode(mode);

Modified: core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -22,45 +22,45 @@
 
 package org.jboss.cache.lock;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Tests the breaking of locks held by dead members.
  *
  * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  * @version $Revision$
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class BreakDeadMemberLocksTest
 {
-   private Map<String, CacheImpl<Object, Object>> caches;
+   private Map<String, CacheSPI<Object, Object>> caches;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      caches = new HashMap<String, CacheImpl<Object, Object>>();
+      caches = new HashMap<String, CacheSPI<Object, Object>>();
    }
 
    public void testBreakDeadMemberLocks() throws Exception
    {
-      CacheImpl<Object, Object> cacheA = createCache("A");
+      CacheSPI<Object, Object> cacheA = createCache("A");
 
       cacheA.put("/1/A", "1", "A");
       cacheA.put("/1/A", "2", "A");
@@ -69,10 +69,10 @@
       cacheA.put("/1/A/I", "1", "A");
       cacheA.put("/1/A/I", "2", "A");
 
-      CacheImpl<Object, Object> cacheB = createCache("B");
+      CacheSPI<Object, Object> cacheB = createCache("B");
 
       // Pause to give caches time to see each other
-      TestingUtil.blockUntilViewsReceived(new CacheImpl[]{cacheA, cacheB}, 60000);
+      TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cacheA, cacheB}, 60000);
 
       final TransactionManager tm = cacheB.getTransactionManager();
       tm.begin();
@@ -99,7 +99,9 @@
                tm.resume(tx);
                tm.commit();
             }
-            catch (Exception e) {}
+            catch (Exception e)
+            {
+            }
          }
       };
 
@@ -116,7 +118,7 @@
       tm.suspend();
 
       // Confirm that B's tx replicated
-      assertTrue(cacheA.exists("/EXISTS"));
+      assertTrue(cacheA.peek(Fqn.fromString("/EXISTS"), false, false) != null);
 
       cacheB.stop();
       cacheB.destroy();
@@ -127,7 +129,9 @@
          {
             Thread.sleep(100);
          }
-         catch (InterruptedException e) {}
+         catch (InterruptedException e)
+         {
+         }
       }
 
       assertEquals("A", cacheA.get("/1/A", "1"));
@@ -143,15 +147,14 @@
       }
    }
 
-   protected CacheImpl<Object, Object> createCache(String cacheID) throws Exception
+   protected CacheSPI<Object, Object> createCache(String cacheID) throws Exception
    {
       if (caches.get(cacheID) != null)
       {
          throw new IllegalStateException(cacheID + " already created");
       }
 
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      cache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
 
       cache.create();
       cache.start();
@@ -214,7 +217,9 @@
          {
             Thread.sleep(30000);
          }
-         catch (InterruptedException e) {}
+         catch (InterruptedException e)
+         {
+         }
       }
 
 

Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -8,21 +8,19 @@
 
 package org.jboss.cache.lock;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.Set;
-
-import javax.transaction.UserTransaction;
-
 import org.apache.commons.logging.Log;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.transaction.TransactionSetup;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.UserTransaction;
+import java.util.Set;
+
 /**
  * Verifies that there are no read locks held when a transaction ends.
  *
@@ -32,7 +30,7 @@
 @Test(groups = {"functional"})
 public class LockReleaseTest
 {
-   CacheImpl<Object, Object> cache = null;
+   CacheSPI<Object, Object> cache = null;
    UserTransaction tx = null;
    Log log;
    final Fqn<String> NODE1 = Fqn.fromString("/test");
@@ -71,9 +69,9 @@
       }
    }
 
-   CacheImpl<Object, Object> createCache(IsolationLevel level) throws Exception
+   CacheSPI<Object, Object> createCache(IsolationLevel level) throws Exception
    {
-      CacheImpl<Object, Object> c = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       c.getConfiguration().setClusterName("test");
       c.getConfiguration().setStateRetrievalTimeout(10000);
       c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
@@ -137,14 +135,14 @@
       cache.put(NODE2, KEY, VAL1);
       assertEquals("we ran outside of a TX, locks should have been released: ", 0, cache.getNumberOfLocksHeld());
 
-      Set<Object> keys = cache.getKeys(NODE1);
+      Set<Object> keys = cache.getNode(NODE1).getKeys();
       System.out.println("keys of " + NODE1 + " are " + keys);
       assertEquals("getKeys() called outside the TX should have released all locks", 0, cache.getNumberOfLocksHeld());
 
       tx.begin();
-      keys = cache.getKeys(NODE1);
+      keys = cache.getNode(NODE1).getKeys();
       assertEquals("we should hold 1 read locks now: ", 2, cache.getNumberOfLocksHeld());
-      keys = cache.getKeys(NODE2);
+      keys = cache.getNode(NODE2).getKeys();
       assertEquals("we should hold 3 read locks now: ", 4, cache.getNumberOfLocksHeld());
       tx.commit();
       assertEquals("we should have released all 3 read locks: ", 0, cache.getNumberOfLocksHeld());
@@ -159,15 +157,15 @@
       cache.put(NODE2, KEY, VAL1);
       assertEquals("we ran outside of a TX, locks should have been released: ", 0, cache.getNumberOfLocksHeld());
 
-      Set<String> keys = cache.getChildrenNames(NODE2);
+      Set<String> keys = cache.getNode(NODE2).getChildrenNames();
       System.out.println("keys of " + NODE2 + " are " + keys);
       assertEquals("getChildrenNames() called outside the TX should have released all locks", 0,
-                   cache.getNumberOfLocksHeld());
+            cache.getNumberOfLocksHeld());
 
       tx.begin();
-      keys = cache.getChildrenNames(NODE1);
+      keys = cache.getNode(NODE1).getChildrenNames();
       assertEquals("we should hold 1 read locks now: ", 2, cache.getNumberOfLocksHeld());
-      keys = cache.getChildrenNames(NODE2);
+      keys = cache.getNode(NODE2).getChildrenNames();
       assertEquals("we should hold 3 read locks now: ", 4, cache.getNumberOfLocksHeld());
       tx.commit();
       assertEquals("we should have released all 3 read locks: ", 0, cache.getNumberOfLocksHeld());
@@ -181,13 +179,13 @@
       cache.put(NODE2, KEY, VAL1);
       assertEquals("we ran outside of a TX, locks should have been released: ", 0, cache.getNumberOfLocksHeld());
 
-      cache.print(NODE1);
+      System.out.println(cache.getNode(NODE1));
       assertEquals("print() called outside the TX should have released all locks", 0, cache.getNumberOfLocksHeld());
 
       tx.begin();
-      cache.print(NODE1);
+      System.out.println(cache.getNode(NODE1));
       assertEquals("we should hold 1 read locks now (for print()): ", 2, cache.getNumberOfLocksHeld());
-      cache.print(NODE2);
+      System.out.println(cache.getNode(NODE2));
       assertEquals("we should hold 3 read locks now (for print()): ", 4, cache.getNumberOfLocksHeld());
       tx.commit();
       assertEquals("we should have released all 3 read locks: ", 0, cache.getNumberOfLocksHeld());

Modified: core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,24 +6,22 @@
  */
 package org.jboss.cache.lock;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
 /**
  * Tests ReentrantWriterPreferenceReadWriteLock
  *
  * @author Bela Ban
  * @version $Id$
  */
- at Test(groups = { "functional" }, enabled = false) // historical disabled - and wont fix.  See JBCACHE-461
+ at Test(groups = {"functional"}, enabled = false)
+// historical disabled - and wont fix.  See JBCACHE-461
 public class ReentrantWriterPreference2Readers1WriterLockTest
 {
    ReentrantReadWriteLock lock;
@@ -48,7 +46,7 @@
    private void log(String msg)
    {
       System.out.println(System.currentTimeMillis() + "  " + Thread.currentThread() +
-                         " [" + Thread.currentThread().getName() + "]: " + msg);
+            " [" + Thread.currentThread().getName() + "]: " + msg);
    }
 
 
@@ -134,7 +132,7 @@
 
       upgrader.join(3000);
       assertTrue("Known failure. See JBCACHE-461; This is due to a potential bug in ReentrantWriterPreferenceReadWriteLock !",
-                 upgrader.wasUpgradeSuccessful());
+            upgrader.wasUpgradeSuccessful());
    }
 
 
@@ -213,7 +211,6 @@
          }
          catch (InterruptedException e)
          {
-            ;
          }
          finally
          {

Modified: core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,24 +1,21 @@
 package org.jboss.cache.lock;
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+
 /**
  * Tests ReentrantWriterPreferenceReadWriteLock
  *
  * @author Bela Ban
  * @version $Id$
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public class ReentrantWriterPreferenceReadWriteLockTest
 {
    // ReentrantWriterPreferenceReadWriteLock lock;
@@ -219,7 +216,7 @@
    private static void log(String msg)
    {
       System.out.println(System.currentTimeMillis() + "  " + Thread.currentThread() +
-                         " [" + Thread.currentThread().getName() + "]: " + msg);
+            " [" + Thread.currentThread().getName() + "]: " + msg);
    }
 
    class Reader extends Thread
@@ -247,7 +244,6 @@
          }
          catch (InterruptedException e)
          {
-            ;
          }
       }
    }
@@ -278,7 +274,6 @@
          }
          catch (InterruptedException e)
          {
-            ;
          }
       }
    }
@@ -321,7 +316,6 @@
          }
          catch (InterruptedException e)
          {
-            ;
          }
       }
    }

Modified: core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/lock/UpgradeLockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -8,30 +8,29 @@
 
 package org.jboss.cache.lock;
 
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.transaction.DummyTransactionManager;
 import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
-import java.util.Properties;
-
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.transaction.UserTransaction;
+import java.util.Properties;
 
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 /**
  * Tests upgrade locks from read -> write
  *
  * @author Bela Ban
  * @version $Id$
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public class UpgradeLockTest
 {
-   CacheImpl<Object, Object> cache = null;
+   CacheSPI<Object, Object> cache = null;
    UserTransaction tx = null;
    Properties p = null;
    String old_factory = null;
@@ -85,9 +84,9 @@
       }
    }
 
-   private CacheImpl<Object, Object> createCache(IsolationLevel level) throws Exception
+   private CacheSPI<Object, Object> createCache(IsolationLevel level)
    {
-      CacheImpl<Object, Object> c = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       c.getConfiguration().setClusterName("test");
       c.getConfiguration().setStateRetrievalTimeout(10000);
       c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.JBossTransactionManagerLookup");

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,23 +7,20 @@
 
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.lang.reflect.Method;
-
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
 import org.jboss.cache.Version;
+import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Method;
+
 /**
  * Tests the "activate/deactivate" functionality of LegacyTreeCacheMarshaller.
  *
@@ -46,7 +43,7 @@
       c.getConfiguration().setUseRegionBasedMarshalling(true);
       c.getConfiguration().setFetchInMemoryState(false);
       c.start();
-      rman = c.getRegionManager();
+      rman = TestingUtil.extractComponentRegistry(c).getComponent(RegionManager.class);
    }
 
    @AfterMethod(alwaysRun = true)
@@ -64,11 +61,11 @@
 
       rman.deactivate(A);
       assertFalse("Root is not active after inactivating subtree",
-                  rman.isInactive(Fqn.ROOT));
+            rman.isInactive(Fqn.ROOT));
 
       rman.activate(A);
       assertFalse("Root is not active after activating subtree",
-                  rman.isInactive(Fqn.ROOT));
+            rman.isInactive(Fqn.ROOT));
 
       rman.activate(A_B);
 
@@ -84,11 +81,11 @@
 
       rman.activate(A);
       assertTrue("Root is not inactive after activating subtree",
-                 rman.isInactive(Fqn.ROOT));
+            rman.isInactive(Fqn.ROOT));
 
       rman.deactivate(A);
       assertTrue("Root is not inactive after inactivating subtree",
-                 rman.isInactive(Fqn.ROOT));
+            rman.isInactive(Fqn.ROOT));
 
       rman.deactivate(A_B);
 
@@ -101,26 +98,26 @@
       rman.setDefaultInactive(false);
       rman.activate(A);
       assertFalse("/a is not active after activating",
-                  rman.isInactive(A));
+            rman.isInactive(A));
 
       rman.deactivate(A);
       rman.activate(A);
       assertFalse("/a is not active after reactivating",
-                  rman.isInactive(A));
+            rman.isInactive(A));
 
       rman.reset();
       rman.setDefaultInactive(true);
 
       rman.activate(I);
       assertFalse("/i is not active after activating",
-                  rman.isInactive(I));
+            rman.isInactive(I));
       assertFalse("/i/k is not active after activating /i",
-                  rman.isInactive(Fqn.fromString("/i/k")));
+            rman.isInactive(Fqn.fromString("/i/k")));
 
       rman.deactivate(I);
       rman.activate(I);
       assertFalse("/i is not active after reactivating",
-                  rman.isInactive(I));
+            rman.isInactive(I));
    }
 
    public void testInactivate() throws Exception
@@ -129,32 +126,32 @@
 
       rman.deactivate(I);
       assertTrue("/i is not inactive after inactivating",
-                 rman.isInactive(I));
+            rman.isInactive(I));
 
       rman.activate(I);
       rman.deactivate(I);
       assertTrue("/i is not inactive after re-inactivating",
-                 rman.isInactive(I));
+            rman.isInactive(I));
 
       rman.reset();
       rman.setDefaultInactive(false);
 
       rman.deactivate(A);
       assertTrue("/a is not inactive after inactivating",
-                 rman.isInactive(A));
+            rman.isInactive(A));
       assertTrue("/a/b is not inactive after inactivating /a",
-                 rman.isInactive(A_B));
+            rman.isInactive(A_B));
 
       rman.activate(A);
       rman.deactivate(A);
       assertTrue("/a is not inactive after re-inactivating",
-                 rman.isInactive(A));
+            rman.isInactive(A));
    }
 
    public void testObjectFromByteBuffer() throws Exception
    {
       MethodCall put = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
-                                                null, A_B, "name", "Joe", false);
+            A_B, "name", "Joe", false);
 
       MethodCall replicate = MethodCallFactory.create(MethodDeclarations.replicateMethod, put);
 
@@ -182,7 +179,7 @@
       MethodCall result = (MethodCall) testee.objectFromByteBuffer(callBytes);
       Method method = result.getMethod();
       assertEquals("Did not get replicate method when passing" +
-                   " call for active node", MethodDeclarations.replicateMethod, method);
+            " call for active node", MethodDeclarations.replicateMethod, method);
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -9,20 +9,6 @@
 package org.jboss.cache.marshall;
 
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.lang.reflect.Method;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -32,9 +18,20 @@
 import org.jboss.cache.marshall.data.Address;
 import org.jboss.cache.marshall.data.Person;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.lang.reflect.Method;
+
 /**
  * Test marshalling for async mode.
  *
@@ -71,7 +68,7 @@
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
    }
 
-   private CacheSPI<Object, Object> createCache(String name) throws Exception
+   private CacheSPI<Object, Object> createCache(String name)
    {
       CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
       cache.getConfiguration().setClusterName(name);

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -61,16 +61,15 @@
     * region based marshalling is used, and it is expected that we would need to marshall the response using the same
     * region as well.  To deal with this, the region (as an Fqn) is read off the stream when unmarshalling and then
     * stored in a ThreadLocal so it can be accessed for when the response needs to be marshalled again.
-    *
+    * <p/>
     * The problem here - registered as JBCACHE-1170 - is that this has a tendency to leak scope and affect more than the
     * required method call.
-    *
     */
    public void testLeakageOfFqn() throws Throwable
    {
       // Use a thread pool so that we know threads will be reused.
       // You don't need any concurrency here to demonstrate the failure - a single thread is enough.
-      ExecutorService e  = Executors.newFixedThreadPool(1);
+      ExecutorService e = Executors.newFixedThreadPool(1);
       // to capture throwables
       final List<Throwable> throwables = new CopyOnWriteArrayList<Throwable>();
 
@@ -87,14 +86,14 @@
       final Fqn region = Fqn.fromString("/hello");
       Region r = rm.getRegion(region, true);
       r.registerContextClassLoader(this.getClass().getClassLoader());
-      cm200.objectToObjectStream(MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, null, null), oos, region);
+      cm200.objectToObjectStream(MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, null), oos, region);
       oos.close();
 
       final byte[] stream = baos.toByteArray();
       // so now the stream starts with the Fqn "/hello".
 
       // repeat 100 times
-      for (int i=0; i<100; i++)
+      for (int i = 0; i < 100; i++)
       {
          if (i % 3 == 0)
          {
@@ -185,7 +184,7 @@
 
       e.shutdown();
       e.awaitTermination(60, TimeUnit.SECONDS);
-      
+
       for (Throwable t : throwables)
       {
          t.printStackTrace();

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -99,7 +99,7 @@
 
    public void testStringBasedFqn() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(new Object[]{"JSESSIONID", "1010.10.5:3000", "1234567890", "1"});
+      Fqn fqn = new Fqn<Object>("JSESSIONID", "1010.10.5:3000", "1234567890", "1");
       byte[] asBytes = marshaller.objectToByteBuffer(fqn);
       System.out.println("Marshalled to " + asBytes.length + " bytes");
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
@@ -108,7 +108,7 @@
 
    public void testNonStringBasedFqn() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(new Object[]{3, false});
+      Fqn fqn = new Fqn<Object>(3, false);
       byte[] asBytes = marshaller.objectToByteBuffer(fqn);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
       assertEquals(fqn, o2);
@@ -116,8 +116,8 @@
 
    public void testMethodCall() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(new Object[]{3, false});
-      MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, fqn, "key", "value", true);
+      Fqn fqn = new Fqn<Object>(3, false);
+      MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn, "key", "value", true);
       byte[] asBytes = marshaller.objectToByteBuffer(call);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
 
@@ -129,8 +129,8 @@
 
    public void testNestedMethodCall() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(new Object[]{3, false});
-      MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, fqn, "key", "value", true);
+      Fqn fqn = new Fqn<Object>(3, false);
+      MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn, "key", "value", true);
       MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, call);
       byte[] asBytes = marshaller.objectToByteBuffer(replicateCall);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
@@ -216,15 +216,15 @@
       // replication queue takes a list of replicate() MethodCalls and wraps them in a single replicate call.
       List<MethodCall> calls = new ArrayList<MethodCall>();
 
-      Fqn f = new Fqn<Object>(new Object[]{"BlahBlah", 3, false});
+      Fqn f = new Fqn<Object>("BlahBlah", 3, false);
       String k = "key", v = "value";
 
-      MethodCall actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, f, k, v, true);
+      MethodCall actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, f, k, v, true);
       MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, actualCall);
 
       calls.add(replicateCall);
 
-      actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, f, k, v, true);
+      actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, f, k, v, true);
       replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, actualCall);
 
       calls.add(replicateCall);

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CustomCollectionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,27 +1,20 @@
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNotSame;
-import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Unit test to cover replication and marshalling of custom collections
  *
@@ -31,8 +24,8 @@
 @Test(groups = {"functional"})
 public class CustomCollectionTest
 {
-   private Cache<Object, Object> cache1 =null;
-   private Cache<Object, Object> cache2 =null;
+   private Cache<Object, Object> cache1 = null;
+   private Cache<Object, Object> cache2 = null;
    private String myListClass = MyList.class.getName();
    private String mySetClass = MySet.class.getName();
    private String myMapClass = MyMap.class.getName();
@@ -202,7 +195,7 @@
       }
    }
 
-   private void enableRegionBasedClassLoading(ClassLoader customClassLoader) throws Exception
+   private void enableRegionBasedClassLoading(ClassLoader customClassLoader)
    {
       cache1.getConfiguration().setUseRegionBasedMarshalling(true);
       Region region1 = cache1.getRegion(fqn("/a"), true);
@@ -218,10 +211,10 @@
 //      cache2.getMarshaller().defaultMarshaller.useRegionBasedMarshalling = true;
    }
 
-   private ClassLoader getClassLoader() throws Exception
+   private ClassLoader getClassLoader()
    {
-      String[] includesClasses = { myListClass, mySetClass, myMapClass };
-      String [] excludesClasses = {};
+      String[] includesClasses = {myListClass, mySetClass, myMapClass};
+      String[] excludesClasses = {};
       ClassLoader cl = Thread.currentThread().getContextClassLoader();
       return new SelectedClassnameClassLoader(includesClasses, excludesClasses, cl);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,8 +1,7 @@
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertEquals;
-
 import org.jboss.cache.transaction.GlobalTransaction;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.Test;
 
 /**
@@ -22,7 +21,7 @@
    public void testObjectArrayMethod()
    {
       GlobalTransaction gtx = new GlobalTransaction();
-      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, new Object[]{gtx});
+      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
 
       assertEquals(gtx, c.getArgs()[0]);
    }
@@ -30,7 +29,7 @@
    public void testMultipleArrayElems()
    {
       GlobalTransaction gtx = new GlobalTransaction();
-      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, new Object[]{gtx, gtx, gtx});
+      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx, gtx, gtx);
 
       assertEquals(gtx, c.getArgs()[0]);
       assertEquals(gtx, c.getArgs()[1]);

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,6 +1,9 @@
 package org.jboss.cache.marshall;
 
+import org.jboss.cache.Fqn;
 import static org.testng.AssertJUnit.assertEquals;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -9,10 +12,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jboss.cache.Fqn;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
 /**
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  * @since 2.0.0
@@ -33,12 +32,12 @@
    {
       byteStream = new ByteArrayOutputStream();
       stream = new ObjectOutputStream(byteStream);
-      call1 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, Fqn.ROOT, null, null, true);
-      call2 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, Fqn.ROOT, null, null, true);
+      call1 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, Fqn.ROOT, null, null, true);
+      call2 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, Fqn.ROOT, null, null, true);
       list.clear();
       list.add(call1);
       list.add(call2);
-      prepareCall = MethodCallFactory.create(MethodDeclarations.prepareMethod, null, list, null, true);
+      prepareCall = MethodCallFactory.create(MethodDeclarations.prepareMethod, list, null, true);
    }
 
    public void testSingleMethodCall() throws Exception

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RegionManagerTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,24 +1,18 @@
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * Test on ERegionManager class, from a marshalling perspective.
  */
@@ -31,10 +25,7 @@
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
-      c.create();
-      r = new RegionManager(c);
-      c.start();
+      r = new RegionManager();
    }
 
    @AfterMethod(alwaysRun = false)

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,12 +1,6 @@
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.buddyreplication.BuddyGroup;
@@ -14,16 +8,19 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Method;
+import java.util.Collections;
+
 /**
  * Tests whether remote calls to RPC methods suppress return values (as sometimes expected)
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  * @since 2.0.0
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class RemoteCallerReturnValuesTest
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private Fqn fqn = Fqn.fromString("/a");
    private Object key = "key";
    private Object value = "value";
@@ -31,7 +28,7 @@
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache();
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache();
       cache.put(fqn, key, value);
    }
 
@@ -43,10 +40,13 @@
 
    public void testMethodsThatShouldReturnValues() throws Throwable
    {
+      assert false : "Implement me";
+      /*
       Object retval = cache._replicate(MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn), false));
       assertNotNull(retval);
 
       assertNotNull(cache._replicate(MethodCallFactory.create(MethodDeclarations.dataGravitationMethod, fqn, false)));
+      */
    }
 
 
@@ -60,7 +60,6 @@
       doNullReturnTest(MethodDeclarations.releaseAllLocksMethodLocal, fqn);
       doNullReturnTest(MethodDeclarations.printMethodLocal, fqn);
 
-
       // ------------ buddy replication
 
       doNullReturnTest(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod, cache.getLocalAddress(), null);
@@ -76,9 +75,12 @@
    }
 
 
-   private void doNullReturnTest(Method m, Object... args) throws Throwable
+   private void doNullReturnTest(Method m, Object... args)
    {
+      assert false : "Implement me";
+      /*
       MethodCall c = MethodCallFactory.create(m, args);
       assertNull(m + " should return a null when called remotely", cache._replicate(c));
+      */
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,15 +1,11 @@
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -17,12 +13,12 @@
 @Test(groups = {"functional", "jgroups"})
 public class ReplicateToInactiveRegionTest
 {
-   CacheImpl[] caches;
+   CacheSPI[] caches;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      caches = new CacheImpl[]{createCache(), createCache()};
+      caches = new CacheSPI[]{createCache(), createCache()};
       TestingUtil.blockUntilViewsReceived(caches, 10000);
    }
 
@@ -34,14 +30,14 @@
       caches = null;
    }
 
-   private void destroyCache(CacheImpl c)
+   private void destroyCache(CacheSPI c)
    {
       c.stop();
    }
 
-   private CacheImpl createCache() throws Exception
+   private CacheSPI createCache()
    {
-      CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI c = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       c.getConfiguration().setCacheMode("REPL_SYNC");
       c.getConfiguration().setUseRegionBasedMarshalling(true);
       c.start();

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,21 +1,18 @@
 package org.jboss.cache.marshall;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNotSame;
-import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.buddyreplication.GravitateResult;
 import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.List;
+
 /**
  * Tests the marshalling of retvals
  *
@@ -25,7 +22,7 @@
 @Test(groups = {"functional", "jgroups"})
 public class ReturnValueMarshallingTest
 {
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
    private Fqn fqn = Fqn.fromString("/a");
    private ClassLoader classLoader;
    private Object key = "key", value;
@@ -35,13 +32,13 @@
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache1 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache1.getConfiguration().setUseRegionBasedMarshalling(true);
       cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
       cache1.getConfiguration().setSyncReplTimeout(60000);// to aid with debugging
       cache1.start();
 
-      cache2 = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache2.getConfiguration().setUseRegionBasedMarshalling(true);
       cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
       cache2.getConfiguration().setSyncReplTimeout(60000);// to aid with debugging
@@ -69,7 +66,7 @@
       cache2.stop();
    }
 
-   private ClassLoader getClassLoader() throws Exception
+   private ClassLoader getClassLoader()
    {
       String[] includesClasses = {className};
       String[] excludesClasses = {};
@@ -87,13 +84,12 @@
       assertNotSame(MyList.class, cache2.get(fqn, key).getClass());
       assertSame(listClass, cache2.get(fqn, key).getClass());
 
-
       // now test if this is the same when obtained using a clustered get mcall
       MethodCall call = MethodCallFactory.create(MethodDeclarations.replicateMethod,
-              MethodCallFactory.create(MethodDeclarations.clusteredGetMethod,
-                      MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false),
-                      false
-              )
+            MethodCallFactory.create(MethodDeclarations.clusteredGetMethod,
+                  MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false),
+                  false
+            )
       );
 
       List responses = cache1.getRPCManager().callRemoteMethods(null, call, true, true, 15000);
@@ -120,12 +116,11 @@
       assertNotSame(MyList.class, cache2.get(fqn, key).getClass());
       assertSame(listClass, cache2.get(fqn, key).getClass());
 
-
       // now test if this is the same when obtained using a data gravitate call
       MethodCall call = MethodCallFactory.create(MethodDeclarations.replicateMethod,
-              MethodCallFactory.create(MethodDeclarations.dataGravitationMethod,
-                      fqn, false
-              )
+            MethodCallFactory.create(MethodDeclarations.dataGravitationMethod,
+                  fqn, false
+            )
       );
 
       List responses = cache1.getRPCManager().callRemoteMethods(null, call, true, true, 15000);

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SelectedClassnameClassLoader.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SelectedClassnameClassLoader.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SelectedClassnameClassLoader.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,14 +1,14 @@
 package org.jboss.cache.marshall;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 /**
  * A ClassLoader that loads classes whose classname begins with one of a
  * given set of strings, without attempting first to delegate to its
@@ -30,173 +30,201 @@
  * </p>
  *
  * @author Brian Stansberry
- *
  */
-public class SelectedClassnameClassLoader extends ClassLoader {
+public class SelectedClassnameClassLoader extends ClassLoader
+{
 
-    private String[] includedClasses = null;
-    private String[] excludedClasses = null;
-    private String[] notFoundClasses = null;
-    private Log log = LogFactory.getLog(SelectedClassnameClassLoader.class);
+   private String[] includedClasses = null;
+   private String[] excludedClasses = null;
+   private String[] notFoundClasses = null;
+   private Log log = LogFactory.getLog(SelectedClassnameClassLoader.class);
 
-    private Map<String, Class> classes = new java.util.HashMap<String, Class>();
+   private Map<String, Class> classes = new java.util.HashMap<String, Class>();
 
-    /**
-     * Creates a new classloader that loads the given classes.
-     *
-     * @param includedClasses   array of class or package names that should be
-     *                          directly loaded by this loader.  Classes
-     *                          whose name starts with any of the strings
-     *                          in this array will be loaded by this class,
-     *                          unless their name appears in
-     *                          <code>excludedClasses</code>.
-     *                          Can be <code>null</code>
-     * @param excludedClasses   array of class or package names that should NOT
-     *                          be directly loaded by this loader.  Loading of
-     *                          classes whose name starts with any of the
-     *                          strings in this array will be delegated to
-     *                          <code>parent</code>, even if the classes
-     *                          package or classname appears in
-     *                          <code>includedClasses</code>.  Typically this
-     *                          parameter is used to exclude loading one or
-     *                          more classes in a package whose other classes
-     *                          are loaded by this object.
-     * @param parent            ClassLoader to which loading of classes should
-     *                          be delegated if necessary
-     */
-    public SelectedClassnameClassLoader(String[] includedClasses,
-                                 String[] excludedClasses,
-                                 ClassLoader parent) {
-        super(parent);
-        this.includedClasses = includedClasses;
-        this.excludedClasses = excludedClasses;
-    }
+   /**
+    * Creates a new classloader that loads the given classes.
+    *
+    * @param includedClasses array of class or package names that should be
+    *                        directly loaded by this loader.  Classes
+    *                        whose name starts with any of the strings
+    *                        in this array will be loaded by this class,
+    *                        unless their name appears in
+    *                        <code>excludedClasses</code>.
+    *                        Can be <code>null</code>
+    * @param excludedClasses array of class or package names that should NOT
+    *                        be directly loaded by this loader.  Loading of
+    *                        classes whose name starts with any of the
+    *                        strings in this array will be delegated to
+    *                        <code>parent</code>, even if the classes
+    *                        package or classname appears in
+    *                        <code>includedClasses</code>.  Typically this
+    *                        parameter is used to exclude loading one or
+    *                        more classes in a package whose other classes
+    *                        are loaded by this object.
+    * @param parent          ClassLoader to which loading of classes should
+    *                        be delegated if necessary
+    */
+   public SelectedClassnameClassLoader(String[] includedClasses,
+                                       String[] excludedClasses,
+                                       ClassLoader parent)
+   {
+      super(parent);
+      this.includedClasses = includedClasses;
+      this.excludedClasses = excludedClasses;
+   }
 
-    /**
-     * Creates a new classloader that loads the given classes.
-     *
-     * @param includedClasses   array of class or package names that should be
-     *                          directly loaded by this loader.  Classes
-     *                          whose name starts with any of the strings
-     *                          in this array will be loaded by this class,
-     *                          unless their name appears in
-     *                          <code>excludedClasses</code>.
-     *                          Can be <code>null</code>
-     * @param excludedClasses   array of class or package names that should NOT
-     *                          be directly loaded by this loader.  Loading of
-     *                          classes whose name starts with any of the
-     *                          strings in this array will be delegated to
-     *                          <code>parent</code>, even if the classes
-     *                          package or classname appears in
-     *                          <code>includedClasses</code>.  Typically this
-     *                          parameter is used to exclude loading one or
-     *                          more classes in a package whose other classes
-     *                          are loaded by this object.
-     * @param notFoundClasses   array of class or package names for which this
-     *                          should raise a ClassNotFoundException
-     * @param parent            ClassLoader to which loading of classes should
-     *                          be delegated if necessary
-     */
-    public SelectedClassnameClassLoader(String[] includedClasses,
-                                 String[] excludedClasses,
-                                 String[] notFoundClasses,
-                                 ClassLoader parent) {
-        super(parent);
-        this.includedClasses = includedClasses;
-        this.excludedClasses = excludedClasses;
-        this.notFoundClasses = notFoundClasses;
-    }
+   /**
+    * Creates a new classloader that loads the given classes.
+    *
+    * @param includedClasses array of class or package names that should be
+    *                        directly loaded by this loader.  Classes
+    *                        whose name starts with any of the strings
+    *                        in this array will be loaded by this class,
+    *                        unless their name appears in
+    *                        <code>excludedClasses</code>.
+    *                        Can be <code>null</code>
+    * @param excludedClasses array of class or package names that should NOT
+    *                        be directly loaded by this loader.  Loading of
+    *                        classes whose name starts with any of the
+    *                        strings in this array will be delegated to
+    *                        <code>parent</code>, even if the classes
+    *                        package or classname appears in
+    *                        <code>includedClasses</code>.  Typically this
+    *                        parameter is used to exclude loading one or
+    *                        more classes in a package whose other classes
+    *                        are loaded by this object.
+    * @param notFoundClasses array of class or package names for which this
+    *                        should raise a ClassNotFoundException
+    * @param parent          ClassLoader to which loading of classes should
+    *                        be delegated if necessary
+    */
+   public SelectedClassnameClassLoader(String[] includedClasses,
+                                       String[] excludedClasses,
+                                       String[] notFoundClasses,
+                                       ClassLoader parent)
+   {
+      super(parent);
+      this.includedClasses = includedClasses;
+      this.excludedClasses = excludedClasses;
+      this.notFoundClasses = notFoundClasses;
+   }
 
-    protected synchronized Class<?> loadClass(String name, boolean resolve)
-    throws ClassNotFoundException
-    {
-        log.info("In SelectedClassnameClassLoader.loadClass("+name+","+resolve+")");
-        if (isIncluded(name) && (isExcluded(name) == false)) {
-            Class c = findClass(name);
+   protected synchronized Class<?> loadClass(String name, boolean resolve)
+         throws ClassNotFoundException
+   {
+      log.info("In SelectedClassnameClassLoader.loadClass(" + name + "," + resolve + ")");
+      if (isIncluded(name) && (isExcluded(name) == false))
+      {
+         Class c = findClass(name);
 
-            if (resolve) {
-                resolveClass(c);
-            }
-            return c;
-        }
-        else {
-            return super.loadClass(name, resolve);
-        }
-    }
+         if (resolve)
+         {
+            resolveClass(c);
+         }
+         return c;
+      }
+      else
+      {
+         return super.loadClass(name, resolve);
+      }
+   }
 
-    protected Class<?> findClass(String name) throws ClassNotFoundException {
+   protected Class<?> findClass(String name) throws ClassNotFoundException
+   {
 
-        log.info("In SelectedClassnameClassLoader.findClass()");
-        Class result = (Class)classes.get(name);
-        if(result != null){
-            return result;
-        }
+      log.info("In SelectedClassnameClassLoader.findClass()");
+      Class result = classes.get(name);
+      if (result != null)
+      {
+         return result;
+      }
 
-        if (isIncluded(name) && (isExcluded(name) == false)) {
-            try {
-                InputStream is = getResourceAsStream( name.replace('.','/').concat(".class"));
-                byte[] bytes = new byte[1024];
-                ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-                int read;
-                while ((read = is.read(bytes)) > -1) {
-                    baos.write(bytes, 0, read);
-                }
-                bytes = baos.toByteArray();
-                result = this.defineClass(name, bytes, 0, bytes.length);
-            } catch (FileNotFoundException e) {
-                throw new ClassNotFoundException("cannot find " + name, e);
-            } catch (IOException e) {
-                throw new ClassNotFoundException("cannot read " + name, e);
+      if (isIncluded(name) && (isExcluded(name) == false))
+      {
+         try
+         {
+            InputStream is = getResourceAsStream(name.replace('.', '/').concat(".class"));
+            byte[] bytes = new byte[1024];
+            ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+            int read;
+            while ((read = is.read(bytes)) > -1)
+            {
+               baos.write(bytes, 0, read);
             }
-        }
-        else if (isNotFound(name)) {
-           throw new ClassNotFoundException(name + " is discarded");
-        }
-        else {
-            result = super.findClass(name);
-        }
+            bytes = baos.toByteArray();
+            result = this.defineClass(name, bytes, 0, bytes.length);
+         }
+         catch (FileNotFoundException e)
+         {
+            throw new ClassNotFoundException("cannot find " + name, e);
+         }
+         catch (IOException e)
+         {
+            throw new ClassNotFoundException("cannot read " + name, e);
+         }
+      }
+      else if (isNotFound(name))
+      {
+         throw new ClassNotFoundException(name + " is discarded");
+      }
+      else
+      {
+         result = super.findClass(name);
+      }
 
-        classes.put(name, result);
+      classes.put(name, result);
 
-        return result;
-    }
+      return result;
+   }
 
-    private boolean isIncluded(String className) {
+   private boolean isIncluded(String className)
+   {
 
-        if (includedClasses != null) {
-            for (int i = 0; i < includedClasses.length; i++) {
-                if (className.startsWith(includedClasses[i])) {
-                    return true;
-                }
+      if (includedClasses != null)
+      {
+         for (int i = 0; i < includedClasses.length; i++)
+         {
+            if (className.startsWith(includedClasses[i]))
+            {
+               return true;
             }
-        }
+         }
+      }
 
-        return false;
-    }
+      return false;
+   }
 
-    private boolean isExcluded(String className) {
+   private boolean isExcluded(String className)
+   {
 
-        if (excludedClasses != null) {
-            for (int i = 0; i < excludedClasses.length; i++) {
-                if (className.startsWith(excludedClasses[i])) {
-                    return true;
-                }
+      if (excludedClasses != null)
+      {
+         for (int i = 0; i < excludedClasses.length; i++)
+         {
+            if (className.startsWith(excludedClasses[i]))
+            {
+               return true;
             }
-        }
+         }
+      }
 
-        return false;
-    }
+      return false;
+   }
 
-    private boolean isNotFound(String className) {
+   private boolean isNotFound(String className)
+   {
 
-        if (notFoundClasses != null) {
-            for (int i = 0; i < notFoundClasses.length; i++) {
-                if (className.startsWith(notFoundClasses[i])) {
-                    return true;
-                }
+      if (notFoundClasses != null)
+      {
+         for (int i = 0; i < notFoundClasses.length; i++)
+         {
+            if (className.startsWith(notFoundClasses[i]))
+            {
+               return true;
             }
-        }
+         }
+      }
 
-        return false;
-    }
+      return false;
+   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -9,20 +9,6 @@
 package org.jboss.cache.marshall;
 
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -32,11 +18,17 @@
 import org.jboss.cache.marshall.data.Address;
 import org.jboss.cache.marshall.data.Person;
 import org.jboss.cache.misc.TestingUtil;
-import org.jboss.cache.transaction.DummyTransactionManager;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
 /**
  * Test case for marshalling using Sync mode.
  *
@@ -72,7 +64,7 @@
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
    }
 
-   private CacheSPI<Object, Object> createCache(String name) throws Exception
+   private CacheSPI<Object, Object> createCache(String name)
    {
       CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
       cache.getConfiguration().setClusterName(name);

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/data/Address.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/data/Address.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/data/Address.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -19,11 +19,6 @@
    String city = "San Jose";
    int zip = 0;
 
-   public Address()
-   {
-
-   }
-
    public String getStreet()
    {
       return street;

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/data/Person.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -16,10 +16,6 @@
    String name = null;
    Address address;
 
-   public Person()
-   {
-   }
-
    public String getName()
    {
       return name;

Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/InvalidationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,6 +1,6 @@
 package org.jboss.cache.mgmt;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -14,6 +14,7 @@
 import org.testng.annotations.Test;
 
 import java.util.HashMap;
+
 /**
  * Simple functional tests for InvalidationInterceptor statistics
  *
@@ -29,8 +30,8 @@
    private static final String POPULATION = "population";
    private static final String AREA = "area";
 
-   private CacheImpl<Object, Object> cache1 = null;
-   private CacheImpl<Object, Object> cache2 = null;
+   private CacheSPI<Object, Object> cache1 = null;
+   private CacheSPI<Object, Object> cache2 = null;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
@@ -112,7 +113,7 @@
 
    }
 
-   private void loadCache1(CacheImpl<Object, Object> cache) throws Exception
+   private void loadCache1(CacheSPI<Object, Object> cache)
    {
       cache.put("Europe", new HashMap());
       cache.put("Europe/Austria", new HashMap());
@@ -129,7 +130,7 @@
 
    }
 
-   private void loadCache2(CacheImpl<Object, Object> cache) throws Exception
+   private void loadCache2(CacheSPI<Object, Object> cache)
    {
       // the following line will invalidate /Europe (and its' children) across the cluster!!
 //      cache.put("Europe", new HashMap<Object, Object>());
@@ -146,16 +147,13 @@
 
    }
 
-   private CacheImpl<Object, Object> createCache(String clusterName) throws Exception
+   private CacheSPI<Object, Object> createCache(String clusterName)
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+
       Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.INVALIDATION_SYNC);
-      cache.setConfiguration(c);
       c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
       c.setExposeManagementStatistics(true);
       c.setClusterName(clusterName);
-      cache.create();
-      cache.start();
-      return cache;
+      return (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,21 +1,19 @@
 package org.jboss.cache.mgmt;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.interceptors.CacheMgmtInterceptor;
+import org.jboss.cache.interceptors.Interceptor;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * Simple functional tests for CacheMgmtInterceptor
  *
@@ -30,12 +28,12 @@
    private static final String POPULATION = "population";
    private static final String AREA = "area";
 
-   CacheImpl<Object, Object> cache = null;
+   CacheSPI<Object, Object> cache = null;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setExposeManagementStatistics(true);
       cache.create();
@@ -162,7 +160,7 @@
       assertEquals("Misses count error after reset: ", new Long(0), new Long(mgmt.getMisses()));
    }
 
-   private void loadCacheData() throws Exception
+   private void loadCacheData()
    {
       cache.put("Europe", new HashMap());
       cache.put("Europe/Austria", new HashMap());
@@ -201,28 +199,28 @@
       cache.put("Europe/Poland", POPULATION, 38635144);
       cache.put("Europe/Switzerland", POPULATION, 7489370);
 
-      HashMap<Object, Object> albania = new HashMap<Object, Object> (4);
+      HashMap<Object, Object> albania = new HashMap<Object, Object>(4);
       albania.put(CAPITAL, "Tirana");
       albania.put(CURRENCY, "Lek");
       albania.put(POPULATION, 3563112);
       albania.put(AREA, 28748);
       cache.put("Europe/Albania", albania);
 
-      HashMap<Object, Object>  hungary = new HashMap<Object, Object> (4);
+      HashMap<Object, Object> hungary = new HashMap<Object, Object>(4);
       hungary.put(CAPITAL, "Budapest");
       hungary.put(CURRENCY, "Forint");
       hungary.put(POPULATION, 10006835);
       hungary.put(AREA, 93030);
       cache.put("Europe/Hungary", hungary);
 
-      HashMap<Object, Object>  romania = new HashMap<Object, Object> (4);
+      HashMap<Object, Object> romania = new HashMap<Object, Object>(4);
       romania.put(CAPITAL, "Bucharest");
       romania.put(CURRENCY, "Leu");
       romania.put(POPULATION, 22329977);
       romania.put(AREA, 237500);
       cache.put("Europe/Romania", romania);
 
-      HashMap<Object, Object>  slovakia = new HashMap<Object, Object> (4);
+      HashMap<Object, Object> slovakia = new HashMap<Object, Object>(4);
       slovakia.put(CAPITAL, "Bratislava");
       slovakia.put(CURRENCY, "Slovak Koruna");
       slovakia.put(POPULATION, 5431363);
@@ -233,18 +231,17 @@
 
    private CacheMgmtInterceptor getCacheMgmtInterceptor()
    {
-      List interceptors = cache.getInterceptors();
+      List<Interceptor> interceptors = cache.getInterceptorChain();
       if (interceptors.isEmpty())
       {
          return null;
       }
 
-      for (int i = 0; i < interceptors.size(); i++)
+      for (Interceptor interceptor : interceptors)
       {
-         Object o = interceptors.get(i);
-         if (o instanceof CacheMgmtInterceptor)
+         if (interceptor instanceof CacheMgmtInterceptor)
          {
-            return (CacheMgmtInterceptor) o;
+            return (CacheMgmtInterceptor) interceptor;
          }
       }
       return null;

Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/TxTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,24 +1,20 @@
 package org.jboss.cache.mgmt;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.util.HashMap;
-import java.util.List;
-
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.interceptors.TxInterceptor;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * Simple functional tests for TxInterceptor statistics
  *
@@ -34,8 +30,8 @@
    private static final String POPULATION = "population";
    private static final String AREA = "area";
 
-   private CacheImpl<Object, Object> cache1 = null;
-   private CacheImpl<Object, Object> cache2 = null;
+   private CacheSPI<Object, Object> cache1 = null;
+   private CacheSPI<Object, Object> cache2 = null;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
@@ -141,7 +137,7 @@
       assertEquals("Cache2 Tx Rollbacks error after reset: ", new Long(0), new Long(tx2.getRollbacks()));
    }
 
-   private void loadCacheNoTx(CacheImpl<Object, Object> cache) throws Exception
+   private void loadCacheNoTx(CacheSPI<Object, Object> cache)
    {
       cache.put("Europe", new HashMap<Object, Object>());
       cache.put("Europe/Austria", new HashMap());
@@ -157,7 +153,7 @@
       cache.put("Europe/Albania", albania);
    }
 
-   private void loadCacheTxCommit(CacheImpl<Object, Object> cache, TransactionManager tm) throws Exception
+   private void loadCacheTxCommit(CacheSPI<Object, Object> cache, TransactionManager tm) throws Exception
    {
       tm.begin();
 
@@ -174,7 +170,7 @@
       tm.commit();
    }
 
-   private void loadCacheTxCommit2(CacheImpl<Object, Object> cache, TransactionManager tm) throws Exception
+   private void loadCacheTxCommit2(CacheSPI<Object, Object> cache, TransactionManager tm) throws Exception
    {
       tm.begin();
 
@@ -195,7 +191,7 @@
       tm.commit();
    }
 
-   private void loadCacheTxRollback(CacheImpl<Object, Object> cache, TransactionManager tm) throws Exception
+   private void loadCacheTxRollback(CacheSPI<Object, Object> cache, TransactionManager tm) throws Exception
    {
       tm.begin();
 
@@ -212,10 +208,9 @@
       tm.rollback();
    }
 
-   private CacheImpl<Object, Object> createCache(String clusterName) throws Exception
+   private CacheSPI<Object, Object> createCache(String clusterName)
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      cache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
       cache.getConfiguration().setUseRegionBasedMarshalling(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
       cache.getConfiguration().setExposeManagementStatistics(true);
@@ -225,17 +220,16 @@
       return cache;
    }
 
-   private TxInterceptor getTxInterceptor(CacheImpl cache)
+   private TxInterceptor getTxInterceptor(CacheSPI cache)
    {
-      List interceptors = cache.getInterceptors();
+      List interceptors = cache.getInterceptorChain();
       if (interceptors.isEmpty())
       {
          return null;
       }
 
-      for (int i = 0; i < interceptors.size(); i++)
+      for (Object o : interceptors)
       {
-         Object o = interceptors.get(i);
          if (o instanceof TxInterceptor)
          {
             return (TxInterceptor) o;

Modified: core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -12,10 +12,14 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.CacheStatus;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.factories.InterceptorChainFactory;
 import org.jboss.cache.interceptors.Interceptor;
+import org.jboss.cache.invocation.RemoteCacheInvocationDelegate;
 import org.jboss.cache.util.CachePrinter;
 
 import java.io.File;
+import java.lang.reflect.Field;
 import java.util.List;
 import java.util.Random;
 
@@ -29,6 +33,29 @@
 {
    private static Random random = new Random();
 
+   /**
+    * Extracts the value of a field in a given target instance using reflection, able to extract private fields as well.
+    *
+    * @param target    object to extract field from
+    * @param fieldName name of field to extract
+    * @return field value
+    */
+   public static Object extractField(Object target, String fieldName)
+   {
+      Field field;
+      try
+      {
+         field = target.getClass().getDeclaredField(fieldName);
+         field.setAccessible(true);
+         return field.get(target);
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         return null;
+      }
+   }
+
    public static <T extends Interceptor> T findInterceptor(CacheSPI<?, ?> cache, Class<T> interceptorToFind)
    {
       for (Interceptor i : cache.getInterceptorChain())
@@ -96,7 +123,7 @@
    }
 
    /**
-    * Loops, continually calling {@link #areCacheViewsComplete(CacheImpl[])}
+    * Loops, continually calling {@link #areCacheViewsComplete(org.jboss.cache.CacheSPI[])}
     * until it either returns true or <code>timeout</code> ms have elapsed.
     *
     * @param caches  caches which must all have consistent views
@@ -104,7 +131,7 @@
     * @throws RuntimeException if <code>timeout</code> ms have elapse without
     *                          all caches having the same number of members.
     */
-   public static void blockUntilViewsReceived(CacheImpl[] caches, long timeout)
+   public static void blockUntilViewsReceived(CacheSPI[] caches, long timeout)
    {
       long failTime = System.currentTimeMillis() + timeout;
 
@@ -120,6 +147,7 @@
       throw new RuntimeException("timed out before caches had complete views");
    }
 
+
    /**
     * An overloaded version of {@link #blockUntilViewsReceived(long,org.jboss.cache.Cache[])} that allows for 'shrinking' clusters.
     * I.e., the usual method barfs if there are more members than expected.  This one takes a param (barfIfTooManyMembers) which,
@@ -147,7 +175,7 @@
    }
 
    /**
-    * Loops, continually calling {@link #areCacheViewsComplete(CacheImpl[])}
+    * Loops, continually calling {@link #areCacheViewsComplete(org.jboss.cache.CacheSPI[])}
     * until it either returns true or <code>timeout</code> ms have elapsed.
     *
     * @param groupSize number of caches expected in the group
@@ -172,7 +200,7 @@
    }
 
    /**
-    * Loops, continually calling {@link #areCacheViewsComplete(CacheImpl[])}
+    * Loops, continually calling {@link #areCacheViewsComplete(org.jboss.cache.CacheSPI[])}
     * until it either returns true or <code>timeout</code> ms have elapsed.
     *
     * @param groupSize number of caches expected in the group
@@ -238,7 +266,7 @@
     * @throws IllegalStateException if any of the caches have MORE view
     *                               members than caches.length
     */
-   public static boolean areCacheViewsComplete(CacheImpl[] caches)
+   public static boolean areCacheViewsComplete(CacheSPI[] caches)
    {
       if (caches == null) throw new NullPointerException("Cache impl array is null");
       Cache[] c = new Cache[caches.length];
@@ -382,7 +410,7 @@
     */
    public static void killCaches(Cache... caches)
    {
-      for (Cache c: caches)
+      for (Cache c : caches)
       {
          if (c != null && c.getCacheStatus() == CacheStatus.STARTED)
          {
@@ -422,7 +450,7 @@
     */
    public static void killTransactions(Cache... caches)
    {
-      for (Cache c: caches)
+      for (Cache c : caches)
       {
          if (c != null && c.getCacheStatus() == CacheStatus.STARTED)
          {
@@ -441,4 +469,63 @@
          }
       }
    }
+
+   /**
+    * For testing only - introspects a cache and extracts the ComponentRegistry
+    *
+    * @param cache cache to introspect
+    * @return component registry
+    */
+   public static ComponentRegistry extractComponentRegistry(Cache cache)
+   {
+      CacheImpl ci = (CacheImpl) extractField(cache, "cache");
+      return extractComponentRegistry(ci);
+   }
+
+   /**
+    * For testing only - introspects a cache and extracts the ComponentRegistry
+    *
+    * @param cache cache to introspect
+    * @return component registry
+    */
+   public static ComponentRegistry extractComponentRegistry(CacheImpl ci)
+   {
+      ComponentRegistry cr = (ComponentRegistry) extractField(ci, "componentRegistry");
+      return cr;
+   }
+
+
+   /**
+    * Replaces the existing interceptor chain in the cache wih one represented by the interceptor passed in.  This
+    * utility updates dependencies on all components that rely on the interceptor chain as well.
+    *
+    * @param cache       cache that needs to be altered
+    * @param interceptor the first interceptor in the new chain.
+    */
+   public static void replaceInterceptorChain(CacheSPI<?, ?> cache, Interceptor interceptor)
+   {
+      ComponentRegistry cr = extractComponentRegistry(cache);
+
+      // This will replace the previous interceptor chain in the component registry
+      cr.registerComponent(interceptor);
+
+      // update all component dependencies
+      cr.updateDependencies();
+
+      // make sure the new interceptors have their deps satisfied.
+      InterceptorChainFactory.getInstance().correctInterceptorChaining(interceptor, cache.getConfiguration(), cr);
+   }
+
+   /**
+    * Retrieves the remote delegate for a given cache.  It is on this remote delegate that the JGroups RPCDispatcher
+    * invokes remote methods.
+    *
+    * @param cache cache instance for which a remote delegate is to be retrieved
+    * @return remote delegate, or null if the cacge is not configured for replication.
+    */
+   public static RemoteCacheInvocationDelegate getRemoteDelegate(CacheSPI cache)
+   {
+      ComponentRegistry cr = extractComponentRegistry(cache);
+      return cr.getComponent(RemoteCacheInvocationDelegate.class);
+   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/MultiplexerTestHelper.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/MultiplexerTestHelper.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/MultiplexerTestHelper.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -25,7 +25,6 @@
 import org.jgroups.ChannelFactory;
 import org.jgroups.JChannel;
 import org.jgroups.JChannelFactory;
-import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -50,10 +49,6 @@
    private final Set<JChannelFactory> factories = Collections.synchronizedSet(new HashSet<JChannelFactory>());
    private final Set<Cache> caches = Collections.synchronizedSet(new HashSet<Cache>());
 
-   public MultiplexerTestHelper()
-   {
-   }
-
    /**
     * Configures the given cache to get its JChannel from a
     * multiplexer-enabled JChannelFactory.  The JChannelFactory will

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -3,19 +3,7 @@
  */
 package org.jboss.cache.optimistic;
 
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Random;
-
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -35,6 +23,7 @@
 import org.jboss.cache.marshall.MethodCallFactory;
 import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
 import org.jboss.cache.transaction.TransactionSetup;
 import org.jboss.cache.xml.XmlHelper;
 import org.jgroups.Address;
@@ -42,6 +31,16 @@
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
 
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+
 /**
  * @author manik
  */
@@ -52,31 +51,29 @@
    protected Fqn<String> fqn = Fqn.fromString("/blah");
    protected String key = "myKey", value = "myValue";
 
-   protected CacheImpl<Object, Object> createCacheUnstarted() throws Exception
+   protected CacheSPI<Object, Object> createCacheUnstarted() throws Exception
    {
       return createCacheUnstarted(true);
    }
 
-   protected CacheImpl<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
+   protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
-      if (optimistic) c.setNodeLockingScheme("OPTIMISTIC");
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
 
-      c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      c.setCacheMode("LOCAL");
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+      cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       return cache;
    }
 
-   protected CacheImpl<Object, Object> createCacheWithListener() throws Exception
+   protected CacheSPI<Object, Object> createCacheWithListener() throws Exception
    {
       return createCacheWithListener(new TestListener());
    }
 
-   protected CacheImpl<Object, Object> createCacheWithListener(Object listener) throws Exception
+   protected CacheSPI<Object, Object> createCacheWithListener(Object listener) throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheUnstarted();
+      CacheSPI<Object, Object> cache = createCacheUnstarted();
       cache.create();
       cache.start();
       cache.getNotifier().addCacheListener(listener);
@@ -85,11 +82,8 @@
 
    /**
     * Returns a tree cache with passivation disabled in the loader.
-    *
-    * @return
-    * @throws Exception
     */
-   protected CacheImpl<Object, Object> createCacheWithLoader() throws Exception
+   protected CacheSPI<Object, Object> createCacheWithLoader() throws Exception
    {
       return createCacheWithLoader(false);
    }
@@ -97,27 +91,26 @@
    protected CacheLoaderConfig getCacheLoaderConfig(boolean shared, boolean passivation) throws Exception
    {
       String xml = "            <config>\n" +
-              "                <passivation>" + passivation + "</passivation>\n" +
-              "                <preload></preload>\n" +
-              "                <shared>" + shared + "</shared>\n" +
-              "                <cacheloader>\n" +
-              "                    <class>" + (shared ? DummySharedInMemoryCacheLoader.class.getName() : DummyInMemoryCacheLoader.class.getName()) + "</class>\n" +
-              "                    <properties>\n" +
-              "                    </properties>\n" +
-              "                    <async>false</async>\n" +
-              "                    <fetchPersistentState>" + (!shared) + "</fetchPersistentState>\n" +
-              "                    <ignoreModifications>false</ignoreModifications>\n" +
-              "                </cacheloader>\n" +
-              "            </config>";
+            "                <passivation>" + passivation + "</passivation>\n" +
+            "                <preload></preload>\n" +
+            "                <shared>" + shared + "</shared>\n" +
+            "                <cacheloader>\n" +
+            "                    <class>" + (shared ? DummySharedInMemoryCacheLoader.class.getName() : DummyInMemoryCacheLoader.class.getName()) + "</class>\n" +
+            "                    <properties>\n" +
+            "                    </properties>\n" +
+            "                    <async>false</async>\n" +
+            "                    <fetchPersistentState>" + (!shared) + "</fetchPersistentState>\n" +
+            "                    <ignoreModifications>false</ignoreModifications>\n" +
+            "                </cacheloader>\n" +
+            "            </config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
 
-   protected CacheImpl<Object, Object> createCacheWithLoader(boolean passivationEnabled) throws Exception
+   protected CacheSPI<Object, Object> createCacheWithLoader(boolean passivationEnabled) throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheUnstarted();
+      CacheSPI<Object, Object> cache = createCacheUnstarted();
       Configuration c = cache.getConfiguration();
-      cache.setConfiguration(c);
       c.setCacheLoaderConfig(getCacheLoaderConfig(true, passivationEnabled));
       cache.create();
       cache.start();
@@ -125,9 +118,9 @@
    }
 
 
-   protected CacheImpl<Object, Object> createCache() throws Exception
+   protected CacheSPI<Object, Object> createCache() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheUnstarted();
+      CacheSPI<Object, Object> cache = createCacheUnstarted();
       cache.create();
       cache.start();
       return cache;
@@ -140,11 +133,10 @@
    }
 
 
-   protected CacheImpl<Object, Object> createPessimisticCache() throws Exception
+   protected CacheSPI createPessimisticCache() throws Exception
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
 
       c.setClusterName("name");
       c.setStateRetrievalTimeout(5000);
@@ -159,11 +151,10 @@
       return cache;
    }
 
-   protected CacheImpl<Object, Object> createPessimisticCacheLocal() throws Exception
+   protected CacheSPI createPessimisticCacheLocal() throws Exception
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
 
       c.setClusterName("name");
       c.setStateRetrievalTimeout(5000);
@@ -182,36 +173,35 @@
    protected String getDefaultProperties()
    {
       return "UDP(mcast_addr=228.1.2.3;mcast_port=48866;ip_ttl=32;" +
-              "mcast_send_buf_size=150000;mcast_recv_buf_size=80000;loopback=true;ip_mcast=true;bind_addr=127.0.0.1):" +
-              "PING(timeout=1000;num_initial_members=2):" +
-              "MERGE2(min_interval=5000;max_interval=10000):" +
-              "FD_SOCK:" +
-              "VERIFY_SUSPECT(timeout=1500):" +
-              "pbcast.NAKACK(gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800):" +
-              "UNICAST(timeout=600,1200,2400,4800):" +
-              "pbcast.STABLE(desired_avg_gossip=20000):" +
-              "FRAG(frag_size=8192;down_thread=false;up_thread=false):" +
-              "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
-              "shun=false;print_local_addr=true):" +
-              "pbcast.STATE_TRANSFER";
+            "mcast_send_buf_size=150000;mcast_recv_buf_size=80000;loopback=true;ip_mcast=true;bind_addr=127.0.0.1):" +
+            "PING(timeout=1000;num_initial_members=2):" +
+            "MERGE2(min_interval=5000;max_interval=10000):" +
+            "FD_SOCK:" +
+            "VERIFY_SUSPECT(timeout=1500):" +
+            "pbcast.NAKACK(gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800):" +
+            "UNICAST(timeout=600,1200,2400,4800):" +
+            "pbcast.STABLE(desired_avg_gossip=20000):" +
+            "FRAG(frag_size=8192;down_thread=false;up_thread=false):" +
+            "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
+            "shun=false;print_local_addr=true):" +
+            "pbcast.STATE_TRANSFER";
    }
 
-   protected CacheImpl<Object, Object> createReplicatedCache(Configuration.CacheMode mode) throws Exception
+   protected CacheSPI createReplicatedCache(Configuration.CacheMode mode) throws Exception
    {
       return createReplicatedCache("test", mode);
    }
 
-   protected CacheImpl<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode) throws Exception
+   protected CacheSPI createReplicatedCache(String name, Configuration.CacheMode mode) throws Exception
    {
       return createReplicatedCache(name, mode, true);
    }
-   
-   protected CacheImpl<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode, boolean start) throws Exception
-   {  
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
 
+   protected CacheSPI<Object, Object> createReplicatedCache(String name, Configuration.CacheMode mode, boolean start) throws Exception
+   {
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
+
       c.setClusterName(name);
       c.setStateRetrievalTimeout(5000);
       c.setClusterConfig(getDefaultProperties());
@@ -224,7 +214,7 @@
       }
       c.setNodeLockingScheme("OPTIMISTIC");
       c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
-      
+
       if (start)
       {
          cache.create();
@@ -234,26 +224,25 @@
       return cache;
    }
 
-   protected CacheImpl<Object, Object> createReplicatedCacheWithLoader(boolean shared, Configuration.CacheMode cacheMode) throws Exception
+   protected CacheSPI createReplicatedCacheWithLoader(boolean shared, Configuration.CacheMode cacheMode) throws Exception
    {
       return createReplicatedCacheWithLoader("temp-loader", shared, cacheMode);
    }
 
-   protected CacheImpl<Object, Object> createReplicatedCacheWithLoader(boolean shared) throws Exception
+   protected CacheSPI<Object, Object> createReplicatedCacheWithLoader(boolean shared) throws Exception
    {
       return createReplicatedCacheWithLoader("temp-loader", shared, Configuration.CacheMode.REPL_SYNC);
    }
 
-   protected CacheImpl<Object, Object> createReplicatedCacheWithLoader(String name, boolean shared) throws Exception
+   protected CacheSPI createReplicatedCacheWithLoader(String name, boolean shared) throws Exception
    {
       return createReplicatedCacheWithLoader(name, shared, Configuration.CacheMode.REPL_SYNC);
    }
 
-   protected CacheImpl<Object, Object> createReplicatedCacheWithLoader(String name, boolean shared, Configuration.CacheMode cacheMode) throws Exception
+   protected CacheSPI<Object, Object> createReplicatedCacheWithLoader(String name, boolean shared, Configuration.CacheMode cacheMode) throws Exception
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
       c.setClusterName(name);
       c.setStateRetrievalTimeout(5000);
       c.setClusterConfig(getDefaultProperties());
@@ -369,22 +358,22 @@
       }
 
       public void readFrom(DataInputStream
-              arg0)
+            arg0)
       {
       }
 
       public void writeTo(DataOutputStream
-              arg0)
+            arg0)
       {
       }
 
       public void readExternal(ObjectInput
-              arg0)
+            arg0)
       {
       }
 
       public void writeExternal(ObjectOutput
-              arg0)
+            arg0)
       {
       }
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncCacheTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -3,28 +3,25 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.TransactionSetup;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 @Test(groups = {"functional", "transaction"})
 public class AsyncCacheTest extends AbstractOptimisticTestCase
 {
-   private CacheImpl<Object, Object> cache, cache2;
+   private CacheSPI<Object, Object> cache, cache2;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
@@ -44,9 +41,9 @@
    }
 
    @Override
-   protected CacheImpl<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
+   protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
    {
-      CacheImpl<Object, Object> cache = super.createCacheUnstarted(optimistic);
+      CacheSPI<Object, Object> cache = super.createCacheUnstarted(optimistic);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       return cache;
    }
@@ -83,7 +80,7 @@
       assertEquals(pojo, cache.get(Fqn.fromString("/one/two"), "key1"));
 
       // allow changes to replicate since this is async
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
@@ -105,7 +102,7 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, false);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -125,7 +122,7 @@
       assertEquals(pojo, cache.get(Fqn.fromString("/one/two"), "key1"));
 
       // let the async calls complete
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,17 +1,8 @@
 package org.jboss.cache.optimistic;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
@@ -20,7 +11,12 @@
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * @author xenephon
  */
@@ -38,7 +34,7 @@
    public void testSingleInstanceRollback() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -59,7 +55,7 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertEquals(false, cache.exists(Fqn.fromString("/one/two")));
-      assertNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNull(cache.getNode("/one"));
 
       destroyCache(cache);
 
@@ -68,7 +64,7 @@
    public void testSingleInstanceDuplicateCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -102,11 +98,11 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getNode("/one"));
+      assertEquals(false, cache.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode(Fqn.fromString("/one"))).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode(Fqn.fromString("/one/two"))).getLock().isLocked());
+      assertNotNull(cache.getNode("/one/two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -116,7 +112,7 @@
    public void testValidationFailCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -167,11 +163,11 @@
       assertEquals(true, fail);
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getNode("/one"));
+      assertEquals(false, cache.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -181,8 +177,8 @@
    public void test2InstanceCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createAsyncReplicatedCache();
-      CacheImpl<Object, Object> cache2 = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache2 = createAsyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -204,34 +200,34 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache.getNode("/one"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getNode("/one"));
+      assertEquals(false, cache.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       // let async calls propagate
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       // cache2 asserts
       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache2.getRoot().getChild("one"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache2.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache2.getRoot().getChild("one"));
+      assertEquals(false, cache2.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache2.getNode("/one").getChild("two"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -241,8 +237,8 @@
    public void test2InstanceRemove() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createAsyncReplicatedCache();
-      CacheImpl<Object, Object> cache2 = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache2 = createAsyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -264,45 +260,43 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache.getNode("/one"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getNode("/one"));
+      assertEquals(false, cache.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       // let async calls propagate
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       // cache2 asserts
       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache2.getRoot().getChild("one"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache2.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache2.getRoot().getChild("one"));
+      assertEquals(false, cache2.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache2.getNode("/one").getChild("two"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
-      cache.remove("/one/two");
-      log.debug("  C1 " + cache.get("/one/two"));
+      cache.removeNode("/one/two");
       assertEquals(false, cache.exists("/one/two"));
       assertEquals(null, cache.get("/one/two", "key1"));
 
       // let async calls propagate
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
-      log.debug("  C2 " + cache2.get("/one/two"));
       assertEquals(false, cache2.exists("/one/two"));
       assertEquals(null, cache2.get("/one/two", "key1"));
 
@@ -313,8 +307,8 @@
    public void testValidationFailCommit2Instances() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createAsyncReplicatedCache();
-      CacheImpl<Object, Object> cache2 = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
+      CacheSPI<Object, Object> cache2 = createAsyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -333,9 +327,9 @@
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
-      OptimisticTransactionEntry entry = (OptimisticTransactionEntry)table.get(gtx);
+      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
 
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
       assertNull(mgr.getTransaction());
@@ -349,7 +343,7 @@
       mgr.commit();
 
       // let async calls propagate
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
@@ -375,11 +369,11 @@
       assertEquals(0, entry.getTransactionWorkSpace().getNodes().size());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>)cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getNode("/one"));
+      assertEquals(false, cache.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -387,7 +381,7 @@
 
    }
 
-   protected CacheImpl<Object, Object> createAsyncReplicatedCache() throws Exception
+   protected CacheSPI<Object, Object> createAsyncReplicatedCache() throws Exception
    {
       return createReplicatedCache("temp" + groupIncreaser, Configuration.CacheMode.REPL_ASYNC);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -3,42 +3,38 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.marshall.MethodCall;
 import org.jboss.cache.marshall.MethodCallFactory;
 import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.RollbackException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
 
+
 @Test(groups = "functional")
 public class CacheTest extends AbstractOptimisticTestCase
 {
    Log log = LogFactory.getLog(CacheTest.class);
 
-   private CacheImpl<Object, Object> c;
+   private CacheSPI<Object, Object> c;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
@@ -84,7 +80,8 @@
 
       for (int i = 0; i < numThreads; i++)
       {
-         thread[i] = new ExceptionThread() {
+         thread[i] = new ExceptionThread()
+         {
             public void run()
             {
                try
@@ -125,10 +122,8 @@
    public void testLocalTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(c);
+      TestingUtil.replaceInterceptorChain(c, getAlteredInterceptorChain(dummy, c, true));
 
-      c.setInterceptorChain(getAlteredInterceptorChain(dummy, c, true));
-
       TransactionManager mgr = c.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
 
@@ -162,9 +157,8 @@
       c = createCacheWithListener();
 
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(c);
+      TestingUtil.replaceInterceptorChain(c, getAlteredInterceptorChain(dummy, c, true));
 
-      c.setInterceptorChain(getAlteredInterceptorChain(dummy, c, true));
 
       TransactionManager mgr = c.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -193,9 +187,8 @@
       c = createCacheWithListener();
 
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(c);
+      TestingUtil.replaceInterceptorChain(c, getAlteredInterceptorChain(dummy, c, true));
 
-      c.setInterceptorChain(getAlteredInterceptorChain(dummy, c, true));
       TransactionManager mgr = c.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -203,15 +196,15 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      c.getCurrentTransaction(tx);
+      c.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       c.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = c.getCurrentTransaction(tx);
+      GlobalTransaction gtx = c.getCurrentTransaction(tx, true);
       TransactionTable table = c.getTransactionTable();
-      OptimisticTransactionEntry entry = (OptimisticTransactionEntry)table.get(gtx);
+      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
       mgr.commit();
 
@@ -225,7 +218,7 @@
       //call our remote method
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null,
             remoteGtx.getAddress(), Boolean.FALSE);
-      c._replicate(prepareMethod);
+      TestingUtil.getRemoteDelegate(c)._replicate(prepareMethod);
 
       //our thread should be null
       assertNull(mgr.getTransaction());
@@ -250,8 +243,8 @@
    {
       destroyCache(c);
 
-      CacheImpl<Object, Object> cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
-      CacheImpl<Object, Object> cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI<Object, Object> cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI<Object, Object> cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       assertEquals(2, cache.getMembers().size());
       assertEquals(2, cache2.getMembers().size());
 
@@ -294,8 +287,8 @@
    {
 
       destroyCache(c);
-      CacheImpl<Object, Object> cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
-      CacheImpl<Object, Object> cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI<Object, Object> cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI<Object, Object> cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       assertEquals(2, cache.getMembers().size());
       assertEquals(2, cache2.getMembers().size());
 
@@ -306,7 +299,7 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -342,8 +335,8 @@
    //   {
    //      destroyCache(c);
    //
-   //      CacheImpl cache = createPessimisticCache();
-   //      CacheImpl cache2 = createPessimisticCache();
+   //      CacheSPI cache = createPessimisticCache();
+   //      CacheSPI cache2 = createPessimisticCache();
    //
    //      TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
    //
@@ -379,7 +372,7 @@
       Transaction tx = mgr.suspend();
 
       // now remove the original node...
-      c.remove(fqn);
+      c.removeNode(fqn);
 
       mgr.resume(tx);
       // now try and commit this - this should fail.
@@ -455,8 +448,8 @@
       TransactionManager tm = c.getTransactionManager();
       c.put(Fqn.fromString("/a/b"), "k", "v");
       tm.begin();
-      c.remove(Fqn.fromString("/a"));
-      c.remove(Fqn.fromString("/a/b"));
+      c.removeNode(Fqn.fromString("/a"));
+      c.removeNode(Fqn.fromString("/a/b"));
       tm.commit();
 
       destroyCache(c);
@@ -468,7 +461,7 @@
       TransactionManager tm = c.getTransactionManager();
       c.put(Fqn.fromString("/a/b"), "k", "v");
       tm.begin();
-      c.remove(Fqn.fromString("/a"));
+      c.removeNode(Fqn.fromString("/a"));
       c.put(Fqn.fromString("/a/b"), "k", "v");
       tm.commit();
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,14 +1,14 @@
 package org.jboss.cache.optimistic;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.FqnComparator;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jboss.cache.Fqn;
-import org.jboss.cache.FqnComparator;
-import org.testng.annotations.Test;
-
 /**
  * Tests {@link FqnComparator}.
  *
@@ -142,11 +142,11 @@
 
    public void testOrdinaryObjectCompare()
    {
-      Fqn<Object> fqn1 = new Fqn<Object>(new Object[]{new XYZ(), new ABC()});
-      Fqn<Object> fqn2 = new Fqn<Object>(new Object[]{"XYZ", "ABC"});
-      Fqn<Object> fqn3 = new Fqn<Object>(new Object[]{"XYZ", new ABC()});
+      Fqn<Object> fqn1 = new Fqn<Object>(new XYZ(), new ABC());
+      Fqn<Object> fqn2 = new Fqn<Object>("XYZ", "ABC");
+      Fqn<Object> fqn3 = new Fqn<Object>("XYZ", new ABC());
 
-      Fqn<Object> fqn4 = new Fqn<Object>(new Object[]{"XYZ", new XYZ()});
+      Fqn<Object> fqn4 = new Fqn<Object>("XYZ", new XYZ());
 
       assertEquals(0, comp.compare(fqn1, fqn2));
       assertEquals(0, comp.compare(fqn1, fqn3));

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/FullStackInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -4,7 +4,7 @@
 import junit.framework.AssertionFailedError;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
@@ -19,6 +19,7 @@
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import java.util.Set;
+
 /**
  * @author xenephon
  */
@@ -32,7 +33,7 @@
    public void testLocalTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -53,7 +54,7 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache.getRoot().getChild("one"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
       // flesh this out a bit more
 
@@ -65,7 +66,7 @@
    {
       TestListener listener = new TestListener();
 
-      CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -82,13 +83,13 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       assertEquals(2, listener.getNodesAdded());
@@ -101,7 +102,7 @@
    public void testSingleInstanceCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -122,17 +123,17 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache.getRoot().getChild("one"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
       destroyCache(cache);
 
@@ -141,7 +142,7 @@
    public void testSingleInstanceRollback() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createSyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -162,7 +163,7 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertEquals(false, cache.exists(Fqn.fromString("/one/two")));
-      assertNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNull(cache.getRoot().getChild("one"));
 
       destroyCache(cache);
 
@@ -171,7 +172,7 @@
    public void testSingleInstanceDuplicateCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createSyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -205,13 +206,13 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -221,7 +222,7 @@
    public void testValidationFailCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createSyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -272,13 +273,13 @@
       assertEquals(true, fail);
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -288,8 +289,8 @@
    public void test2InstanceCommit() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createSyncReplicatedCache();
-      CacheImpl<Object, Object> cache2 = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -311,17 +312,17 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache.getRoot().getChild("one"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       // cache2 asserts
@@ -329,15 +330,15 @@
       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache2.getRoot().getChild("one"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache2.getRoot().getChild("one"));
+      assertEquals(false, cache2.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache2.getNode("/one").getChild("two"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -347,8 +348,8 @@
    public void test2InstanceRemove() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createSyncReplicatedCache();
-      CacheImpl<Object, Object> cache2 = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -370,17 +371,17 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache.getRoot().getChild("one"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock()
-              .isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock()
+            .isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
       // cache2 asserts
@@ -388,20 +389,18 @@
       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
+      assertNotNull(cache2.getRoot().getChild("one"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache2.getRoot().getChild("one"));
+      assertEquals(false, cache2.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache2.getNode("/one").getChild("two"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 
-      cache.remove("/one/two");
-      log.debug("  C1 " + cache.get("/one/two"));
-      log.debug("  C2 " + cache2.get("/one/two"));
+      cache.removeNode("/one/two");
 
       assertEquals(false, cache.exists("/one/two"));
       assertEquals(false, cache2.exists("/one/two"));
@@ -415,8 +414,8 @@
    public void testValidationFailCommit2Instances() throws Exception
    {
       groupIncreaser++;
-      CacheImpl<Object, Object> cache = createSyncReplicatedCache();
-      CacheImpl<Object, Object> cache2 = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache = createSyncReplicatedCache();
+      CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -435,10 +434,10 @@
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table
-              .get(gtx);
+            .get(gtx);
 
 
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
@@ -476,11 +475,11 @@
       assertEquals(0, entry.getTransactionWorkSpace().getNodes().size());
 
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
-      assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one"))).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
-      assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
+      assertNotNull(cache.getRoot().getChild("one"));
+      assertEquals(false, cache.getRoot().getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock().isLocked());
+      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertNotNull(cache.getNode("/one").getChild("two"));
       assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
 
       destroyCache(cache);
@@ -493,7 +492,7 @@
       SamplePojo pojo1 = new SamplePojo(21, "test-1");
       SamplePojo pojo2 = new SamplePojo(21, "test-2");
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
@@ -540,7 +539,7 @@
    public void testGetKeysIsolationTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       if (mgr.getTransaction() != null) mgr.rollback();
@@ -560,7 +559,7 @@
 
       mgr.begin();
       Transaction tx = mgr.getTransaction();
-      assertEquals(1, cache.getKeys("/one/two").size());
+      assertEquals(1, cache.getNode("/one/two").getKeys().size());
       // start another
       mgr.suspend();
 
@@ -570,12 +569,12 @@
       mgr.commit();
 
       // assert we can see this outsode the existing tx
-      assertEquals(2, cache.getKeys("/one/two").size());
+      assertEquals(2, cache.getNode("/one/two").getKeys().size());
 
       // resume the suspended one
       mgr.resume(tx);
       // assert we can't see thge change from tx2 as we already touched the node
-      assertEquals(1, cache.getKeys("/one/two").size());
+      assertEquals(1, cache.getNode("/one/two").getKeys().size());
       mgr.commit();
       destroyCache(cache);
 
@@ -584,7 +583,7 @@
 
    public void testTxRollbackThroughConcurrentWrite() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
       Set keys;
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -597,7 +596,7 @@
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
       cache.put("/one/two", "key1", "val1");
       mgr.commit();
-      keys = cache.getKeys("/one/two");
+      keys = cache.getNode("/one/two").getKeys();
       System.out.println("keys after TX #1: " + keys);
       assertEquals(1, keys.size());
 
@@ -615,14 +614,14 @@
       mgr.commit();// now version is 2, attrs are key1 and key3
 
       // assert we can see this outside the existing tx
-      keys = cache.getKeys("/one/two");
+      keys = cache.getNode("/one/two").getKeys();
       System.out.println("keys after TX #3 committed: " + keys);
       assertEquals(2, keys.size());
 
       // resume the suspended one
       mgr.resume(tx);
       // assert we can't see the change from tx2 as we already touched the node
-      keys = cache.getKeys("/one/two");
+      keys = cache.getNode("/one/two").getKeys();
       System.out.println("keys after TX #2 resumed (in private workspace of TX #2): " + keys);
       assertEquals(2, keys.size());// we will see key1 and key2, but *not* key3
 
@@ -635,24 +634,24 @@
       catch (RollbackException rollback_ex)
       {
          System.out.println("TX was rolled back because the other TX committed first and incremented version ID." +
-                 " This is the expected behavior");
+               " This is the expected behavior");
       }
 
-      keys = cache.getKeys("/one/two");
+      keys = cache.getNode("/one/two").getKeys();
       System.out.println("keys after TX #2 was rolled back: " + keys);
       assertEquals(2, keys.size());// key1 and key2
       destroyCache(cache);
    }
 
 
-   protected CacheImpl<Object, Object> createSyncReplicatedCache() throws Exception
+   protected CacheSPI<Object, Object> createSyncReplicatedCache() throws Exception
    {
       return createReplicatedCache("temp" + groupIncreaser, Configuration.CacheMode.REPL_SYNC);
    }
-   
-   protected CacheImpl<Object, Object> createSyncReplicatedCacheAsyncCommit() throws Exception
+
+   protected CacheSPI<Object, Object> createSyncReplicatedCacheAsyncCommit() throws Exception
    {
-      CacheImpl<Object, Object> cache = createReplicatedCache("temp" + groupIncreaser, Configuration.CacheMode.REPL_SYNC, false);
+      CacheSPI<Object, Object> cache = createReplicatedCache("temp" + groupIncreaser, Configuration.CacheMode.REPL_SYNC, false);
       cache.getConfiguration().setSyncCommitPhase(false);
       cache.getConfiguration().setSyncRollbackPhase(false);
       cache.create();
@@ -662,11 +661,11 @@
 
    public void testPuts() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI cache = createCache();
       Transaction tx;
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
 
       mgr.begin();
       cache.put(fqn, key, value);
@@ -688,18 +687,18 @@
 
    public void testRemoves() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       Transaction tx;
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
       cache.put(fqn, key, value);
       Assert.assertEquals(value, cache.get(fqn, key));
 
       mgr.begin();
       Assert.assertEquals(value, cache.get(fqn, key));
-      cache.remove(fqn);
-      Assert.assertNull(cache.get(fqn));
+      cache.removeNode(fqn);
+      Assert.assertNull(cache.getNode(fqn));
       tx = mgr.getTransaction();
       mgr.suspend();
 
@@ -708,26 +707,26 @@
       mgr.commit();
 
       mgr.resume(tx);
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
       mgr.commit();
 
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
    }
 
 
    public void testRemovesBeforeGet() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       Transaction tx;
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
       cache.put(fqn, key, value);
       Assert.assertEquals(value, cache.get(fqn, key));
 
       mgr.begin();
-      cache.remove(fqn);
-      Assert.assertNull(cache.get(fqn));
+      cache.removeNode(fqn);
+      Assert.assertNull(cache.getNode(fqn));
       tx = mgr.getTransaction();
       mgr.suspend();
 
@@ -736,10 +735,10 @@
       mgr.commit();
 
       mgr.resume(tx);
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
       mgr.commit();
 
-      Assert.assertNull(cache.get(fqn));
+      Assert.assertNull(cache.getNode(fqn));
    }
 
    public void testLoopedPutAndGet() throws Exception
@@ -747,8 +746,8 @@
       try
       {
          log.debug("Starting test");
-         CacheImpl<Object, Object> cache1 = createSyncReplicatedCache();
-         CacheImpl<Object, Object> cache2 = createSyncReplicatedCache();
+         CacheSPI<Object, Object> cache1 = createSyncReplicatedCache();
+         CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();
          log.debug("Created caches");
          TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
 
@@ -779,60 +778,64 @@
          throw e;
       }
    }
-   
+
    /**
     * Tests that if synchronous commit messages are not used, the proper
     * data is returned from remote nodes after a tx that does a local
     * put returns.
-    * 
+    *
     * @throws Exception
     */
-   @Test(enabled = false) // known failure - JBCACHE-1201
-   public void testAsynchronousCommit() throws Exception 
+   @Test(enabled = false)
+   // known failure - JBCACHE-1201
+   public void testAsynchronousCommit() throws Exception
    {
-      CacheImpl<Object, Object> cache1 = createSyncReplicatedCacheAsyncCommit();
-      CacheImpl<Object, Object> cache2 = createSyncReplicatedCacheAsyncCommit();
+      CacheSPI<Object, Object> cache1 = createSyncReplicatedCacheAsyncCommit();
+      CacheSPI<Object, Object> cache2 = createSyncReplicatedCacheAsyncCommit();
       // Test will pass if we set up the caches with SyncCommitPhaseTrue
-//      CacheImpl<Object, Object> cache1 = createSyncReplicatedCache();
-//      CacheImpl<Object, Object> cache2 = createSyncReplicatedCache();
-      
+//      CacheSPI<Object, Object> cache1 = createSyncReplicatedCache();
+//      CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();
+
       TransactionManager tm1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
-      
+
       Fqn<String> fqn = Fqn.fromString("/test/node");
       String KEY = "key";
       String VALUE1 = "value1";
-      
+
       tm1.begin();
       cache1.put(fqn, KEY, VALUE1);
       tm1.commit();
-      
+
       // A simple sleep will also make this test pass
 //      try { Thread.sleep(100); } catch (InterruptedException e) {}
-      
+
       assertEquals("Known issue JBCACHE-1201: Correct node2 value", VALUE1, cache2.get(fqn, KEY));
       assertEquals("Correct node1 value", VALUE1, cache1.get(fqn, KEY));
-      
+
       destroyCache(cache1);
       destroyCache(cache2);
-  }
-   
-   private void rollback(TransactionManager tm) {
-       try {
-           tm.rollback();
-       }
-       catch (Exception e) {
-           log.error(e.getMessage(), e);
-       }
-       
    }
-   
-  private class ExceptionHolder
-  {
-     Exception node1Exception;
-     Exception node2Exception;
-     
-     AssertionFailedError node1Failure;
-     AssertionFailedError node2Failure;
-  }
 
+   private void rollback(TransactionManager tm)
+   {
+      try
+      {
+         tm.rollback();
+      }
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
+      }
+
+   }
+
+   private class ExceptionHolder
+   {
+      Exception node1Exception;
+      Exception node2Exception;
+
+      AssertionFailedError node1Failure;
+      AssertionFailedError node2Failure;
+   }
+
 }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/HasChildTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,16 +1,15 @@
 package org.jboss.cache.optimistic;
 
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
 import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.Fqn;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
 /**
  * Tests the hasChild() API
  *
@@ -19,7 +18,7 @@
  */
 public class HasChildTest extends AbstractOptimisticTestCase
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private TransactionManager txMgr;
    private Fqn f = Fqn.fromString("/a");
 
@@ -43,7 +42,7 @@
 
       assertTrue(cache.getRoot().hasChild(f));
 
-      cache.remove(f);
+      cache.removeNode(f);
 
       assertFalse(cache.getRoot().hasChild(f));
 
@@ -63,7 +62,7 @@
 
       txMgr.begin();
       assertTrue(cache.getRoot().hasChild(f));
-      cache.remove(f);
+      cache.removeNode(f);
       assertFalse(cache.getRoot().hasChild(f));
 
       t = txMgr.suspend();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,14 +1,14 @@
 package org.jboss.cache.optimistic;
 
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.interceptors.Interceptor;
+import org.jboss.cache.marshall.MethodCall;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.interceptors.Interceptor;
-import org.jboss.cache.marshall.MethodCall;
-
 /**
  * Handles putXXX() methods: if the given node doesn't exist, it will be created
  * (depending on the create_if_not_exists argument)
@@ -19,7 +19,7 @@
  */
 public class MockInterceptor extends Interceptor
 {
-   public void setCache(CacheImpl cache)
+   public void setCache(CacheSPI cache)
    {
       super.setCache(cache);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,11 +1,12 @@
 package org.jboss.cache.optimistic;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
@@ -19,26 +20,23 @@
 /**
  * @author xenephon
  */
- at Test (groups = {"functional"})
+ at Test(groups = {"functional"})
 public class NodeInterceptorGetChildrenNamesTest extends AbstractOptimisticTestCase
 {
    public void testTransactionGetNamesMethod() throws Exception
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -47,7 +45,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
 
       SamplePojo pojo = new SamplePojo(21, "test");
@@ -65,7 +63,7 @@
       TransactionWorkspace<Object, Object> workspace = entry.getTransactionWorkSpace();
 
       //assert we can see this with a key value get in the transaction
-      assertEquals(1, cache.getChildrenNames("/one").size());
+      assertEquals(1, cache.getNode("/one").getChildrenNames().size());
       mgr.commit();
 
       //assert what should be the results of our call
@@ -85,9 +83,9 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx2);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2, true));
 
-      assertEquals(0, cache.getChildrenNames("/").size());
+      assertEquals(0, cache.getRoot().getChildrenNames().size());
       mgr.commit();
       cache.stop();
    }
@@ -97,19 +95,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -118,7 +113,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
 
       assertEquals(null, dummy.getCalled());
@@ -129,7 +124,7 @@
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
 
       //assert we can see this with a key value get in the transaction
-      assertEquals(0, cache.getChildrenNames("/").size());
+      assertEquals(0, cache.getRoot().getChildrenNames().size());
       mgr.commit();
 
 
@@ -147,19 +142,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -168,7 +160,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -185,11 +177,11 @@
       TransactionWorkspace<Object, Object> workspace = entry.getTransactionWorkSpace();
 
       //assert we can see this
-      assertEquals(1, cache.getChildrenNames("/one").size());
+      assertEquals(1, cache.getNode("/one").getChildrenNames().size());
 
       try
       {
-         for (Iterator<?> it = cache.getChildrenNames("/one").iterator(); it.hasNext();)
+         for (Iterator<?> it = cache.getNode("/one").getChildrenNames().iterator(); it.hasNext();)
          {
             it.next();
             it.remove();
@@ -202,7 +194,7 @@
       }
 
       //assert the removal has had no effect
-      assertEquals(1, cache.getChildrenNames("/one").size());
+      assertEquals(1, cache.getNode("/one").getChildrenNames().size());
       assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
 
       mgr.commit();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,22 +1,20 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * @author xenephon
  */
@@ -26,19 +24,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -47,7 +42,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -84,7 +79,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx2);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2, true));
 
       assertNull(cache.get("/one/two", "key1"));
       mgr.commit();
@@ -95,19 +90,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -116,7 +108,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -155,19 +147,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -176,7 +165,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -214,19 +203,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -235,7 +221,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -250,7 +236,7 @@
       Transaction tx2 = mgr.getTransaction();
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx2);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2, true));
 
       SamplePojo pojo2 = new SamplePojo(22, "test2");
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,24 +1,21 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.Iterator;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.Iterator;
+
 /**
  * @author xenephon
  */
@@ -28,19 +25,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -49,7 +43,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -66,7 +60,7 @@
       TransactionWorkspace<Object, Object> workspace = entry.getTransactionWorkSpace();
 
       //assert we can see this with a key value get in the transaction
-      assertEquals(1, cache.getKeys("/one/two").size());
+      assertEquals(1, cache.getNode("/one/two").getKeys().size());
       mgr.commit();
 
       //assert what should be the results of our call
@@ -86,7 +80,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx2);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2, true));
 
       assertNull(cache.get("/one/two", "key1"));
       mgr.commit();
@@ -98,19 +92,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -119,7 +110,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
 
       assertEquals(null, dummy.getCalled());
@@ -130,7 +121,7 @@
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
 
       //assert we can see this with a key value get in the transaction
-      assertEquals(0, cache.getKeys("/").size());
+      assertEquals(0, cache.getRoot().getKeys().size());
       mgr.commit();
 
 
@@ -146,19 +137,16 @@
    public void testTransactionGetKeysIteratorMethod() throws Exception
    {
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -167,7 +155,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
 
       SamplePojo pojo = new SamplePojo(21, "test");
@@ -182,14 +170,14 @@
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
 
       //assert we can see this with a key value get in the transaction
-      assertEquals(1, cache.getKeys("/one/two").size());
+      assertEquals(1, cache.getNode("/one/two").getKeys().size());
 
-      for (Iterator<?> it = cache.getKeys("/one/two").iterator(); it.hasNext();)
+      for (Iterator<?> it = cache.getNode("/one/two").getKeys().iterator(); it.hasNext();)
       {
          it.next();
          it.remove();
       }
-      assertEquals(0, cache.getKeys("/one/two").size());
+      assertEquals(0, cache.getNode("/one/two").getKeys().size());
       mgr.commit();
 
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,21 +1,20 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * @author xenephon
  */
@@ -25,19 +24,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -46,7 +42,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -80,19 +76,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -101,7 +94,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -138,19 +131,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -159,7 +149,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -195,19 +185,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -216,7 +203,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -253,19 +240,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
@@ -274,7 +258,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -287,7 +271,7 @@
       mgr.begin();
       Transaction tx2 = mgr.getTransaction();
       cache.getInvocationContext().setTransaction(tx2);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2, true));
 
       SamplePojo pojo2 = new SamplePojo(21, "test");
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,24 +1,22 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author xenephon
  */
@@ -29,19 +27,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -50,7 +45,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -83,19 +78,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -104,7 +96,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -140,19 +132,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -161,7 +150,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,24 +1,22 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author xenephon
  */
@@ -29,20 +27,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
-
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -51,7 +45,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -86,19 +80,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -107,7 +98,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -145,20 +136,17 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
       Fqn f = Fqn.fromString("/one/two");
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -167,7 +155,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,25 +1,22 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author xenephon
  */
@@ -30,19 +27,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -51,9 +45,9 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
-      cache.removeData("/one/two");
+      cache.getNode("/one/two").clearData();
 
       assertEquals(null, dummy.getCalled());
       TransactionTable table = cache.getTransactionTable();
@@ -81,19 +75,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -102,13 +93,13 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       Map temp = new HashMap();
 
       cache.put("/one/two", temp);
 
-      cache.removeData("/one/two");
+      cache.getNode("/one/two").clearData();
 
       assertEquals(null, dummy.getCalled());
       TransactionTable table = cache.getTransactionTable();
@@ -138,19 +129,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -159,7 +147,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -177,7 +165,7 @@
       TransactionWorkspace workspace = entry.getTransactionWorkSpace();
       assertEquals(1, workspace.getNode(Fqn.fromString("/one/two")).getMergedData().size());
 
-      cache.removeData("/one/two");
+      cache.getNode("/one/two").clearData();
 
       mgr.commit();
 
@@ -198,19 +186,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -219,7 +204,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -237,7 +222,7 @@
       TransactionWorkspace workspace = entry.getTransactionWorkSpace();
       assertEquals(1, workspace.getNode(Fqn.fromString("/one/two")).getMergedData().size());
 
-      cache.removeData("/one");
+      cache.getNode("/one").clearData();
 
       mgr.commit();
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,27 +5,24 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.loader.SamplePojo;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author xenephon
  */
@@ -36,19 +33,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -57,7 +51,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       cache.remove("/one/two", "keyOne");
 
@@ -87,19 +81,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -108,7 +99,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -145,19 +136,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -166,7 +154,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,7 +6,7 @@
  */
 package org.jboss.cache.optimistic;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.factories.InterceptorChainFactory;
@@ -31,16 +31,17 @@
 /**
  * @author xenephon
  */
- at Test (groups = {"functional"})
+ at Test(groups = {"functional"})
 @SuppressWarnings("unchecked")
 public class NodeInterceptorRemoveNodeTest extends AbstractOptimisticTestCase
 {
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private TestListener listener;
    private MockInterceptor dummy;
    private TransactionManager mgr;
 
-   @BeforeMethod(alwaysRun = true) public void setUp() throws Exception
+   @BeforeMethod(alwaysRun = true)
+   public void setUp() throws Exception
    {
       listener = new TestListener();
       cache = createCacheWithListener(listener);
@@ -61,11 +62,11 @@
 
       InterceptorChainFactory.getInstance().setLastInterceptorPointer(interceptor, dummy);
 
-      cache.setInterceptorChain(interceptor);
       mgr = cache.getTransactionManager();
    }
 
-   @AfterMethod(alwaysRun = true) public void tearDown()
+   @AfterMethod(alwaysRun = true)
+   public void tearDown()
    {
       super.tearDown();
       cache.stop();
@@ -78,10 +79,10 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
 
-      cache.remove("/one/two");
+      cache.removeNode("/one/two");
 
       TransactionTable table = cache.getTransactionTable();
       GlobalTransaction gtx = table.get(tx);
@@ -108,14 +109,14 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
-      cache.remove("/one/two");
+      cache.removeNode("/one/two");
       assertEquals(null, dummy.getCalled());
       TransactionTable table = cache.getTransactionTable();
 
@@ -149,14 +150,14 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
-      cache.remove("/one");
+      cache.removeNode("/one");
       assertEquals(null, dummy.getCalled());
       TransactionTable table = cache.getTransactionTable();
 
@@ -188,7 +189,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -207,7 +208,7 @@
       workspace.getNode(Fqn.fromString("/one/two"));
 
 
-      cache.remove("/one");
+      cache.removeNode("/one");
 
       assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
       assertEquals(true, workspace.getNode(Fqn.fromString("/one/two")).isDeleted());
@@ -215,7 +216,7 @@
       assertEquals(true, workspace.getNode(Fqn.fromString("/one")).isDeleted());
 
       //now put /one/two back in
-      cache.remove("/one");
+      cache.removeNode("/one");
 
 
       assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
@@ -244,7 +245,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -263,7 +264,7 @@
       Node two = workspace.getNode(Fqn.fromString("/one/two"));
 
 
-      cache.remove("/one");
+      cache.removeNode("/one");
 
       assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
       assertEquals(true, workspace.getNode(Fqn.fromString("/one/two")).isDeleted());
@@ -303,7 +304,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -322,7 +323,7 @@
       Node two = workspace.getNode(Fqn.fromString("/one/two"));
 
 
-      cache.remove("/one");
+      cache.removeNode("/one");
 
       assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
       assertEquals(true, workspace.getNode(Fqn.fromString("/one/two")).isDeleted());
@@ -363,7 +364,7 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
       Map temp = new HashMap();
@@ -382,7 +383,7 @@
 
       assertEquals(1, one.getMergedChildren().get(0).size());
 
-      cache.remove("/one/two");
+      cache.removeNode("/one/two");
 
       assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
       assertEquals(true, workspace.getNode(Fqn.fromString("/one/two")).isDeleted());

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,14 +5,13 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
+import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 
 /**
  * @author xenephon
@@ -24,19 +23,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
       try
       {
@@ -56,19 +52,16 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
       boolean fail = false;
       try

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,24 +5,23 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * @author xenephon
  */
@@ -37,7 +36,7 @@
    protected OptimisticTransactionEntry entry;
    protected TransactionWorkspace workspace;
 
-   protected void setupTransactionsInInvocationCtx(CacheImpl cache) throws Exception
+   protected void setupTransactionsInInvocationCtx(CacheSPI cache) throws Exception
    {
       txManager = DummyTransactionManager.getInstance();
       // start a tx
@@ -61,16 +60,14 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
       setupTransactionsInInvocationCtx(cache);
 
@@ -95,18 +92,14 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
 
       interceptor.setNext(dummy);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
-
-      cache.setInterceptorChain(interceptor);
-
       setupTransactionsInInvocationCtx(cache);
       final SamplePojo pojo = new SamplePojo(21, "test");
       cache.put("/one/two", "key1", pojo);
@@ -142,15 +135,12 @@
    {
 
       TestListener listener = new TestListener();
-      final CacheImpl cache = createCacheWithListener(listener);
+      final CacheSPI cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       interceptor.setNext(dummy);
-
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
       SamplePojo pojo = new SamplePojo(21, "test");
 
       setupTransactionsInInvocationCtx(cache);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,50 +5,48 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
 
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.marshall.MethodCall;
 import org.jboss.cache.marshall.MethodCallFactory;
 import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
 import org.jgroups.Address;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
+import javax.transaction.RollbackException;
+import javax.transaction.Transaction;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author xenephon
  */
 @SuppressWarnings("unchecked")
 public class OptimisticReplicationInterceptorTest extends AbstractOptimisticTestCase
 {
-   private CacheImpl cache;
+   private CacheSPI cache;
 
-   @BeforeMethod(alwaysRun = true) public void setUp() throws Exception
+   @BeforeMethod(alwaysRun = true)
+   public void setUp() throws Exception
    {
       cache = createCache();
    }
 
-   @AfterMethod(alwaysRun = true) public void tearDown()
+   @AfterMethod(alwaysRun = true)
+   public void tearDown()
    {
       super.tearDown();
       destroyCache(cache);
@@ -57,10 +55,8 @@
    public void testLocalTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       assertNull(mgr.getTransaction());
 
@@ -90,10 +86,8 @@
    public void testRollbackTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       assertNull(mgr.getTransaction());
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -118,10 +112,8 @@
    public void testRemotePrepareTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
       //start local transaction
@@ -129,13 +121,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -153,7 +145,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -185,10 +177,8 @@
    public void testRemoteRollbackTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
       //start local transaction
@@ -196,13 +186,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -220,7 +210,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -249,7 +239,7 @@
       MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
       try
       {
-         cache._replicate(rollbackMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
       }
       catch (Throwable t)
       {
@@ -266,10 +256,8 @@
    public void testRemoteCommitNoPrepareTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
       //start local transaction
@@ -277,13 +265,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -310,7 +298,7 @@
       MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
       try
       {
-         cache._replicate(commitMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
          fail();
       }
       catch (Throwable t)
@@ -329,10 +317,8 @@
    public void testRemoteRollbackNoPrepareTransaction() throws Throwable
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
       //start local transaction
@@ -340,13 +326,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -372,7 +358,7 @@
       //	    call our remote method
       MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
 
-      cache._replicate(rollbackMethod);
+      TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
       assertTrue("Should be handled on the remote end without barfing, in the event of a rollback without a prepare", true);
 
       //we should have the commit as well now
@@ -386,10 +372,8 @@
    public void testRemoteCommitTransaction() throws Exception
    {
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
       //start local transaction
@@ -397,13 +381,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -421,7 +405,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -451,7 +435,7 @@
       MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
       try
       {
-         cache._replicate(commitMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
       }
       catch (Throwable t)
       {
@@ -471,15 +455,12 @@
       cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
 
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
-      CacheImpl cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       MockInterceptor dummy2 = new MockInterceptor();
-      dummy.setCache(cache2);
+      TestingUtil.replaceInterceptorChain(cache2, getAlteredInterceptorChain(dummy2, cache2, true));
 
-      cache2.setInterceptorChain(getAlteredInterceptorChain(dummy2, cache2, true));
 
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
@@ -488,7 +469,7 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -527,19 +508,15 @@
       cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
 
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
-      CacheImpl cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       MockFailureInterceptor dummy2 = new MockFailureInterceptor();
       List failures = new ArrayList();
       failures.add(MethodDeclarations.optimisticPrepareMethod);
       dummy2.setFailurelist(failures);
-      dummy.setCache(cache2);
+      TestingUtil.replaceInterceptorChain(cache2, getAlteredInterceptorChain(dummy2, cache2, true));
 
-      cache2.setInterceptorChain(getAlteredInterceptorChain(dummy2, cache2, true));
-
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
       //start local transaction
@@ -547,7 +524,7 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -594,16 +571,12 @@
       cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
 
       MockFailureInterceptor dummy = new MockFailureInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
-      CacheImpl cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
+      CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       MockInterceptor dummy2 = new MockInterceptor();
-      dummy.setCache(cache2);
+      TestingUtil.replaceInterceptorChain(cache2, getAlteredInterceptorChain(dummy2, cache2, true));
 
-      cache2.setInterceptorChain(getAlteredInterceptorChain(dummy2, cache2, true));
-
       List failures = new ArrayList();
       failures.add(MethodDeclarations.optimisticPrepareMethod);
       dummy.setFailurelist(failures);
@@ -615,7 +588,7 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,19 +5,19 @@
  * See terms of license at gnu.org.
  */
 package org.jboss.cache.optimistic;
-import javax.transaction.RollbackException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
 
 import junit.framework.Assert;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
+import javax.transaction.RollbackException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * Unit test that covers versioning of data and workspace nodes when using optimistic locking.
  *
@@ -26,15 +26,17 @@
 @SuppressWarnings("unchecked")
 public class OptimisticVersioningTest extends AbstractOptimisticTestCase
 {
-   CacheImpl cache1, cache2;
+   CacheSPI cache1, cache2;
 
-   @BeforeMethod(alwaysRun = true) public void setUp() throws Exception
+   @BeforeMethod(alwaysRun = true)
+   public void setUp() throws Exception
    {
       cache1 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
    }
 
-   @AfterMethod(alwaysRun = true) public void tearDown()
+   @AfterMethod(alwaysRun = true)
+   public void tearDown()
    {
       super.tearDown();
       destroyCache(cache1);
@@ -43,15 +45,15 @@
       cache2 = null;
    }
 
-   public void testVersionPropagation() throws Exception
+   public void testVersionPropagation()
    {
       Fqn fqn = Fqn.fromString("/a/b");
       String key = "key";
 
       cache1.put(fqn, key, "value");
 
-      DataVersion v1 = ((NodeSPI) cache1.get(fqn)).getVersion();
-      DataVersion v2 = ((NodeSPI) cache2.get(fqn)).getVersion();
+      DataVersion v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
+      DataVersion v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
 
       Assert.assertEquals("value", cache1.get(fqn, key));
       Assert.assertEquals("value", cache2.get(fqn, key));
@@ -60,8 +62,8 @@
       // change stuff in the node again...
       cache1.put(fqn, key, "value2");
 
-      v1 = ((NodeSPI) cache1.get(fqn)).getVersion();
-      v2 = ((NodeSPI) cache2.get(fqn)).getVersion();
+      v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
+      v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
 
       Assert.assertEquals("value2", cache1.get(fqn, key));
       Assert.assertEquals("value2", cache2.get(fqn, key));
@@ -79,8 +81,8 @@
 
       cache1.put(fqn, key, "value");
 
-      DataVersion v1 = ((NodeSPI) cache1.get(fqn)).getVersion();
-      DataVersion v2 = ((NodeSPI) cache2.get(fqn)).getVersion();
+      DataVersion v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
+      DataVersion v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
 
       Assert.assertEquals("value", cache1.get(fqn, key));
       Assert.assertEquals("value", cache2.get(fqn, key));
@@ -113,8 +115,8 @@
       }
 
       // data versions should be in sync.
-      v1 = ((NodeSPI) cache1.get(fqn)).getVersion();
-      v2 = ((NodeSPI) cache2.get(fqn)).getVersion();
+      v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
+      v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
 
       Assert.assertEquals("Version info should have propagated", v1, v2);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,17 +5,16 @@
  * See terms of license at gnu.org.
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
 
-import javax.transaction.Transaction;
-
 import junit.framework.Assert;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.transaction.DummyTransactionManager;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
 
+import javax.transaction.Transaction;
+
 /**
  * Tests optimistic locking with cache loaders
  *
@@ -26,7 +25,7 @@
 
    public void testLoaderIndependently() throws Exception
    {
-      CacheImpl cache = createCacheWithLoader();
+      CacheSPI cache = createCacheWithLoader();
       CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
 
       // test the cache loader independently first ...
@@ -44,14 +43,14 @@
       CacheLoader loader = null;
       try
       {
-         CacheImpl<Object, Object> cache = createCacheWithLoader();
+         CacheSPI<Object, Object> cache = createCacheWithLoader();
          loader = cache.getCacheLoaderManager().getCacheLoader();
 
          DummyTransactionManager mgr = DummyTransactionManager.getInstance();
          Transaction tx;
 
          // make sure the fqn is not in cache
-         assertNull(cache.get(fqn));
+         assertNull(cache.getNode(fqn));
 
          // put something in the loader and make sure all tx's can see it
          loader.put(fqn, key, value);
@@ -81,7 +80,7 @@
    public void testCacheStoring() throws Exception
    {
       Transaction tx;
-      CacheImpl<Object, Object> cache = createCacheWithLoader();
+      CacheSPI<Object, Object> cache = createCacheWithLoader();
       CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
 
       // test the cache ...
@@ -98,7 +97,7 @@
 
 
       mgr.begin();
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       mgr.commit();
 
       Assert.assertNull(cache.get(fqn, key));
@@ -127,7 +126,7 @@
 
    public void testCacheLoading() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheWithLoader();
+      CacheSPI<Object, Object> cache = createCacheWithLoader();
       CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
 
       Assert.assertNull(cache.get(fqn, key));
@@ -148,11 +147,11 @@
 
    public void testCacheLoadingWithReplication() throws Exception
    {
-      CacheImpl<Object, Object> cache1 = createReplicatedCacheWithLoader(false);
-      CacheLoader loader1 = cache1.getCacheLoader();
+      CacheSPI<Object, Object> cache1 = createReplicatedCacheWithLoader(false);
+      CacheLoader loader1 = cache1.getCacheLoaderManager().getCacheLoader();
 
-      CacheImpl<Object, Object> cache2 = createReplicatedCacheWithLoader(false);
-      CacheLoader loader2 = cache2.getCacheLoader();
+      CacheSPI<Object, Object> cache2 = createReplicatedCacheWithLoader(false);
+      CacheLoader loader2 = cache2.getCacheLoaderManager().getCacheLoader();
 
       // test the cache ...
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -180,7 +179,7 @@
 
       // cache2 removes entry
       mgr.begin();
-      cache2.remove(fqn);
+      cache2.removeNode(fqn);
       Assert.assertNull(cache2.get(fqn, key));
       // test that loader1, loader2 and cache2 have the entry
       Assert.assertEquals(value, cache1.get(fqn, key));
@@ -191,20 +190,20 @@
       mgr.commit();
 
       // test that the entry has been removed everywhere.
-      Assert.assertNull(cache1.get(fqn));
+      Assert.assertNull(cache1.getNode(fqn));
       Assert.assertNull(loader1.get(fqn));
       Assert.assertNull(loader2.get(fqn));
-      Assert.assertNull(cache2.get(fqn));
+      Assert.assertNull(cache2.getNode(fqn));
 
    }
 
    public void testSharedCacheLoadingWithReplication() throws Exception
    {
-      CacheImpl<Object, Object> cache1 = createReplicatedCacheWithLoader(true);
-      CacheLoader loader1 = cache1.getCacheLoader();
+      CacheSPI<Object, Object> cache1 = createReplicatedCacheWithLoader(true);
+      CacheLoader loader1 = cache1.getCacheLoaderManager().getCacheLoader();
 
-      CacheImpl<Object, Object> cache2 = createReplicatedCacheWithLoader(true);
-      CacheLoader loader2 = cache2.getCacheLoader();
+      CacheSPI<Object, Object> cache2 = createReplicatedCacheWithLoader(true);
+      CacheLoader loader2 = cache2.getCacheLoaderManager().getCacheLoader();
 
       // test the cache ...
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -233,7 +232,7 @@
 
       // cache2 removes entry
       mgr.begin();
-      cache2.remove(fqn);
+      cache2.removeNode(fqn);
       Assert.assertNull(cache2.get(fqn, key));
       // test that loader1, loader2 and cache2 have the entry
       Assert.assertEquals(value, cache1.get(fqn, key));
@@ -244,10 +243,10 @@
       mgr.commit();
 
       // test that the entry has been removed everywhere.
-      Assert.assertNull(cache1.get(fqn));
+      Assert.assertNull(cache1.getNode(fqn));
       Assert.assertNull(loader1.get(fqn));
       Assert.assertNull(loader2.get(fqn));
-      Assert.assertNull(cache2.get(fqn));
+      Assert.assertNull(cache2.getNode(fqn));
 
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,9 +5,9 @@
  * See terms of license at gnu.org.
  */
 package org.jboss.cache.optimistic;
+
 import junit.framework.Assert;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.CacheLoader;
@@ -25,25 +25,25 @@
    protected CacheLoaderConfig getCacheLoaderConfig() throws Exception
    {
       String xml = "            <config>\n" +
-              "                \n" +
-              "                <passivation>true</passivation>\n" +
-              "                <preload></preload>\n" +
-              "\n" +
-              "                <cacheloader>\n" +
-              "                    <class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>\n" +
-              "                    <async>false</async>\n" +
-              "                    <fetchPersistentState>false</fetchPersistentState>\n" +
-              "                    <ignoreModifications>false</ignoreModifications>\n" +
-              "                </cacheloader>\n" +
-              "                \n" +
-              "            </config>";
+            "                \n" +
+            "                <passivation>true</passivation>\n" +
+            "                <preload></preload>\n" +
+            "\n" +
+            "                <cacheloader>\n" +
+            "                    <class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>\n" +
+            "                    <async>false</async>\n" +
+            "                    <fetchPersistentState>false</fetchPersistentState>\n" +
+            "                    <ignoreModifications>false</ignoreModifications>\n" +
+            "                </cacheloader>\n" +
+            "                \n" +
+            "            </config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
 
-   private CacheImpl<Object, Object> createLocalCache() throws Exception
+   private CacheSPI createLocalCache() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheUnstarted(false);
+      CacheSPI cache = createCacheUnstarted(false);
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig());
 
       cache.create();
@@ -53,11 +53,11 @@
 
    public void testPassivationLocal() throws Exception
    {
-      CacheImpl<Object, Object> cache = createLocalCache();
-      CacheLoader loader = cache.getCacheLoader();
+      CacheSPI cache = createLocalCache();
+      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
 
       // clean up
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       loader.remove(fqn);
 
       Assert.assertNull(loader.get(fqn));
@@ -93,7 +93,7 @@
 
       // clean up
       mgr.begin();
-      cache.remove(fqn);
+      cache.removeNode(fqn);
       loader.remove(fqn);
       mgr.commit();
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/RemoveBeforeCreateTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,28 +1,29 @@
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
 
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
+import javax.transaction.TransactionManager;
+
 /**
  * Tests removal of a node before the node is even created.
  */
 public class RemoveBeforeCreateTest extends AbstractOptimisticTestCase
 {
-   CacheImpl[] c = null;
+   CacheSPI<Object, Object>[] c = null;
    TransactionManager t;
 
-   @BeforeMethod(alwaysRun = true) public void setUp() throws Exception
+   @BeforeMethod(alwaysRun = true)
+   public void setUp() throws Exception
    {
-      c = new CacheImpl[2];
+      c = new CacheSPI[2];
       c[0] = createReplicatedCache(Configuration.CacheMode.REPL_ASYNC);
       c[1] = createReplicatedCache(Configuration.CacheMode.REPL_ASYNC);
 
@@ -31,7 +32,8 @@
       t = c[0].getTransactionManager();
    }
 
-   @AfterMethod(alwaysRun = true) public void tearDown()
+   @AfterMethod(alwaysRun = true)
+   public void tearDown()
    {
       if (c != null)
       {
@@ -52,10 +54,10 @@
       assertEquals("value", c[0].get("/control", "key"));
       assertEquals("value", c[1].get("/control", "key"));
 
-      DefaultDataVersion v1 = (DefaultDataVersion) ((NodeSPI) c[0].get("/control")).getVersion();
+      DefaultDataVersion v1 = (DefaultDataVersion) ((NodeSPI) c[0].getNode("/control")).getVersion();
       assertEquals(1, v1.getRawVersion());
 
-      DefaultDataVersion v2 = (DefaultDataVersion) ((NodeSPI) c[1].get("/control")).getVersion();
+      DefaultDataVersion v2 = (DefaultDataVersion) ((NodeSPI) c[1].getNode("/control")).getVersion();
       assertEquals(1, v2.getRawVersion());
 
 
@@ -65,18 +67,18 @@
    public void testRemoveBeforePut() throws Exception
    {
       Fqn f = Fqn.fromString("/test");
-      assertNull(c[0].get(f));
-      assertNull(c[1].get(f));
+      assertNull(c[0].getNode(f));
+      assertNull(c[1].getNode(f));
 
       t.begin();
-      c[0].remove(f);
+      c[0].removeNode(f);
 
       // should NOT barf!!!
       t.commit();
       TestingUtil.sleepThread(200);
 
-      assertNull(c[0].get(f));
-      assertNull(c[1].get(f));
+      assertNull(c[0].getNode(f));
+      assertNull(c[1].getNode(f));
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedCacheAccessTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,16 +6,15 @@
  */
 package org.jboss.cache.optimistic;
 
-import javax.transaction.TransactionManager;
-
 import junit.framework.Assert;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.testng.annotations.AfterMethod;
 
+import javax.transaction.TransactionManager;
+
 /**
  * Tests multiple thread access on opt locked cache
  *
@@ -36,7 +35,7 @@
    private final Fqn fqn = Fqn.fromString("/a/b");
    private final String key = "key", value = "value";
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI cache;
    private WorkerThread[] threads;
 
    @AfterMethod(alwaysRun = true)

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,13 +5,8 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.Interceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
@@ -19,19 +14,24 @@
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * @author xenephon
  */
 public class ThreadedOptimisticCreateIfNotExistsInterceptorTest extends AbstractOptimisticTestCase
 {
-   protected synchronized void setTransactionsInInvocationCtx(TransactionManager mgr, CacheImpl cache) throws Exception
+   protected synchronized void setTransactionsInInvocationCtx(TransactionManager mgr, CacheSPI cache) throws Exception
    {
       cache.getInvocationContext().setTransaction(mgr.getTransaction());
       cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction());
    }
 
-   protected void resetInvocationCtx(CacheImpl cache)
+   protected void resetInvocationCtx(CacheSPI cache)
    {
       cache.getInvocationContext().setTransaction(null);
       cache.getInvocationContext().setGlobalTransaction(null);
@@ -44,15 +44,13 @@
       final int minSleep = 0;
       final int maxSleep = 1000;
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       interceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
       // should just be the root node
       assertEquals(0, cache.getNumberOfNodes());
@@ -110,15 +108,13 @@
       final int minSleep = 0;
       final int maxSleep = 500;
       TestListener listener = new TestListener();
-      final CacheImpl<Object, Object> cache = createCacheWithListener(listener);
+      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       interceptor.setNext(dummy);
 
-      cache.setInterceptorChain(interceptor);
+      TestingUtil.replaceInterceptorChain(cache, interceptor);
 
       final DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,48 +5,40 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNotSame;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
 
-import java.util.List;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.marshall.MethodCall;
 import org.jboss.cache.marshall.MethodCallFactory;
 import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionSetup;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.List;
+
 @Test(groups = {"functional", "transaction"})
 public class TxInterceptorTest extends AbstractOptimisticTestCase
 {
    @Override
-   protected CacheImpl<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
+   protected CacheSPI<Object, Object> createCacheUnstarted(boolean optimistic) throws Exception
    {
-      CacheImpl<Object, Object> cache = super.createCacheUnstarted(optimistic);
+      CacheSPI<Object, Object> cache = super.createCacheUnstarted(optimistic);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       return cache;
    }
 
    public void testNoTransaction() throws Exception
    {
-
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
-
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       assertNull(mgr.getTransaction());
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -72,11 +64,10 @@
    public void testLocalTransactionExists() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
@@ -110,11 +101,10 @@
    public void testRollbackTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -142,11 +132,10 @@
 
    public void testEmptyLocalTransaction() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -171,12 +160,10 @@
    public void testEmptyRollbackLocalTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
-
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -201,12 +188,10 @@
    public void testLocalRollbackAftercommitTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
-
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -246,11 +231,10 @@
 
    public void testgtxTransactionExists() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -258,7 +242,7 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
@@ -284,11 +268,10 @@
    public void testRemotePrepareTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -300,7 +283,7 @@
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -327,7 +310,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -354,11 +337,10 @@
    public void testRemotePrepareSuspendTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -370,7 +352,7 @@
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertEquals(tx, mgr.getTransaction());
@@ -388,7 +370,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -437,12 +419,10 @@
    public void testRemoteCommitSuspendTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
-
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -450,13 +430,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertEquals(tx, mgr.getTransaction());
@@ -474,7 +454,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -488,7 +468,7 @@
       MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
       try
       {
-         cache._replicate(commitMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
       }
       catch (Throwable t)
       {
@@ -528,11 +508,10 @@
    public void testRemoteRollbackSuspendTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -540,13 +519,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertEquals(tx, mgr.getTransaction());
@@ -564,7 +543,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -578,7 +557,7 @@
       MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
       try
       {
-         cache._replicate(rollbackMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
       }
       catch (Throwable t)
       {
@@ -617,11 +596,10 @@
    public void testRemoteCommitTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -629,13 +607,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -664,7 +642,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -690,7 +668,7 @@
       MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx, Boolean.TRUE);
       try
       {
-         cache._replicate(commitMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
       }
       catch (Throwable t)
       {
@@ -710,11 +688,10 @@
    public void testRemoteRollbackTransaction() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, true));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 
       //start local transaction
@@ -722,13 +699,13 @@
       Transaction tx = mgr.getTransaction();
 
       //this sets
-      cache.getCurrentTransaction(tx);
+      cache.getCurrentTransaction(tx, true);
 
       SamplePojo pojo = new SamplePojo(21, "test");
 
       cache.put("/one/two", "key1", pojo);
 
-      GlobalTransaction gtx = cache.getCurrentTransaction(tx);
+      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
@@ -751,7 +728,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
@@ -774,7 +751,7 @@
       MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
       try
       {
-         cache._replicate(rollbackMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
       }
       catch (Throwable t)
       {
@@ -798,11 +775,10 @@
    public void testSequentialTransactionExists() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
+      TestingUtil.replaceInterceptorChain(cache, getAlteredInterceptorChain(dummy, cache, false));
 
-      cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, false));
 
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidationFailureTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,14 +5,14 @@
  * See terms of license at gnu.org.
  */
 package org.jboss.cache.optimistic;
+
+import org.jboss.cache.CacheSPI;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
-import org.jboss.cache.CacheImpl;
-
 /**
  * Tests a failure in validating a concurrently updated node
  *
@@ -22,7 +22,7 @@
 {
    public void testValidationFailureLockRelease() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCache();
+      CacheSPI<Object, Object> cache = createCache();
 
       TransactionManager mgr = cache.getTransactionManager();
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -5,18 +5,8 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.interceptors.Interceptor;
@@ -27,11 +17,17 @@
 import org.jboss.cache.marshall.MethodCall;
 import org.jboss.cache.marshall.MethodCallFactory;
 import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author xenephon
  */
@@ -39,21 +35,17 @@
 {
    public void testTransactionvalidateMethod() throws Exception
    {
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       Interceptor validateInterceptor = new OptimisticValidatorInterceptor();
-      validateInterceptor.setCache(cache);
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       validateInterceptor.setNext(interceptor);
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(validateInterceptor);
+      TestingUtil.replaceInterceptorChain(cache, validateInterceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -62,10 +54,10 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
-      Map<String, SamplePojo> temp = new HashMap<String, SamplePojo>();
+      Map<Object, Object> temp = new HashMap<Object, Object>();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
@@ -93,14 +85,14 @@
       assertEquals(null, dummy.getCalled());
 
       //now let us do a prepare
-      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE});
+      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
       }
       catch (Throwable t)
       {
-
+         // do nothing
       }
 
 
@@ -122,21 +114,17 @@
    public void testTransactionValidateFailureMethod() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       Interceptor validateInterceptor = new OptimisticValidatorInterceptor();
-      validateInterceptor.setCache(cache);
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       validateInterceptor.setNext(interceptor);
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(validateInterceptor);
+      TestingUtil.replaceInterceptorChain(cache, validateInterceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -145,10 +133,10 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
-      Map<String, SamplePojo> temp = new HashMap<String, SamplePojo>();
+      Map<Object, Object> temp = new HashMap<Object, Object>();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
@@ -181,7 +169,7 @@
       MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
          fail();
       }
       catch (Throwable t)
@@ -198,21 +186,17 @@
    public void testTransactionValidateCommitMethod() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       Interceptor validateInterceptor = new OptimisticValidatorInterceptor();
-      validateInterceptor.setCache(cache);
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       validateInterceptor.setNext(interceptor);
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(validateInterceptor);
+      TestingUtil.replaceInterceptorChain(cache, validateInterceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -221,10 +205,10 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
-      Map<String, SamplePojo> temp = new HashMap<String, SamplePojo>();
+      Map<Object, Object> temp = new HashMap<Object, Object>();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
@@ -253,10 +237,10 @@
 
       //lets change one of the underlying version numbers
       //now let us do a prepare
-      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE});
+      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
          fail();
       }
       catch (Throwable t)
@@ -264,10 +248,10 @@
          assertTrue(true);
       }
 
-      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, new Object[]{gtx});
+      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
       try
       {
-         cache._replicate(commitMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
       }
       catch (Throwable t)
       {
@@ -309,21 +293,17 @@
    public void testTransactionValidateFailRemoteCommitMethod() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
 
       Interceptor validateInterceptor = new OptimisticValidatorInterceptor();
-      validateInterceptor.setCache(cache);
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       validateInterceptor.setNext(interceptor);
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(validateInterceptor);
+      TestingUtil.replaceInterceptorChain(cache, validateInterceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -332,10 +312,10 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
-      Map<String, SamplePojo> temp = new HashMap<String, SamplePojo>();
+      Map<Object, Object> temp = new HashMap<Object, Object>();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
@@ -359,10 +339,10 @@
 
       //lets change one of the underlying version numbers
       //now let us do a prepare
-      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE});
+      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
          fail();
       }
       catch (Throwable t)
@@ -371,10 +351,10 @@
       }
 
 
-      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, new Object[]{gtx});
+      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
       try
       {
-         cache._replicate(commitMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
       }
       catch (Throwable t)
       {
@@ -415,20 +395,17 @@
    public void testTransactionValidateRollbackMethod() throws Exception
    {
 
-      CacheImpl<Object, Object> cache = createCacheWithListener();
+      CacheSPI<Object, Object> cache = createCacheWithListener();
       Interceptor validateInterceptor = new OptimisticValidatorInterceptor();
       validateInterceptor.setCache(cache);
       Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      interceptor.setCache(cache);
       Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
-      nodeInterceptor.setCache(cache);
       MockInterceptor dummy = new MockInterceptor();
-      dummy.setCache(cache);
       validateInterceptor.setNext(interceptor);
       interceptor.setNext(nodeInterceptor);
       nodeInterceptor.setNext(dummy);
 
-      cache.setInterceptorChain(validateInterceptor);
+      TestingUtil.replaceInterceptorChain(cache, validateInterceptor);
 
 //		 first set up a node with a pojo
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -437,10 +414,10 @@
 
       // inject InvocationContext
       cache.getInvocationContext().setTransaction(tx);
-      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
+      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
 
       SamplePojo pojo = new SamplePojo(21, "test");
-      Map<String, SamplePojo> temp = new HashMap<String, SamplePojo>();
+      Map<Object, Object> temp = new HashMap<Object, Object>();
       temp.put("key1", pojo);
       cache.put("/one/two", temp);
 
@@ -469,10 +446,10 @@
 
       //lets change one of the underlying version numbers
       //now let us do a prepare
-      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE});
+      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), gtx.getAddress(), Boolean.FALSE);
       try
       {
-         cache._replicate(prepareMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
          fail();
       }
       catch (Throwable t)
@@ -480,10 +457,10 @@
          assertTrue(true);
       }
 
-      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, new Object[]{gtx});
+      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, gtx);
       try
       {
-         cache._replicate(rollbackMethod);
+         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
       }
       catch (Throwable t)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/VersioningOnReadTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,31 +1,33 @@
 package org.jboss.cache.optimistic;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.fail;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.Fqn;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
 /**
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  */
 public class VersioningOnReadTest extends AbstractOptimisticTestCase
 {
-   CacheImpl<Object, Object> cache;
+   CacheSPI cache;
    Fqn fqn = Fqn.fromString("/a");
    TransactionManager tm;
 
-   @BeforeMethod(alwaysRun = true) public void setUp() throws Exception
+   @BeforeMethod(alwaysRun = true)
+   public void setUp() throws Exception
    {
       cache = createCache();
       tm = cache.getTransactionManager();
    }
 
-   @AfterMethod(alwaysRun = true) public void tearDown()
+   @AfterMethod(alwaysRun = true)
+   public void tearDown()
    {
       super.tearDown();
       destroyCache(cache);
@@ -99,7 +101,7 @@
 
       // now start a tx to mod the node
       tm.begin();
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
       // suspend the tx
       Transaction tx = tm.suspend();

Modified: core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/CacheModeLocalSimpleTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,41 +6,38 @@
  */
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+
 /**
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
 @Test(groups = {"functional"})
 public class CacheModeLocalSimpleTest
 {
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
    private Option cacheModeLocal;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache1 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache1.setConfiguration(c);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache1.getConfiguration();
       c.setCacheMode("REPL_SYNC");
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 
-      cache2 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      c = new Configuration();
-      cache2.setConfiguration(c);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      c = cache2.getConfiguration();
       c.setCacheMode("REPL_SYNC");
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 

Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,14 +1,7 @@
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.fail;
-
-import javax.transaction.RollbackException;
-import javax.transaction.TransactionManager;
-
 import junit.framework.Assert;
-
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
@@ -16,20 +9,25 @@
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.RollbackException;
+import javax.transaction.TransactionManager;
+
 /**
  * Tests the passing in of explicit {@see DataVersion} instances when using optimistic locking + replication.
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 @SuppressWarnings("unchecked")
 public class ExplicitVersionsReplTest
 {
-   private CacheImpl cache[];
+   private CacheSPI cache[];
    private Fqn fqn = Fqn.fromString("/a");
    private String key = "key";
 
@@ -38,16 +36,15 @@
    {
       if (cache != null)
          tearDown();
-      cache = new CacheImpl[2];
+      cache = new CacheSPI[2];
       cache[0] = createCache();
       cache[1] = createCache();
       TestingUtil.blockUntilViewsReceived(cache, 20000);
    }
 
-   private CacheImpl createCache() throws Exception
+   private CacheSPI createCache()
    {
-      CacheImpl cache = (CacheImpl)DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = cache.getConfiguration();
+      Configuration c = new Configuration();
       c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
       c.setNodeLockingScheme("OPTIMISTIC");
       // give us lots of time to trace and debug shit
@@ -57,9 +54,8 @@
       c.setLockAcquisitionTimeout(1000);
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 
-      cache.setConfiguration(c);
-      cache.start();
-      return cache;
+
+      return (CacheSPI) DefaultCacheFactory.getInstance().createCache(c);
    }
 
    @AfterMethod(alwaysRun = true)
@@ -67,13 +63,13 @@
    {
       if (cache != null)
       {
-         for (CacheImpl aCache : cache)
+         for (CacheSPI aCache : cache)
             destroyCache(aCache);
          cache = null;
       }
    }
 
-   private void destroyCache(CacheImpl c)
+   private void destroyCache(CacheSPI c)
    {
       TransactionManager tm = c.getTransactionManager();
       try
@@ -112,9 +108,6 @@
       {
          mgr.commit();
 
-         System.out.println(cache[0].printDetails());
-         System.out.println(cache[1].printDetails());
-
          Assert.assertTrue("expected to fail", false);
       }
       catch (RollbackException e)
@@ -258,22 +251,22 @@
    public void testPropagationOfDefaultVersions() throws Exception
    {
       DefaultDataVersion expected = new DefaultDataVersion();
-      expected = (DefaultDataVersion)expected.increment();
+      expected = (DefaultDataVersion) expected.increment();
 
       cache[0].put(fqn, key, "value");
 
       assertEquals("value", cache[0].get(fqn, key));
       assertEquals("value", cache[1].get(fqn, key));
-      assertEquals(expected, ((NodeSPI)cache[0].get(fqn)).getVersion());
-      assertEquals(expected, ((NodeSPI)cache[1].get(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
 
       cache[1].put(fqn, key, "value2");
-      expected = (DefaultDataVersion)expected.increment();
+      expected = (DefaultDataVersion) expected.increment();
 
       assertEquals("value2", cache[0].get(fqn, key));
       assertEquals("value2", cache[1].get(fqn, key));
-      assertEquals(expected, ((NodeSPI)cache[0].get(fqn)).getVersion());
-      assertEquals(expected, ((NodeSPI)cache[1].get(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
    }
 
    public void testPropagationOfCustomVersions() throws Exception
@@ -284,8 +277,8 @@
 
       assertEquals("value", cache[0].get(fqn, key));
       assertEquals("value", cache[1].get(fqn, key));
-      assertEquals(expected, ((NodeSPI)cache[0].get(fqn)).getVersion());
-      assertEquals(expected, ((NodeSPI)cache[1].get(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
 
       expected = new TestVersion("200");
       cache[1].getInvocationContext().getOptionOverrides().setDataVersion(expected);
@@ -293,8 +286,8 @@
 
       assertEquals("value2", cache[0].get(fqn, key));
       assertEquals("value2", cache[1].get(fqn, key));
-      assertEquals(expected, ((NodeSPI)cache[0].get(fqn)).getVersion());
-      assertEquals(expected, ((NodeSPI)cache[1].get(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
+      assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
    }
 
    public void testExplicitVersionOnRoot() throws Exception
@@ -319,18 +312,18 @@
    public void testExplicitVersionOnLeaf() throws Exception
    {
       cache[0].put("/org/domain/Entity", null);
-      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[0].get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[1].get("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache[0].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache[1].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
 
       TestVersion v = new TestVersion("Arse");
       cache[0].getInvocationContext().getOptionOverrides().setDataVersion(v);
 
       cache[0].put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
 
-      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[0].get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(v, ((NodeSPI)cache[0].get("/org/domain/Entity/EntityInstance#1")).getVersion());
-      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[1].get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(v, ((NodeSPI)cache[1].get("/org/domain/Entity/EntityInstance#1")).getVersion());
+      assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache[0].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(v, ((NodeSPI) cache[0].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+      assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache[1].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(v, ((NodeSPI) cache[1].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
 
    }
 
@@ -341,10 +334,10 @@
 
       cache[0].put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
 
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache[0].get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(v, ((NodeSPI)cache[0].get("/org/domain/Entity/EntityInstance#1")).getVersion());
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache[1].get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(v, ((NodeSPI)cache[1].get("/org/domain/Entity/EntityInstance#1")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[0].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(v, ((NodeSPI) cache[0].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[1].getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(v, ((NodeSPI) cache[1].getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
 
    }
 
@@ -357,10 +350,10 @@
       cache[0].put(Fqn.fromString("/parent"), "k", "v");
       cache[0].getTransactionManager().commit();
 
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache[0].get("/")).getVersion()).getRawVersion());
-      assertEquals(vParent, ((NodeSPI)cache[0].get("/parent")).getVersion());
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache[1].get("/")).getVersion()).getRawVersion());
-      assertEquals(vParent, ((NodeSPI)cache[1].get("/parent")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[0].getRoot()).getVersion()).getRawVersion());
+      assertEquals(vParent, ((NodeSPI) cache[0].getNode("/parent")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[1].getRoot()).getVersion()).getRawVersion());
+      assertEquals(vParent, ((NodeSPI) cache[1].getNode("/parent")).getVersion());
 
       TestVersion vChild = new TestVersion("Child-Version");
 
@@ -369,12 +362,12 @@
       cache[0].put(Fqn.fromString("/parent/child"), "k", "v");
       cache[0].getTransactionManager().commit();
 
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache[0].get("/")).getVersion()).getRawVersion());
-      assertEquals(vParent, ((NodeSPI)cache[0].get("/parent")).getVersion());
-      assertEquals(vChild, ((NodeSPI)cache[0].get("/parent/child")).getVersion());
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache[1].get("/")).getVersion()).getRawVersion());
-      assertEquals(vParent, ((NodeSPI)cache[1].get("/parent")).getVersion());
-      assertEquals(vChild, ((NodeSPI)cache[1].get("/parent/child")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[0].getRoot()).getVersion()).getRawVersion());
+      assertEquals(vParent, ((NodeSPI) cache[0].getNode("/parent")).getVersion());
+      assertEquals(vChild, ((NodeSPI) cache[0].getNode("/parent/child")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache[1].getRoot()).getVersion()).getRawVersion());
+      assertEquals(vParent, ((NodeSPI) cache[1].getNode("/parent")).getVersion());
+      assertEquals(vChild, ((NodeSPI) cache[1].getNode("/parent/child")).getVersion());
 
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,15 +6,9 @@
  */
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import javax.transaction.TransactionManager;
-
 import junit.framework.Assert;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
@@ -22,19 +16,23 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+
 /**
  * Tests the passing in of explicit {@see DataVersion} instances when using optimistic locking.
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public class ExplicitVersionsTest
 {
-   private CacheImpl<String, String> cache;
+   private CacheSPI<String, String> cache;
    private Fqn fqn = Fqn.fromString("/a");
    private String key = "key";
 
@@ -44,7 +42,7 @@
       if (cache != null)
          tearDown();
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
@@ -71,11 +69,11 @@
       Assert.assertEquals("value", cache.get(fqn, key));
 
       // get a hold of the node
-      NodeSPI<String, String> node = (NodeSPI<String, String>)cache.get(fqn);
+      NodeSPI<String, String> node = (NodeSPI<String, String>) cache.getNode(fqn);
       DataVersion versionFromCache = node.getVersion();
 
       Assert.assertEquals(TestVersion.class, versionFromCache.getClass());
-      Assert.assertEquals("99", ((TestVersion)versionFromCache).getInternalVersion());
+      Assert.assertEquals("99", ((TestVersion) versionFromCache).getInternalVersion());
    }
 
    public void testFailingPut() throws Exception
@@ -126,14 +124,14 @@
    public void testExplicitVersionOnLeaf() throws Exception
    {
       cache.put("/org/domain/Entity", null);
-      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache.get("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/org/domain/Entity")).getVersion()).getRawVersion());
 
       TestVersion v = new TestVersion("Arse");
       cache.getInvocationContext().getOptionOverrides().setDataVersion(v);
       cache.put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
 
-      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache.get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(v, ((NodeSPI)cache.get("/org/domain/Entity/EntityInstance#1")).getVersion());
+      assertEquals(1, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(v, ((NodeSPI) cache.getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
    }
 
    public void testExplicitVersionOnLeafImplicitParentCreation() throws Exception
@@ -142,8 +140,8 @@
       cache.getInvocationContext().getOptionOverrides().setDataVersion(v);
       cache.put(Fqn.fromString("/org/domain/Entity/EntityInstance#1"), "k", "v");
 
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache.get("/org/domain/Entity")).getVersion()).getRawVersion());
-      assertEquals(v, ((NodeSPI)cache.get("/org/domain/Entity/EntityInstance#1")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/org/domain/Entity")).getVersion()).getRawVersion());
+      assertEquals(v, ((NodeSPI) cache.getNode("/org/domain/Entity/EntityInstance#1")).getVersion());
    }
 
    public void testExplicitVersionsOnParents()
@@ -154,7 +152,7 @@
       cache.getInvocationContext().getOptionOverrides().setDataVersion(lev2V);
       root.addChild(Fqn.fromString("LEV2"));
 
-      NodeSPI<String, String> lev2 = (NodeSPI<String, String>)root.getChild(Fqn.fromString("LEV2"));
+      NodeSPI<String, String> lev2 = (NodeSPI<String, String>) root.getChild(Fqn.fromString("LEV2"));
 
       assertNotNull(lev2);
 
@@ -164,7 +162,7 @@
       cache.getInvocationContext().getOptionOverrides().setDataVersion(lev3V);
       lev2.addChild(Fqn.fromString("LEV3"));
 
-      NodeSPI<String, String> lev3 = (NodeSPI<String, String>)lev2.getChild(Fqn.fromString("LEV3"));
+      NodeSPI<String, String> lev3 = (NodeSPI<String, String>) lev2.getChild(Fqn.fromString("LEV3"));
 
       assertNotNull(lev3);
 
@@ -174,7 +172,7 @@
       cache.getInvocationContext().getOptionOverrides().setDataVersion(lev4V);
       lev3.addChild(Fqn.fromString("LEV4"));
 
-      NodeSPI<String, String> lev4 = (NodeSPI<String, String>)lev3.getChild(Fqn.fromString("LEV4"));
+      NodeSPI<String, String> lev4 = (NodeSPI<String, String>) lev3.getChild(Fqn.fromString("LEV4"));
 
       assertNotNull(lev4);
 
@@ -190,8 +188,8 @@
       cache.put(Fqn.fromString("/parent"), "k", "v");
       cache.getTransactionManager().commit();
 
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache.get("/")).getVersion()).getRawVersion());
-      assertEquals(vParent, ((NodeSPI)cache.get("/parent")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/")).getVersion()).getRawVersion());
+      assertEquals(vParent, ((NodeSPI) cache.getNode("/parent")).getVersion());
 
       TestVersion vChild = new TestVersion("Child-Version");
 
@@ -200,9 +198,9 @@
       cache.put(Fqn.fromString("/parent/child"), "k", "v");
       cache.getTransactionManager().commit();
 
-      assertEquals(0, ((DefaultDataVersion)((NodeSPI)cache.get("/")).getVersion()).getRawVersion());
-      assertEquals(vParent, ((NodeSPI)cache.get("/parent")).getVersion());
-      assertEquals(vChild, ((NodeSPI)cache.get("/parent/child")).getVersion());
+      assertEquals(0, ((DefaultDataVersion) ((NodeSPI) cache.getNode("/")).getVersion()).getRawVersion());
+      assertEquals(vParent, ((NodeSPI) cache.getNode("/parent")).getVersion());
+      assertEquals(vChild, ((NodeSPI) cache.getNode("/parent/child")).getVersion());
    }
 
 }
\ No newline at end of file

Modified: core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/FailSilentlyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,23 +6,21 @@
  */
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Tests passing in the failSilently option in various scenarios.
  *
@@ -31,7 +29,7 @@
 @Test(groups = {"functional"})
 public class FailSilentlyTest
 {
-   private CacheImpl<String, String> cache;
+   private CacheImpl cache;
    private TransactionManager manager;
    private Transaction tx;
    private Fqn<String> fqn = Fqn.fromString("/a");
@@ -43,7 +41,7 @@
       if (cache != null)
          tearDown();
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheImpl) instance.createCache(false);
       // very short acquisition timeout
       cache.getConfiguration().setLockAcquisitionTimeout(100);
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");

Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -9,7 +9,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -46,24 +46,22 @@
    private static final String VALUE1 = "value1";
    private static final String VALUE2 = "value2";
 
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
    private Option asyncOption;
    private Option syncOption;
    private static CountDownLatch latch;
    private BlockingListener listener;
 
-   private void createCaches(NodeLockingScheme scheme, CacheMode mode) throws Exception
+   private void createCaches(NodeLockingScheme scheme, CacheMode mode)
    {
-      cache1 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache1.setConfiguration(c);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache1.getConfiguration();
       c.setNodeLockingScheme(scheme);
       c.setCacheMode(mode);
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 
-      cache2 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      c = new Configuration();
-      cache2.setConfiguration(c);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      c = cache2.getConfiguration();
       c.setNodeLockingScheme(scheme);
       c.setCacheMode(mode);
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
@@ -82,9 +80,9 @@
 
       cache1.getInvocationContext().setOptionOverrides(local);
       cache1.put(FQNA, KEY, VALUE1);
-      
+
       assertEquals("Cache1 correct", VALUE1, cache1.get(FQNA, KEY));
-      
+
       local = new Option();
       local.setCacheModeLocal(true);
       cache2.getInvocationContext().setOptionOverrides(local);
@@ -93,7 +91,7 @@
       // Validate data is as expected
       assertEquals("Cache1 correct", VALUE1, cache1.get(FQNA, KEY));
       assertEquals("Cache2 correct", VALUE1, cache2.get(FQNA, KEY));
-      
+
       listener = new BlockingListener();
       cache2.addCacheListener(listener);
    }
@@ -298,9 +296,9 @@
     * Confirms the updater is not blocked and that the cache state is as
     * expected at the end.
     *
-    * @param tm transction manager Updater should use. For non-transactional
-    *           tests, should be <code>null</code>
-    * @param option Option to set before doing put
+    * @param tm         transction manager Updater should use. For non-transactional
+    *                   tests, should be <code>null</code>
+    * @param option     Option to set before doing put
     * @param removeTest true if we're testing a remove; false if a put
     * @throws InterruptedException
     * @throws CacheException
@@ -344,9 +342,9 @@
     * Confirms the updater is blocked and that the cache state is as
     * expected at the end.
     *
-    * @param tm transction manager Updater should use. For non-transactional
-    *           tests, should be <code>null</code>
-    * @param option Option to set before doing put
+    * @param tm         transction manager Updater should use. For non-transactional
+    *                   tests, should be <code>null</code>
+    * @param option     Option to set before doing put
     * @param removeTest true if we're testing a remove; false if a put
     * @throws InterruptedException
     * @throws CacheException
@@ -376,7 +374,7 @@
             break;
          TestingUtil.sleepThread(10);
       }
-      
+
       assertTrue("Updater finished", updater.finished);
       assertFalse("Listener blocked", listener.blocked);
       assertNull("Updater succeeded", updater.failure);
@@ -469,7 +467,9 @@
             {
                latch.await();
             }
-            catch (InterruptedException e) {}
+            catch (InterruptedException e)
+            {
+            }
 
             blocked = false;
          }

Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,10 +1,5 @@
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
@@ -12,17 +7,21 @@
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.NodeLock;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+
 /**
  * Tests forcing a write lock to be obtained on a node
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  * @since 2.0.0
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public class ForceWriteLockTest
 {
    private CacheSPI<String, String> cache;
@@ -35,7 +34,7 @@
       Configuration c = new Configuration();
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheSPI<String, String>)instance.createCache(c);
+      cache = (CacheSPI<String, String>) instance.createCache(c);
       tm = cache.getTransactionManager();
    }
 
@@ -113,14 +112,14 @@
       testControl();
    }
 
-   private void assertNotLocked(Fqn fqn) throws Exception
+   private void assertNotLocked(Fqn fqn)
    {
       NodeSPI<String, String> n = cache.peek(fqn, true);
       NodeLock lock = n.getLock();
       assertFalse("node " + fqn + " is locked!", lock.isLocked());
    }
 
-   private void assertLocked(Object owner, Fqn fqn, boolean write_locked) throws Exception
+   private void assertLocked(Object owner, Fqn fqn, boolean write_locked)
    {
       NodeSPI<String, String> n = cache.peek(fqn, true);
       if (owner == null)

Modified: core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,26 +6,21 @@
  */
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+
 /**
  * Test functionality of {@link Option#setLockAcquisitionTimeout(int)}.
  *
@@ -42,15 +37,14 @@
    private static final String VALUE1 = "value1";
    private static final String VALUE2 = "value2";
 
-   private CacheImpl<Object, Object> cache;
+   private CacheSPI<Object, Object> cache;
    private Option option;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
-      cache = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      Configuration c = new Configuration();
-      cache.setConfiguration(c);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      Configuration c = cache.getConfiguration();
       c.setCacheMode("REPL_SYNC");
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 

Modified: core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/SuppressLockingTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,26 +6,21 @@
  */
 package org.jboss.cache.options;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Tests the suppression of locking nodes
  *
@@ -37,7 +32,7 @@
    private Fqn fqn = Fqn.fromString("/blah");
    private Fqn fqn1 = Fqn.fromString("/blah/1");
 
-   private CacheImpl<String, String> cache;
+   private CacheSPI<String, String> cache;
 
    private TransactionManager m;
 
@@ -48,7 +43,7 @@
       config.setCacheMode(Configuration.CacheMode.LOCAL);
       config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(config);
+      cache = (CacheSPI<String, String>) instance.createCache(config);
       m = cache.getTransactionManager();
    }
 
@@ -75,7 +70,7 @@
       m.commit();
       assertEquals(0, cache.getNumberOfLocksHeld());
 
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
       m.begin();
       cache.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
@@ -87,7 +82,7 @@
       assertEquals(0, cache.getNumberOfLocksHeld());
 
       // test normal operation again
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
       m.begin();
       assertFalse(cache.getInvocationContext().getOptionOverrides().isSuppressLocking());
@@ -113,7 +108,7 @@
       m.commit();
       assertEquals(0, cache.getNumberOfLocksHeld());
 
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
       m.begin();
       cache.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
@@ -136,7 +131,7 @@
       assertEquals(0, cache.getNumberOfLocksHeld());
 
       // test normal operation again
-      cache.remove(fqn);
+      cache.removeNode(fqn);
 
       m.begin();
       cache.put(fqn, "x", "3");

Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,26 +6,23 @@
  */
 package org.jboss.cache.options.cachemodelocal;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-
 import junit.framework.Assert;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Tests the cache mode local override in various scenarios.  To be subclassed to test REPL_SYNC, REPL_ASYNC, INVALIDATION_SYNC, INVALIDATION_ASYNC for Opt and Pess locking.
  * <p/>
@@ -33,7 +30,7 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public abstract class CacheModeLocalTestBase
 {
    // to be subclassed.
@@ -44,8 +41,8 @@
     */
    protected boolean isInvalidation;
 
-   private CacheImpl<String, String> cache1;
-   private CacheImpl<String, String> cache2;
+   private CacheSPI<String, String> cache1;
+   private CacheSPI<String, String> cache2;
 
    private Fqn fqn = Fqn.fromString("/a");
    private String key = "key";
@@ -58,7 +55,7 @@
          tearDown();
 
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache1 = (CacheImpl<String, String>)instance.createCache(false);
+      cache1 = (CacheSPI<String, String>) instance.createCache(false);
       cache1.getConfiguration().setClusterName("test");
       cache1.getConfiguration().setStateRetrievalTimeout(1000);
       cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
@@ -66,7 +63,7 @@
       cache1.getConfiguration().setCacheMode(cacheMode);
       cache1.start();
 
-      cache2 = (CacheImpl<String, String>)instance.createCache(false);
+      cache2 = (CacheSPI<String, String>) instance.createCache(false);
       cache2.getConfiguration().setClusterName("test");
       cache2.getConfiguration().setStateRetrievalTimeout(1000);
       cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
@@ -259,7 +256,7 @@
 
       // now try again with passing the default options
       cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
-      cache1.remove(fqn);
+      cache1.removeNode(fqn);
       delay();
 
       // both should be null

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/BasicPassivationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,11 +7,6 @@
 
 package org.jboss.cache.passivation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.fail;
-
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
@@ -24,6 +19,7 @@
 import org.jboss.cache.notifications.annotation.NodePassivated;
 import org.jboss.cache.notifications.event.Event;
 import org.jboss.cache.notifications.event.NodeEvent;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -32,10 +28,10 @@
  * @author Ben Wang
  * @version $Revision$
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public class BasicPassivationTest
 {
-   CacheImpl<String, String> cache_;
+   CacheImpl cache;
    int wakeupIntervalMillis_ = 0;
    final String ROOT_STR = "/test";
    Throwable t1_ex, t2_ex;
@@ -49,7 +45,7 @@
    public void setUp() throws Exception
    {
       initCaches();
-      wakeupIntervalMillis_ = cache_.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
+      wakeupIntervalMillis_ = cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
       log("wakeupInterval is " + wakeupIntervalMillis_);
       if (wakeupIntervalMillis_ < 0)
       {
@@ -60,22 +56,21 @@
       isTrue = true;
    }
 
-   private void initCaches() throws Exception
+   private void initCaches()
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache_ = (CacheImpl<String, String>)instance.createCache(false);
-      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"));// read in generic local xml
-      cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      cache = (CacheImpl) instance.createCache(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"), false);
+      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       Object listener = new TestCacheListener();
-      cache_.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
-      cache_.start();
-      cache_.getNotifier().addCacheListener(listener);
+      cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
+      cache.start();
+      cache.getNotifier().addCacheListener(listener);
    }
 
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
    {
-      cache_.stop();
+      cache.stop();
    }
 
    public void testBasic()
@@ -85,20 +80,20 @@
       Fqn fqn = Fqn.fromString(FQNSTR);
       try
       {
-         cache_.put(fqn, FQNSTR, FQNSTR);
+         cache.put(fqn, FQNSTR, FQNSTR);
       }
       catch (Exception e)
       {
          fail("Failed to insert data" + e);
          e.printStackTrace();
       }
-      System.out.println(cache_.toString());
+      System.out.println(cache.toString());
       TestingUtil.sleepThread(21000);
-      System.out.println(cache_.toString());
+      System.out.println(cache.toString());
       try
       {
-         assertFalse(cache_.exists(FQNSTR, FQNSTR));
-         String val = cache_.get(FQNSTR, FQNSTR);
+         assertFalse(cache.exists(FQNSTR, FQNSTR));
+         Object val = cache.get(FQNSTR, FQNSTR);
          assertNotNull("DataNode should not be empty ", val);
       }
       catch (Exception e)
@@ -113,20 +108,20 @@
    public void testDualPassivation() throws Exception
    {
       Fqn fqn = Fqn.fromString(FQNSTR);
-      cache_.put(fqn, "key", "value");
-      cache_.evict(fqn);
-      cache_.evict(fqn);
-      assertEquals("Proper value after 2 passivations", "value", cache_.get(fqn, "key"));
+      cache.put(fqn, "key", "value");
+      cache.evict(fqn);
+      cache.evict(fqn);
+      assertEquals("Proper value after 2 passivations", "value", cache.get(fqn, "key"));
    }
 
    public void testIntermingledPassivation() throws Exception
    {
       Fqn fqn = Fqn.fromString(FQNSTR);
-      cache_.put(fqn, "key1", "value");
-      cache_.evict(fqn);
-      cache_.put(fqn, "key2", "value");
-      cache_.evict(fqn);
-      assertEquals("Proper value after 2 passivations", "value", cache_.get(fqn, "key1"));
+      cache.put(fqn, "key1", "value");
+      cache.evict(fqn);
+      cache.put(fqn, "key2", "value");
+      cache.evict(fqn);
+      assertEquals("Proper value after 2 passivations", "value", cache.get(fqn, "key1"));
 
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,15 +7,14 @@
 
 package org.jboss.cache.passivation;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.fail;
-
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -30,7 +29,7 @@
 @Test(groups = {"functional"})
 public class ConcurrentPassivationTest
 {
-   private CacheImpl<Integer, String> cache_;
+   private CacheImpl cache_;
    private int wakeupIntervalMillis_ = 0;
 
    @BeforeMethod(alwaysRun = true)
@@ -45,11 +44,10 @@
 
    }
 
-   private void initCaches() throws Exception
+   private void initCaches()
    {
       CacheFactory<Integer, String> instance = DefaultCacheFactory.getInstance();
-      cache_ = (CacheImpl<Integer, String>)instance.createCache(false);
-      cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"));// read in generic local xml
+      cache_ = (CacheImpl) instance.createCache(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"), false);
       cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache_.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
       cache_.start();

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,16 +7,12 @@
 
 package org.jboss.cache.passivation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.fail;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.misc.TestingUtil;
@@ -26,6 +22,8 @@
 import org.jboss.cache.notifications.annotation.NodePassivated;
 import org.jboss.cache.notifications.event.Event;
 import org.jboss.cache.notifications.event.NodeEvent;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -36,7 +34,7 @@
 @Test(groups = {"functional"})
 public class LocalPassivationIntegrationTest
 {
-   CacheImpl<String, String> cache_;
+   CacheSPI<String, String> cache;
    protected final static Log log = LogFactory.getLog(LocalPassivationIntegrationTest.class);
    int wakeupIntervalMillis_ = 0;
    PassivationListener listener_;
@@ -46,18 +44,19 @@
    public void setUp() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache_ = (CacheImpl<String, String>)instance.createCache(false);
-      initCaches(cache_);
-      cache_.getConfiguration().setUseRegionBasedMarshalling(true);
+      cache = (CacheSPI<String, String>) instance.createCache(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"), false);
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+      cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
+      cache.getConfiguration().setUseRegionBasedMarshalling(true);
 
-      cache_.start();
+      cache.start();
 
       listener_ = new PassivationListener();
 
-      cache_.getNotifier().addCacheListener(listener_);
+      cache.getNotifier().addCacheListener(listener_);
       listener_.resetCounter();
 
-      wakeupIntervalMillis_ = cache_.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
+      wakeupIntervalMillis_ = cache.getConfiguration().getEvictionConfig().getWakeupIntervalSeconds() * 1000;
       log("wakeupInterval is " + wakeupIntervalMillis_);
       if (wakeupIntervalMillis_ <= 0)
       {
@@ -65,17 +64,10 @@
       }
    }
 
-   void initCaches(CacheImpl<String, String> cache) throws Exception
-   {
-      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-passivation-service.xml"));// read in generic local xml
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
-   }
-
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
    {
-      cache_.stop();
+      cache.stop();
    }
 
    /**
@@ -84,14 +76,14 @@
    {
       String rootStr = "/org/jboss/test/data/";
       String str = rootStr + "0";
-      cache_.remove("/");
+      cache.removeNode(Fqn.ROOT);
       listener_.resetCounter();
 
-      cache_.put(str, str, str);
+      cache.put(str, str, str);
 
       TestingUtil.sleepThread(20000);
-      assertFalse("UnversionedNode should not exist", cache_.exists(str, str));
-      String val = cache_.get(str, str);
+      assertFalse("UnversionedNode should not exist", cache.exists(str));
+      String val = cache.get(str, str);
       assertNotNull("DataNode should be activated ", val);
       TestingUtil.sleepThread(LISTENER_WAIT_TIME);
       assertEquals("Eviction counter ", 1, listener_.getCounter());

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,21 +6,10 @@
  */
 package org.jboss.cache.passivation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
@@ -35,10 +24,16 @@
 import org.jboss.cache.notifications.annotation.NodeActivated;
 import org.jboss.cache.notifications.annotation.NodePassivated;
 import org.jboss.cache.notifications.event.NodeEvent;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 /**
  * Tests that the TreeCacheListener implementation used by EJB3 SFSBs works.
  *
@@ -60,7 +55,7 @@
    {
       log.debug("");
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode("local");
       configureEviction();
       configureCacheLoader();
@@ -184,7 +179,7 @@
          if (bean == null)
          {
             activationException = new IllegalStateException("nodeActivate(): null bean instance.");
-            throw (IllegalStateException)activationException;
+            throw (IllegalStateException) activationException;
          }
 
          if (log.isTraceEnabled())

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,33 +1,14 @@
 package org.jboss.cache.passivation;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.Transaction;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Modification;
 import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.CacheLoader;
@@ -38,11 +19,22 @@
 import org.jboss.cache.xml.XmlHelper;
 import org.jboss.util.stream.MarshalledValueInputStream;
 import org.jboss.util.stream.MarshalledValueOutputStream;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Base tests for passivation using any of the cache loaders
  *
@@ -56,7 +48,7 @@
    Log log = LogFactory.getLog(getClass());
 
    //Cache Loader fields
-   CacheImpl<Object, Object> cache;
+   CacheSPI<Object, Object> cache;
    CacheLoader loader = null;
    static final Fqn<String> FQN = new Fqn<String>("key");
 
@@ -64,40 +56,40 @@
    protected CacheLoaderConfig getCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState) throws Exception
    {
       String xml = "<config>\n" +
-              "<passivation>true</passivation>\n" +
-              "<preload>" + preload + "</preload>\n" +
-              "<cacheloader>\n" +
-              "<class>" + cacheloaderClass + "</class>\n" +
-              "<properties>" + properties + "</properties>\n" +
-              "<async>" + async + "</async>\n" +
-              "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
-              "</cacheloader>\n" +
-              "</config>";
+            "<passivation>true</passivation>\n" +
+            "<preload>" + preload + "</preload>\n" +
+            "<cacheloader>\n" +
+            "<class>" + cacheloaderClass + "</class>\n" +
+            "<properties>" + properties + "</properties>\n" +
+            "<async>" + async + "</async>\n" +
+            "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
+            "</cacheloader>\n" +
+            "</config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
 
-   @BeforeMethod(alwaysRun = true) public void setUp() throws Exception
+   @BeforeMethod(alwaysRun = true)
+   public void setUp() throws Exception
    {
-      log.debug("");
-      cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheMode("local");
       configureCache();
-      // cache.setCacheLoaderPreload("/1/2/3/4/5/d");
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
       cache.create();
       cache.start();
-      loader = cache.getCacheLoader();
+      loader = cache.getCacheLoaderManager().getCacheLoader();
    }
 
    abstract protected void configureCache() throws Exception;
 
 
-   @AfterMethod(alwaysRun = true) public void tearDown() throws Exception
+   @AfterMethod(alwaysRun = true)
+   public void tearDown() throws Exception
    {
-      cache.remove("/");
-      loader.remove(Fqn.fromString("/"));
+      cache.removeNode(Fqn.ROOT);
+      loader.remove(Fqn.ROOT);
       cache.stop();
       cache.destroy();
    }
@@ -105,20 +97,38 @@
 
    protected void addDelay()
    {
-      ;// returns immediately in this case.  Subclasses may override where a delay is needed.
+      // returns immediately in this case.  Subclasses may override where a delay is needed.
    }
 
+   /**
+    * Helper method to test the existence of a key
+    *
+    * @param fqn
+    * @param key
+    */
+   protected boolean exists(String fqn, String key)
+   {
+      NodeSPI n = cache.peek(Fqn.fromString(fqn), false, false);
+      if (key == null) return n != null;
+      return n != null && n.getKeysDirect().contains(key);
+   }
+
+   protected boolean exists(String fqn)
+   {
+      return exists(fqn, null);
+   }
+
    public void testPrintPassivation() throws Exception
    {
       final Fqn<String> NODE = Fqn.fromString("/test");
       final String KEY = "key";
       loader.remove(NODE);
       cache.put(NODE, KEY, 10);
-      cache.evict(NODE);
+      cache.evict(NODE, true);
       assertTrue(loader.exists(NODE));
       addDelay();
       log.info("print node " + NODE);
-      String ret = cache.print(NODE);
+      Node ret = cache.getRoot().getChild(NODE);
       assertNotNull(ret);
       log.info("loader exists " + NODE);
       assertTrue(!loader.exists(NODE));
@@ -128,39 +138,39 @@
 
    public void testPutPassivation() throws Exception
    {
-      final String NODE = "/test";
+      final Fqn NODE = Fqn.fromString("/test");
       final String KEY = "key";
       Object retval = null;
-      cache.remove(NODE);// nothing to remove
+      cache.removeNode(NODE);// nothing to remove
       addDelay();
       retval = cache.put(NODE, KEY, 10);// put in memory
       assertNull(retval);
       retval = cache.put(NODE, KEY, 20);// put in memory
       addDelay();
       assertEquals(10, retval);// get from memory
-      cache.evict(Fqn.fromString(NODE));// passivate node
+      cache.evict(NODE, true);// passivate node
       addDelay();
       log.debug("______________");
       retval = cache.put(NODE, KEY, 30);// activate node then does put in memory
-      assertFalse(loader.exists(Fqn.fromString(NODE)));
+      assertFalse(loader.exists(NODE));
       assertEquals(20, retval);
    }
 
    public void testPut2Passivation() throws CacheException
    {
-      final String NODE = "/a/b/c";
+      final Fqn NODE = Fqn.fromString("/a/b/c");
       final String KEY = "key";
-      Object retval = null;
-      cache.remove(NODE);// nothing to remove
+      Object retval;
+      cache.removeNode(NODE);// nothing to remove
       addDelay();
       retval = cache.put(NODE, KEY, 10);// put in memory
       assertNull(retval);
       addDelay();
       retval = cache.put(NODE, KEY, 20);// put in memory
       assertEquals(10, retval);
-      cache.evict(Fqn.fromString(NODE));// passivate node
-      cache.evict(Fqn.fromString("/a/b"));// passivate parent node
-      cache.evict(Fqn.fromString("/a"));// passivate parent node
+      cache.evict(NODE, true);// passivate node
+      cache.evict(Fqn.fromString("/a/b"), true);// passivate parent node
+      cache.evict(Fqn.fromString("/a"), true);// passivate parent node
       addDelay();
       try
       {
@@ -173,7 +183,7 @@
       retval = cache.put(NODE, KEY, 30);// activate node, put in memory new value
       try
       {
-         assertFalse(loader.exists(Fqn.fromString(NODE)));
+         assertFalse(loader.exists(NODE));
       }
       catch (Exception e)
       {
@@ -185,26 +195,27 @@
 
    public void testSerializationPassivation() throws CacheException
    {
+      Fqn fqn = Fqn.fromString("/mypojo");
       SamplePojo pojo = new SamplePojo(39, "Hany");
       pojo.getHobbies().add("Running");
       pojo.getHobbies().add("Beerathlon");
       pojo.getHobbies().add("Triathlon");
-      cache.put("/mypojo", 322649, pojo);// put in memory
+      cache.put(fqn, 322649, pojo);// put in memory
       addDelay();
-      assertNotNull(cache.get("/mypojo", 322649));// get from memory
-      cache.evict(Fqn.fromString("/mypojo"));// passivate node
+      assertNotNull(cache.get(fqn, 322649));// get from memory
+      cache.evict(fqn, false);// passivate node
       try
       {
-         assertTrue(loader.exists(Fqn.fromString("/mypojo")));
+         assertTrue(loader.exists(fqn));
       }
       catch (Exception e)
       {
          fail(e.toString());
       }
-      SamplePojo pojo2 = (SamplePojo) cache.get("/mypojo", 322649);// activate node
+      SamplePojo pojo2 = (SamplePojo) cache.get(fqn, 322649);// activate node
       try
       {
-         assertFalse(loader.exists(Fqn.fromString("/mypojo")));
+         assertFalse(loader.exists(fqn));
       }
       catch (Exception e)
       {
@@ -229,7 +240,10 @@
             m.put("key" + i, "val" + i);
          }
          cache.put("/a/b/c", m);
-         cache.load("/1/2/3/4/5");
+
+         // force preloading this node from the cache loader.
+         cache.getCacheLoaderManager().preload(Fqn.fromString("/1/2/3/4/5"), true, true);
+
          cache.put("/1/2/3/4/5", null);
          cache.put("/1/2/3/4/5/a", null);
          cache.put("/1/2/3/4/5/b", null);
@@ -242,9 +256,9 @@
          // cache.put("/a/b/c", "newKey", "newValue");
          System.out.println("cache: " + cache);
 
-         assertTrue(cache.exists("/1/2/3/4"));
-         assertTrue(cache.exists("/a/b/c"));
-         assertFalse(cache.exists("/a/b/c/d"));
+         assert (exists("/1/2/3/4"));
+         assert (exists("/a/b/c"));
+         assert (!exists("/a/b/c/d"));
       }
       catch (Exception e)
       {
@@ -255,7 +269,7 @@
 
    public void testPreloadingPassivation() throws Exception
    {
-      cache.remove("/");// remove nothing
+      cache.removeNode(Fqn.ROOT);// remove nothing
       cache.put("1/2/3/4/5/d", "key", "val");// put in memory
       cache.evict(Fqn.fromString("1/2/3/4/5/d"));// passivate node
       System.out.println("-- checking for 1/2/3/4/5/d");
@@ -268,9 +282,9 @@
       {
          fail(e.toString());
       }
-      cache.get("1/2/3/4/5/d");// get from loader but doesn't load attributes
+      cache.getNode("1/2/3/4/5/d");// get from loader but doesn't load attributes
       assertEquals(true, loader.exists(Fqn.fromString("1/2/3/4/5/d")));
-      assertTrue(cache.exists("1/2/3/4/5/d"));
+      assert (exists("1/2/3/4/5/d"));
       System.out.println("-- 1/2/3/4/5/d exists");
       cache.get("1/2/3/4/5/d", "key");// activate node
       assertEquals(false, loader.exists(Fqn.fromString("1/2/3/4/5/d")));
@@ -281,7 +295,7 @@
    {
       Set<Object> keys = null;
       cache.put("/a/b/c", "key", "val");
-      keys = cache.getKeys(Fqn.fromString("/a/b/c"));
+      keys = cache.getNode(Fqn.fromString("/a/b/c")).getKeys();
       assertNotNull(keys);
       assertEquals(1, keys.size());
       keys.add("myKey");
@@ -291,11 +305,11 @@
    public void testExists() throws Exception
    {
       cache.put("/eins/zwei/drei", "key1", "val1");
-      assertTrue(cache.exists("/eins/zwei/drei"));
-      assertTrue(cache.exists("/eins/zwei/drei", "key1"));
-      assertFalse(cache.exists("/eins/zwei/drei", "key2"));
-      assertFalse(cache.exists("/uno/due/tre"));
-      assertFalse(cache.exists("/une/due/tre", "key1"));
+      assert (exists("/eins/zwei/drei"));
+      assert (exists("/eins/zwei/drei", "key1"));
+      assert (!exists("/eins/zwei/drei", "key2"));
+      assert (!exists("/uno/due/tre"));
+      assert (!exists("/une/due/tre", "key1"));
    }
 
    public void testGetChildren() throws Exception
@@ -303,8 +317,8 @@
       cache.put("/d/one", null);
       cache.put("/d/two", null);
       cache.put("/d/three", null);
-      cache.get("/d");
-      Set children = cache.getChildrenNames("/d");
+      cache.getNode("/d");
+      Set children = cache.getNode("/d").getChildrenNames();
       assertNotNull(children);
       assertEquals(3, children.size());
       assertTrue(children.contains("one"));
@@ -326,7 +340,7 @@
       cache.evict(Fqn.fromString("/a"));// passivate node
       cache.evict(Fqn.fromString("/"));// passivate node
       addDelay();
-      Set children = cache.getChildrenNames("/a/b/c");// load node children names
+      Set children = cache.getNode("/a/b/c").getChildrenNames();// load node children names
       assertNotNull(children);
       assertEquals(3, children.size());
       assertTrue(children.contains("1"));
@@ -352,7 +366,7 @@
       {
          cache.put("/1", null);
          cache.put("a", null);
-         Set children = cache.getChildrenNames("/");// get root node children names
+         Set children = cache.getRoot().getChildrenNames();// get root node children names
          assertNotNull(children);
          assertEquals(2, children.size());
          assertTrue(children.contains("1"));
@@ -370,7 +384,7 @@
       {
          cache.put("/1", null);
          cache.put("a", null);
-         Set children = cache.getChildrenNames("");// get children from root node
+         Set children = cache.getRoot().getChildrenNames();// get children from root node
          assertNotNull(children);
          assertEquals(2, children.size());
          assertTrue(children.contains("1"));
@@ -390,7 +404,7 @@
          {
             cache.put("/a/b/c", null);
          }
-         Set children = cache.getChildrenNames((Fqn<Object>) null);// get "null* node children names
+         Set children = cache.getRoot().getChildrenNames();// get "null* node children names
          assertTrue(children.isEmpty());
       }
       catch (Exception e)
@@ -407,12 +421,11 @@
          cache.put("/a/1", null);
          cache.put("/a/2", null);
          cache.put("/a/3", null);
-         System.out.println("cache is " + cache.printLockInfo());
 
-         Node n = cache.get("/a");
+         Node n = cache.getNode("/a");
          assertNotNull(n);
 
-         Set children = cache.getChildrenNames("/a");
+         Set children = n.getChildrenNames();
          assertNotNull(children);
          assertEquals(3, children.size());
       }
@@ -428,17 +441,15 @@
       cache.put("/a/1", null);// put node in memory
       cache.put("/a/2", null);// put node in memory
       cache.put("/a/3", null);// put node in memory
-      System.out.println("cache is " + cache.printLockInfo());
       cache.evict(Fqn.fromString("/a/1"));// passivate node
       cache.evict(Fqn.fromString("/a/2"));// passivate node
       cache.evict(Fqn.fromString("/a/3"));// passivate node
       cache.evict(Fqn.fromString("/a"));// passivate node
       assertTrue(loader.exists(Fqn.fromString("/a")));
-      System.out.println("cache is " + cache.printLockInfo());
       addDelay();
-      assertNotNull(cache.get("/a"));// load node
+      assertNotNull(cache.getNode("/a"));// load node
       assertTrue(loader.exists(Fqn.fromString("/a")));// children haven't been loaded
-      Set children = cache.getChildrenNames("/a");
+      Set children = cache.getNode("/a").getChildrenNames();
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -458,18 +469,16 @@
       cache.put("/a/2", null);
       cache.put("/a/3", null);
       cache.put("/a", "test", "test");
-      System.out.println("cache is " + cache.printLockInfo());
       cache.evict(Fqn.fromString("/a/1"));// passivate node
       cache.evict(Fqn.fromString("/a/2"));// passivate node
       cache.evict(Fqn.fromString("/a/3"));// passivate node
       cache.evict(Fqn.fromString("/a"));// passivate node
       assertTrue(loader.exists(Fqn.fromString("/a")));
-      System.out.println("cache is " + cache.printLockInfo());
       addDelay();
       Object val = cache.get("/a", "test");// load node's attributes but not children
       assertEquals("attributes weren't loaded", "test", val);
 
-      Set children = cache.getChildrenNames("/a");// get node's children names
+      Set children = cache.getNode("/a").getChildrenNames();
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -487,20 +496,18 @@
       cache.put("/a/1", null);
       cache.put("/a/2", null);
       cache.put("/a/3", null);
-      System.out.println("cache is " + cache.printLockInfo());
       cache.evict(Fqn.fromString("/a/1"));// passivate node
       cache.evict(Fqn.fromString("/a/2"));// passivate node
       cache.evict(Fqn.fromString("/a/3"));// passivate node
       cache.evict(Fqn.fromString("/a"));// passivate node
 
-      System.out.println("cache is " + cache.printLockInfo());
       addDelay();
       assertNull(cache.get("/a", "test"));// load attributes only
       assertTrue(loader.exists(Fqn.fromString("/a")));// loaded attibutes but not children
 
       assertNull(cache.get("/a/1", "test"));// activate node
       assertFalse(loader.exists(Fqn.fromString("/a/1")));// loaded attributes and has no children
-      Set children = cache.getChildrenNames("/a");// load children names
+      Set children = cache.getNode("/a").getChildrenNames();// load children names
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -512,13 +519,11 @@
       cache.put("/a/1", null);
       cache.put("/a/2", null);
       cache.put("/a/3", null);
-      System.out.println("cache is " + cache.printLockInfo());
       cache.evict(Fqn.fromString("/a/1"));// passivate node
       cache.evict(Fqn.fromString("/a/2"));// passivate node
       cache.evict(Fqn.fromString("/a/3"));// passivate node
       cache.evict(Fqn.fromString("/a"));// passivate node
       assertTrue(loader.exists(Fqn.fromString("/a")));
-      System.out.println("cache is " + cache.printLockInfo());
       addDelay();
 
       cache.get("/a/1", "test");// activate node
@@ -527,7 +532,7 @@
       assertFalse(loader.exists(Fqn.fromString("/a/2")));
       cache.get("/a/3", "test");// activate node
       assertFalse(loader.exists(Fqn.fromString("/a/3")));
-      Set children = cache.getChildrenNames("/a");// get node's children names
+      Set children = cache.getNode("/a").getChildrenNames();// get node's children names
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -538,7 +543,6 @@
       cache.evict(Fqn.fromString("/a/2"));// passivate node
       cache.evict(Fqn.fromString("/a/3"));// passivate node
       cache.evict(Fqn.fromString("/a"));// passivate node
-      System.out.println("cache is " + cache.printLockInfo());
       assertTrue(loader.exists(Fqn.fromString("/a")));
 
       cache.get("/a/1", "test");// activate node
@@ -547,7 +551,7 @@
       assertFalse(loader.exists(Fqn.fromString("/a/2")));
       cache.get("/a/3", "test");// activate node
       assertFalse(loader.exists(Fqn.fromString("/a/3")));
-      children = cache.getChildrenNames("/a");// get children names
+      children = cache.getNode("/a").getChildrenNames();// get children names
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -561,12 +565,10 @@
       cache.put("/a/1", null);
       cache.put("/a/2", null);
       cache.put("/a/3", null);
-      System.out.println("cache is " + cache.printLockInfo());
       cache.evict(Fqn.fromString("/a/1"));// passivate node
       cache.evict(Fqn.fromString("/a/2"));// passivate node
       cache.evict(Fqn.fromString("/a/3"));// passivate node
       cache.evict(Fqn.fromString("/a"));// passivate node
-      System.out.println("cache is " + cache.printLockInfo());
       addDelay();
       assertTrue(loader.exists(Fqn.fromString("/a")));
       assertNull(cache.get("/a", "test"));// load attributes from loader
@@ -579,7 +581,7 @@
       assertFalse(loader.exists(Fqn.fromString("/a/2")));
       cache.get("/a/3", "test");// passivate node
       assertFalse(loader.exists(Fqn.fromString("/a/3")));
-      Set children = cache.getChildrenNames("/a");
+      Set children = cache.getNode("/a").getChildrenNames();
       assertNotNull("No children were loaded", children);
       System.out.println("children: " + children);
       assertEquals("3 children weren't loaded", 3, children.size());
@@ -594,11 +596,11 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      assertEquals(3, cache.getKeys(key).size());
-      cache.removeData(key);
-      Set<Object> keys = cache.getKeys(Fqn.fromString(key));
+      assertEquals(3, cache.getNode(key).getKeys().size());
+      cache.getNode(key).clearData();
+      Set<Object> keys = cache.getNode(key).getKeys();
       assertEquals(0, keys.size());
-      cache.remove("/x");
+      cache.removeNode("/x");
       Object val = cache.get(key, "keyA");
       assertNull(val);
    }
@@ -612,13 +614,13 @@
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
       addDelay();
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertEquals(3, keys.size());
-      cache.removeData(key);
+      cache.getNode(key).clearData();
       cache.evict(key);// passivate node
 
       addDelay();
-      keys = cache.getKeys(key);// activate node
+      keys = cache.getNode(key).getKeys();// activate node
       assertFalse(loader.exists(key));
       assertEquals(0, keys.size());
    }
@@ -630,12 +632,12 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      keys = cache.getKeys(key);
+      keys = cache.getNode(key).getKeys();
       assertEquals(3, keys.size());
       cache.evict(key);// passivate node
       assertTrue(loader.exists(key));
-      cache.removeData(key);
-      keys = cache.getKeys(key);// activate node
+      cache.getNode(key).clearData();
+      keys = cache.getNode(key).getKeys();// activate node
       assertFalse(loader.exists(key));
       assertEquals(0, keys.size());
    }
@@ -647,17 +649,17 @@
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
       cache.remove(key, "keyA");
-      assertEquals(2, cache.getKeys(key).size());
-      cache.remove("/x");
+      assertEquals(2, cache.getNode(key).getKeys().size());
+      cache.removeNode("/x");
    }
 
 
    public void testRemoveKey2() throws CacheException
    {
-      final String NODE = "/test";
+      final Fqn NODE = Fqn.fromString("/test");
       final String KEY = "key";
       Object retval = null;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       retval = cache.put(NODE, KEY, 10);
       assertNull(retval);
       addDelay();
@@ -670,25 +672,25 @@
 
    public void testRemoveKey3Passivation() throws Exception
    {
-      final String NODE = "/test";
+      final Fqn NODE = Fqn.fromString("/test");
       final String KEY = "key";
       Object retval = null;
-      cache.remove(NODE);
+      cache.removeNode(NODE);
       retval = cache.put(NODE, KEY, 10);
       assertNull(retval);
 
-      cache.evict(Fqn.fromString(NODE));// passivate node
+      cache.evict(NODE);// passivate node
       addDelay();
-      assertTrue(loader.exists(Fqn.fromString(NODE)));
-      assertEquals(10, loader.get(Fqn.fromString(NODE)).get(KEY));
+      assertTrue(loader.exists(NODE));
+      assertEquals(10, loader.get(NODE).get(KEY));
       retval = cache.remove(NODE, KEY);// activate node
       assertEquals(10, retval);
-      assertFalse(loader.exists(Fqn.fromString(NODE)));
+      assertFalse(loader.exists(NODE));
 
-      cache.evict(Fqn.fromString(NODE));// passiave node
+      cache.evict(NODE);// passiave node
       addDelay();
       retval = cache.remove(NODE, KEY);// activate node
-      assertFalse(loader.exists(Fqn.fromString(NODE)));
+      assertFalse(loader.exists(NODE));
       assertNull(retval);
    }
 
@@ -699,25 +701,25 @@
       cache.put(key, "keyA", "valA");
       cache.put(key, "keyB", "valB");
       cache.put(key, "keyC", "valC");
-      cache.remove("/x");
+      cache.removeNode("/x");
       assertNull(cache.get(key, "keyA"));
       addDelay();
-      Set<Object> keys = cache.getKeys(Fqn.fromString(key));
+      Set<Object> keys = cache.getNode(key).getKeys();
       assertNull(keys);
-      cache.remove("/x");
+      cache.removeNode("/x");
    }
 
 
    public void testRemoveRoot() throws Exception
    {
-      assertEquals(0, cache.getKeys("/").size());
+      assertEquals(0, cache.getRoot().getKeys().size());
       cache.put("/1/2/3/4/5", null);
       cache.put("uno/due/tre", null);
       cache.put("1/2/3/a", null);
       cache.put("/eins/zwei/drei", null);
       cache.put("/one/two/three", null);
-      cache.remove("/");
-      assertEquals(0, cache.getKeys("/").size());
+      cache.removeNode(Fqn.ROOT);
+      assertEquals(0, cache.getRoot().getKeys().size());
    }
 
 
@@ -728,16 +730,16 @@
       cache.evict(Fqn.fromString("/first/second"));// pasivate node to cache loader
       addDelay();
       assertTrue(loader.exists(Fqn.fromString("/first/second")));
-      assertTrue(cache.exists("/first"));
+      assert (exists("/first"));
       String val = (String) cache.get("/first/second", "key1");
       assertTrue(loader.exists(Fqn.fromString("/first/second")));
       assertEquals("val1", val);
       String val2 = (String) cache.get("/first/second/third", "key2");// activate node
       assertFalse(loader.exists(Fqn.fromString("/first/second/third")));
       assertEquals("val2", val2);
-      assertTrue(cache.exists("/first/second/third"));
-      assertTrue(cache.exists("/first/second"));
-      assertTrue(cache.exists("/first"));
+      assert (exists("/first/second/third"));
+      assert (exists("/first/second"));
+      assert (exists("/first"));
    }
 
 
@@ -747,14 +749,14 @@
       cache.evict(Fqn.fromString("/first/second/third"));// passivate node, note: it has no children
       addDelay();
       assertTrue(loader.exists(Fqn.fromString("/first/second/third")));
-      assertTrue(cache.exists("/first/second"));
-      assertTrue(cache.exists("/first"));
+      assert (exists("/first/second"));
+      assert (exists("/first"));
       String val = (String) cache.get("/first/second/third", "key1");// activate node
       assertFalse(loader.exists(Fqn.fromString("/first/second/third")));
       assertEquals("val1", val);
-      assertTrue(cache.exists("/first/second/third"));
-      assertTrue(cache.exists("/first/second"));
-      assertTrue(cache.exists("/first"));
+      assert (exists("/first/second/third"));
+      assert (exists("/first/second"));
+      assert (exists("/first"));
    }
 
 
@@ -775,7 +777,7 @@
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();
       mgr.getTransaction();
-      Set<?> children = cache.getChildrenNames("/a");
+      Set<?> children = cache.getNode("/a").getChildrenNames();
       assertEquals(3, children.size());
       assertTrue(children.contains("1"));
       assertTrue(children.contains("2"));
@@ -785,7 +787,7 @@
    }
 
 
-   public void testTxPutCommit() throws Exception, NotSupportedException
+   public void testTxPutCommit() throws Exception
    {
 
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -796,7 +798,7 @@
 
       mgr.commit();
 
-      assertNotNull(cache.getKeys("/one/two/three"));
+      assertNotNull(cache.getNode("/one/two/three").getKeys());
       assertEquals("val1", cache.get(Fqn.fromString("/one/two/three"), "key1"));
       mgr.begin();
 
@@ -806,10 +808,10 @@
       mgr.commit();
       assertTrue(loader.exists(Fqn.fromString("/one/two/three")));
       assertTrue(loader.exists(Fqn.fromString("/one/two/three/four")));
-      assertNotNull(cache.getKeys("/one/two/three"));
-      Set<?> children = cache.getChildrenNames("/one");
+      assertNotNull(cache.getNode("/one/two/three").getKeys());
+      Set<?> children = cache.getNode("/one").getChildrenNames();
       assertEquals(1, children.size());
-      cache.remove("/");
+      cache.removeNode(Fqn.ROOT);
    }
 
 
@@ -817,7 +819,7 @@
    {
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
 
-      cache.remove("/one");
+      cache.removeNode("/one");
       addDelay();
       mgr.begin();
 
@@ -825,9 +827,9 @@
       cache.put("/one/two/three/four", "key2", "val2");
       mgr.rollback();
       addDelay();
-      assertNull(cache.getKeys("/one/two/three"));
-      Set<?> children = cache.getChildrenNames("/one");
-      assertTrue(children.isEmpty());
+      assertNull(cache.getNode("/one/two/three"));
+      assert cache.getNode("/one") == null;
+
       assertFalse(loader.exists(Fqn.fromString("/one/two/three")));
       assertFalse(loader.exists(Fqn.fromString("/one/two/three/four")));
    }
@@ -859,7 +861,7 @@
     * Tests basic operations without a transaction.
     */
    public void testBasicOperations()
-           throws Exception
+         throws Exception
    {
 
       doTestBasicOperations();
@@ -869,7 +871,7 @@
     * Tests basic operations with a transaction.
     */
    public void testBasicOperationsTransactional()
-           throws Exception
+         throws Exception
    {
 
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -911,7 +913,7 @@
     * Do basic put tests for a given FQN.
     */
    private void doPutTests(Fqn<String> fqn)
-           throws Exception
+         throws Exception
    {
 
       assertTrue(!loader.exists(fqn));
@@ -958,7 +960,7 @@
     * Do basic remove tests for a given FQN.
     */
    private void doRemoveTests(Fqn<String> fqn)
-           throws Exception
+         throws Exception
    {
 
       /* remove(Fqn,Object) */
@@ -991,7 +993,7 @@
     * and tests removing subtrees.
     */
    public void testMultiLevelTree()
-           throws Exception
+         throws Exception
    {
 
       /* Create top level node implicitly. */
@@ -1155,7 +1157,7 @@
     * Tests the getChildrenNames() method.
     */
    public void testGetChildrenNames()
-           throws Exception
+         throws Exception
    {
 
       checkChildren(new Fqn(), null);
@@ -1181,14 +1183,14 @@
       loader.put(Fqn.fromString("/key0/abc"), null);
       addDelay();
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc"});
+            new String[]{"a", "ab", "abc"});
 
       loader.put(Fqn.fromString("/key0/xxx"), null);
       loader.put(Fqn.fromString("/key0/xx"), null);
       loader.put(Fqn.fromString("/key0/x"), null);
       addDelay();
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
 
       loader.put(Fqn.fromString("/key0/a/1"), null);
       loader.put(Fqn.fromString("/key0/a/2"), null);
@@ -1197,7 +1199,7 @@
       checkChildren(Fqn.fromString("/key0/a/2"), new String[]{"1"});
       checkChildren(Fqn.fromString("/key0/a"), new String[]{"1", "2"});
       checkChildren(Fqn.fromString("/key0"),
-              new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
+            new String[]{"a", "ab", "abc", "x", "xx", "xxx"});
       //
       //      loader.put(Fqn.fromString("/key0/\u0000"), null);
       //      loader.put(Fqn.fromString("/key0/\u0001"), null);
@@ -1224,7 +1226,7 @@
     * Checks that the given list of children part names is returned.
     */
    private void checkChildren(Fqn fqn, String[] names)
-           throws Exception
+         throws Exception
    {
 
       Set set = loader.getChildrenNames(fqn);
@@ -1246,7 +1248,7 @@
     * Tests basic operations without a transaction.
     */
    public void testModifications()
-           throws Exception
+         throws Exception
    {
 
       doTestModifications();
@@ -1256,7 +1258,7 @@
     * Tests basic operations with a transaction.
     */
    public void testModificationsTransactional()
-           throws Exception
+         throws Exception
    {
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();
@@ -1268,7 +1270,7 @@
     * Tests modifications.
     */
    private void doTestModifications()
-           throws Exception
+         throws Exception
    {
 
       /* PUT_KEY_VALUE, PUT_DATA */
@@ -1315,7 +1317,7 @@
     * Tests a one-phase transaction.
     */
    public void testOnePhaseTransaction()
-           throws Exception
+         throws Exception
    {
       List<Modification> mods = createUpdates();
       loader.prepare(null, mods, true);
@@ -1326,7 +1328,7 @@
     * Tests a two-phase transaction.
     */
    public void testTwoPhaseTransactionPassivation()
-           throws Exception
+         throws Exception
    {
 
       Object txnKey = new Object();
@@ -1345,7 +1347,7 @@
     * Tests rollback of a two-phase transaction.
     */
    public void testTransactionRollbackPassivation()
-           throws Exception
+         throws Exception
    {
 
       loader.remove(Fqn.fromString("/"));
@@ -1407,7 +1409,7 @@
     * Checks that a list of modifications was applied.
     */
    private void checkModifications(List<Modification> list)
-           throws Exception
+         throws Exception
    {
 
       for (int i = 0; i < list.size(); i += 1)
@@ -1451,7 +1453,7 @@
     * Tests that null keys and values work as for a standard Java Map.
     */
    public void testNullKeysAndValues()
-           throws Exception
+         throws Exception
    {
 
       loader.put(FQN, null, "x");
@@ -1506,7 +1508,7 @@
     * Test non-default database name.
     */
    public void testDatabaseNamePassivation()
-           throws Exception
+         throws Exception
    {
 
       loader.put(FQN, "one", "two");
@@ -1518,7 +1520,7 @@
     * Test load/store state.
     */
    public void testLoadAndStore()
-           throws Exception
+         throws Exception
    {
 
       /* Empty state. */
@@ -1593,7 +1595,7 @@
          {
             Complex x = (Complex) o;
             return (nested != null) ? nested.equals(x.nested)
-                    : (x.nested == null);
+                  : (x.nested == null);
          }
          catch (ClassCastException e)
          {

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToJDBCCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToJDBCCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToJDBCCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,13 +6,13 @@
  */
 package org.jboss.cache.passivation;
 
-import java.util.Properties;
-
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.xml.XmlHelper;
 import org.w3c.dom.Element;
 
+import java.util.Properties;
+
 /**
  * Tests passivation using JDBC Cache Loader.
  * This test has MySQL hard-coded. To run it, run MySQL first: mysqld -u=root
@@ -27,27 +27,27 @@
    protected CacheLoaderConfig getCacheLoaderConfig() throws Exception
    {
       String xml = "            <config>\n" +
-                   "                \n" +
-                   "                <passivation>true</passivation>\n" +
-                   "                <preload></preload>\n" +
-                   "\n" +
-                   "                <cacheloader>\n" +
-                   "                    <class>org.jboss.cache.loader.JDBCCacheLoader</class>\n" +
-                   "                    <properties>\n" +
-                   getJDBCProps() +
-                   "                    </properties>\n" +
-                   "                    <async>false</async>\n" +
-                   "                    <fetchPersistentState>false</fetchPersistentState>\n" +
-                   "                    <ignoreModifications>false</ignoreModifications>\n" +
-                   "                </cacheloader>\n" +
-                   "                \n" +
-                   "            </config>";
+            "                \n" +
+            "                <passivation>true</passivation>\n" +
+            "                <preload></preload>\n" +
+            "\n" +
+            "                <cacheloader>\n" +
+            "                    <class>org.jboss.cache.loader.JDBCCacheLoader</class>\n" +
+            "                    <properties>\n" +
+            getJDBCProps() +
+            "                    </properties>\n" +
+            "                    <async>false</async>\n" +
+            "                    <fetchPersistentState>false</fetchPersistentState>\n" +
+            "                    <ignoreModifications>false</ignoreModifications>\n" +
+            "                </cacheloader>\n" +
+            "                \n" +
+            "            </config>";
       Element element = XmlHelper.stringToElement(xml);
       return XmlConfigurationParser.parseCacheLoaderConfig(element);
    }
 
 
-   protected String getJDBCProps() throws Exception
+   protected String getJDBCProps()
    {
       Properties prop = new Properties();
       try
@@ -59,11 +59,11 @@
          System.out.println("Error loading jdbc properties ");
       }
       return "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.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat");
+            "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.sql-concat=" + prop.getProperty("cache.jdbc.sql-concat");
    }
 
    protected void configureCache() throws Exception

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationToLocalDelegatingCacheLoaderTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,10 +1,11 @@
 package org.jboss.cache.passivation;
 
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.LocalDelegatingCacheLoader;
+import org.jboss.cache.misc.TestingUtil;
 import org.testng.annotations.AfterMethod;
 
 /**
@@ -15,23 +16,27 @@
  */
 public class PassivationToLocalDelegatingCacheLoaderTest extends PassivationTestsBase
 {
-   CacheImpl delegating_cache;
+   CacheSPI delegating_cache;
    CacheLoader cache_loader;
 
    @SuppressWarnings("deprecation")
    protected void configureCache() throws Exception
    {
-      delegating_cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+      delegating_cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       delegating_cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       delegating_cache.create();
       delegating_cache.start();
       cache_loader = new LocalDelegatingCacheLoader(delegating_cache);
       // setCache first ...
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig("", "org.jboss.cache.loader.LocalDelegatingCacheLoader", "", false, false));
-      cache.setCacheLoader(cache_loader);
+      cache.getCacheLoaderManager().setCacheLoader(cache_loader);
+
+      // don't actually alter the interceptor chain, but this will force a re-injection of all deps in all components.
+      TestingUtil.replaceInterceptorChain(cache, cache.getInterceptorChain().get(0));
    }
 
-   @AfterMethod(alwaysRun = true) public void tearDown() throws Exception
+   @AfterMethod(alwaysRun = true)
+   public void tearDown() throws Exception
    {
       super.tearDown();
       delegating_cache.stop();

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ReplicatedPassivationIntegrationTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -22,15 +22,14 @@
 
 package org.jboss.cache.passivation;
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.fail;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.misc.TestingUtil;
@@ -39,6 +38,8 @@
 import org.jboss.cache.notifications.annotation.NodeLoaded;
 import org.jboss.cache.notifications.annotation.NodePassivated;
 import org.jboss.cache.notifications.event.NodeEvent;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -46,11 +47,11 @@
 /**
  * @author Ben Wang, Feb 11, 2004
  */
- at Test(groups = { "functional", "jgroups" })
+ at Test(groups = {"functional", "jgroups"})
 public class ReplicatedPassivationIntegrationTest
 {
-   private CacheImpl<String, String> cache_;
-   private CacheImpl<String, String> cache1_;
+   private CacheSPI<String, String> cache_;
+   private CacheSPI<String, String> cache1_;
    protected final static Log log = LogFactory.getLog(ReplicatedPassivationIntegrationTest.class);
    int wakeupIntervalMillis_ = 0;
    PassivationListener listener_;
@@ -64,13 +65,11 @@
    public void setUp() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache_ = (CacheImpl<String, String>)instance.createCache(false);
-      initCaches(cache_);
+      cache_ = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
       cache_.getConfiguration().setUseRegionBasedMarshalling(true);
       cache_.start();
 
-      cache1_ = (CacheImpl<String, String>)instance.createCache(false);
-      initCaches(cache1_);
+      cache1_ = (CacheSPI<String, String>) instance.createCache(getCfg(), false);
       cache1_.getConfiguration().setUseRegionBasedMarshalling(true);
 
       cache1_.start();
@@ -85,11 +84,12 @@
       }
    }
 
-   void initCaches(CacheImpl<String, String> cache) throws Exception
+   Configuration getCfg() throws Exception
    {
-      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replSync-passivation-service.xml"));// read in generic local xml
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      cache.getConfiguration().getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
+      Configuration cfg = new XmlConfigurationParser().parseFile("META-INF/replSync-passivation-service.xml");// read in generic local xml
+      cfg.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      cfg.getCacheLoaderConfig().getFirstCacheLoaderConfig().setClassName(DummyInMemoryCacheLoader.class.getName());
+      return cfg;
    }
 
    @AfterMethod(alwaysRun = true)
@@ -106,13 +106,14 @@
       String rootStr = "/org/jboss/test/data/";
       String rootStr1 = "/__JBossInternal__/5c4o12-pzhlhj-esnuy3sg-1-esnuy3sg-2";
       String str = rootStr + "0";
-      cache_.remove("/");
+      cache_.removeNode(Fqn.ROOT);
 
       cache_.put(str, str, str);
       cache_.put(rootStr1, str, str);
 
       TestingUtil.sleepThread(11000);
-      assertFalse("UnversionedNode should not exist", cache1_.exists(str, str));
+      Node n = cache1_.peek(Fqn.fromString(str), false, false);
+      assert n == null || !n.getKeys().contains(str) : "UnversionedNode should not exist";
       String val;
       val = cache1_.get(str, str);
       val = cache1_.get(rootStr1, str);

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -8,35 +8,31 @@
 
 package org.jboss.cache.replicated;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.TransactionManager;
+
 /**
- * Unit test for replicated async CacheImpl. Use locking and multiple threads to test
+ * Unit test for replicated async CacheSPI. Use locking and multiple threads to test
  * concurrent access to the tree.
  *
  * @version $Revision$
  */
- at Test(groups = { "functional", "jgroups" })
+ at Test(groups = {"functional", "jgroups"})
 public class AsyncReplTest
 {
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
+
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
@@ -47,10 +43,9 @@
       cache2 = createCache("CacheGroup");
    }
 
-   private CacheImpl<Object, Object> createCache(String name) throws Exception
+   private CacheSPI<Object, Object> createCache(String name) throws Exception
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      cache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC));
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
       cache.getConfiguration().setClusterName(name);
 
       // Call the hook that allows mux integration
@@ -114,7 +109,7 @@
 
       cache1.put(fqn, key, "value1");
       // allow for replication
-      TestingUtil.sleepThread((long)500);
+      TestingUtil.sleepThread((long) 500);
       assertEquals("value1", cache1.get(fqn, key));
       assertEquals("value1", cache2.get(fqn, key));
 
@@ -127,7 +122,7 @@
 
       mgr.commit();
 
-      TestingUtil.sleepThread((long)500);
+      TestingUtil.sleepThread((long) 500);
 
       assertEquals("value2", cache1.get(fqn, key));
       assertEquals("value2", cache2.get(fqn, key));
@@ -139,7 +134,7 @@
 
       mgr.rollback();
 
-      TestingUtil.sleepThread((long)500);
+      TestingUtil.sleepThread((long) 500);
 
       assertEquals("value2", cache1.get(fqn, key));
       assertEquals("value2", cache2.get(fqn, key));
@@ -160,7 +155,7 @@
 
    public void testPutShouldNotReplicateToDifferentCluster()
    {
-      CacheImpl<Object, Object> cache3 = null, cache4 = null;
+      CacheSPI<Object, Object> cache3 = null, cache4 = null;
       try
       {
          cache3 = createCache("DifferentGroup");
@@ -168,7 +163,7 @@
          cache1.put("/a/b/c", "age", 38);
          // because we use async repl, modfication may not yet have been propagated to cache2, so
          // we have to wait a little
-         TestingUtil.sleepThread((long)1000);
+         TestingUtil.sleepThread((long) 1000);
          assertNull("Should not have replicated", cache3.get("/a/b/c", "age"));
       }
       catch (Exception e)
@@ -190,7 +185,7 @@
 
    public void testStateTransfer()
    {
-      CacheImpl<Object, Object> cache4 = null;
+      CacheSPI<Object, Object> cache4 = null;
       try
       {
          cache1.put("a/b/c", "age", 38);
@@ -222,7 +217,7 @@
          cache1.put("/a/b/c", "age", 38);
 
          // value on cache2 may be 38 or not yet replicated
-         age = (Integer)cache2.get("/a/b/c", "age");
+         age = (Integer) cache2.get("/a/b/c", "age");
          log("attr \"age\" of \"/a/b/c\" on cache2=" + age);
          assertTrue("should be either null or 38", age == null || age == 38);
       }
@@ -244,7 +239,7 @@
          tm.commit();
 
          // value on cache2 may be 38 or not yet replicated
-         age = (Integer)cache2.get("/a/b/c", "age");
+         age = (Integer) cache2.get("/a/b/c", "age");
          log("attr \"age\" of \"/a/b/c\" on cache2=" + age);
          assertTrue("should be either null or 38", age == null || age == 38);
       }

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,39 +7,36 @@
  */
 package org.jboss.cache.replicated;
 
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.io.NotSerializableException;
-import java.io.Serializable;
-
-import javax.naming.Context;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.transaction.DummyTransactionManager;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.naming.Context;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.io.NotSerializableException;
+import java.io.Serializable;
+
 /**
  * Teting of replication exception for a Nonerislizable object
  *
  * @author Ben Wang
  * @version $Revision$
  */
- at Test(groups = { "functional" })
+ at Test(groups = {"functional"})
 public class ReplicationExceptionTest
 {
-   private CacheImpl<String, ContainerData> cache1, cache2;
+   private CacheSPI<String, ContainerData> cache1, cache2;
 
    String old_factory = null;
    final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
@@ -70,11 +67,11 @@
       return mgr;
    }
 
-   private void initCaches(Configuration.CacheMode caching_mode) throws Exception
+   private void initCaches(Configuration.CacheMode caching_mode)
    {
       CacheFactory<String, ContainerData> instance = DefaultCacheFactory.getInstance();
-      cache1 = (CacheImpl<String, ContainerData>)instance.createCache(false);
-      cache2 = (CacheImpl<String, ContainerData>)instance.createCache(false);
+      cache1 = (CacheSPI<String, ContainerData>) instance.createCache(false);
+      cache2 = (CacheSPI<String, ContainerData>) instance.createCache(false);
       cache1.getConfiguration().setCacheMode(caching_mode);
       cache2.getConfiguration().setCacheMode(caching_mode);
       cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,26 +7,10 @@
  */
 package org.jboss.cache.replicated;
 
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
@@ -35,19 +19,27 @@
 import org.jboss.cache.notifications.annotation.NodeRemoved;
 import org.jboss.cache.notifications.event.NodeEvent;
 import org.jboss.cache.transaction.DummyTransactionManager;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.naming.Context;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Test out the TreeCacheListener
  *
  * @version $Revision$
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class SyncCacheListenerTest
 {
-   private CacheImpl<Object, Object> cache1, cache2;
+   private CacheSPI<Object, Object> cache1, cache2;
    private final static Log log_ = LogFactory.getLog(SyncCacheListenerTest.class);
    private String old_factory = null;
    private final static String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
@@ -77,10 +69,10 @@
       System.out.println("*** finished tearDown()");
    }
 
-   private void initCaches() throws Exception
+   private void initCaches()
    {
-      cache1 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      cache2 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
       cache2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
       cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
@@ -127,7 +119,7 @@
       tm.commit();
 
       // value on cache2 must be 38
-      age = (Integer)cache2.get("/a/b/c", "age");
+      age = (Integer) cache2.get("/a/b/c", "age");
       assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
       assertTrue("\"age\" must be 38", age == 38);
    }
@@ -140,7 +132,7 @@
       cache1.put("/a/b/c", "age", 38);
 
       // value on cache2 must be 38
-      age = (Integer)cache2.get("/a/b/c", "age");
+      age = (Integer) cache2.get("/a/b/c", "age");
       assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
       assertTrue("\"age\" must be 38", age == 38);
       cache1.remove("/a/b/c", "age");
@@ -154,7 +146,7 @@
       lis.put("/a/b/c", "age", 38);
 
       // value on cache2 must be 38
-      age = (Integer)cache2.get("/a/b/c", "age");
+      age = (Integer) cache2.get("/a/b/c", "age");
       assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
       assertTrue("\"age\" must be 38", age == 38);
    }
@@ -177,7 +169,7 @@
       tm.commit();
 
       // value on cache2 must be 38
-      age = (Integer)cache2.get("/a/b/c", "age");
+      age = (Integer) cache2.get("/a/b/c", "age");
       assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
       assertTrue("\"age\" must be 38", age == 38);
    }
@@ -194,7 +186,7 @@
       lis.put("/a/b/c", map);
 
       // value on cache2 must be 38
-      age = (Integer)cache2.get("/a/b/c", "age");
+      age = (Integer) cache2.get("/a/b/c", "age");
       assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
       assertTrue("\"age\" must be 38", age == 38);
    }
@@ -210,7 +202,7 @@
          cache1.put(fqn, key, val);
       }
 
-      public void put(String fqn, Map<String, Comparable> map)
+      public void put(String fqn, Map map)
       {
          if (map.size() == 0)
             fail("put(): map size can't be 0");

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,31 +7,12 @@
  */
 package org.jboss.cache.replicated;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Semaphore;
-
-import javax.naming.Context;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -41,11 +22,24 @@
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeModified;
 import org.jboss.cache.notifications.event.NodeEvent;
-import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.TransactionSetup;
+import org.jboss.cache.util.CachePrinter;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Semaphore;
+
 /**
  * Replicated unit test for sync transactional CacheImpl
  * Note: we use DummyTransactionManager for Tx purpose instead of relying on
@@ -57,8 +51,8 @@
 public class SyncReplTxTest
 {
    private static Log log = LogFactory.getLog(SyncReplTxTest.class);
-   private CacheImpl<Object, Object> cache1;
-   private CacheImpl<Object, Object> cache2;
+   private CacheSPI<Object, Object> cache1;
+   private CacheSPI<Object, Object> cache2;
 
    Semaphore lock;
    private Throwable t1_ex;
@@ -83,7 +77,7 @@
       return beginTransaction(cache1);
    }
 
-   private TransactionManager beginTransaction(Cache c) throws SystemException, NotSupportedException
+   private TransactionManager beginTransaction(CacheSPI c) throws SystemException, NotSupportedException
    {
       TransactionManager mgr = c.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
@@ -92,8 +86,8 @@
 
    private void initCaches(Configuration.CacheMode caching_mode) throws Exception
    {
-      cache1 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
-      cache2 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
+      cache1 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache2 = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache1.getConfiguration().setCacheMode(caching_mode);
       cache2.getConfiguration().setCacheMode(caching_mode);
       cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
@@ -156,7 +150,7 @@
    {
       initCaches(Configuration.CacheMode.REPL_SYNC);
       cache1.getConfiguration().setSyncCommitPhase(true);
-      cache1.releaseAllLocks("/");
+      cache1.getRoot().getLock().releaseAll();
       TransactionManager tm = beginTransaction();
       cache1.put("/bela/ban", "name", "Bela Ban");
       assertEquals(3, cache1.getNumberOfLocksHeld());
@@ -183,15 +177,15 @@
          cache1.put("/a/b/c", "age", 38);
          tx = mgr.suspend();
          assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
-         log.debug("cache1: locks held before commit: " + cache1.printLockInfo());
-         log.debug("cache2: locks held before commit: " + cache2.printLockInfo());
+         log.debug("cache1: locks held before commit: " + CachePrinter.printCacheLockingInfo(cache1));
+         log.debug("cache2: locks held before commit: " + CachePrinter.printCacheLockingInfo(cache2));
          mgr.resume(tx);
          mgr.commit();
-         log.debug("cache1: locks held after commit: " + cache1.printLockInfo());
-         log.debug("cache2: locks held after commit: " + cache2.printLockInfo());
+         log.debug("cache1: locks held after commit: " + CachePrinter.printCacheLockingInfo(cache1));
+         log.debug("cache2: locks held after commit: " + CachePrinter.printCacheLockingInfo(cache2));
 
          // value on cache2 must be 38
-         age = (Integer)cache2.get("/a/b/c", "age");
+         age = (Integer) cache2.get("/a/b/c", "age");
          assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
          assertTrue("\"age\" must be 38", age == 38);
       }
@@ -267,8 +261,8 @@
       cache2.put(NODE2, "age", 39);
       System.out.println("TransactionTable for cache2 after cache2.put():\n" + cache2.getTransactionTable().toString(true));
 
-      System.out.println("cache1 before commit:\n" + cache1.printLockInfo());
-      System.out.println("cache2 before commit:\n" + cache2.printLockInfo());
+      System.out.println("cache1 before commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 before commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       try
       {
@@ -280,8 +274,8 @@
          //should be a classic deadlock here.
       }
 
-      System.out.println("cache1 after commit:\n" + cache1.printLockInfo());
-      System.out.println("cache2 after commit:\n" + cache2.printLockInfo());
+      System.out.println("cache1 after commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 after commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       /*
        assertTrue(cache1.exists(NODE1));
@@ -324,8 +318,8 @@
       cache2.put(NODE, "age", 39);
       System.out.println("TransactionTable for cache2 after cache2.put():\n" + cache2.getTransactionTable().toString(true));
 
-      System.out.println("cache1 before commit:\n" + cache1.printLockInfo());
-      System.out.println("cache2 before commit:\n" + cache2.printLockInfo());
+      System.out.println("cache1 before commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 before commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       try
       {
@@ -337,8 +331,8 @@
          System.out.println("Transaction was rolled back, this is correct");
       }
 
-      System.out.println("cache1 after commit:\n" + cache1.printLockInfo());
-      System.out.println("cache2 after commit:\n" + cache2.printLockInfo());
+      System.out.println("cache1 after commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 after commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       assertEquals(0, cache1.getNumberOfLocksHeld());
       assertEquals(0, cache2.getNumberOfLocksHeld());
@@ -362,8 +356,8 @@
       cache1.put(NODE1, "age", 38);
       cache2.put(NODE2, "age", 39);
 
-      System.out.println("cache1 (before commit):\n" + cache1.printLockInfo());
-      System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
+      System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       // this will rollback the transaction
       Transaction tx = tm.getTransaction();
@@ -379,8 +373,8 @@
          System.out.println("Transaction was rolled back, this is correct");
       }
 
-      System.out.println("cache1 (after rollback):\n" + cache1.printLockInfo());
-      System.out.println("cache2 (after rollback):\n" + cache2.printLockInfo());
+      System.out.println("cache1 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       assertEquals(0, cache1.getNumberOfLocksHeld());
       assertEquals(0, cache2.getNumberOfLocksHeld());
@@ -415,8 +409,8 @@
    //      tx = beginTransaction();
    //      cache1.put(NODE1, "age", 38);
    //
-   //      System.out.println("cache1 (before commit):\n" + cache1.printLockInfo());
-   //      System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
+   //      System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
+   //      System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
    //
    //      // this will rollback the transaction
    //      tx.registerSynchronization(new TransactionAborter(tx));
@@ -435,8 +429,8 @@
    //      // Sleep, as the rollback call to cache2 is async
    //      TestingUtil.sleepThread(1000);
    //
-   //      System.out.println("cache1 (after rollback):\n" + cache1.printLockInfo());
-   //      System.out.println("cache2 (after rollback):\n" + cache2.printLockInfo());
+   //      System.out.println("cache1 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache1));
+   //      System.out.println("cache2 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache2));
    //
    //      assertNull(cbl1.getCallbackException());
    //      assertNull(cbl2.getCallbackException());
@@ -456,16 +450,16 @@
    //      tx = beginTransaction();
    //      cache1.put(NODE1, "age", 38);
    //
-   //      System.out.println("cache1 (before commit):\n" + cache1.printLockInfo());
-   //      System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
+   //      System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
+   //      System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
    //
    //      tx.commit();
    //
    //      // Sleep, as the commit call to cache2 is async
    //      TestingUtil.sleepThread(1000);
    //
-   //      System.out.println("cache1 (after rollback):\n" + cache1.printLockInfo());
-   //      System.out.println("cache2 (after rollback):\n" + cache2.printLockInfo());
+   //      System.out.println("cache1 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache1));
+   //      System.out.println("cache2 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache2));
    //
    //      assertNull(cbl1.getCallbackException());
    //      assertNull(cbl2.getCallbackException());
@@ -503,8 +497,8 @@
       tm = beginTransaction();
       cache1.put(NODE1, "age", 38);
 
-      System.out.println("cache1 (before commit):\n" + cache1.printLockInfo());
-      System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
+      System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       // instead of a listener lets just get a WL on ROOT on cache2. And hold on to it.
       Transaction tx = tm.suspend();
@@ -513,7 +507,7 @@
       cache2.getRoot().put("x", "y");
       Transaction tx2 = cache2.getTransactionManager().suspend();
 
-      System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
+      System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
       tm.resume(tx);
 
       try
@@ -534,8 +528,8 @@
       // Sleep, as the commit call to cache2 is async
       TestingUtil.sleepThread(1000);
 
-      System.out.println("cache1 (after rollback):\n" + cache1.printLockInfo());
-      System.out.println("cache2 (after rollback):\n" + cache2.printLockInfo());
+      System.out.println("cache1 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache1));
+      System.out.println("cache2 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache2));
 
       //assertNull(tal.getCallbackException());
 
@@ -562,7 +556,7 @@
       Thread.sleep(1000);
 
       // value on cache2 must be 38
-      age = (Integer)cache2.get("/a/b/c", "age");
+      age = (Integer) cache2.get("/a/b/c", "age");
       assertNotNull("\"age\" obtained from cache2 is null ", age);
       assertTrue("\"age\" must be 38", age == 38);
 
@@ -609,7 +603,8 @@
       initCaches(Configuration.CacheMode.REPL_SYNC);
       cache1.getConfiguration().setSyncCommitPhase(true);
 
-      Thread t1 = new Thread("Thread1") {
+      Thread t1 = new Thread("Thread1")
+      {
          TransactionManager tm;
 
          public void run()
@@ -620,8 +615,8 @@
                cache1.put("/bela/ban", "name", "Bela Ban");
                TestingUtil.sleepThread(2000);// Thread2 will be blocked until we commit
                tm.commit();
-               System.out.println("[Thread1] ** LOCK INFO cache1: " + cache1.printLockInfo());
-               System.out.println("[Thread1] ** LOCK INFO cache2: " + cache2.printLockInfo());
+               System.out.println("[Thread1] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
+               System.out.println("[Thread1] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
             }
             catch (Throwable ex)
             {
@@ -631,7 +626,8 @@
          }
       };
 
-      Thread t2 = new Thread("Thread2") {
+      Thread t2 = new Thread("Thread2")
+      {
          TransactionManager tm;
 
          public void run()
@@ -640,14 +636,14 @@
             {
                TestingUtil.sleepThread(1000);// give Thread1 time to acquire the lock
                tm = beginTransaction();
-               System.out.println("[Thread2] ** LOCK INFO cache1: " + cache1.printLockInfo());
-               System.out.println("[Thread2] ** LOCK INFO cache2: " + cache2.printLockInfo());
+               System.out.println("[Thread2] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
+               System.out.println("[Thread2] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
                cache1.put("/bela/ban", "name", "Michelle Ban");
-               System.out.println("[Thread2] ** LOCK INFO cache1: " + cache1.printLockInfo());
-               System.out.println("[Thread2] ** LOCK INFO cache2: " + cache2.printLockInfo());
+               System.out.println("[Thread2] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
+               System.out.println("[Thread2] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
                tm.commit();
-               System.out.println("[Thread2] ** LOCK INFO cache1: " + cache1.printLockInfo());
-               System.out.println("[Thread2] ** LOCK INFO cache2: " + cache2.printLockInfo());
+               System.out.println("[Thread2] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
+               System.out.println("[Thread2] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
             }
             catch (Throwable ex)
             {
@@ -696,12 +692,12 @@
    /**
     * Should reproduce JBCACHE-32 problem (http://jira.jboss.com/jira/browse/JBCACHE-32)
     */
-   private void _testConcurrentCommits(int num_threads) throws Exception
+   private void _testConcurrentCommits(int num_threads)
    {
       Object myMutex = new Object();
 
-      final CacheImpl c1 = (CacheImpl)DefaultCacheFactory.getInstance().createCache(false);
-      final CacheImpl c2 = (CacheImpl)DefaultCacheFactory.getInstance().createCache(false);
+      final CacheSPI c1 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+      final CacheSPI c2 = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       c1.getConfiguration().setClusterName("TempCluster");
       c2.getConfiguration().setClusterName("TempCluster");
       c1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -781,7 +777,7 @@
       TestingUtil.sleepThread(6000);
       synchronized (myMutex)
       {
-         System.out.println("cache is " + c1.printLockInfo());
+         System.out.println("cache is " + CachePrinter.printCacheLockingInfo(c1));
          System.out.println("******************* SIGNALLING THREADS ********************");
          myMutex.notifyAll();
       }
@@ -799,7 +795,7 @@
          }
       }
 
-      System.out.println("FINAL c1:\n" + c1.printDetails() + "\nlocks:\n" + c1.printLockInfo());
+      System.out.println("FINAL c1:\n" + CachePrinter.printCacheDetails(c1) + "\nlocks:\n" + CachePrinter.printCacheLockingInfo(c1));
 
       assertEquals(0, c1.getNumberOfLocksHeld());
       assertEquals(0, c2.getNumberOfLocksHeld());
@@ -827,10 +823,11 @@
    public void testConcurrentPutsOnTwoInstances() throws Exception
    {
       initCaches(Configuration.CacheMode.REPL_SYNC);
-      final CacheImpl<Object, Object> c1 = this.cache1;
-      final CacheImpl<Object, Object> c2 = this.cache2;
+      final CacheSPI<Object, Object> c1 = this.cache1;
+      final CacheSPI<Object, Object> c2 = this.cache2;
 
-      Thread t1 = new Thread() {
+      Thread t1 = new Thread()
+      {
          TransactionManager tm;
 
          public void run()
@@ -850,7 +847,8 @@
          }
       };
 
-      Thread t2 = new Thread() {
+      Thread t2 = new Thread()
+      {
          TransactionManager tm;
 
          public void run()
@@ -896,9 +894,10 @@
    public void testPut() throws Exception
    {
       initCaches(Configuration.CacheMode.REPL_SYNC);
-      final CacheImpl<Object, Object> c1 = this.cache1;
+      final CacheSPI<Object, Object> c1 = this.cache1;
 
-      Thread t1 = new Thread() {
+      Thread t1 = new Thread()
+      {
          public void run()
          {
             try
@@ -934,7 +933,8 @@
          }
       };
 
-      Thread t2 = new Thread() {
+      Thread t2 = new Thread()
+      {
          public void run()
          {
             try
@@ -944,7 +944,7 @@
                lock.acquire();
                System.out.println("-- t2 has lock");
                // Should replicate the value right away.
-               Integer val = (Integer)cache2.get("/a/b/c", "age");
+               Integer val = (Integer) cache2.get("/a/b/c", "age");
                System.out.println("[Thread2] value is " + val);
                assertEquals(new Integer(38), val);
                System.out.println("-- t2 releases lock");
@@ -954,7 +954,7 @@
                TestingUtil.sleepThread(500);
                lock.acquire();
                System.out.println("-- t2 has lock");
-               val = (Integer)cache2.get("/a/b/c", "age");
+               val = (Integer) cache2.get("/a/b/c", "age");
                System.out.println("-- t2 releases lock");
                lock.release();
                assertEquals(new Integer(39), val);
@@ -1037,8 +1037,9 @@
    public void testPutTx1() throws Exception
    {
       initCaches(Configuration.CacheMode.REPL_SYNC);
-      final CacheImpl<Object, Object> c1 = this.cache1;
-      Thread t1 = new Thread() {
+      final CacheSPI<Object, Object> c1 = this.cache1;
+      Thread t1 = new Thread()
+      {
          public void run()
          {
             TransactionManager tm = null;
@@ -1078,7 +1079,8 @@
          }
       };
 
-      Thread t2 = new Thread() {
+      Thread t2 = new Thread()
+      {
          public void run()
          {
             TransactionManager tm = null;
@@ -1136,8 +1138,9 @@
    public void testPutTxWithRollback() throws Exception
    {
       initCaches(Configuration.CacheMode.REPL_SYNC);
-      final CacheImpl<Object, Object> c2 = this.cache1;
-      Thread t1 = new Thread() {
+      final CacheSPI<Object, Object> c2 = this.cache1;
+      Thread t1 = new Thread()
+      {
          public void run()
          {
             TransactionManager tm = null;
@@ -1167,7 +1170,8 @@
          }
       };
 
-      Thread t2 = new Thread() {
+      Thread t2 = new Thread()
+      {
          public void run()
          {
             TransactionManager tm = null;
@@ -1246,12 +1250,12 @@
    static class CallbackListener
    {
 
-      CacheImpl<Object, Object> callbackCache;
+      CacheSPI<Object, Object> callbackCache;
       Object callbackKey;
       Exception ex;
       Object mutex = new Object();
 
-      CallbackListener(CacheImpl<Object, Object> cache, Object callbackKey)
+      CallbackListener(CacheSPI<Object, Object> cache, Object callbackKey)
       {
          this.callbackCache = cache;
          this.callbackKey = callbackKey;
@@ -1295,7 +1299,7 @@
 
       TransactionManager callbackTM;
 
-      TransactionAborterCallbackListener(CacheImpl<Object, Object> cache, Object callbackKey)
+      TransactionAborterCallbackListener(CacheSPI<Object, Object> cache, Object callbackKey)
       {
          super(cache, callbackKey);
          callbackTM = callbackCache.getTransactionManager();

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/CorruptedFileCacheLoader.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/CorruptedFileCacheLoader.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/CorruptedFileCacheLoader.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,17 +1,13 @@
 package org.jboss.cache.statetransfer;
 
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
 import org.jboss.cache.Fqn;
 import org.jboss.cache.loader.FileCacheLoader;
 
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
 public class CorruptedFileCacheLoader extends FileCacheLoader
 {
-   public CorruptedFileCacheLoader()
-   {
-      super();
-   }
 
    @Override
    public void loadState(Fqn subtree, ObjectOutputStream os) throws Exception

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -23,11 +23,15 @@
 package org.jboss.cache.statetransfer;
 
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Version;
 import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.lock.TimeoutException;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.remoting.jgroups.CacheMessageListener;
 import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.Test;
 
@@ -45,8 +49,7 @@
 
    public void testFailedStateTransfer() throws Exception
    {
-      CacheImpl cache = new SecretiveStateCache();
-      cache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC));
+      CacheSPI cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
       cache.getConfiguration().setClusterName("VersionedTestBase");
       cache.getConfiguration().setReplVersionString(getReplicationVersion());
       // Use a long timeout to facilitate setting debugger breakpoints
@@ -56,12 +59,16 @@
       // start it can still be destroyed later
       caches.put("secretive", cache);
 
-      cache.create();
+      // inject our own message listener and re-wire deps
+      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
+      cr.unregisterComponent(CacheMessageListener.class);
+      cr.registerComponent(new SecretiveStateCacheMessageListener());
+      cr.updateDependencies();
+
       cache.start();
 
 
-      CacheImpl recipient = new SecretiveStateCache();
-      recipient.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC));
+      CacheSPI recipient = (CacheSPI) DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
       recipient.getConfiguration().setClusterName("VersionedTestBase");
       recipient.getConfiguration().setReplVersionString(getReplicationVersion());
       // Use a long timeout to facilitate setting debugger breakpoints
@@ -71,9 +78,14 @@
       // start it can still be destroyed later
       caches.put("secretive2", recipient);
 
+      // inject our own message listener and re-wire deps
+      cr = TestingUtil.extractComponentRegistry(recipient);
+      cr.unregisterComponent(CacheMessageListener.class);
+      cr.registerComponent(new SecretiveStateCacheMessageListener());
+      cr.updateDependencies();
+
       try
       {
-         recipient.create();
          recipient.start();
          fail("start() should throw an exception");
       }
@@ -88,40 +100,30 @@
       return Version.version;
    }
 
-   private static class SecretiveStateCache extends CacheImpl<Object, Object>
+   private static class SecretiveStateCacheMessageListener extends CacheMessageListener
    {
-      SecretiveStateCache() throws Exception
+      @Override
+      public void setState(byte[] new_state)
       {
-         super();
-         setMessageListener(new Adaptor());
+         setStateException = new TimeoutException("Planned Timeout");
       }
 
-      class Adaptor extends MessageListenerAdaptor
+      @Override
+      public void setState(InputStream istream)
       {
+         setStateException = new TimeoutException("Planned Timeout");
+      }
 
-         @Override
-         public void setState(byte[] new_state)
-         {
-            setStateException = new TimeoutException("Planned Timeout");
-         }
+      @Override
+      public void setState(String state_id, byte[] state)
+      {
+         setStateException = new TimeoutException("Planned Timeout");
+      }
 
-         @Override
-         public void setState(InputStream istream)
-         {
-            setStateException = new TimeoutException("Planned Timeout");
-         }
-
-         @Override
-         public void setState(String state_id, byte[] state)
-         {
-            setStateException = new TimeoutException("Planned Timeout");
-         }
-
-         @Override
-         public void setState(String state_id, InputStream istream)
-         {
-            setStateException = new TimeoutException("Planned Timeout");
-         }
+      @Override
+      public void setState(String state_id, InputStream istream)
+      {
+         setStateException = new TimeoutException("Planned Timeout");
       }
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -110,7 +110,7 @@
          cache2 = createCache("cache2", false, false, true, false, false);
          cache2.create();
          cache2.start();
-         
+
          //Vladimir  October 5th 2007
          //failure of integration of persistent state is not considered to be fatal
          //to revisit with Manik
@@ -196,7 +196,7 @@
    protected void initialStateTferWithLoaderTest(boolean asyncLoader) throws Exception
    {
       initialStateTferWithLoaderTest("org.jboss.cache.loader.FileCacheLoader",
-              "org.jboss.cache.loader.FileCacheLoader", asyncLoader);
+            "org.jboss.cache.loader.FileCacheLoader", asyncLoader);
    }
 
    public void testPartialStateTransfer() throws Exception
@@ -361,10 +361,10 @@
       Thread.currentThread().setContextClassLoader(getNotFoundClassLoader());
 
       CacheSPI<Object, Object> cache1 = createCache("cache1",
-              false, // async
-              true, // use marshaller
-              true, // use cacheloader
-              false, false);// don't start
+            false, // async
+            true, // use marshaller
+            true, // use cacheloader
+            false, false);// don't start
       ClassLoader cl1 = getClassLoader();
       cache1.getRegion(A, true).registerContextClassLoader(cl1);
       startCache(cache1);
@@ -377,10 +377,10 @@
 
       // For cache 2 we won't register loader until later
       CacheSPI<Object, Object> cache2 = createCache("cache2",
-              false, // async
-              true, // use marshalling
-              true, // use cacheloader
-              false, true);// start
+            false, // async
+            true, // use marshalling
+            true, // use cacheloader
+            false, true);// start
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -408,20 +408,20 @@
    private Object createBen(ClassLoader loader) throws Exception
    {
       Class addrClazz = loader.loadClass(ADDRESS_CLASSNAME);
-      Method setCity = addrClazz.getMethod("setCity", new Class[]{String.class});
-      Method setStreet = addrClazz.getMethod("setStreet", new Class[]{String.class});
-      Method setZip = addrClazz.getMethod("setZip", new Class[]{int.class});
+      Method setCity = addrClazz.getMethod("setCity", String.class);
+      Method setStreet = addrClazz.getMethod("setStreet", String.class);
+      Method setZip = addrClazz.getMethod("setZip", int.class);
       Object addr = addrClazz.newInstance();
-      setCity.invoke(addr, new Object[]{"San Jose"});
-      setStreet.invoke(addr, new Object[]{"1007 Home"});
-      setZip.invoke(addr, new Object[]{90210});
+      setCity.invoke(addr, "San Jose");
+      setStreet.invoke(addr, "1007 Home");
+      setZip.invoke(addr, 90210);
 
       Class benClazz = loader.loadClass(PERSON_CLASSNAME);
-      Method setName = benClazz.getMethod("setName", new Class[]{String.class});
-      Method setAddress = benClazz.getMethod("setAddress", new Class[]{addrClazz});
+      Method setName = benClazz.getMethod("setName", String.class);
+      Method setAddress = benClazz.getMethod("setAddress", addrClazz);
       Object ben = benClazz.newInstance();
-      setName.invoke(ben, new Object[]{"Ben"});
-      setAddress.invoke(ben, new Object[]{addr});
+      setName.invoke(ben, "Ben");
+      setAddress.invoke(ben, addr);
 
       return ben;
    }

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -82,7 +82,7 @@
     * @param sync use REPL_SYNC or REPL_ASYNC
     * @throws Exception
     */
-   private void concurrentActivationTest(boolean sync) throws Exception
+   private void concurrentActivationTest(boolean sync)
    {
       String[] names = {"A", "B", "C", "D", "E"};
       int count = names.length;
@@ -135,8 +135,8 @@
          {
             Exception aException = activators[i].getException();
             boolean gotUnexpectedException = aException != null
-                    && !(aException instanceof InactiveRegionException ||
-                    aException.getCause() instanceof InactiveRegionException);
+                  && !(aException instanceof InactiveRegionException ||
+                  aException.getCause() instanceof InactiveRegionException);
             if (gotUnexpectedException)
             {
                fail("Activator " + names[i] + " caught an exception " + aException);
@@ -146,7 +146,7 @@
             {
                Fqn fqn = new Fqn<String>(A_B, names[j]);
                assertEquals("Incorrect value for " + fqn + " on activator " + names[i],
-                       "VALUE", activators[i].getCacheValue(fqn));
+                     "VALUE", activators[i].getCacheValue(fqn));
                //               System.out.println(names[i] + ":" + fqn + " = " + activators[i].getCacheValue(fqn));
             }
          }
@@ -183,7 +183,7 @@
     * @param sync use REPL_SYNC or REPL_ASYNC
     * @throws Exception
     */
-   private void concurrentActivationTest2(boolean sync) throws Exception
+   private void concurrentActivationTest2(boolean sync)
    {
       String[] names = {"A", "B"};
       int count = names.length;
@@ -238,8 +238,8 @@
          {
             Exception aException = activators[i].getException();
             boolean gotUnexpectedException = aException != null
-                    && !(aException instanceof InactiveRegionException ||
-                    aException.getCause() instanceof InactiveRegionException);
+                  && !(aException instanceof InactiveRegionException ||
+                  aException.getCause() instanceof InactiveRegionException);
             if (gotUnexpectedException)
             {
                fail("Activator " + names[i] + " caught an exception " + aException);
@@ -249,7 +249,7 @@
             {
                Fqn fqn = Fqn.fromString("/a/" + i + "/" + names[i]);
                assertEquals("Incorrect value for " + fqn + " on activator " + names[i],
-                       "VALUE", activators[i].getCacheValue(fqn));
+                     "VALUE", activators[i].getCacheValue(fqn));
             }
          }
       }
@@ -434,8 +434,8 @@
                {
                   Fqn fqn = Fqn.fromString("/" + names[i] + "/" + j);
                   assertEquals("/A/" + j + " matches " + fqn,
-                          cacheA.get(fqn, "KEY"),
-                          stressors[i].getCacheSPI().get(fqn, "KEY"));
+                        cacheA.get(fqn, "KEY"),
+                        stressors[i].getCacheSPI().get(fqn, "KEY"));
                }
             }
          }
@@ -482,10 +482,10 @@
       Region region = cache2.getRegion(Fqn.ROOT, false);
       // We expect events for /a, /a/b and /a/b/c
       int nodeEventQueueSize = region.nodeEventQueueSize();
-      int i=0;
+      int i = 0;
       while (region.nodeEventQueueSize() > 0)
       {
-         System.out.println(++i+") Queue contains : " + region.takeLastEventNode());
+         System.out.println(++i + ") Queue contains : " + region.takeLastEventNode());
       }
 
       assertEquals("Saw the expected number of node events", 3, nodeEventQueueSize);
@@ -658,7 +658,7 @@
       CacheActivator(Semaphore semaphore,
                      String name,
                      boolean sync, CacheSPI[] caches)
-              throws Exception
+            throws Exception
       {
          super(semaphore, name, sync, false);
          this.caches = caches;
@@ -683,10 +683,9 @@
        * A activates the /a/b
        * A puts something in /a/b and replicates
        * B fails to accept the replication as it has the /a/b region inactive.
-       *
+       * <p/>
        * So we cannot expect all the put operation to replicate accross all the members from the cluser, WITHOUTH
        * having the region active on ALL members.
-       *
        */
       private void waitUntillAllChachesActivatedRegion()
       {
@@ -721,7 +720,7 @@
                                     String name,
                                     boolean sync,
                                     int regionCount)
-              throws Exception
+            throws Exception
       {
          super(semaphore, name, sync, false);
          this.regionCount = regionCount;
@@ -755,7 +754,7 @@
       CacheStressor(Semaphore semaphore,
                     String name,
                     boolean sync)
-              throws Exception
+            throws Exception
       {
          super(semaphore, name, sync, true);
       }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,35 +6,30 @@
  */
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotSame;
-import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.assertTrue;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.NotifyingTransactionManager.Notification;
-import org.jgroups.Channel;
 import org.jgroups.JChannel;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class AbortionTest
 {
-   private MyTC cache1, cache2, cache3;
+   private CacheSPI cache1, cache2, cache3;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
@@ -60,9 +55,9 @@
       System.out.println("********* END: TEAR DOWN *************");
    }
 
-   private MyTC initCache(boolean notifying) throws Exception
+   private CacheSPI initCache(boolean notifying)
    {
-      MyTC c = new MyTC();
+      CacheSPI c = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
       c.getConfiguration().setCacheMode("REPL_SYNC");
       c.getConfiguration().setClusterConfig(getJGroupsStack());
       c.getConfiguration().setFetchInMemoryState(false);
@@ -81,19 +76,10 @@
    // we need a 'special' stack that does not attempt redelivery since we kill a channel midway during a tx in this test.
    private String getJGroupsStack()
    {
-      //       return "UDP(mcast_addr=224.0.0.36;mcast_port=55566;ip_ttl=32;" +
-      //          "mcast_send_buf_size=150000;mcast_recv_buf_size=80000):" +
-      //          "PING(timeout=10;num_initial_members=1):" +
-      //          "pbcast.NAKACK(gc_lag=50;max_xmit_size=8192;retransmit_timeout=10):" +
-      //          "UNICAST(timeout=600):" +
-      //          "FRAG(frag_size=8192;down_thread=false;up_thread=false):" +
-      //          "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
-      //          "shun=false;print_local_addr=true):" +
-      //          "pbcast.STATE_TRANSFER";
       return JChannel.DEFAULT_PROTOCOL_STACK;
    }
 
-   private void destroyCache(MyTC c)
+   private void destroyCache(CacheSPI c)
    {
       if (c != null)
       {
@@ -134,7 +120,7 @@
       TransactionManager mgr1 = cache1.getTransactionManager();
       TransactionManager mgr2 = cache2.getTransactionManager();
       assertTrue(cache3.getTransactionManager() instanceof NotifyingTransactionManager);
-      NotifyingTransactionManager mgr3 = (NotifyingTransactionManager)cache3.getTransactionManager();
+      NotifyingTransactionManager mgr3 = (NotifyingTransactionManager) cache3.getTransactionManager();
 
       assertSame(mgr1, mgr2);
       assertNotSame(mgr1, mgr3);
@@ -179,13 +165,14 @@
          final Transaction finalTx = tx;
          System.out.println("Notify called.");
          // add an aborting sync handler.
-         Synchronization abort = new Synchronization() {
+         Synchronization abort = new Synchronization()
+         {
 
             public void beforeCompletion()
             {
                if (abortBeforeCompletion)
                {
-                  cache3.myChannel.close();
+                  cache3.getConfiguration().getRuntimeConfig().getChannel().close();
                   System.out.println("Returning from abort.beforeCompletion");
                   try
                   {
@@ -203,7 +190,7 @@
             {
                if (!abortBeforeCompletion)
                {
-                  cache3.myChannel.close();
+                  cache3.getConfiguration().getRuntimeConfig().getChannel().close();
                   System.out.println("Returning from abort.afterCompletion");
                   throw new RuntimeException("Dummy exception");
                }
@@ -216,23 +203,4 @@
       }
 
    }
-
-   ;
-
-   public static class MyTC extends CacheImpl<Object, Object>
-   {
-      Channel myChannel;
-
-      public MyTC() throws Exception
-      {
-         super();
-      }
-
-      public void start() throws CacheException
-      {
-         super.start();
-         myChannel = channel;
-      }
-   }
-
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/AsyncRollbackTxTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,32 +1,28 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+
 /**
  * Test behaviour of async rollback timeouted transaction
  *
  * @author <a href="mailto:jhalat at infovide.pl">Jacek Halat</a>
  * @since 1.4.0
  */
- at Test(groups={"functional"})
+ at Test(groups = {"functional"})
 public class AsyncRollbackTxTest
 {
-   private CacheImpl<String, String> cache;
+   private CacheSPI<String, String> cache;
    private TransactionManager tm;
    private Fqn fqn = Fqn.fromString("/test");
    // This sleep time (millis) should be longer than the transaction timeout time.
@@ -40,7 +36,7 @@
       Configuration c = new Configuration();
       c.setTransactionManagerLookupClass("org.jboss.cache.transaction.AsyncRollbackTransactionManagerLookup");
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(c);
+      cache = (CacheSPI<String, String>) instance.createCache(c);
       tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       tm.setTransactionTimeout(txTimeout);
    }
@@ -240,5 +236,4 @@
       }
    }
 
-   ;
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,28 +1,27 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.transaction.UserTransaction;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.Fqn;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.TimeoutException;
 import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.util.CachePrinter;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.UserTransaction;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+
 /**
  * Unit test for local CacheImpl with concurrent transactions.
  * Uses locking and multiple threads to test concurrent r/w access to the tree.
@@ -31,15 +30,15 @@
  * @author Ben Wang
  * @version $Revision$
  */
- at Test(groups = { "functional", "transaction" }, enabled = false)
+ at Test(groups = {"functional", "transaction"}, enabled = false)
 public class ConcurrentBankTest
 {
-   private CacheImpl<Object, Integer> cache;
+   private CacheSPI<Object, Integer> cache;
    private static Log logger_ = LogFactory.getLog(ConcurrentBankTest.class);
-   private final String NODE = "/cachetest";
+   private final Fqn NODE = Fqn.fromString("/cachetest");
    private final int ROLLBACK_CHANCE = 100;
 
-   private static String customer[] = { "cu1", "cu2", "cu3" };
+   private static String customer[] = {"cu1", "cu2", "cu3"};
    private static final int BOOKINGS = 1000;
    private static boolean _testFailedinThread = false;
 
@@ -52,10 +51,8 @@
    public void setUp() throws Exception
    {
       CacheFactory<Object, Integer> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<Object, Integer>)instance.createCache(false);
+      cache = (CacheSPI<Object, Integer>) instance.createCache("META-INF/local-lru-eviction-service.xml", false);
 
-      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-lru-eviction-service.xml"));
-
       // XML file above only sets REPEATABLE-READ
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
 
@@ -78,7 +75,7 @@
       Teller one, two;
       try
       {
-         if (cache.get(NODE) == null)
+         if (cache.getRoot().get(NODE) == null)
          {
             cache.put(NODE, "cu1", 1000);
             cache.put(NODE, "cu2", 1000);
@@ -89,12 +86,12 @@
          two = new Teller("two", cache);
 
          one.start();
-         TestingUtil.sleepThread((long)100);
+         TestingUtil.sleepThread((long) 100);
          two.start();
          one.join();
          two.join();
 
-         log("lock info:\n" + cache.printLockInfo() + _testFailedinThread);
+         log("lock info:\n" + CachePrinter.printCacheLockingInfo(cache) + _testFailedinThread);
          if (_testFailedinThread)
             fail();
       }
@@ -124,9 +121,9 @@
 
    private class Teller extends Thread
    {
-      CacheImpl<Object, Integer> cache;
+      CacheSPI<Object, Integer> cache;
 
-      public Teller(String str, CacheImpl<Object, Integer> cache)
+      public Teller(String str, CacheSPI<Object, Integer> cache)
       {
          super(str);
          this.cache = cache;
@@ -149,9 +146,9 @@
             {
                if (!again)
                {
-                  src = (int)(Math.random() * count);
-                  dst = (int)(Math.random() * (count - 1));
-                  amo = 1 + (int)(Math.random() * 20);
+                  src = (int) (Math.random() * count);
+                  dst = (int) (Math.random() * (count - 1));
+                  amo = 1 + (int) (Math.random() * 20);
                   if (dst >= src)
                      dst++;
                }
@@ -213,7 +210,7 @@
          log("deposit(" + from + ", " + to + ", " + amount + ") debited.");
 
          // eventually rollback the transaction
-         if ((int)(Math.random() * ROLLBACK_CHANCE) == 0)
+         if ((int) (Math.random() * ROLLBACK_CHANCE) == 0)
          {
             log("!!!manually set rollback (" + from + ", " + to + ", " + amount + ").");
             tx.setRollbackOnly();
@@ -236,7 +233,7 @@
          HashMap<Object, Integer> result = new HashMap<Object, Integer>();
          try
          {
-            Set set = cache.getKeys(NODE);// gets read lock
+            Set set = cache.getRoot().getChild(NODE).getKeys();// gets read lock
             for (Object name : set)
             {
                result.put(name, cache.get(NODE, name));

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentTransactionalTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -7,39 +7,37 @@
  */
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import javax.transaction.UserTransaction;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.lock.IsolationLevel;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.UserTransaction;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
 /**
- * Unit test for local CacheImpl. Use locking and multiple threads to test
+ * Unit test for local CacheSPI. Use locking and multiple threads to test
  * concurrent access to the tree.
  *
  * @version $Id$
  */
- at Test(groups = { "functional", "transaction" })
+ at Test(groups = {"functional", "transaction"})
 public class ConcurrentTransactionalTest
 {
-   private CacheImpl<Integer, String> cache;
+   private CacheSPI<Integer, String> cache;
    private Log logger_ = LogFactory.getLog(ConcurrentTransactionalTest.class);
    private static Throwable thread_ex = null;
    private static final int NUM = 10000;
@@ -49,11 +47,10 @@
    {
    }
 
-   private void createCache(IsolationLevel level) throws Exception
+   private void createCache(IsolationLevel level)
    {
       CacheFactory<Integer, String> factory = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<Integer, String>)factory.createCache(false);
-      cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-service.xml"));
+      cache = (CacheSPI<Integer, String>) factory.createCache(new XmlConfigurationParser().parseFile("META-INF/local-service.xml"), false);
 
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setIsolationLevel(level);
@@ -103,7 +100,7 @@
          log("*** Time elapsed: " + (now - current));
 
          System.out.println("cache content: " + cache.toString());
-         Set<Integer> keys = cache.getKeys(Fqn.fromString("/a/b/c"));
+         Set<Integer> keys = cache.getNode(Fqn.fromString("/a/b/c")).getKeys();
          System.out.println("number of keys=" + keys.size());
 
          if (keys.size() != NUM)
@@ -144,8 +141,6 @@
          }
 
          assertEquals(NUM, keys.size());
-         log("lock info:\n" + cache.printLockInfo());
-
       }
       catch (Exception e)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -8,16 +8,11 @@
 
 package org.jboss.cache.transaction;
 
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
@@ -25,20 +20,25 @@
 import org.jboss.cache.lock.TimeoutException;
 import org.jboss.cache.lock.UpgradeException;
 import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.util.CachePrinter;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+
 /**
  * Tests transactional access to a local CacheImpl, with concurrent (deadlock-prone) access.
  * Note: we use DummpyTranasctionManager to replace jta
  *
  * @version $Id$
  */
- at Test(groups = { "functional", "transaction" })
+ at Test(groups = {"functional", "transaction"})
 public class DeadlockTest
 {
-   CacheImpl<String, String> cache = null;
+   CacheSPI<String, String> cache = null;
    Exception thread_ex;
 
    final Fqn NODE = Fqn.fromString("/a/b/c");
@@ -51,7 +51,7 @@
    public void setUp() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setStateRetrievalTimeout(10000);
       cache.getConfiguration().setClusterName("test");
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
@@ -87,14 +87,14 @@
       t1.start();
       t2.start();
 
-      TestingUtil.sleepThread((long)5000);
+      TestingUtil.sleepThread((long) 5000);
 
       synchronized (t1)
       {
          t1.notify();// t1 will now try to upgrade RL to WL, but fails b/c t2 still has a RL
       }
 
-      TestingUtil.sleepThread((long)5000);
+      TestingUtil.sleepThread((long) 5000);
 
       synchronized (t2)
       {
@@ -120,14 +120,14 @@
       t1.start();
       t2.start();
 
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       synchronized (t1)
       {
          t1.notify();// t1 will now try to acquire WL on /1/2/3 (held by t2) - this will time out
       }
 
-      TestingUtil.sleepThread((long)1000);
+      TestingUtil.sleepThread((long) 1000);
 
       synchronized (t2)
       {
@@ -221,8 +221,8 @@
          upgraders[i].start();
       }
 
-      TestingUtil.sleepThread((long)1000);
-      log("locks: " + cache.printLockInfo());
+      TestingUtil.sleepThread((long) 1000);
+      log("locks: " + CachePrinter.printCacheLockingInfo(cache));
 
       synchronized (lock)
       {
@@ -242,7 +242,7 @@
       ContinuousRemover remover = new ContinuousRemover("Remover", PARENT_NODE);
       putter.start();
       remover.start();
-      TestingUtil.sleepThread((long)5000);
+      TestingUtil.sleepThread((long) 5000);
       log("stopping Putter");
       putter.looping = false;
       log("stopping Remover");
@@ -257,7 +257,7 @@
       ContinuousRemover remover = new ContinuousRemover("Remover", NODE);
       putter.start();
       remover.start();
-      TestingUtil.sleepThread((long)5000);
+      TestingUtil.sleepThread((long) 5000);
       log("stopping Putter");
       putter.looping = false;
       log("stopping Remover");
@@ -272,7 +272,7 @@
       ContinuousRemover remover = new ContinuousRemover("Remover", NODE);
       putter.start();
       remover.start();
-      TestingUtil.sleepThread((long)5000);
+      TestingUtil.sleepThread((long) 5000);
       log("stopping Putter");
       putter.looping = false;
       log("stopping Remover");
@@ -349,7 +349,7 @@
                }
                tm = startTransaction();
                log("remove(" + fqn + ")");
-               cache.remove(fqn);
+               cache.removeNode(fqn);
                sleep(random(20));
                tm.commit();
             }
@@ -409,7 +409,7 @@
 
    private static long random(long range)
    {
-      return (long)((Math.random() * 100000) % range) + 1;
+      return (long) ((Math.random() * 100000) % range) + 1;
    }
 
    class MyThread extends GenericThread
@@ -427,7 +427,7 @@
          tm = startTransaction();
          log("get(" + fqn + ")");
          cache.get(fqn, "bla");// acquires RL
-         log("done, locks: " + cache.printLockInfo());
+         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
 
          synchronized (this)
          {
@@ -436,9 +436,9 @@
 
          log("put(" + fqn + ")");
          cache.put(fqn, "key", "val");// need to upgrade RL to WL
-         log("done, locks: " + cache.printLockInfo());
+         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
          tm.commit();
-         log("committed TX, locks: " + cache.printLockInfo());
+         log("committed TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
       }
    }
 
@@ -473,9 +473,9 @@
 
             log("put(" + fqn + ")");
             cache.put(fqn, "key", "val");// need to upgrade RL to WL
-            log("done, locks: " + cache.printLockInfo());
+            log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
             tm.commit();
-            log("committed TX, locks: " + cache.printLockInfo());
+            log("committed TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
          catch (UpgradeException upge)
          {
@@ -503,13 +503,13 @@
          {
             log("received UpgradeException as expected");
             tm.rollback();
-            log("rolled back TX, locks: " + cache.printLockInfo());
+            log("rolled back TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
          catch (TimeoutException timeoutEx)
          {
             log("received TimeoutException as expected");
             tm.rollback();
-            log("rolled back TX, locks: " + cache.printLockInfo());
+            log("rolled back TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
       }
    }
@@ -530,16 +530,16 @@
          tm = startTransaction();
          log("put(" + fqn1 + ")");
          cache.put(fqn1, "key", "val");// need to upgrade RL to WL
-         log("done, locks: " + cache.printLockInfo());
+         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
          synchronized (this)
          {
             wait();
          }
          log("put(" + fqn2 + ")");
          cache.put(fqn2, "key", "val");// need to upgrade RL to WL
-         log("done, locks: " + cache.printLockInfo());
+         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
          tm.commit();
-         log("committed TX, locks: " + cache.printLockInfo());
+         log("committed TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
       }
    }
 
@@ -561,7 +561,7 @@
          {
             log("received TimeoutException as expected");
             tm.rollback();
-            log("rolled back TX, locks: " + cache.printLockInfo());
+            log("rolled back TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
       }
    }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,35 +6,35 @@
  */
 package org.jboss.cache.transaction;
 
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.util.CachePrinter;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
 
 import javax.transaction.Synchronization;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
-import org.jboss.cache.misc.TestingUtil;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
 /**
  * Tests cleaning of invocation contexts on completion of txs
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class InvocationContextCleanupTest
 {
-   private CacheImpl[] caches;
+   private CacheSPI[] caches;
 
-   private CacheImpl<Object, Object> createCache(boolean optimistic) throws Exception
+   private CacheSPI<?, ?> createCache(boolean optimistic)
    {
-      CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
+      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
       if (optimistic)
          cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
@@ -69,9 +69,9 @@
 
    private void test2CachesSync(boolean optimistic) throws Exception
    {
-      caches = new CacheImpl[2];
-      CacheImpl<Object, Object> cache0 = createCache(optimistic);
-      CacheImpl<Object, Object> cache1 = createCache(optimistic);
+      caches = new CacheSPI[2];
+      CacheSPI cache0 = createCache(optimistic);
+      CacheSPI cache1 = createCache(optimistic);
       caches[0] = cache0;
       caches[1] = cache1;
 
@@ -93,18 +93,18 @@
       {
       }
 
-      System.out.println(caches[0].printLockInfo());
-      System.out.println(caches[1].printLockInfo());
+      System.out.println(CachePrinter.printCacheLockingInfo(caches[0]));
+      System.out.println(CachePrinter.printCacheLockingInfo(caches[1]));
       assertEquals("y", cache0.get("/test", "x"));
       assertEquals("y", cache0.get("/test", "x"));
    }
 
    public static class DummySynchronization implements Synchronization
    {
-      private CacheImpl<Object, Object> cache;
+      private CacheSPI cache;
       private TransactionManager mgr;
 
-      public DummySynchronization(CacheImpl<Object, Object> cache, TransactionManager mgr)
+      public DummySynchronization(CacheSPI<?, ?> cache, TransactionManager mgr)
       {
          this.cache = cache;
          this.mgr = mgr;

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,32 +1,31 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+
 /**
  * Tests whether modifications within callbacks (TreeCacheListener) are handled correctly
  *
  * @author Bela Ban
  * @version $Id$
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class IsolationLevelNoneTest
 {
-   CacheImpl<String, String> cache = null;
+   CacheSPI<String, String> cache = null;
    final Fqn FQN = Fqn.fromString("/a/b/c");
    final String KEY = "key";
    final String VALUE = "value";
@@ -46,22 +45,22 @@
    public void testWithoutTransactions() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
       cache.start();
       cache.put(FQN, KEY, VALUE);
       cache.put(FQN + "/d", KEY, VALUE);
-      assertTrue(cache.exists(FQN, KEY));
+      Node node = cache.peek(FQN, false, false);
+      assertTrue(node != null && node.getKeys().contains(KEY));
       assertEquals(VALUE, cache.get(FQN, KEY));
-      System.out.println("cache: " + cache.toString(true) + ", locks: " + cache.printLockInfo());
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
    public void testWithTransactions() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -69,9 +68,9 @@
       tm = startTransaction();
       cache.put(FQN, KEY, VALUE);
       cache.put(FQN + "/d", KEY, VALUE);
-      assertTrue(cache.exists(FQN, KEY));
+      Node node = cache.peek(FQN, false, false);
+      assertTrue(node != null && node.getKeys().contains(KEY));
       assertEquals(VALUE, cache.get(FQN, KEY));
-      System.out.println("cache: " + cache.toString(true) + ", locks: " + cache.printLockInfo());
       assertEquals(0, cache.getNumberOfLocksHeld());
       tm.commit();
    }
@@ -79,7 +78,7 @@
    public void testWithTransactionsRepeatableRead() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -87,9 +86,9 @@
       tm = startTransaction();
       cache.put(FQN, KEY, VALUE);
       cache.put(FQN + "/d", KEY, VALUE);
-      assertTrue(cache.exists(FQN, KEY));
+      Node node = cache.peek(FQN, false, false);
+      assertTrue(node != null && node.getKeys().contains(KEY));
       assertEquals(VALUE, cache.get(FQN, KEY));
-      System.out.println("cache: " + cache.toString(true) + ", locks: " + cache.printLockInfo());
       assertEquals(5, cache.getNumberOfLocksHeld());
       tm.commit();
    }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -6,31 +6,25 @@
  */
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import junit.framework.AssertionFailedError;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Tests READ_COMMITED isolation level.
  *
@@ -41,7 +35,7 @@
 public class IsolationLevelReadCommittedNodeCreationRollbackTest
 {
 
-   private CacheImpl<String, String> cache = null;
+   private CacheSPI<String, String> cache = null;
    private final String KEY = "key";
    private final String VALUE = "value";
 
@@ -61,7 +55,7 @@
       readerError = null;
 
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>) instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
       cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,32 +1,25 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import junit.framework.AssertionFailedError;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Tests READ_COMMITED isolation level.
  *
@@ -34,7 +27,7 @@
  * @version $Id$
  */
 
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class IsolationLevelReadCommittedTest
 {
    private Cache<String, String> cache = null;
@@ -95,7 +88,8 @@
       // start a reader thread; need a transaction so its initial
       // read lock is maintained while the writer does its work
 
-      Thread readerThread = new Thread(new Runnable() {
+      Thread readerThread = new Thread(new Runnable()
+      {
          public void run()
          {
             TransactionManager tm = null;
@@ -160,7 +154,8 @@
 
       // start a writer thread and a transaction
 
-      Thread writerThread = new Thread(new Runnable() {
+      Thread writerThread = new Thread(new Runnable()
+      {
          public void run()
          {
             try
@@ -247,7 +242,8 @@
 
       // start a writer thread and a transaction
 
-      Thread writerThread = new Thread(new Runnable() {
+      Thread writerThread = new Thread(new Runnable()
+      {
          public void run()
          {
             try
@@ -305,7 +301,7 @@
       // wait for the writer to finish
       writerDone.await();
 
-      assertNull("Node was removed", ((CacheImpl<String, String>)cache).get(FQN));
+      assertNull("Node was removed", cache.getNode(FQN));
 
       // If any assertion failed, throw on the AssertionFailedError
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,39 +1,33 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.CountDownLatch;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import junit.framework.AssertionFailedError;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.util.concurrent.CountDownLatch;
+
 /**
  * Tests READ_COMMITED isolation level.
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @version $Id$
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class IsolationLevelRepeatableReadTest
 {
 
-   private CacheImpl<String, String> cache = null;
+   private CacheSPI<String, String> cache = null;
    private final Fqn FQN = Fqn.fromString("/a");
    private final String KEY = "key";
    private final String VALUE = "value";
@@ -48,7 +42,7 @@
       writerError = null;
 
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode("LOCAL");
       cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -80,7 +74,8 @@
 
       // start a writer thread and a transaction
 
-      Thread writerThread = new Thread(new Runnable() {
+      Thread writerThread = new Thread(new Runnable()
+      {
          public void run()
          {
             try
@@ -88,7 +83,7 @@
                TransactionManager tm = startTransaction();
 
                // change VALUE in a transaction
-               cache.remove(FQN);
+               cache.removeNode(FQN);
 
                // notify the reading thread
                readerCanRead.countDown();
@@ -138,7 +133,7 @@
       // wait for the writer to finish
       writerDone.await();
 
-      assertNull("Node was not removed", cache.get(FQN));
+      assertNull("Node was not removed", cache.getNode(FQN));
 
       // If any assertion failed, throw on the AssertionFailedError
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,38 +1,31 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.CountDownLatch;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import junit.framework.AssertionFailedError;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import java.util.concurrent.CountDownLatch;
+
 /**
  * Tests READ_COMMITED isolation level.
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @version $Id$
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class IsolationLevelSerializableTest
 {
 
@@ -86,7 +79,8 @@
 
       // start a writer thread and a transaction
 
-      Thread writerThread = new Thread(new Runnable() {
+      Thread writerThread = new Thread(new Runnable()
+      {
          public void run()
          {
             try
@@ -144,7 +138,7 @@
       // wait for the writer to finish
       writerDone.await();
 
-      assertNull("Node was removed", ((CacheImpl<String, String>)cache).get(FQN));
+      assertNull("Node was removed", cache.getNode(FQN));
 
       // If any assertion failed, throw on the AssertionFailedError
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,36 +1,35 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.NotSupportedException;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * Created by IntelliJ IDEA.
  * User: bela
  * Date: Jun 9, 2004
  * Time: 9:05:19 AM
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class PrepareTxTest
 {
-   CacheImpl<String, String> cache;
+   CacheSPI<String, String> cache;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode("local");
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       cache.create();
@@ -51,7 +50,7 @@
     * @throws Exception
     * @throws NotSupportedException
     */
-   public void testCacheModificationInBeforeCompletionPhase() throws Exception, NotSupportedException
+   public void testCacheModificationInBeforeCompletionPhase() throws Exception
    {
       int numLocks = 0;
       TransactionManager mgr = cache.getTransactionManager();
@@ -60,19 +59,18 @@
 
       // this will cause the cache to register with TransactionManager for TX completion callbacks
       cache.put("/one/two/three", "key1", "val1");
-      System.out.println("before commit:\n" + cache.printLockInfo());
       numLocks = cache.getNumberOfLocksHeld();
       assertEquals(4, numLocks);
 
       // we register *second*
-      tx.registerSynchronization(new Synchronization() {
+      tx.registerSynchronization(new Synchronization()
+      {
 
          public void beforeCompletion()
          {
             try
             {
                cache.put("/a/b/c", null);
-               System.out.println("before commit:\n" + cache.printLockInfo());
             }
             catch (CacheException e)
             {
@@ -86,7 +84,6 @@
       });
 
       mgr.commit();
-      System.out.println("after commit:\n" + cache.printLockInfo());
       numLocks = cache.getNumberOfLocksHeld();
       assertEquals(0, numLocks);
 
@@ -107,7 +104,7 @@
     * @throws Exception
     * @throws NotSupportedException
     */
-   public void testCacheModificationInAfterCompletionPhase() throws Exception, NotSupportedException
+   public void testCacheModificationInAfterCompletionPhase() throws Exception
    {
       int numLocks = 0;
       TransactionManager mgr = cache.getTransactionManager();
@@ -116,12 +113,12 @@
 
       // this will cause the cache to register with TransactionManager for TX completion callbacks
       cache.put("/one/two/three", "key1", "val1");
-      System.out.println("before commit:\n" + cache.printLockInfo());
       numLocks = cache.getNumberOfLocksHeld();
       assertEquals(4, numLocks);
 
       // we register *second*
-      tx.registerSynchronization(new Synchronization() {
+      tx.registerSynchronization(new Synchronization()
+      {
 
          public void beforeCompletion()
          {
@@ -132,7 +129,6 @@
             try
             {
                cache.put("/a/b/c", null);
-               System.out.println("before commit:\n" + cache.printLockInfo());
             }
             catch (CacheException e)
             {
@@ -142,7 +138,6 @@
       });
 
       mgr.commit();
-      System.out.println("after commit:\n" + cache.printLockInfo());
       numLocks = cache.getNumberOfLocksHeld();
       assertEquals(0, numLocks);
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,26 +1,22 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.UserTransaction;
+
 /**
  * A test created to simulate an unexpected TimeoutException in JBossCache
  * 1.3.0SP1 (not relevant for 1.2.4 and earlier releases). The error has been
@@ -65,7 +61,7 @@
  * @author $Author$
  * @version $Date$
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class ReplicatedTransactionDeadlockTest
 {
 
@@ -86,7 +82,7 @@
    /**
     * The source cache where we put modifications.
     */
-   private CacheImpl<Boolean, Boolean> srcCache = null;
+   private CacheSPI<Boolean, Boolean> srcCache = null;
    /**
     * The target cache where we replicate modifications.
     */
@@ -109,8 +105,7 @@
       exception = null;
       CacheFactory<Boolean, Boolean> instance = DefaultCacheFactory.getInstance();
       // setup and start the source cache
-      srcCache = (CacheImpl<Boolean, Boolean>)instance.createCache(false);
-      srcCache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+      srcCache = (CacheSPI<Boolean, Boolean>) instance.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
       srcCache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       srcCache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
 
@@ -119,8 +114,7 @@
       srcCache.create();
       srcCache.start();
       // setup and start the destination cache
-      dstCache = (CacheImpl)instance.createCache(false);
-      dstCache.setConfiguration(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC));
+      dstCache = (CacheImpl) instance.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
       dstCache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       dstCache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
 
@@ -189,9 +183,9 @@
     * @return A user transaction.
     * @throws Exception Any exception thrown by the context lookup.
     */
-   private UserTransaction getTransaction() throws Exception
+   private UserTransaction getTransaction()
    {
-      return  TransactionSetup.getUserTransaction();
+      return TransactionSetup.getUserTransaction();
    }
 
    /**

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/SuspendTxTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -1,35 +1,34 @@
 package org.jboss.cache.transaction;
 
-import static org.testng.AssertJUnit.assertEquals;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * Based on a contribution by Owen Taylor
  *
  * @author otaylor at redhat.com
  * @author Manik Surtani (manik at jboss.org)
  */
- at Test(groups = { "functional", "transaction" })
+ at Test(groups = {"functional", "transaction"})
 public class SuspendTxTest
 {
-   CacheImpl<String, String> cache;
+   CacheSPI<String, String> cache;
    TransactionManager mgr;
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
       CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, String>)instance.createCache(false);
+      cache = (CacheSPI<String, String>) instance.createCache(false);
       cache.getConfiguration().setCacheMode("local");
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       cache.start();

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2007-12-11 17:30:10 UTC (rev 4835)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2007-12-11 17:34:04 UTC (rev 4836)
@@ -10,13 +10,15 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.NodeSPI;
+import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.NodeLock;
+import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -40,10 +42,10 @@
  *
  * @version $Id$
  */
- at Test(groups={"functional", "transaction"})
+ at Test(groups = {"functional", "transaction"})
 public class TransactionTest
 {
-   CacheImpl<String, Comparable> cache = null;
+   CacheSPI cache = null;
    UserTransaction tx = null;
    Exception thread_ex;
 
@@ -52,7 +54,7 @@
    {
 
       CacheFactory<String, Comparable> instance = DefaultCacheFactory.getInstance();
-      cache = (CacheImpl<String, Comparable>)instance.createCache(false);
+      cache = (CacheSPI) instance.createCache(false);
       cache.getConfiguration().setClusterName("test");
       cache.getConfiguration().setStateRetrievalTimeout(10000);
       cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
@@ -132,19 +134,20 @@
       assertEquals(0, cache.getNumberOfLocksHeld());
       assertTrue(cache.exists("/a/b"));
       tx.begin();
-      cache.remove("/a/b");
+      cache.removeNode("/a/b");
       assertFalse(cache.exists("/a/b"));
       tx.rollback();
       assertTrue(cache.exists("/a/b"));
       assertEquals(0, cache.getNumberOfLocksHeld());
       // new tx in new thread
-      Thread th = new Thread() {
+      Thread th = new Thread()
+      {
          public void run()
          {
             try
             {
                cache.getTransactionManager().begin();
-               assertNotNull(cache.get("/a/b"));
+               assertNotNull(cache.getNode("/a/b"));
                cache.getTransactionManager().rollback();
             }
             catch (Exception e)
@@ -185,9 +188,7 @@
    {
       try
       {
-         System.out.println("locks " + cache.printLockInfo());
          cache.put("/a/b/c", "age", 38);
-         System.out.println("locks " + cache.printLockInfo());
          tx.begin();
          cache.remove("/a/b/c", "age");
          tx.rollback();
@@ -235,7 +236,7 @@
          map.put("age", 38);
          tx.begin();
          cache.put("/a/b/c", map);
-         cache.remove("/a/b/c");
+         cache.removeNode("/a/b/c");
          tx.rollback();
 
          // This test is done outside the TX, it wouldn't work if someone else
@@ -260,7 +261,7 @@
          tx.rollback();
          System.out.println("after rollback():\n" + cache);
 
-         assertNull("node should be not existent", cache.get("/bela/ban"));
+         assertNull("node should be not existent", cache.getNode("/bela/ban"));
       }
       catch (Throwable t)
       {
@@ -277,8 +278,8 @@
          tx.begin();
          cache.put("/bela/ban/michelle", null);
          tx.rollback();
-         assertNotNull("node should be not null", cache.get("/bela/ban"));
-         assertNull("node should be not existent", cache.get("/bela/ban/michelle"));
+         assertNotNull("node should be not null", cache.getNode("/bela/ban"));
+         assertNull("node should be not existent", cache.getNode("/bela/ban/michelle"));
       }
       catch (Throwable t)
       {
@@ -293,16 +294,16 @@
       {
          cache.put("/a/b/c", null);
          tx.begin();
-         cache.remove("/a/b/c");
-         assertNull(cache.get("/a/b/c"));
-         cache.remove("/a/b");
-         assertNull(cache.get("/a/b"));
-         cache.remove("/a");
-         assertNull(cache.get("/a"));
+         cache.removeNode("/a/b/c");
+         assertNull(cache.getNode("/a/b/c"));
+         cache.removeNode("/a/b");
+         assertNull(cache.getNode("/a/b"));
+         cache.removeNode("/a");
+         assertNull(cache.getNode("/a"));
          tx.rollback();
-         assertNotNull(cache.get("/a/b/c"));
-         assertNotNull(cache.get("/a/b"));
-         assertNotNull(cache.get("/a"));
+         assertNotNull(cache.getNode("/a/b/c"));
+         assertNotNull(cache.getNode("/a/b"));
+         assertNotNull(cache.getNode("/a"));
       }
       catch (Throwable t)
       {
@@ -317,23 +318,23 @@
       cache.put("/a/b/c1", null);
       cache.put("/a/b/c2", null);
       tx.begin();
-      cache.remove("/a");
-      assertNull(cache.get("/a/b/c"));
-      assertNull(cache.get("/a/b/c1"));
-      assertNull(cache.get("/a/b/c2"));
-      assertNull(cache.get("/a/b"));
-      assertNull(cache.get("/a"));
-      Set children = cache.getChildrenNames("/a/b");
+      cache.removeNode("/a");
+      assertNull(cache.getNode("/a/b/c"));
+      assertNull(cache.getNode("/a/b/c1"));
+      assertNull(cache.getNode("/a/b/c2"));
+      assertNull(cache.getNode("/a/b"));
+      assertNull(cache.getNode("/a"));
+      Set children = cache.getChildrenNames(Fqn.fromString("/a/b"));
       assertTrue(children.isEmpty());
       children = cache.getChildrenNames("/a");
       assertTrue(children.isEmpty());
       tx.rollback();
-      assertNotNull(cache.get("/a"));
-      assertNotNull(cache.get("/a/b"));
-      assertNotNull(cache.get("/a/b/c"));
-      assertNotNull(cache.get("/a/b/c1"));
-      assertNotNull(cache.get("/a/b/c2"));
-      children = cache.getChildrenNames("/a/b");
+      assertNotNull(cache.getNode("/a"));
+      assertNotNull(cache.getNode("/a/b"));
+      assertNotNull(cache.getNode("/a/b/c"));
+      assertNotNull(cache.getNode("/a/b/c1"));
+      assertNotNull(cache.getNode("/a/b/c2"));
+      children = cache.getChildrenNames(Fqn.fromString("/a/b"));
       assertEquals(3, children.size());
    }
 
@@ -347,7 +348,6 @@
       assertLocked(gtx, "/a", false);
       assertLocked(gtx, "/a/b", true);
       assertLocked(gtx, "/a/b/c", true);
-      System.out.println("locks: " + cache.printLockInfo());
    }
 
    public void testNodeCreation2() throws Exception
@@ -359,7 +359,6 @@
       assertLocked(gtx, "/a", true);
       assertLocked(gtx, "/a/b", true);
       assertLocked(gtx, "/a/b/c", true);
-      System.out.println("locks: " + cache.printLockInfo());
    }
 
    public void testNodeRemoval()
@@ -370,12 +369,10 @@
          cache.put("/a/b/c", null);
          tx.begin();
          gtx = cache.getCurrentTransaction();
-         cache.remove("/a/b/c");// need to remove the node, not just the data in the node.
-         System.out.println("Locks: " + cache.printLockInfo());
+         cache.removeNode("/a/b/c");// need to remove the node, not just the data in the node.
          assertLocked(gtx, "/a", false);
          assertLocked(gtx, "/a/b", true);
          assertLocked(gtx, "/a/b/c", true);
-         System.out.println("locks: " + cache.printLockInfo());
       }
       catch (Throwable t)
       {
@@ -392,11 +389,10 @@
          cache.put("/a/b/c", null);
          tx.begin();
          gtx = cache.getCurrentTransaction();
-         cache.remove("/a/b");// need to remove the node, not just the data in the node.
+         cache.removeNode("/a/b");// need to remove the node, not just the data in the node.
          assertLocked(gtx, "/a", true);
          assertLocked(gtx, "/a/b", true);
          assertLocked(gtx, "/a/b/c", true);
-         System.out.println("locks: " + cache.printLockInfo());
       }
       catch (Throwable t)
       {
@@ -423,7 +419,7 @@
    {
       cache.put("/a", null);
       tx.begin();
-      cache.get("/a/b/c");
+      cache.getNode("/a/b/c");
 
       // expecting RLs on /, /a
       // /a/b, /a/b/c should NOT be created!
@@ -442,7 +438,7 @@
    {
       cache.put("/a", null);
       tx.begin();
-      cache.remove("/a/b/c");
+      cache.removeNode("/a/b/c");
 
       // expecting RLs on /, /a
       // /a/b, /a/b/c should NOT be created!
@@ -495,12 +491,10 @@
       assertLocked(gtx, "/a/b/c1/two/2/3", true);
       assertLocked(gtx, "/a/b/c1/two/2/3/4", true);
 
-      System.out.println("locks: " + cache.printLockInfo());
-
-      cache.remove("/a/b");
+      cache.removeNode("/a/b");
       tx.rollback();
       assertTrue(cache.getChildrenNames("/a/b/c1").isEmpty());
-      Set cn = cache.getChildrenNames("/a/b");
+      Set cn = cache.getChildrenNames(Fqn.fromString("/a/b"));
       assertEquals(1, cn.size());
       assertEquals("c1", cn.iterator().next());
    }
@@ -512,21 +506,21 @@
       cache.put("/a/b/c", null);
       cache.put("/a/b/c", null);
 
-      NodeSPI n = (NodeSPI)cache.get("/a");
+      NodeSPI n = (NodeSPI) cache.getNode("/a");
       NodeLock lock = n.getLock();
       int num = lock.getReaderOwners().size();
       assertEquals(0, num);
       // make sure this is write locked.
       assertLocked(gtx, "/a", true);
 
-      n = (NodeSPI)cache.get("/a/b");
+      n = (NodeSPI) cache.getNode("/a/b");
       lock = n.getLock();
       num = lock.getReaderOwners().size();
       assertEquals(0, num);
       // make sure this is write locked.
       assertLocked(gtx, "/a/b", true);
 
-      n = (NodeSPI)cache.get("/a/b/c");
+      n = (NodeSPI) cache.getNode("/a/b/c");
       lock = n.getLock();
       num = lock.getReaderOwners().size();
       assertEquals(0, num);
@@ -537,7 +531,7 @@
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
-   private void assertLocked(Object owner, String fqn, boolean write_locked) throws Exception
+   private void assertLocked(Object owner, String fqn, boolean write_locked)
    {
       NodeSPI<String, Comparable> n = cache.peek(Fqn.fromString(fqn), true);
       NodeLock lock = n.getLock();
@@ -561,18 +555,17 @@
    {
       cache.put("/a/b/c", null);
       tx.begin();
-      cache.remove("/a/b/c");
+      cache.removeNode("/a/b/c");
       // this node should now be locked.
       TransactionManager tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       Transaction t = tm.suspend();
       Transaction t2;
-      System.out.println(cache.printLockInfo());
       // start a new tx
       tm.begin();
       t2 = tm.getTransaction();
       try
       {
-         cache.get("/a/b/c");// should fail
+         cache.getNode("/a/b/c");// should fail
          fail("Should not be able to get a hold of /a/b/c until the deleting tx completes");
       }
       catch (Exception e)
@@ -585,7 +578,7 @@
       tm.resume(t);
       tx.rollback();
 
-      assertNotNull(cache.get("/a/b/c"));
+      assertNotNull(cache.getNode("/a/b/c"));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
@@ -593,16 +586,16 @@
    {
       cache.put("/a/b/c", null);
       tx.begin();
-      cache.remove("/a/b/c");
+      cache.removeNode("/a/b/c");
       // this node should now be locked.
       Transaction t = cache.getTransactionManager().suspend();
-      Thread th = new Thread() {
+      Thread th = new Thread()
+      {
          public void run()
          {
             try
             {
-               System.out.println(cache.printLockInfo());
-               cache.get("/a/b/c");// should fail
+               cache.getNode("/a/b/c");// should fail
 
                fail("Should not be able to get a hold of /a/b/c until the deleting tx completes");
             }
@@ -619,10 +612,16 @@
       cache.getTransactionManager().resume(t);
       tx.rollback();
 
-      assertNotNull(cache.get("/a/b/c"));
+      assertNotNull(cache.getNode("/a/b/c"));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
+   private Map getLockTable(CacheSPI c)
+   {
+      ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
+      return cr.getComponent("LockTable", Map.class);
+   }
+
    public void testRemove() throws CacheException, SystemException, NotSupportedException, HeuristicMixedException, HeuristicRollbackException, RollbackException
    {
       cache.put("/a/b/c", null);
@@ -632,16 +631,14 @@
       cache.put("/a/b/c/3/a/b/c", null);
 
       assertEquals(0, cache.getNumberOfLocksHeld());
-      assertEquals(0, cache.getLockTable().size());
+      assertEquals(0, getLockTable(cache).size());
 
       tx.begin();
-      cache.remove("/a/b/c");
-      System.out.println("locks held (after removing /a/b/c): \n" + cache.printLockInfo());
+      cache.removeNode("/a/b/c");
       // this used to test for 2 locks held.  After the fixes for JBCACHE-875 however, 2 more locks are acquired - for the root node as well as the deleted node.
       // and since we would lock all children of the deleted node as well, we have 10 locks here.
       assertEquals(10, cache.getNumberOfLocksHeld());
       tx.commit();
-      System.out.println("locks held (after committing /a/b/c): \n" + cache.printLockInfo());
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
@@ -655,15 +652,12 @@
       cache.put("/a/b/c/3/a/b/c", null);
 
       assertEquals(0, cache.getNumberOfLocksHeld());
-      assertEquals(0, cache.getLockTable().size());
+      assertEquals(0, getLockTable(cache).size());
 
       tx.begin();
-      System.out.println("locks held (before removing /a/b/c): \n" + cache.printLockInfo());
-      cache.remove("/a/b/c");
-      System.out.println("locks held (after removing /a/b/c): \n" + cache.printLockInfo());
+      cache.removeNode("/a/b/c");
       assertEquals(10, cache.getNumberOfLocksHeld());
       tx.rollback();
-      System.out.println("locks held (after rollback): \n" + cache.printLockInfo());
       assertEquals(0, cache.getNumberOfLocksHeld());
 
       assertTrue(cache.exists("/a/b/c"));
@@ -732,9 +726,9 @@
          tx.begin();
          cache.put("/foo/1", "item", 1);
          assertEquals(cache.get("/foo/1", "item"), 1);
-         cache.remove("/foo/1");
+         cache.removeNode("/foo/1");
          assertNull(cache.get("/foo/1", "item"));
-         cache.remove("/foo/1");
+         cache.removeNode("/foo/1");
          assertNull(cache.get("/foo/1", "item"));
          tx.rollback();
          assertFalse(cache.exists("/foo/1"));
@@ -762,7 +756,7 @@
          cache.put("/bela/ban", m);
          tx.rollback();
 
-         Node n = cache.get("/bela/ban");
+         Node n = cache.getNode("/bela/ban");
          if (n.getData() == null)
             return;
          assertEquals("map should be empty", 0, n.getData().size());
@@ -793,14 +787,14 @@
          tx.begin();
 
          cache.put("/bela/ban", m2);
-         Map tmp = cache.get("/bela/ban").getData();
+         Map tmp = cache.getNode("/bela/ban").getData();
          assertEquals(3, tmp.size());
          assertEquals("Michelle", tmp.get("name"));
          assertEquals(tmp.get("id"), 322649);
          assertEquals("bla", tmp.get("other"));
          tx.rollback();
 
-         tmp = cache.get("/bela/ban").getData();
+         tmp = cache.getNode("/bela/ban").getData();
          assertEquals(2, tmp.size());
          assertEquals("Bela", tmp.get("name"));
          assertEquals(tmp.get("id"), 322649);
@@ -857,15 +851,15 @@
 
       tx.begin();
       cache.put(FQN, "entry", "rollback");
-      cache.remove(FQN);
+      cache.removeNode(FQN);
       tx.rollback();
-      assertEquals("Node should keep the commited value", "commit", cache.get(FQN).get("entry"));
+      assertEquals("Node should keep the commited value", "commit", cache.getNode(FQN).get("entry"));
 
       tx.begin();
-      cache.remove(FQN);
+      cache.removeNode(FQN);
       cache.put(FQN, "entry", "rollback");
       tx.rollback();
-      assertEquals("Node should keep the commited value", "commit", cache.get(FQN).get("entry"));// THIS FAILS
+      assertEquals("Node should keep the commited value", "commit", cache.getNode(FQN).get("entry"));// THIS FAILS
    }
 
    private TransactionManager startTransaction() throws Exception
@@ -964,7 +958,7 @@
       assertTrue(cache.exists(A));
 
       cache.getTransactionManager().begin();
-      cache.remove(A);
+      cache.removeNode(A);
       cache.get(A_B, "k");
       cache.getTransactionManager().commit();
    }
@@ -980,7 +974,7 @@
       assertTrue(cache.exists(A));
 
       cache.getTransactionManager().begin();
-      cache.remove(A_B);
+      cache.removeNode(A_B);
       cache.put(A_B, "k", "v2");
       cache.getTransactionManager().commit();
 
@@ -1004,7 +998,7 @@
       assertTrue(cache.exists(A));
 
       cache.getTransactionManager().begin();
-      cache.remove(A);
+      cache.removeNode(A);
       cache.put(A_B, "k", "v2");
       cache.getTransactionManager().commit();
 
@@ -1025,7 +1019,7 @@
       assertTrue(cache.exists(A));
 
       cache.getTransactionManager().begin();
-      cache.remove(A);
+      cache.removeNode(A);
       cache.put(A_B_C, "k", "v2");
       cache.getTransactionManager().commit();
 
@@ -1051,7 +1045,7 @@
 
       //remove all
       tx.begin();
-      this.cache.remove(root);
+      this.cache.removeNode(root);
       tx.commit();
 
       //get returns null - ok
@@ -1077,7 +1071,7 @@
 
       //remove all
       tx.begin();
-      this.cache.remove(Fqn.ROOT);
+      this.cache.removeNode(Fqn.ROOT);
       tx.commit();
 
       //get returns null - ok
@@ -1105,7 +1099,7 @@
 
       //remove all
       tx.begin();
-      this.cache.remove(root);
+      this.cache.removeNode(root);
       tx.rollback();
 
       assertEquals("v", this.cache.get(fqn, "k"));




More information about the jbosscache-commits mailing list