[hibernate-commits] Hibernate SVN: r15455 - in core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2: functional/bulk and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Oct 30 15:08:59 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-10-30 15:08:58 -0400 (Thu, 30 Oct 2008)
New Revision: 15455

Added:
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java
Modified:
   core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java
Log:
Add MVCC-flavored functional tests 

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java	2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,47 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, 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.functional;
+
+
+/**
+ * Executes the superclass tests, but with Hibernate and JBoss Cache
+ * configured for optimistic locking.
+ * 
+ * @author Brian Stansberry
+ */
+public class MVCCEntityReplicationTest extends PessimisticEntityReplicationTest
+{
+
+   public MVCCEntityReplicationTest(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected String getEntityCacheConfigName()
+   {
+      return "mvcc-shared";
+   }   
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java	2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * 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, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A 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, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Brian Stansberry
+ */
+
+package org.hibernate.test.cache.jbc2.functional;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.test.cache.jbc2.functional.util.IsolatedCacheTestSetup;
+
+/**
+ * A SessionRefreshTest that uses an OPTIMISTIC cache config.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MVCCSessionRefreshTest extends PessimisticSessionRefreshTest
+{
+   
+   private static final String CACHE_CONFIG = "mvcc-entity";
+
+   /**
+    * Create a new OptimisticSessionRefreshTest.
+    * 
+    * @param x
+    */
+   public MVCCSessionRefreshTest(String x)
+   {
+      super(x);
+   }
+   
+   public static Test suite() throws Exception {
+       TestSuite suite = new TestSuite(MVCCSessionRefreshTest.class);
+       String[] acctClasses = { OUR_PACKAGE + ".Account", OUR_PACKAGE + ".AccountHolder" };
+       return new IsolatedCacheTestSetup(suite, acctClasses, CACHE_CONFIG);
+   }
+
+   @Override
+   protected String getEntityCacheConfigName() {
+       return CACHE_CONFIG;
+   } 
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java	2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.hibernate.test.cache.jbc2.functional.bulk;
+
+import junit.framework.Test;
+
+import org.hibernate.test.cache.jbc2.collection.OptimisticInvalidatedTransactionalTestCase;
+import org.hibernate.test.util.CacheTestUtil;
+
+
+/**
+ * Optimistic version of BulkOperationsUnitTestCase.
+ * 
+ * @author Brian Stansberry
+ *
+ */
+public class MVCCBulkOperationsTest 
+   extends PessimisticBulkOperationsTest
+{
+   
+   public static Test suite() throws Exception {
+       return CacheTestUtil.createFailureExpectedSuite(MVCCBulkOperationsTest.class); 
+   }
+
+   /**
+    * @param name
+    */
+   public MVCCBulkOperationsTest(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected String getEntityCacheConfigName()
+   {
+      return "mvcc-entity";
+   } 
+
+}

Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java	                        (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java	2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * 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, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A 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, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Brian Stansberry
+ */
+
+package org.hibernate.test.cache.jbc2.functional.classloader;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.test.cache.jbc2.functional.util.IsolatedCacheTestSetup;
+
+/**
+ * Optimistic locking version of IsolatedClassLoaderTest.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MVCCIsolatedClassLoaderTest extends PessimisticIsolatedClassLoaderTest
+{
+   private static final String CACHE_CONFIG = "mvcc-shared";
+   
+   /**
+    * Create a new OptimisticIsolatedClassLoaderTest.
+    * 
+    * @param name
+    */
+   public MVCCIsolatedClassLoaderTest(String name)
+   {
+      super(name);      
+   }
+   
+   public static Test suite() throws Exception {
+       TestSuite suite = new TestSuite(MVCCIsolatedClassLoaderTest.class);
+       String[] acctClasses = { OUR_PACKAGE + ".Account", OUR_PACKAGE + ".AccountHolder" };
+       return new IsolatedCacheTestSetup(suite, acctClasses, CACHE_CONFIG);
+   }
+
+   protected String getEntityCacheConfigName() {
+       return CACHE_CONFIG;
+   } 
+
+}

Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java	2008-10-30 18:58:21 UTC (rev 15454)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java	2008-10-30 19:08:58 UTC (rev 15455)
@@ -94,6 +94,10 @@
     public void testPutDoesNotBlockGetPessimistic() throws Exception {
         putDoesNotBlockGetTest("pessimistic-shared");
     }
+        
+    public void testPutDoesNotBlockGetMVCC() throws Exception {
+        putDoesNotBlockGetTest("mvcc-shared");
+    }
     
     private void putDoesNotBlockGetTest(String configName) throws Exception {
         
@@ -190,6 +194,10 @@
         getDoesNotBlockPutTest("pessimistic-shared-repeatable");
     }
     
+    public void testGetDoesNotBlockPutMVCC() throws Exception {
+        getDoesNotBlockPutTest("mvcc-shared");
+    }
+    
     private void getDoesNotBlockPutTest(String configName) throws Exception {
         
         Configuration cfg = createConfiguration(configName);




More information about the hibernate-commits mailing list