openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r984147 - /openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/
Date Tue, 10 Aug 2010 17:57:18 GMT
Author: allee8285
Date: Tue Aug 10 17:57:17 2010
New Revision: 984147

URL: http://svn.apache.org/viewvc?rev=984147&view=rev
Log:
OPENJPA-1753 a) remove unneeded import, b) close and clean up em using add Act.CloseEm, c) add better diagnostic info in SequenceActionsTest  and d) clean up and update find/lock permutation tests for more consistent testing.

Modified:
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindBasic.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindException.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindPermutation.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockBasic.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockException.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockPermutation.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshBasic.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshException.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestOptimisticNamedQueryLockMode.java

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java Tue Aug 10 17:57:17 2010
@@ -81,6 +81,7 @@ public abstract class SequencedActionsTe
     private String empTableName;
     private List<TestThread> threads = null;
 
+    @SuppressWarnings("deprecation")
     protected void commonSetUp() {
         empTableName = getMapping(LockEmployee.class).getTable().getFullName();
 
@@ -326,10 +327,12 @@ public abstract class SequencedActionsTe
         LockEmployee employee = null;
         LockModeType lockMode = null;
         Act curAction = null;
+        int actIndex = 0;
         Object[][] threadSequence = actions[threadToRun];
         for (Object[] args : threadSequence) {
             curAction = (Act) args[0];
-            log.trace("** Act=" + Arrays.toString(args));
+            String curAct = "Act[t" + threadToRun + ":" + (++actIndex) +"]=" + Arrays.toString(args);
+            log.trace("** " + curAct);
             try {
                 switch (curAction) {
                 case CreateEm:
@@ -591,7 +594,7 @@ public abstract class SequencedActionsTe
                         id = (Integer)args[1];
                     }
                     employee = employees.get(id);
-                    assertNotNull(employee);
+                    assertNotNull(curAct, employee);
                     break;
                 case TestEmployee:
                     id = 1;
@@ -602,22 +605,22 @@ public abstract class SequencedActionsTe
                     switch (args.length) {
                     case 4:
                         if (args[3] != null) {
-                            assertEquals("", saveVersion
+                            assertEquals(curAct, saveVersion
                                 + (Integer) args[3], employee.getVersion());
                         }
                     case 3:
                         if (args[2] != null) {
-                            assertEquals("", (String) args[2], employee
+                            assertEquals(curAct, (String) args[2], employee
                                 .getFirstName());
                         }
                     case 2:
                         if (args[1] != null) {
-                            assertEquals("", id.intValue(),
+                            assertEquals(curAct, id.intValue(),
                                 employee.getId());
                         }
                         break;
                     case 1:
-                        assertNull(employee);
+                        assertNull(curAct, employee);
                     }
                     break;
                 case SaveVersion:
@@ -640,7 +643,7 @@ public abstract class SequencedActionsTe
                         + (saveVersion + increment) + ", testing="
                         + employee.getVersion());
 
-                    assertEquals("", saveVersion + increment, employee
+                    assertEquals(curAct, saveVersion + increment, employee
                         .getVersion());
                     break;
                 case TestLockMode:
@@ -654,7 +657,7 @@ public abstract class SequencedActionsTe
                     log.trace("test version: expected=" + expectedlockMode
                         + ", testing=" + testinglockMode);
 
-                    assertEquals("", getCanonical(expectedlockMode),
+                    assertEquals(curAct, getCanonical(expectedlockMode),
                         getCanonical(testinglockMode));
                     break;
                 case ResetException:
@@ -696,7 +699,7 @@ public abstract class SequencedActionsTe
                         && expectedExceptions.size() > 0) {
                         for (Class<?> expectedException :
                             expectedExceptions) {
-                            if (matchExpectedException(expectedException,
+                            if (matchExpectedException(curAct, expectedException,
                                 curThrowable)) {
                                 exMatched = true;
                                 break;
@@ -713,7 +716,7 @@ public abstract class SequencedActionsTe
                             logStack(curThrowable);
                         }
                     }
-                    assertTrue("Expecting=" + expectedExceptions
+                    assertTrue(curAct + ":Expecting=" + expectedExceptions
                         + ", Testing=" + testExClass, exMatched);
                     exThread.throwable = null;
                     break;
@@ -908,9 +911,9 @@ public abstract class SequencedActionsTe
         return props;
     }
 
-    private boolean matchExpectedException(Class<?> expected,
+    private boolean matchExpectedException(String curAct, Class<?> expected,
         Throwable tested) {
-        assertNotNull(expected);
+        assertNotNull(curAct, expected);
         Class<?> testExClass = null;
         boolean exMatched = true;
         if (tested != null) {

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java Tue Aug 10 17:57:17 2010
@@ -20,7 +20,6 @@ package org.apache.openjpa.persistence.l
 
 import java.sql.Connection;
 import java.sql.ResultSet;
-import java.util.HashMap;
 
 import javax.persistence.EntityManager;
 import javax.persistence.LockModeType;

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java Tue Aug 10 17:57:17 2010
@@ -121,7 +121,8 @@ public class TestMixedLockManagerDeadloc
             {Act.WaitAllChildren},
             {Act.TestException, 1, t1Exceptions},
 
-            {Act.RollbackTx}
+            {Act.RollbackTx},
+            {Act.CloseEm}
         };
         Object[][] thread1 = {
             {Act.CreateEm},
@@ -134,6 +135,7 @@ public class TestMixedLockManagerDeadloc
             {Act.NamedQueryWithLock, "findEmployeeById", 1, t1Lock, "openjpa.hint.IgnorePreparedQuery", true},            
 
             {Act.RollbackTx},
+            {Act.CloseEm}
         };
         launchActionSequence(testName, parameters, threadMain, thread1);
     }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindBasic.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindBasic.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindBasic.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindBasic.java Tue Aug 10 17:57:17 2010
@@ -111,6 +111,7 @@ public class TestMixedLockManagerFindBas
             { Act.Clear },
             { Act.Find, 1 },
             { Act.TestEmployee, 1, lockMode.toString(), 0 },
+            { Act.CloseEm }
         };
 
         launchActionSequence(testName, "LockMode=" + lockMode, threadMain);

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindException.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindException.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindException.java Tue Aug 10 17:57:17 2010
@@ -67,6 +67,7 @@ public class TestMixedLockManagerFindExc
             
             {Act.FindWithLock, 1, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, TransactionRequiredException.class },
+            {Act.CloseEm},
         };
         launchActionSequence("testLockTxReqExceptions()",
             null, threadMainTxReqTest);
@@ -182,6 +183,7 @@ public class TestMixedLockManagerFindExc
             {Act.FindObject, LockEmployee.class, Boolean.TRUE, 
                 LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
+            {Act.CloseEm}
         };
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test invalid entity.", threadMainInvEntityIllegalArgTest);
@@ -239,6 +241,7 @@ public class TestMixedLockManagerFindExc
                 ? OptimisticLockException.class : null},
             {Act.TestException, 1, expectingOptLockException2
                     ? OptimisticLockException.class : null},
+            {Act.CloseEm}
         };
         Object[][] thread1OptLockExTest = {
             {Act.CreateEm},
@@ -252,6 +255,7 @@ public class TestMixedLockManagerFindExc
             
             {Act.CommitTx},
             {Act.Notify, 0},
+            {Act.CloseEm}
         };        
         launchActionSequence("testLockOptimisticLockExceptions()", null,
             threadMainOptLockExTest, thread1OptLockExTest);

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindPermutation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindPermutation.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindPermutation.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerFindPermutation.java Tue Aug 10 17:57:17 2010
@@ -59,8 +59,8 @@ public class TestMixedLockManagerFindPer
     public void testFindReadPessimisticRead() {
         commonFindTest(
             "testFind(Read,Commit/PessimisticRead,Commit)",
-            LockModeType.READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null);
+            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null);
         commonFindTest(
             "testFind(Read,Commit/PessimisticRead,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
@@ -70,8 +70,8 @@ public class TestMixedLockManagerFindPer
     public void testFindReadPessimisticWrite() {
         commonFindTest(
             "testFind(Read,Commit/PessimisticWrite,Commit)",
-            LockModeType.READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null);
+            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null);
         commonFindTest(
             "testFind(Read,Commit/PessimisticWrite,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
@@ -115,8 +115,8 @@ public class TestMixedLockManagerFindPer
     public void testFindWritePessimisticRead() {
         commonFindTest(
             "testFind(Write,Commit/PessimisticRead,Commit)",
-            LockModeType.WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null);
+            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null);
         commonFindTest(
             "testFind(Write,Commit/PessimisticRead,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
@@ -126,8 +126,8 @@ public class TestMixedLockManagerFindPer
     public void testFindWritePessimisticWrite() {
         commonFindTest(
             "testFind(Write,Commit/PessimisticWrite,Commit)",
-            LockModeType.WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null);
+            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null);
         commonFindTest(
             "testFind(Write,Commit/PessimisticWrite,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
@@ -172,7 +172,7 @@ public class TestMixedLockManagerFindPer
         commonFindTest(
             "testFind(PessimisticRead,Commit/PessimisticRead,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null);
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null);
         commonFindTest(
             "testFind(PessimisticRead,Commit/PessimisticRead,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
@@ -183,7 +183,7 @@ public class TestMixedLockManagerFindPer
         commonFindTest(
             "testFind(PessimisticRead,Commit/PessimisticWrite,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null); 
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null); 
         commonFindTest(
             "testFind(PessimisticRead,Commit/PessimisticWrite,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
@@ -228,7 +228,7 @@ public class TestMixedLockManagerFindPer
         commonFindTest(
             "testFind(PessimsiticWrite,Commit/PessimisticRead,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null); 
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null); 
         commonFindTest(
             "testFind(PessimsiticWrite,Commit/PessimisticRead,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
@@ -239,7 +239,7 @@ public class TestMixedLockManagerFindPer
         commonFindTest(
             "testFind(PessimsiticWrite,Commit/PessimisticWrite,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null); 
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null); 
         commonFindTest(
             "testFind(PessimsiticWrite,Commit/PessimisticWrite,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
@@ -284,7 +284,7 @@ public class TestMixedLockManagerFindPer
         commonFindTest(
             "testFind(PessimsiticForceInc,Commit/PessimisticRead,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null); 
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null); 
         commonFindTest(
             "testFind(PessimsiticForceInc,Commit/PessimisticRead,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
@@ -295,7 +295,7 @@ public class TestMixedLockManagerFindPer
         commonFindTest(
             "testFind(PessimsiticForceInc,Commit/PessimisticWrite,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null);
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null);
         commonFindTest(
             "testFind(PessimsiticForceInc,Commit/PessimisticWrite,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
@@ -327,51 +327,57 @@ public class TestMixedLockManagerFindPer
                 ", expectedEx= " + Arrays.toString(t2Exceptions)};
             
         Object[][] threadMain = {
-            {Act.CreateEm},
-            {Act.Find},
-            {Act.SaveVersion},
-            {Act.TestEmployee, 1, Default_FirstName},
-            
-            {Act.NewThread, 1 },
-            {Act.NewThread, 2 },
-            {Act.StartThread, 1 },
-            {Act.Wait},
-            {Act.StartThread, 2 },
-            {Act.Notify, 1, 1000 },
-            {Act.Notify, 2, 1000 },
-            {Act.WaitAllChildren},
-            {Act.Find},
-            {Act.TestEmployee, 1},
-            {Act.TestException, 1, t1Exceptions },
-            {Act.TestException, 2, t2Exceptions },
-        };
-        Object[][] thread1 = {
-            {Act.CreateEm},
-            {Act.StartTx},
-            {Act.FindWithLock, 1, t1Lock},
-            {Act.SaveVersion},
-            {Act.TestException},
-            {Act.Notify, 0},
-            {Act.Wait},
-            {Act.UpdateEmployee},
-            
-            {t1IsCommit},
-            {Act.Find},
-            {Act.TestEmployee, 1, null, t1VersionInc}
-        };
-        Object[][] thread2 = {
-            {Act.CreateEm},
-            {Act.StartTx},
-            {Act.FindWithLock, 1, t2Lock},
-            {Act.SaveVersion},
-            {Act.Notify, 0},
-            {Act.Wait},
-            
-            {t2IsCommit},
-            {Act.Find},
-            {Act.TestEmployee, 1, null, t2VersionInc}
-        };
-        launchActionSequence(testName, parameters, threadMain, thread1,
-            thread2);
+                {Act.CreateEm},
+                {Act.Find},
+                {Act.SaveVersion},
+                {Act.TestEmployee, 1, Default_FirstName},
+                {Act.CloseEm},
+                {Act.Sleep, 100},
+
+                {Act.CreateEm},
+                {Act.StartTx},
+                {Act.FindWithLock, 1, t1Lock},
+                {Act.SaveVersion},
+                {Act.TestException},
+                
+                {Act.NewThread, 1 },
+                {Act.StartThread, 1 },
+                
+                {Act.Wait},
+                {Act.UpdateEmployee},                
+                {t1IsCommit},
+                
+                {Act.Notify, 1},
+
+                {Act.Find},
+                
+                {Act.WaitAllChildren},
+                {Act.Find},
+                {Act.TestEmployee, 1, null, t1VersionInc},
+                {Act.TestException, 0, t1Exceptions },
+                {Act.TestException, 1, t2Exceptions },
+                {Act.CloseEm}
+            };
+
+            Object[][] thread1 = {
+                {Act.CreateEm},
+                {Act.StartTx},
+                {Act.FindWithLock, 1, t2Lock},
+                {Act.SaveVersion},
+                {Act.TestException},
+                {Act.Notify, 0},
+                
+                {Act.Wait},
+                {Act.Sleep, 2000},  // sleep for at least 2 sec so that the entity name updated with timestamp 
+                                    // in each of the 2 threads are different. 
+                {Act.UpdateEmployee},
+                
+                {t2IsCommit},
+                {Act.Sleep, 1000},
+                {Act.Find},
+                {Act.TestEmployee, 1, null, t2VersionInc},
+                {Act.CloseEm}
+            };
+            launchActionSequence(testName, parameters, threadMain, thread1);
     }
 }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockBasic.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockBasic.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockBasic.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockBasic.java Tue Aug 10 17:57:17 2010
@@ -109,6 +109,7 @@ public class TestMixedLockManagerLockBas
             { Act.Clear },
             { Act.Find, 1 },
             { Act.TestEmployee, 1, lockMode.toString(), 0 },
+            { Act.CloseEm }
         };
         launchActionSequence(testName, "LockMode=" + lockMode, threadMain);
     }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockException.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockException.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockException.java Tue Aug 10 17:57:17 2010
@@ -66,6 +66,7 @@ public class TestMixedLockManagerLockExc
             
             {Act.Lock, 1, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, TransactionRequiredException.class },
+            {Act.CloseEm}
         };
         
         launchActionSequence("testLockTxReqExceptions()",
@@ -124,7 +125,8 @@ public class TestMixedLockManagerLockExc
             {Act.TestException, 0, IllegalArgumentException.class },
             {Act.LockObject, "null", LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
-        };
+            {Act.CloseEm}
+       };
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test invalid entity.", threadMainInvEntityIllegalArgTest);
         
@@ -163,6 +165,7 @@ public class TestMixedLockManagerLockExc
 
             {Act.Lock, 2, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
+            {Act.CloseEm}
         };
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test detached entity.", threadMainDetachEntityIllegalArgTest);
@@ -200,6 +203,7 @@ public class TestMixedLockManagerLockExc
 
             {Act.Lock, 2, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
+            {Act.CloseEm}
         };        
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test detached entity using serialization.",
@@ -238,6 +242,7 @@ public class TestMixedLockManagerLockExc
             {Act.TestException},
             
             {Act.RollbackTx},
+            {Act.CloseEm}
         };
         launchActionSequence(
             "testLockIllegalArgrumentExceptions()",
@@ -296,6 +301,7 @@ public class TestMixedLockManagerLockExc
                 ? OptimisticLockException.class : null},
             
             {Act.RollbackTx},
+            {Act.CloseEm}
         };
         Object[][] thread1OptLockExTest = {
             {Act.CreateEm},
@@ -309,6 +315,7 @@ public class TestMixedLockManagerLockExc
             
             {Act.CommitTx},
             {Act.Notify, 0},
+            {Act.CloseEm}
         };        
         launchActionSequence("testLockOptimisticLockExceptions()", null,
             threadMainOptLockExTest, thread1OptLockExTest);

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockPermutation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockPermutation.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockPermutation.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerLockPermutation.java Tue Aug 10 17:57:17 2010
@@ -38,55 +38,55 @@ public class TestMixedLockManagerLockPer
         commonLockTest(
             "testLock(Read,Commit/Read,Commit)",
             LockModeType.READ, Act.CommitTx, 1, null, 
-            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.READ, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(Read,Commit/Read,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
-            LockModeType.READ, Act.RollbackTx, 1, null);
+            LockModeType.READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockReadWrite() {
         commonLockTest(
             "testLock(Read,Commit/Write,Commit)",
             LockModeType.READ, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.WRITE, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(Read,Commit/Write,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.RollbackTx, 1, null);
+            LockModeType.WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockReadPessimisticRead() {
         commonLockTest(
             "testLock(Read,Commit/PessimisticRead,Commit)",
-            LockModeType.READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null);
+            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, null);
         commonLockTest(
             "testLock(Read,Commit/PessimisticRead,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, null);
+            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockReadPessimisticWrite() {
         commonLockTest(
             "testLock(Read,Commit/PessimisticWrite,Commit)",
-            LockModeType.READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null);
+            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, null);
         commonLockTest(
             "testLock(Read,Commit/PessimisticWrite,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, null);
+            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockReadPessimisticForceInc() {
         commonLockTest(
             "testLock(Read,Commit/PessimisticForceInc,Commit)",
             LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, null);
         commonLockTest(
             "testLock(Read,Commit/PessimisticForceInc,Rollback)",
             LockModeType.READ, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, null);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, null, null);
     }
     
     /* ======== Thread 1 : Write Lock ============*/
@@ -94,55 +94,55 @@ public class TestMixedLockManagerLockPer
         commonLockTest(
             "testLock(Write,Commit/Read,Commit)",
             LockModeType.WRITE, Act.CommitTx, 1, null, 
-            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.READ, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(Write,Commit/Read,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
-            LockModeType.READ, Act.RollbackTx, 1, null);
+            LockModeType.READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockWriteWrite() {
         commonLockTest(
             "testLock(Write,Commit/Write,Commit)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.WRITE, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(Write,Commit/Write,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.RollbackTx, 1, null);
+            LockModeType.WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockWritePessimisticRead() {
         commonLockTest(
             "testLock(Write,Commit/PessimisticRead,Commit)",
-            LockModeType.WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 0, null);
+            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, null);
         commonLockTest(
             "testLock(Write,Commit/PessimisticRead,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, null);
+            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockWritePessimisticWrite() {
         commonLockTest(
             "testLock(Write,Commit/PessimisticWrite,Commit)",
-            LockModeType.WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 0, null);
+            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, null);
         commonLockTest(
             "testLock(Write,Commit/PessimisticWrite,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, null);
+            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockWritePessimisticForceInc() {
         commonLockTest(
             "testLock(Write,Commit/PessimisticForceInc,Commit)",
             LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass, 
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, null);
         commonLockTest(
             "testLock(Write,Commit/PessimisticForceInc,Rollback)",
             LockModeType.WRITE, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, null);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, null, null);
     }
     
     /* ======== Thread 1 : PessimisticRead Lock ============*/
@@ -150,55 +150,58 @@ public class TestMixedLockManagerLockPer
         commonLockTest(
             "testLock(PessimisticRead,Commit/Read,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, 
-            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.READ, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimisticRead,Commit/Read,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
-            LockModeType.READ, Act.RollbackTx, 1, null);
+            LockModeType.READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockPessimisticReadWrite() {
         commonLockTest(
             "testLock(PessimisticRead,Commit/Write,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.WRITE, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimisticRead,Commit/Write,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.RollbackTx, 1, null);
+            LockModeType.WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockPessimisticReadPessimisticRead() {
         commonLockTest(
             "testLock(PessimisticRead,Commit/PessimisticRead,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimisticRead,Commit/PessimisticRead,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     public void testLockPessimisticReadPessimisticWrite() {
         commonLockTest(
             "testLock(PessimisticRead,Commit/PessimisticWrite,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimisticRead,Commit/PessimisticWrite,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     public void testLockPessimisticReadPessimisticForceInc() {
         commonLockTest(
             "testLock(PessimisticRead,Commit/PessimisticForceInc,Commit)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimisticRead,Commit/PessimisticForceInc,Rollback)",
             LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     /* ======== Thread 1 : Pessimsitic Write Lock ============*/
@@ -206,55 +209,58 @@ public class TestMixedLockManagerLockPer
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/Read,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, 
-            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.READ, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/Read,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
-            LockModeType.READ, Act.RollbackTx, 1, null);
+            LockModeType.READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockPessimsiticWriteWrite() {
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/Write,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.WRITE, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/Write,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.RollbackTx, 1, null);
+            LockModeType.WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockPessimsiticWritePessimisticRead() {
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/PessimisticRead,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/PessimisticRead,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     public void testLockPessimsiticWritePessimisticWrite() {
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/PessimisticWrite,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/PessimisticWrite,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     public void testLockPessimsiticWritePessimisticForceInc() {
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/PessimisticForceInc,Commit)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticWrite,Commit/PessimisticForceInc,Rollback)",
             LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     /* ======== Thread 1 : Pessimsitic Force Increment Lock ============*/
@@ -262,62 +268,65 @@ public class TestMixedLockManagerLockPer
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/Read,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, 
-            LockModeType.READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.READ, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/Read,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
-            LockModeType.READ, Act.RollbackTx, 1, null);
+            LockModeType.READ, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockPessimsiticForceIncWrite() {
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/Write,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.WRITE, Act.CommitTx, 1, null, ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/Write,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
-            LockModeType.WRITE, Act.RollbackTx, 1, null);
+            LockModeType.WRITE, Act.RollbackTx, 1, null, null);
     }
     
     public void testLockPessimsiticForceIncPessimisticRead() {
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/PessimisticRead,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_READ, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/PessimisticRead,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_READ, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     public void testLockPessimsiticForceIncPessimisticWrite() {
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/PessimisticWrite,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_WRITE, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/PessimisticWrite,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_WRITE, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
     
     public void testLockPessimsiticForceIncPessimisticForceInc() {
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/PessimisticForceInc,Commit)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null, 
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, ExpectingOptimisticLockExClass,
+            ExpectingOptimisticLockExClass);
         commonLockTest(
             "testLock(PessimsiticForceInc,Commit/PessimisticForceInc,Rollback)",
             LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 1, null,
-            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, ExpectingOptimisticLockExClass);
+            LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.RollbackTx, 1, ExpectingOptimisticLockExClass, null);
     }
 
     private void commonLockTest( String testName, 
         LockModeType t1Lock, Act t1IsCommit, int t1VersionInc, 
             Class<?>[] t1Exceptions, 
         LockModeType t2Lock, Act t2IsCommit, int t2VersionInc,
-            Class<?>[] t2Exceptions ) {
+            Class<?>[] t2Exceptions, Class<?>[] t3Exceptions ) {
         String[] parameters = new String[] {
             "Thread 1: lock= " + t1Lock + ", isCommit= " + t1IsCommit +
                 ", versionInc= +" + t1VersionInc +
@@ -327,53 +336,109 @@ public class TestMixedLockManagerLockPer
                 ", expectedEx= " + Arrays.toString(t2Exceptions)};
             
         Object[][] threadMain = {
-            {Act.CreateEm},
-            {Act.Find},
-            {Act.SaveVersion},
-            {Act.TestEmployee, 1, Default_FirstName},
-            
-            {Act.NewThread, 1 },
-            {Act.NewThread, 2 },
-            {Act.StartThread, 1 },
-            {Act.Wait},
-            {Act.StartThread, 2 },
-            {Act.Notify, 1, 1000 },
-            {Act.Notify, 2, 1000 },
-            {Act.WaitAllChildren},
-            {Act.Find},
-            {Act.TestEmployee, 1},
-            {Act.TestException, 1, t1Exceptions },
-            {Act.TestException, 2, t2Exceptions },
-        };
-        Object[][] thread1 = {
-            {Act.CreateEm},
-            {Act.StartTx},
-            {Act.Find},
-            {Act.SaveVersion},
-            {Act.Lock, 1, t1Lock },
-            {Act.TestException},
-            {Act.Notify, 0},
-            {Act.Wait},
-            {Act.UpdateEmployee},
-            
-            {t1IsCommit},
-            {Act.Find},
-            {Act.TestEmployee, 1, null, t1VersionInc}
-        };
-        Object[][] thread2 = {
-            {Act.CreateEm},
-            {Act.StartTx},
-            {Act.Find},
-            {Act.SaveVersion},
-            {Act.Lock, 1, t2Lock },
-            {Act.Notify, 0},
-            {Act.Wait},
-            
-            {t2IsCommit},
-            {Act.Find},
-            {Act.TestEmployee, 1, null, t2VersionInc}
-        };
-        launchActionSequence(testName, parameters, threadMain, thread1,
-            thread2);
+                {Act.CreateEm},
+                {Act.Find},
+                {Act.SaveVersion},
+                {Act.TestEmployee, 1, Default_FirstName},
+                {Act.CloseEm},
+                {Act.Sleep, 100},
+
+                {Act.CreateEm},
+                {Act.StartTx},
+                {Act.Find},
+                {Act.SaveVersion},
+                {Act.Lock, 1, t1Lock},
+                {Act.TestException},
+                
+                {Act.NewThread, 1 },
+                {Act.StartThread, 1 },
+                
+                {Act.Wait},
+                {Act.UpdateEmployee},                
+                {t1IsCommit},
+                
+                {Act.Notify, 1},
+
+                {Act.Find},
+                
+                {Act.WaitAllChildren},
+                {Act.Find},
+                {Act.TestEmployee, 1, null, t1VersionInc},
+                {Act.TestException, 0, t1Exceptions },
+                {Act.TestException, 1, t3Exceptions },
+                {Act.CloseEm}
+            };
+
+            Object[][] thread1 = {
+                {Act.CreateEm},
+                {Act.StartTx},
+                {Act.Find},
+                {Act.SaveVersion},
+                {Act.Lock, 1, t2Lock},
+                {Act.TestException, 1, t2Exceptions},
+                {Act.Notify, 0},
+                
+                {Act.Wait},
+                {Act.Sleep, 2000},  // sleep for at least 2 sec so that the entity name updated with timestamp 
+                                    // in each of the 2 threads are different. 
+                {Act.UpdateEmployee},
+                
+                {t2IsCommit},
+                {Act.Sleep, 1000},
+                {Act.Find},
+                {Act.TestEmployee, 1, null, t2VersionInc},
+                {Act.CloseEm}
+            };
+            launchActionSequence(testName, parameters, threadMain, thread1);
+
+//        Object[][] threadMain = {
+//            {Act.CreateEm},
+//            {Act.Find},
+//            {Act.SaveVersion},
+//            {Act.TestEmployee, 1, Default_FirstName},
+//            
+//            {Act.NewThread, 1 },
+//            {Act.NewThread, 2 },
+//            {Act.StartThread, 1 },
+//            {Act.Wait},
+//            {Act.StartThread, 2 },
+//            {Act.Notify, 1, 1000 },
+//            {Act.Notify, 2, 1000 },
+//            {Act.WaitAllChildren},
+//            {Act.Find},
+//            {Act.TestEmployee, 1},
+//            {Act.TestException, 1, t1Exceptions },
+//            {Act.TestException, 2, t2Exceptions },
+//        };
+//        Object[][] thread1 = {
+//            {Act.CreateEm},
+//            {Act.StartTx},
+//            {Act.Find},
+//            {Act.SaveVersion},
+//            {Act.Lock, 1, t1Lock },
+//            {Act.TestException},
+//            {Act.Notify, 0},
+//            {Act.Wait},
+//            {Act.UpdateEmployee},
+//            
+//            {t1IsCommit},
+//            {Act.Find},
+//            {Act.TestEmployee, 1, null, t1VersionInc}
+//        };
+//        Object[][] thread2 = {
+//            {Act.CreateEm},
+//            {Act.StartTx},
+//            {Act.Find},
+//            {Act.SaveVersion},
+//            {Act.Lock, 1, t2Lock },
+//            {Act.Notify, 0},
+//            {Act.Wait},
+//            
+//            {t2IsCommit},
+//            {Act.Find},
+//            {Act.TestEmployee, 1, null, t2VersionInc}
+//        };
+//        launchActionSequence(testName, parameters, threadMain, thread1,
+//            thread2);
     }
 }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshBasic.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshBasic.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshBasic.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshBasic.java Tue Aug 10 17:57:17 2010
@@ -116,6 +116,7 @@ public class TestMixedLockManagerRefresh
             { Act.Clear },
             { Act.Find, 1 },
             { Act.TestEmployee, 1, lockMode.toString(), 0 },
+            { Act.CloseEm }
         };
         launchActionSequence(testName, "LockMode=" + lockMode, threadMain);
     }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshException.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshException.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshException.java Tue Aug 10 17:57:17 2010
@@ -66,6 +66,7 @@ public class TestMixedLockManagerRefresh
             
             {Act.Refresh, 1, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, null },
+            {Act.CloseEm}
         };
         launchActionSequence("testLockTxReqExceptions()",
             null, threadMainTxReqTest);
@@ -104,6 +105,7 @@ public class TestMixedLockManagerRefresh
             
             {Act.RefreshWithLock, 1, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, TransactionRequiredException.class },
+            {Act.CloseEm}
         };
         launchActionSequence("testLockTxReqExceptions()",
             null, threadMainTxReqTest);
@@ -165,6 +167,7 @@ public class TestMixedLockManagerRefresh
             {Act.RefreshObject, "null", 
                 LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
+            {Act.CloseEm}
         };
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test invalid entity.", threadMainInvEntityIllegalArgTest);
@@ -204,6 +207,7 @@ public class TestMixedLockManagerRefresh
 
             {Act.Refresh, 2, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
+            {Act.CloseEm}
         };
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test detached entity.", threadMainDetachEntityIllegalArgTest);
@@ -241,7 +245,8 @@ public class TestMixedLockManagerRefresh
 
             {Act.Refresh, 2, LockModeType.PESSIMISTIC_FORCE_INCREMENT },
             {Act.TestException, 0, IllegalArgumentException.class },
-        };        
+            {Act.CloseEm}
+       };        
         launchActionSequence("testLockIllegalArgrumentExceptions()",
             "Test detached entity using serialization.",
             threadMainDetachSerializeIllegalArgTest);
@@ -279,6 +284,7 @@ public class TestMixedLockManagerRefresh
             {Act.TestException, 1, IllegalArgumentException.class },
             
             {Act.RollbackTx},
+            {Act.CloseEm}
         };
         launchActionSequence(
             "testLockIllegalArgrumentExceptions()",

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java Tue Aug 10 17:57:17 2010
@@ -332,6 +332,61 @@ public class TestMixedLockManagerRefresh
         String t1Message2 = "Refresh in Thread 1 Again";
         String t2Message1 = "Refresh in Thread 2";
         
+//        Object[][] threadMain = {
+//                {Act.CreateEm},
+//                {Act.Find},
+//                {Act.SaveVersion},
+//                {Act.TestEmployee, 1, Default_FirstName},
+//                
+//                {Act.CloseEm},
+//                {Act.Sleep, 100},
+//
+//                {Act.CreateEm},
+//                {Act.StartTx},
+//                {Act.RefreshWithLock, 1, t1Lock},
+//                {Act.SaveVersion},
+//                {Act.TestException},
+//                
+//                {Act.NewThread, 1 },
+//                {Act.StartThread, 1 },
+//                
+//                {Act.Wait},
+//                {Act.UpdateEmployee},                
+//                {t1IsCommit},
+//                
+//                {Act.Notify, 1},
+//
+//                {Act.Find},
+//                
+//                {Act.WaitAllChildren},
+//                {Act.Find},
+//                {Act.TestEmployee, 1, null, t1VersionInc},
+//                {Act.TestException, 0, t1Exceptions },
+//                {Act.TestException, 1, t2Exceptions },
+//                {Act.CloseEm}
+//            };
+//
+//            Object[][] thread1 = {
+//                {Act.CreateEm},
+//                {Act.StartTx},
+//                {Act.FindWithLock, 1, t2Lock},
+//                {Act.SaveVersion},
+//                {Act.TestException},
+//                {Act.Notify, 0},
+//                
+//                {Act.Wait},
+//                {Act.Sleep, 2000},  // sleep for at least 2 sec so that the entity name updated with timestamp 
+//                                    // in each of the 2 threads are different. 
+//                {Act.UpdateEmployee},
+//                
+//                {t2IsCommit},
+//                {Act.Sleep, 1000},
+//                {Act.Find},
+//                {Act.TestEmployee, 1, null, t2VersionInc},
+//                {Act.CloseEm}
+//            };
+//            launchActionSequence(testName, parameters, threadMain, thread1);
+
         Object[][] threadMain = {
             {Act.CreateEm},
             {Act.Find},
@@ -351,6 +406,7 @@ public class TestMixedLockManagerRefresh
             {Act.TestEmployee, 1},
             {Act.TestException, 1, t1Exceptions },
             {Act.TestException, 2, t2Exceptions },
+            {Act.CloseEm}
         };
         Object[][] thread1 = {
             {Act.CreateEm},
@@ -381,7 +437,8 @@ public class TestMixedLockManagerRefresh
             
             {Act.Clear},
             {Act.Find},
-            {Act.TestEmployee, 1, null, t1VersionInc}
+            {Act.TestEmployee, 1, null, t1VersionInc},
+            {Act.CloseEm}
         };
         Object[][] thread2 = {
             {Act.CreateEm},
@@ -406,7 +463,8 @@ public class TestMixedLockManagerRefresh
             {Act.Clear},
             {Act.Find},
             {Act.TestEmployee, 1, null, t2VersionInc},
-        };
+            {Act.CloseEm}
+       };
         
         launchActionSequence(testName, parameters, threadMain, thread1,
             thread2);

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestOptimisticNamedQueryLockMode.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestOptimisticNamedQueryLockMode.java?rev=984147&r1=984146&r2=984147&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestOptimisticNamedQueryLockMode.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestOptimisticNamedQueryLockMode.java Tue Aug 10 17:57:17 2010
@@ -22,8 +22,6 @@ import javax.persistence.EntityManager;
 import javax.persistence.LockModeType;
 import javax.persistence.Query;
 
-import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
-import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.persistence.FetchPlan;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;



Mime
View raw message