You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by al...@apache.org on 2010/08/11 00:22:10 UTC
svn commit: r984243 -
/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java
Author: allee8285
Date: Tue Aug 10 22:22:10 2010
New Revision: 984243
URL: http://svn.apache.org/viewvc?rev=984243&view=rev
Log:
OPENJPA-1753 update lockmgr RefreshPermutation for more consistent test cycle.
Modified:
openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerRefreshPermutation.java
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=984243&r1=984242&r2=984243&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 22:22:10 2010
@@ -308,7 +308,7 @@ public class TestMixedLockManagerRefresh
commonRefreshTest(
"testRefresh(PessimsiticForceInc,Commit/PessimisticForceInc,Commit)",
LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 3, null,
- LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 3, null);
+ LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 2, null);
commonRefreshTest(
"testRefresh(PessimsiticForceInc,Commit/PessimisticForceInc,Rollback)",
LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 2, null,
@@ -328,145 +328,70 @@ public class TestMixedLockManagerRefresh
", versionInc= +" + t2VersionInc +
", expectedEx= " + Arrays.toString(t2Exceptions)};
- String t1Message1 = "Refresh in Thread 1";
- 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);
-
+ String t1Message1 = "Refresh in Thread 0";
+ String t1Message2 = "Refresh in Thread 0 Again";
+ String t2Message1 = "Refresh in Thread 1";
+
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.WaitAllChildren},
-
- {Act.Find},
- {Act.TestEmployee, 1},
- {Act.TestException, 1, t1Exceptions },
- {Act.TestException, 2, t2Exceptions },
- {Act.CloseEm}
- };
- Object[][] thread1 = {
- {Act.CreateEm},
- {Act.Find, 1},
- {Act.SaveVersion},
- {Act.TestEmployee, 1, Default_FirstName},
- {Act.Notify, 0},
- {Act.Wait},
-
- {Act.StartTx},
- {Act.UpdateEmployee, 1, t1Message1},
- {Act.TestEmployee, 1, t1Message1},
- {Act.CommitTx},
- {Act.TestException},
- {Act.Notify, 2},
- {Act.Wait},
-
- {Act.StartTx},
- {Act.RefreshWithLock, 1, t1Lock },
- {Act.TestLockMode, 1, t1Lock},
- {Act.TestEmployee, 1, t1Message1},
- {Act.UpdateEmployee, 1, t1Message2},
- {Act.TestEmployee, 1, t1Message2},
-
- {t1IsCommit},
- {Act.Notify, 2},
- {Act.Notify, 2},
-
- {Act.Clear},
- {Act.Find},
- {Act.TestEmployee, 1, null, t1VersionInc},
- {Act.CloseEm}
- };
- Object[][] thread2 = {
- {Act.CreateEm},
- {Act.Find, 1},
- {Act.SaveVersion},
- {Act.TestEmployee, 1, Default_FirstName},
- {Act.Notify, 1},
- {Act.Wait},
+ {Act.CreateEm},
+ {Act.Find},
+ {Act.SaveVersion},
+ {Act.TestEmployee, 1, Default_FirstName},
+
+ {Act.NewThread, 1 },
+ {Act.StartThread, 1 },
+ {Act.Wait},
+
+ {Act.StartTx},
+ {Act.UpdateEmployee, 1, t1Message1},
+ {Act.TestEmployee, 1, t1Message1},
+ {Act.CommitTx},
+ {Act.TestException},
+ {Act.Notify, 1},
+ {Act.Wait},
+
+ {Act.StartTx},
+ {Act.RefreshWithLock, 1, t1Lock},
+ {Act.TestLockMode, 1, t1Lock},
+ {Act.TestEmployee, 1, t1Message1},
+ {Act.UpdateEmployee, 1, t1Message2},
+ {Act.TestEmployee, 1, t1Message2},
+
+ {t1IsCommit},
+
+ {Act.Notify, 1},
- {Act.StartTx},
- {Act.UpdateEmployee, 1, t2Message1},
- {Act.TestEmployee, 1, t2Message1},
- {Act.RefreshWithLock, 1, t2Lock },
- {Act.TestLockMode, 1, t2Lock},
- {Act.TestEmployee, 1, t1Message1},
-
- {Act.Notify, 1},
- {Act.Wait},
- {t2IsCommit},
- {Act.Wait},
-
- {Act.Clear},
- {Act.Find},
- {Act.TestEmployee, 1, null, t2VersionInc},
- {Act.CloseEm}
- };
+ {Act.WaitAllChildren},
+ {Act.Find},
+ {Act.TestEmployee, 1, null, t1VersionInc},
+
+ {Act.TestException, 0, t1Exceptions },
+ {Act.TestException, 1, t2Exceptions },
+ {Act.CloseEm}
+ };
+
+ Object[][] thread1 = {
+ {Act.CreateEm},
+ {Act.Find, 1},
+ {Act.SaveVersion},
+ {Act.TestEmployee, 1, Default_FirstName},
+ {Act.TestException},
+ {Act.Notify, 0},
+ {Act.Wait},
+
+ {Act.StartTx},
+ {Act.UpdateEmployee, 1, t2Message1},
+ {Act.TestEmployee, 1, t2Message1},
+ {Act.RefreshWithLock, 1, t2Lock },
+ {Act.TestLockMode, 1, t2Lock},
+ {Act.TestEmployee, 1, t1Message1},
+
+ {Act.Notify, 0},
+ {Act.Wait},
+ {t2IsCommit},
- launchActionSequence(testName, parameters, threadMain, thread1,
- thread2);
+ {Act.CloseEm}
+ };
+ launchActionSequence(testName, parameters, threadMain, thread1);
}
}