mirror of https://github.com/apache/openjpa.git
OPENJPA-1753 update lockmgr RefreshPermutation for more consistent test cycle.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@984243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4fd4c17c76
commit
7b1d5067d6
|
@ -308,7 +308,7 @@ public class TestMixedLockManagerRefreshPermutation
|
|||
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,64 +328,9 @@ public class TestMixedLockManagerRefreshPermutation
|
|||
", 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},
|
||||
|
@ -394,34 +339,15 @@ public class TestMixedLockManagerRefreshPermutation
|
|||
{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.Notify, 1},
|
||||
{Act.Wait},
|
||||
|
||||
{Act.StartTx},
|
||||
|
@ -432,20 +358,25 @@ public class TestMixedLockManagerRefreshPermutation
|
|||
{Act.TestEmployee, 1, t1Message2},
|
||||
|
||||
{t1IsCommit},
|
||||
{Act.Notify, 2},
|
||||
{Act.Notify, 2},
|
||||
|
||||
{Act.Clear},
|
||||
{Act.Notify, 1},
|
||||
|
||||
{Act.WaitAllChildren},
|
||||
{Act.Find},
|
||||
{Act.TestEmployee, 1, null, t1VersionInc},
|
||||
|
||||
{Act.TestException, 0, t1Exceptions },
|
||||
{Act.TestException, 1, t2Exceptions },
|
||||
{Act.CloseEm}
|
||||
};
|
||||
Object[][] thread2 = {
|
||||
|
||||
Object[][] thread1 = {
|
||||
{Act.CreateEm},
|
||||
{Act.Find, 1},
|
||||
{Act.SaveVersion},
|
||||
{Act.TestEmployee, 1, Default_FirstName},
|
||||
{Act.Notify, 1},
|
||||
{Act.TestException},
|
||||
{Act.Notify, 0},
|
||||
{Act.Wait},
|
||||
|
||||
{Act.StartTx},
|
||||
|
@ -455,18 +386,12 @@ public class TestMixedLockManagerRefreshPermutation
|
|||
{Act.TestLockMode, 1, t2Lock},
|
||||
{Act.TestEmployee, 1, t1Message1},
|
||||
|
||||
{Act.Notify, 1},
|
||||
{Act.Notify, 0},
|
||||
{Act.Wait},
|
||||
{t2IsCommit},
|
||||
{Act.Wait},
|
||||
|
||||
{Act.Clear},
|
||||
{Act.Find},
|
||||
{Act.TestEmployee, 1, null, t2VersionInc},
|
||||
{Act.CloseEm}
|
||||
};
|
||||
|
||||
launchActionSequence(testName, parameters, threadMain, thread1,
|
||||
thread2);
|
||||
launchActionSequence(testName, parameters, threadMain, thread1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue