[hibernate-commits] Hibernate SVN: r15454 - in core/branches/JBOSS_CACHE_3/cache-jbosscache2/src: test/java/org/hibernate/test/cache/jbc2/collection and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Oct 30 14:58:22 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-10-30 14:58:21 -0400 (Thu, 30 Oct 2008)
New Revision: 15454

Added:
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java
Modified:
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jbc2-configs.xml
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
Log:
Add Jason's MVCC tests

Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jbc2-configs.xml
===================================================================
(Binary files differ)

Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java	2008-10-30 16:45:35 UTC (rev 15453)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -56,9 +56,9 @@
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.transaction.BatchModeTransactionManager;
 
-/** 
+/**
  * Base class for tests of CollectionRegionAccessStrategy impls.
- * 
+ *
  * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  * @version $Revision: 1 $
  */
@@ -68,44 +68,44 @@
     public static final String KEY_BASE = "KEY";
     public static final String VALUE1 = "VALUE1";
     public static final String VALUE2 = "VALUE2";
-    
+
     protected static int testCount;
-    
+
     protected static Configuration localCfg;
     protected static JBossCacheRegionFactory localRegionFactory;
     protected static Cache localCache;
     protected static Configuration remoteCfg;
     protected static JBossCacheRegionFactory remoteRegionFactory;
     protected static Cache remoteCache;
-    
+
     protected CollectionRegion localCollectionRegion;
     protected CollectionRegionAccessStrategy localAccessStrategy;
 
     protected CollectionRegion remoteCollectionRegion;
     protected CollectionRegionAccessStrategy remoteAccessStrategy;
-    
+
     protected boolean invalidation;
     protected boolean optimistic;
     protected boolean synchronous;
-    
+
     protected Exception node1Exception;
     protected Exception node2Exception;
-    
+
     protected AssertionFailedError node1Failure;
     protected AssertionFailedError node2Failure;
-    
+
     public static Test getTestSetup(Class testClass, String configName) {
         TestSuite suite = new TestSuite(testClass);
         return new AccessStrategyTestSetup(suite, configName);
     }
-    
+
     public static Test getTestSetup(Test test, String configName) {
         return new AccessStrategyTestSetup(test, configName);
     }
-    
+
     /**
      * Create a new TransactionalAccessTestCase.
-     * 
+     *
      * @param name
      */
     public AbstractCollectionRegionAccessStrategyTestCase(String name) {
@@ -116,38 +116,38 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        
+
         // Sleep a bit to avoid concurrent FLUSH problem
         avoidConcurrentFlush();
-        
+
         invalidation = CacheHelper.isClusteredInvalidation(localCache);
         synchronous = CacheHelper.isSynchronous(localCache);
         optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
         localCollectionRegion = localRegionFactory.buildCollectionRegion(REGION_NAME, localCfg.getProperties(), getCacheDataDescription());
         localAccessStrategy = localCollectionRegion.buildAccessStrategy(getAccessType());
-        
+
         // Sleep a bit to avoid concurrent FLUSH problem
         avoidConcurrentFlush();
-        
+
         remoteCollectionRegion = remoteRegionFactory.buildCollectionRegion(REGION_NAME, remoteCfg.getProperties(), getCacheDataDescription());
         remoteAccessStrategy = remoteCollectionRegion.buildAccessStrategy(getAccessType());
-        
+
         node1Exception = null;
         node2Exception = null;
-        
+
         node1Failure = null;
         node2Failure  = null;
     }
 
     protected void tearDown() throws Exception {
-        
+
         super.tearDown();
-        
+
         if (localCollectionRegion != null)
             localCollectionRegion.destroy();
         if (remoteCollectionRegion != null)
             remoteCollectionRegion.destroy();
-        
+
         try {
             localCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
             localCache.removeNode(Fqn.ROOT);
@@ -155,7 +155,7 @@
         catch (Exception e) {
             log.error("Problem purging local cache" ,e);
         }
-        
+
         try {
             remoteCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
             remoteCache.removeNode(Fqn.ROOT);
@@ -163,14 +163,14 @@
         catch (Exception e) {
             log.error("Problem purging remote cache" ,e);
         }
-        
+
         node1Exception = null;
         node2Exception = null;
-        
+
         node1Failure = null;
         node2Failure  = null;
     }
-    
+
     protected static Configuration createConfiguration(String configName, String configResource) {
         Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX, MultiplexedJBossCacheRegionFactory.class, true, false);
         cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP, configName);
@@ -179,33 +179,38 @@
         }
         return cfg;
     }
-    
+
     protected CacheDataDescription getCacheDataDescription() {
         return new CacheDataDescriptionImpl(true, true, ComparableComparator.INSTANCE);
     }
-    
+
     protected boolean isUsingOptimisticLocking() {
         return optimistic;
     }
-    
+
+    public boolean isBlockingReads()
+    {
+    	return !isUsingOptimisticLocking();
+    }
+
     protected boolean isUsingInvalidation() {
         return invalidation;
     }
-    
+
     protected boolean isSynchronous() {
         return synchronous;
     }
-    
+
     protected Fqn getRegionFqn(String regionName, String regionPrefix) {
         return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, CollectionRegionImpl.TYPE);
     }
-    
+
     /**
      * This is just a setup test where we assert that the cache config is
      * as we expected.
      */
     public abstract void testCacheConfiguration();
-    
+
     /**
      * Test method for {@link TransactionalAccess#getRegion()}.
      */
@@ -226,7 +231,7 @@
     public void testPutFromLoadMinimal() throws Exception {
         putFromLoadTest(true);
     }
-    
+
     /**
      * Simulate 2 nodes, both start, tx do a get, experience a cache miss,
      * then 'read from db.' First does a putFromLoad, then an evict (to represent a change).
@@ -235,37 +240,37 @@
      * both start a new tx and get. First should see the updated data;
      * second should either see the updated data (isInvalidation()( == false)
      * or null (isInvalidation() == true).
-     * 
+     *
      * @param useMinimalAPI
      * @throws Exception
      */
     private void putFromLoadTest(final boolean useMinimalAPI) throws Exception {
-        
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         final CountDownLatch writeLatch1 = new CountDownLatch(1);
         final CountDownLatch writeLatch2 = new CountDownLatch(1);
         final CountDownLatch completionLatch = new CountDownLatch(2);
-        
-        Thread node1 = new Thread() {          
-            
+
+        Thread node1 = new Thread() {
+
             public void run() {
-                
-                try {       
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     assertEquals("node1 starts clean", null, localAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     writeLatch1.await();
-                    
+
                     if (useMinimalAPI) {
-                        localAccessStrategy.putFromLoad(KEY, VALUE2, txTimestamp, new Integer(2), true);                        
+                        localAccessStrategy.putFromLoad(KEY, VALUE2, txTimestamp, new Integer(2), true);
                     }
                     else {
                         localAccessStrategy.putFromLoad(KEY, VALUE2, txTimestamp, new Integer(2));
                     }
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -284,32 +289,32 @@
                 }
             }
         };
-        
+
         Thread node2 = new Thread() {
-          
-            public void run() { 
-                
-                try {                  
+
+            public void run() {
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     assertNull("node2 starts clean", remoteAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     // Let node1 write
                     writeLatch1.countDown();
                     // Wait for node1 to finish
                     writeLatch2.await();
-                    
+
                     // Let the first PFER propagate
                     sleep(200);
-                    
+
                     if (useMinimalAPI) {
-                        remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);                        
+                        remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
                     }
                     else {
                         remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1));
                     }
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -326,26 +331,26 @@
                 }
             }
         };
-        
+
         node1.setDaemon(true);
         node2.setDaemon(true);
-        
+
         node1.start();
-        node2.start();        
-        
+        node2.start();
+
         assertTrue("Threads completed", completionLatch.await(2, TimeUnit.SECONDS));
-        
+
         if (node1Failure != null)
             throw node1Failure;
         if (node2Failure != null)
             throw node2Failure;
-        
+
         assertEquals("node1 saw no exceptions", null, node1Exception);
         assertEquals("node2 saw no exceptions", null, node2Exception);
-        
+
         // let the final PFER propagate
         sleep(100);
-        
+
         long txTimestamp = System.currentTimeMillis();
         String msg1 = "Correct node1 value";
         String msg2 = "Correct node2 value";
@@ -364,8 +369,8 @@
             expected1 = VALUE2;
             expected2 = VALUE2;
         }
-        
-        assertEquals(msg1, expected1, localAccessStrategy.get(KEY, txTimestamp));        
+
+        assertEquals(msg1, expected1, localAccessStrategy.get(KEY, txTimestamp));
         assertEquals(msg2, expected2, remoteAccessStrategy.get(KEY, txTimestamp));
     }
 
@@ -385,7 +390,7 @@
 
     /**
      * Test method for {@link TransactionalAccess#evict(java.lang.Object)}.
-     * 
+     *
      * FIXME add testing of the "immediately without regard for transaction
      * isolation" bit in the CollectionRegionAccessStrategy API.
      */
@@ -395,7 +400,7 @@
 
     /**
      * Test method for {@link TransactionalAccess#evictAll()}.
-     * 
+     *
      * FIXME add testing of the "immediately without regard for transaction
      * isolation" bit in the CollectionRegionAccessStrategy API.
      */
@@ -404,41 +409,41 @@
     }
 
     private void evictOrRemoveTest(boolean evict) {
-       
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
         assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Wait for async propagation
         sleep(250);
-        
+
         if (evict)
             localAccessStrategy.evict(KEY);
         else
             localAccessStrategy.remove(KEY);
-        
+
         assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
     }
 
     private void evictOrRemoveAllTest(boolean evict) {
-       
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         Fqn regionFqn = getRegionFqn(REGION_NAME, REGION_PREFIX);
-        
+
         Node regionRoot = localCache.getRoot().getChild(regionFqn);
         assertFalse(regionRoot == null);
         assertEquals(0, getValidChildrenCount(regionRoot));
         assertTrue(regionRoot.isResident());
-        
+
         if (isUsingOptimisticLocking()) {
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
         }
@@ -447,37 +452,37 @@
         assertFalse(regionRoot == null);
         assertEquals(0, getValidChildrenCount(regionRoot));
         assertTrue(regionRoot.isResident());
-        
+
         if (isUsingOptimisticLocking()) {
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
         }
-        
+
         assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
         assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Wait for async propagation
         sleep(250);
-        
+
         if (isUsingOptimisticLocking()) {
             regionRoot = localCache.getRoot().getChild(regionFqn);
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
             regionRoot = remoteCache.getRoot().getChild(regionFqn);
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
         }
-        
+
         if (evict)
             localAccessStrategy.evictAll();
         else
             localAccessStrategy.removeAll();
-        
+
         // This should re-establish the region root node in the optimistic case
         assertNull(localAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         regionRoot = localCache.getRoot().getChild(regionFqn);
         if (isUsingOptimisticLocking()) {
             assertFalse(regionRoot == null);
@@ -489,7 +494,7 @@
             assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
         }
 
-        // Re-establishing the region root on the local node doesn't 
+        // Re-establishing the region root on the local node doesn't
         // propagate it to other nodes. Do a get on the remote node to re-establish
         // This only adds a node in the case of optimistic locking
         assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
@@ -501,15 +506,15 @@
            assertTrue(regionRoot.isResident());
            // Not invalidation, so we didn't insert a child above
            assertEquals(0, getValidChildrenCount(regionRoot));
-        }        
+        }
         else {
             assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
         }
-        
+
         // Test whether the get above messes up the optimistic version
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Revalidate the region root
         regionRoot = remoteCache.getRoot().getChild(regionFqn);
         assertFalse(regionRoot == null);
@@ -517,14 +522,14 @@
         assertTrue(regionRoot.isResident());
         // Region root should have 1 child -- the one we added above
         assertEquals(1, getValidChildrenCount(regionRoot));
-        
+
         // Wait for async propagation of the putFromLoad
         sleep(250);
-        
+
         assertEquals("local is correct", (isUsingInvalidation() ? null : VALUE1), localAccessStrategy.get(KEY, System.currentTimeMillis()));
         assertEquals("remote is correct", VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
     }
-    
+
     private int getValidChildrenCount(Node node) {
         int result = 0;
         for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
@@ -532,9 +537,9 @@
               result++;
            }
         }
-        return result;        
+        return result;
     }
-    
+
     private void rollback() {
         try {
             BatchModeTransactionManager.getInstance().rollback();
@@ -542,21 +547,21 @@
         catch (Exception e) {
             log.error(e.getMessage(), e);
         }
-        
+
     }
-    
+
     private static class AccessStrategyTestSetup extends TestSetup {
-        
+
         private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
-        
+
         private final String configResource;
         private final String configName;
         private String preferIPv4Stack;
-        
+
         public AccessStrategyTestSetup(Test test, String configName) {
             this(test, configName, null);
         }
-        
+
         public AccessStrategyTestSetup(Test test, String configName, String configResource) {
             super(test);
             this.configName = configName;
@@ -565,41 +570,41 @@
 
         @Override
         protected void setUp() throws Exception {
-            super.setUp();  
-            
-            // Try to ensure we use IPv4; otherwise cluster formation is very slow 
+            super.setUp();
+
+            // Try to ensure we use IPv4; otherwise cluster formation is very slow
             preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
             System.setProperty(PREFER_IPV4STACK, "true");
-            
+
             localCfg = createConfiguration(configName, configResource);
             localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
             localCache = localRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
-            
+
             remoteCfg = createConfiguration(configName, configResource);
             remoteRegionFactory  = CacheTestUtil.startRegionFactory(remoteCfg);
             remoteCache = remoteRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
         }
 
         @Override
-        protected void tearDown() throws Exception {      
+        protected void tearDown() throws Exception {
             try {
                 super.tearDown();
             }
             finally {
                 if (preferIPv4Stack == null)
                     System.clearProperty(PREFER_IPV4STACK);
-                else 
-                    System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);                
+                else
+                    System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
             }
-            
+
             if (localRegionFactory != null)
                 localRegionFactory.stop();
-            
+
             if (remoteRegionFactory != null)
                 remoteRegionFactory.stop();
         }
-        
-        
+
+
     }
 
 }

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,62 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests TRANSACTIONAL access when pessimistic locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccInvalidatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+    /**
+     * Create a new PessimisticTransactionalAccessTestCase.
+     *
+     * @param name
+     */
+    public MvccInvalidatedTransactionalTestCase(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccInvalidatedTransactionalTestCase.class);
+        return getTestSetup(suite, "mvcc-entity");
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertTrue("Using Invalidation", isUsingInvalidation());
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+        assertTrue("Synchronous mode", isSynchronous());
+    }
+
+    // Known failures
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,72 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.cache.access.CollectionRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this
+ * version using pessimistic locking with READ_ONLY access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyExtraAPITestCase extends OptimisticReadOnlyExtraAPITestCase {
+
+    private static CollectionRegionAccessStrategy localAccessStrategy;
+
+    /**
+     * Create a new PessimisticAccessStrategyExtraAPITestCase.
+     *
+     * @param name
+     */
+    public MvccReadOnlyExtraAPITestCase(String name) {
+        super(name);
+    }
+
+    @Override
+    protected String getCacheConfigName() {
+        return "mvcc-entity";
+    }
+
+    @Override
+    protected CollectionRegionAccessStrategy getCollectionAccessStrategy() {
+        return localAccessStrategy;
+    }
+
+    @Override
+    protected void setCollectionAccessStrategy(CollectionRegionAccessStrategy strategy) {
+        localAccessStrategy = strategy;
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+    }
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,63 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests READ_ONLY access when pessimistic locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyTestCase extends AbstractReadOnlyAccessTestCase {
+
+    /**
+     * Create a new PessimisticTransactionalAccessTestCase.
+     *
+     * @param name
+     */
+    public MvccReadOnlyTestCase(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccReadOnlyTestCase.class);
+        return getTestSetup(suite, "mvcc-entity");
+    }
+
+    // Known failures
+
+    // Overrides
+
+    @Override
+    public void testCacheConfiguration() {
+        assertTrue("Using Invalidation", isUsingInvalidation());
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+    }
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,58 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import junit.framework.Test;
+
+/**
+ * Tests TRANSACTIONAL access when pessimistic locking and replication are used.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReplicatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+    /**
+     * Create a new PessimisticTransactionalAccessTestCase.
+     *
+     * @param name
+     */
+    public MvccReplicatedTransactionalTestCase(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        return getTestSetup(MvccReplicatedTransactionalTestCase.class, "mvcc-shared");
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertFalse("Using Invalidation", isUsingInvalidation());
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+        assertTrue("Synchronous mode", isSynchronous());
+    }
+
+
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,72 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.cache.access.CollectionRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this base
+ * version using Optimistic locking with TRANSACTIONAL access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccTransactionalExtraAPITestCase extends OptimisticTransactionalExtraAPITestCase {
+
+    private static CollectionRegionAccessStrategy localAccessStrategy;
+
+    /**
+     * Create a new PessimisticAccessStrategyExtraAPITestCase.
+     *
+     * @param name
+     */
+    public MvccTransactionalExtraAPITestCase(String name) {
+        super(name);
+    }
+
+    @Override
+    protected String getCacheConfigName() {
+        return "mvcc-entity";
+    }
+
+    @Override
+    protected CollectionRegionAccessStrategy getCollectionAccessStrategy() {
+        return localAccessStrategy;
+    }
+
+    @Override
+    protected void setCollectionAccessStrategy(CollectionRegionAccessStrategy strategy) {
+        localAccessStrategy = strategy;
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+    }
+
+}

Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java	2008-10-30 16:45:35 UTC (rev 15453)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -55,9 +55,9 @@
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.transaction.BatchModeTransactionManager;
 
-/** 
+/**
  * Base class for tests of EntityRegionAccessStrategy impls.
- * 
+ *
  * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  * @version $Revision: 1 $
  */
@@ -67,54 +67,54 @@
     public static final String KEY_BASE = "KEY";
     public static final String VALUE1 = "VALUE1";
     public static final String VALUE2 = "VALUE2";
-    
+
     protected static int testCount;
-    
+
     protected static Configuration localCfg;
     protected static JBossCacheRegionFactory localRegionFactory;
     protected static Cache localCache;
     protected static Configuration remoteCfg;
     protected static JBossCacheRegionFactory remoteRegionFactory;
     protected static Cache remoteCache;
-    
+
     protected static boolean invalidation;
     protected static boolean optimistic;
     protected static boolean synchronous;
-    
+
     protected EntityRegion localEntityRegion;
     protected EntityRegionAccessStrategy localAccessStrategy;
 
     protected EntityRegion remoteEntityRegion;
     protected EntityRegionAccessStrategy remoteAccessStrategy;
-    
+
     protected Exception node1Exception;
     protected Exception node2Exception;
-    
+
     protected AssertionFailedError node1Failure;
     protected AssertionFailedError node2Failure;
-    
-    
+
+
     public static Test getTestSetup(Class testClass, String configName) {
         return getTestSetup(testClass, configName, null);
     }
-    
+
     public static Test getTestSetup(Test test, String configName) {
        return getTestSetup(test, configName, null);
-    }    
-    
+    }
+
     public static Test getTestSetup(Class testClass, String configName, String configResource) {
         TestSuite suite = new TestSuite(testClass);
         return new AccessStrategyTestSetup(suite, configName, configResource);
     }
-    
+
     public static Test getTestSetup(Test test, String configName, String configResource) {
         return new AccessStrategyTestSetup(test, configName, configResource);
     }
-    
-    
+
+
     /**
      * Create a new TransactionalAccessTestCase.
-     * 
+     *
      * @param name
      */
     public AbstractEntityRegionAccessStrategyTestCase(String name) {
@@ -125,35 +125,35 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        
+
         // Sleep a bit to avoid concurrent FLUSH problem
         avoidConcurrentFlush();
-        
+
         localEntityRegion = localRegionFactory.buildEntityRegion(REGION_NAME, localCfg.getProperties(), getCacheDataDescription());
         localAccessStrategy = localEntityRegion.buildAccessStrategy(getAccessType());
-        
+
         // Sleep a bit to avoid concurrent FLUSH problem
         avoidConcurrentFlush();
-        
+
         remoteEntityRegion = remoteRegionFactory.buildEntityRegion(REGION_NAME, remoteCfg.getProperties(), getCacheDataDescription());
         remoteAccessStrategy = remoteEntityRegion.buildAccessStrategy(getAccessType());
-                
+
         node1Exception = null;
         node2Exception = null;
-        
+
         node1Failure = null;
         node2Failure  = null;
     }
 
     protected void tearDown() throws Exception {
-        
+
         super.tearDown();
-        
+
         if (localEntityRegion != null)
             localEntityRegion.destroy();
         if (remoteEntityRegion != null)
             remoteEntityRegion.destroy();
-        
+
         try {
             localCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
             localCache.removeNode(Fqn.ROOT);
@@ -161,7 +161,7 @@
         catch (Exception e) {
             log.error("Problem purging local cache" ,e);
         }
-        
+
         try {
             remoteCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
             remoteCache.removeNode(Fqn.ROOT);
@@ -169,14 +169,14 @@
         catch (Exception e) {
             log.error("Problem purging remote cache" ,e);
         }
-        
+
         node1Exception = null;
         node2Exception = null;
-        
+
         node1Failure = null;
         node2Failure  = null;
     }
-    
+
     protected static Configuration createConfiguration(String configName, String configResource) {
         Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX, MultiplexedJBossCacheRegionFactory.class, true, false);
         cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP, configName);
@@ -185,23 +185,23 @@
         }
         return cfg;
     }
-    
+
     protected CacheDataDescription getCacheDataDescription() {
         return new CacheDataDescriptionImpl(true, true, ComparableComparator.INSTANCE);
     }
-    
+
     protected boolean isUsingOptimisticLocking() {
         return optimistic;
     }
-    
+
     protected boolean isUsingInvalidation() {
         return invalidation;
     }
-    
+
     protected boolean isSynchronous() {
         return synchronous;
     }
-    
+
     protected Fqn getRegionFqn(String regionName, String regionPrefix) {
         return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, EntityRegionImpl.TYPE);
     }
@@ -212,24 +212,24 @@
             throw node1Failure;
         if (node2Failure != null)
             throw node2Failure;
-      
+
         if (node1Exception != null) {
             log.error("node1 saw an exception", node1Exception);
             assertEquals("node1 saw no exceptions", null, node1Exception);
         }
-        
+
         if (node2Exception != null) {
             log.error("node2 saw an exception", node2Exception);
             assertEquals("node2 saw no exceptions", null, node2Exception);
         }
     }
-    
+
     /**
      * This is just a setup test where we assert that the cache config is
      * as we expected.
      */
     public abstract void testCacheConfiguration();
-    
+
     /**
      * Test method for {@link TransactionalAccess#getRegion()}.
      */
@@ -250,7 +250,7 @@
     public void testPutFromLoadMinimal() throws Exception {
         putFromLoadTest(true);
     }
-    
+
     /**
      * Simulate 2 nodes, both start, tx do a get, experience a cache miss,
      * then 'read from db.' First does a putFromLoad, then an update.
@@ -259,39 +259,39 @@
      * both start a new tx and get. First should see the updated data;
      * second should either see the updated data (isInvalidation() == false)
      * or null (isInvalidation() == true).
-     * 
+     *
      * @param useMinimalAPI
      * @throws Exception
      */
     private void putFromLoadTest(final boolean useMinimalAPI) throws Exception {
-        
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         final CountDownLatch writeLatch1 = new CountDownLatch(1);
         final CountDownLatch writeLatch2 = new CountDownLatch(1);
         final CountDownLatch completionLatch = new CountDownLatch(2);
-        
-        Thread node1 = new Thread() {          
-            
+
+        Thread node1 = new Thread() {
+
             public void run() {
-                
-                try {       
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     assertNull("node1 starts clean", localAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     writeLatch1.await();
-                    
+
                     if (useMinimalAPI) {
-                        localAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);                        
+                        localAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
                     }
                     else {
                         localAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1));
                     }
-                    
+
                     localAccessStrategy.update(KEY, VALUE2, new Integer(2), new Integer(1));
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -310,29 +310,29 @@
                 }
             }
         };
-        
+
         Thread node2 = new Thread() {
-          
-            public void run() { 
-                
-                try {                  
+
+            public void run() {
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     assertNull("node1 starts clean", remoteAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     // Let node1 write
                     writeLatch1.countDown();
                     // Wait for node1 to finish
                     writeLatch2.await();
-                    
+
                     if (useMinimalAPI) {
-                        remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);                        
+                        remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
                     }
                     else {
                         remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1));
                     }
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -349,32 +349,32 @@
                 }
             }
         };
-        
+
         node1.setDaemon(true);
         node2.setDaemon(true);
-        
+
         node1.start();
-        node2.start();        
-        
+        node2.start();
+
         assertTrue("Threads completed", completionLatch.await(2, TimeUnit.SECONDS));
-        
+
         assertThreadsRanCleanly();
-        
+
         long txTimestamp = System.currentTimeMillis();
         assertEquals("Correct node1 value", VALUE2, localAccessStrategy.get(KEY, txTimestamp));
-        
+
         if (isUsingInvalidation()) {
             if (isUsingOptimisticLocking())
-                // The node is "deleted" but it's ghost data version prevents the stale node2 PFER 
+                // The node is "deleted" but it's ghost data version prevents the stale node2 PFER
                 assertEquals("Correct node2 value", null, remoteAccessStrategy.get(KEY, txTimestamp));
             else {
                 // no data version to prevent the PFER; we count on db locks preventing this
-                assertEquals("Expected node2 value", VALUE1, remoteAccessStrategy.get(KEY, txTimestamp));                
+                assertEquals("Expected node2 value", VALUE1, remoteAccessStrategy.get(KEY, txTimestamp));
             }
         }
         else {
             // The node1 update is replicated, preventing the node2 PFER
-            assertEquals("Correct node2 value", VALUE2, remoteAccessStrategy.get(KEY, txTimestamp));            
+            assertEquals("Correct node2 value", VALUE2, remoteAccessStrategy.get(KEY, txTimestamp));
         }
     }
 
@@ -382,28 +382,28 @@
      * Test method for {@link TransactionalAccess#insert(java.lang.Object, java.lang.Object, java.lang.Object)}.
      */
     public void testInsert() throws Exception {
-       
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         final CountDownLatch readLatch = new CountDownLatch(1);
         final CountDownLatch commitLatch = new CountDownLatch(1);
         final CountDownLatch completionLatch = new CountDownLatch(2);
-        
-        Thread inserter = new Thread() {          
-            
+
+        Thread inserter = new Thread() {
+
             public void run() {
-                
-                try {       
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     assertNull("Correct initial value", localAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     localAccessStrategy.insert(KEY, VALUE1, new Integer(1));
-                    
+
                     readLatch.countDown();
                     commitLatch.await();
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -420,20 +420,20 @@
                 }
             }
         };
-        
-        Thread reader = new Thread() {          
-            
+
+        Thread reader = new Thread() {
+
             public void run() {
-                
-                try {       
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     readLatch.await();
-                    Object expected = isUsingOptimisticLocking() ? null : VALUE1;
-                    
+                    Object expected = !isBlockingReads() ? null : VALUE1;
+
                     assertEquals("Correct initial value", expected, localAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -451,13 +451,13 @@
                 }
             }
         };
-        
+
         inserter.setDaemon(true);
         reader.setDaemon(true);
         inserter.start();
         reader.start();
-        
-        if (isUsingOptimisticLocking())
+
+        if (! isBlockingReads())
             assertTrue("Threads completed", completionLatch.await(1, TimeUnit.SECONDS));
         else {
             // Reader should be blocking for lock
@@ -465,48 +465,53 @@
             commitLatch.countDown();
             assertTrue("Threads completed", completionLatch.await(1, TimeUnit.SECONDS));
         }
-        
+
         assertThreadsRanCleanly();
-        
+
         long txTimestamp = System.currentTimeMillis();
         assertEquals("Correct node1 value", VALUE1, localAccessStrategy.get(KEY, txTimestamp));
         Object expected = isUsingInvalidation() ? null : VALUE1;
         assertEquals("Correct node2 value", expected, remoteAccessStrategy.get(KEY, txTimestamp));
     }
 
+    public boolean isBlockingReads()
+    {
+    	return !isUsingOptimisticLocking();
+    }
+
     /**
      * Test method for {@link TransactionalAccess#update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)}.
      */
     public void testUpdate() throws Exception {
-       
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         // Set up initial state
         localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
-        
+
         // Let the async put propagate
         sleep(250);
-        
+
         final CountDownLatch readLatch = new CountDownLatch(1);
         final CountDownLatch commitLatch = new CountDownLatch(1);
         final CountDownLatch completionLatch = new CountDownLatch(2);
-        
-        Thread updater = new Thread() {          
-            
+
+        Thread updater = new Thread() {
+
             public void run() {
-                
-                try {       
+
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     assertEquals("Correct initial value", VALUE1, localAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     localAccessStrategy.update(KEY, VALUE2, new Integer(2), new Integer(1));
-                    
+
                     readLatch.countDown();
                     commitLatch.await();
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -523,22 +528,22 @@
                 }
             }
         };
-        
-        Thread reader = new Thread() {          
-            
-            public void run() {                
-                try {       
+
+        Thread reader = new Thread() {
+
+            public void run() {
+                try {
                     long txTimestamp = System.currentTimeMillis();
                     BatchModeTransactionManager.getInstance().begin();
-                    
+
                     readLatch.await();
-                    
+
                     // This will block w/ pessimistic locking and then
                     // read the new value; w/ optimistic it shouldn't
                     // block and will read the old value
-                    Object expected = isUsingOptimisticLocking() ? VALUE1 : VALUE2;
+                    Object expected = !isBlockingReads() ? VALUE1 : VALUE2;
                     assertEquals("Correct value", expected, localAccessStrategy.get(KEY, txTimestamp));
-                    
+
                     BatchModeTransactionManager.getInstance().commit();
                 }
                 catch (Exception e) {
@@ -553,28 +558,28 @@
                 finally {
                     commitLatch.countDown();
                     completionLatch.countDown();
-                }                
+                }
             }
         };
-        
+
         updater.setDaemon(true);
         reader.setDaemon(true);
         updater.start();
         reader.start();
-        
-        if (isUsingOptimisticLocking())
+
+        if (! isBlockingReads())
             // Should complete promptly
             assertTrue(completionLatch.await(1, TimeUnit.SECONDS));
-        else {        
+        else {
             // Reader thread should be blocking
             assertFalse(completionLatch.await(250, TimeUnit.MILLISECONDS));
             // Let the writer commit down
             commitLatch.countDown();
             assertTrue(completionLatch.await(1, TimeUnit.SECONDS));
         }
-        
+
         assertThreadsRanCleanly();
-        
+
         long txTimestamp = System.currentTimeMillis();
         assertEquals("Correct node1 value", VALUE2, localAccessStrategy.get(KEY, txTimestamp));
         Object expected = isUsingInvalidation() ? null : VALUE2;
@@ -597,7 +602,7 @@
 
     /**
      * Test method for {@link TransactionalAccess#evict(java.lang.Object)}.
-     * 
+     *
      * FIXME add testing of the "immediately without regard for transaction
      * isolation" bit in the EntityRegionAccessStrategy API.
      */
@@ -607,7 +612,7 @@
 
     /**
      * Test method for {@link TransactionalAccess#evictAll()}.
-     * 
+     *
      * FIXME add testing of the "immediately without regard for transaction
      * isolation" bit in the EntityRegionAccessStrategy API.
      */
@@ -616,43 +621,43 @@
     }
 
     private void evictOrRemoveTest(boolean evict) {
-       
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
         assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Wait for async propagation
         sleep(250);
-        
+
         if (evict)
             localAccessStrategy.evict(KEY);
         else
             localAccessStrategy.remove(KEY);
-        
+
         assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
 //        sleep(1000);
-        
+
         assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
     }
 
     private void evictOrRemoveAllTest(boolean evict) {
-       
+
         final String KEY = KEY_BASE + testCount++;
-        
+
         Fqn regionFqn = getRegionFqn(REGION_NAME, REGION_PREFIX);
-        
+
         Node regionRoot = localCache.getRoot().getChild(regionFqn);
         assertFalse(regionRoot == null);
         assertEquals(0, getValidChildrenCount(regionRoot));
         assertTrue(regionRoot.isResident());
-        
+
         if (isUsingOptimisticLocking()) {
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
         }
@@ -661,41 +666,41 @@
         assertFalse(regionRoot == null);
         assertEquals(0, getValidChildrenCount(regionRoot));
         assertTrue(regionRoot.isResident());
-        
+
         if (isUsingOptimisticLocking()) {
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
         }
-        
+
         assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
         assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Wait for async propagation
         sleep(250);
-        
+
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Wait for async propagation
         sleep(250);
-        
+
         if (isUsingOptimisticLocking()) {
             regionRoot = localCache.getRoot().getChild(regionFqn);
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
             regionRoot = remoteCache.getRoot().getChild(regionFqn);
             assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
         }
-        
+
         if (evict)
             localAccessStrategy.evictAll();
         else
             localAccessStrategy.removeAll();
-        
+
         // This should re-establish the region root node in the optimistic case
         assertNull(localAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         regionRoot = localCache.getRoot().getChild(regionFqn);
         if (isUsingOptimisticLocking()) {
             assertFalse(regionRoot == null);
@@ -707,7 +712,7 @@
             assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
         }
 
-        // Re-establishing the region root on the local node doesn't 
+        // Re-establishing the region root on the local node doesn't
         // propagate it to other nodes. Do a get on the remote node to re-establish
         assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
 
@@ -718,15 +723,15 @@
            assertTrue(regionRoot.isResident());
            // Not invalidation, so we didn't insert a child above
            assertEquals(0, getValidChildrenCount(regionRoot));
-       }        
+       }
        else {
           assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
        }
-        
+
         // Test whether the get above messes up the optimistic version
         remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
         assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-        
+
         // Revalidate the region root
         regionRoot = remoteCache.getRoot().getChild(regionFqn);
         assertFalse(regionRoot == null);
@@ -734,14 +739,14 @@
         assertTrue(regionRoot.isResident());
         // Region root should have 1 child -- the one we added above
         assertEquals(1, getValidChildrenCount(regionRoot));
-        
+
         // Wait for async propagation
         sleep(250);
-        
+
         assertEquals("local is correct", (isUsingInvalidation() ? null : VALUE1), localAccessStrategy.get(KEY, System.currentTimeMillis()));
         assertEquals("remote is correct", VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
     }
-    
+
     private int getValidChildrenCount(Node node) {
         int result = 0;
         for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
@@ -749,9 +754,9 @@
               result++;
            }
         }
-        return result;        
+        return result;
     }
-    
+
     protected void rollback() {
         try {
             BatchModeTransactionManager.getInstance().rollback();
@@ -759,21 +764,21 @@
         catch (Exception e) {
             log.error(e.getMessage(), e);
         }
-        
+
     }
-    
+
     private static class AccessStrategyTestSetup extends TestSetup {
-        
+
         private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
-        
+
         private final String configResource;
         private final String configName;
         private String preferIPv4Stack;
-        
+
         public AccessStrategyTestSetup(Test test, String configName) {
             this(test, configName, null);
         }
-        
+
         public AccessStrategyTestSetup(Test test, String configName, String configResource) {
             super(test);
             this.configName = configName;
@@ -788,39 +793,39 @@
             finally {
                 if (preferIPv4Stack == null)
                     System.clearProperty(PREFER_IPV4STACK);
-                else 
-                    System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);                
+                else
+                    System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
             }
-            
-            // Try to ensure we use IPv4; otherwise cluster formation is very slow 
+
+            // Try to ensure we use IPv4; otherwise cluster formation is very slow
             preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
             System.setProperty(PREFER_IPV4STACK, "true");
-            
+
             localCfg = createConfiguration(configName, configResource);
             localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
             localCache = localRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
-            
+
             remoteCfg = createConfiguration(configName, configResource);
             remoteRegionFactory  = CacheTestUtil.startRegionFactory(remoteCfg);
             remoteCache = remoteRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
-            
+
             invalidation = CacheHelper.isClusteredInvalidation(localCache);
             synchronous = CacheHelper.isSynchronous(localCache);
             optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
         }
 
         @Override
-        protected void tearDown() throws Exception {            
+        protected void tearDown() throws Exception {
             super.tearDown();
-            
+
             if (localRegionFactory != null)
                 localRegionFactory.stop();
-            
+
             if (remoteRegionFactory != null)
                 remoteRegionFactory.stop();
         }
-        
-        
+
+
     }
 
 }

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests TRANSACTIONAL access when MVCC locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccInvalidatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+    /**
+     * Create a new PessimisticTransactionalAccessTestCase.
+     *
+     * @param name
+     */
+    public MvccInvalidatedTransactionalTestCase(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccInvalidatedTransactionalTestCase.class);
+        return getTestSetup(suite, "mvcc-entity");
+    }
+
+    // Known failures
+
+    // Overrides
+
+    @Override
+    public void testCacheConfiguration() {
+        assertTrue("Using Invalidation", isUsingInvalidation());
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+        assertTrue("Synchronous mode", isSynchronous());
+    }
+
+	@Override
+	public boolean isBlockingReads() {
+		return false;
+	}
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this
+ * version using pessimistic locking with READ_ONLY access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyExtraAPITestCase extends OptimisticReadOnlyExtraAPITestCase {
+
+    private static EntityRegionAccessStrategy localAccessStrategy;
+
+    /**
+     * Create a new PessimisticAccessStrategyExtraAPITestCase.
+     *
+     * @param name
+     */
+    public MvccReadOnlyExtraAPITestCase(String name) {
+        super(name);
+    }
+
+    @Override
+    protected String getCacheConfigName() {
+        return "mvcc-entity";
+    }
+
+    @Override
+    protected EntityRegionAccessStrategy getEntityAccessStrategy() {
+        return localAccessStrategy;
+    }
+
+    @Override
+    protected void setEntityRegionAccessStrategy(EntityRegionAccessStrategy strategy) {
+        localAccessStrategy = strategy;
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+    }
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests READ_ONLY access when pessimistic locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyTestCase extends AbstractReadOnlyAccessTestCase {
+
+    /**
+     * Create a new PessimisticTransactionalAccessTestCase.
+     *
+     * @param name
+     */
+    public MvccReadOnlyTestCase(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccReadOnlyTestCase.class);
+        return getTestSetup(suite, "mvcc-entity");
+    }
+
+    // Known failures
+
+    // Overrides
+
+
+    @Override
+    public void testCacheConfiguration() {
+        assertTrue("Using Invalidation", isUsingInvalidation());
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+    }
+
+    @Override
+	public boolean isBlockingReads() {
+		return false;
+	}
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,62 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import junit.framework.Test;
+
+/**
+ * Tests TRANSACTIONAL access when pessimistic locking and replication are used.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReplicatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+    /**
+     * Create a new PessimisticTransactionalAccessTestCase.
+     *
+     * @param name
+     */
+    public MvccReplicatedTransactionalTestCase(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        return getTestSetup(MvccReplicatedTransactionalTestCase.class, "mvcc-shared");
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertFalse("Using Invalidation", isUsingInvalidation());
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+        assertTrue("Synchronous mode", isSynchronous());
+    }
+
+    @Override
+	public boolean isBlockingReads() {
+		return false;
+	}
+
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this base
+ * version using Optimistic locking with TRANSACTIONAL access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccTransactionalExtraAPITestCase extends OptimisticTransactionalExtraAPITestCase {
+
+    private static EntityRegionAccessStrategy localAccessStrategy;
+
+    /**
+     * Create a new PessimisticAccessStrategyExtraAPITestCase.
+     *
+     * @param name
+     */
+    public MvccTransactionalExtraAPITestCase(String name) {
+        super(name);
+    }
+
+    @Override
+    protected String getCacheConfigName() {
+        return "mvcc-entity";
+    }
+
+    @Override
+    protected EntityRegionAccessStrategy getEntityAccessStrategy() {
+        return localAccessStrategy;
+    }
+
+    @Override
+    protected void setEntityRegionAccessStrategy(EntityRegionAccessStrategy strategy) {
+        localAccessStrategy = strategy;
+    }
+
+    @Override
+    public void testCacheConfiguration() {
+        assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+    }
+}




More information about the hibernate-commits mailing list