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:
Albert Lee 2010-08-10 22:22:10 +00:00
parent 4fd4c17c76
commit 7b1d5067d6
1 changed files with 63 additions and 138 deletions

View File

@ -308,7 +308,7 @@ public class TestMixedLockManagerRefreshPermutation
commonRefreshTest( commonRefreshTest(
"testRefresh(PessimsiticForceInc,Commit/PessimisticForceInc,Commit)", "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, 3, null); LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 2, null);
commonRefreshTest( commonRefreshTest(
"testRefresh(PessimsiticForceInc,Commit/PessimisticForceInc,Rollback)", "testRefresh(PessimsiticForceInc,Commit/PessimisticForceInc,Rollback)",
LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 2, null, LockModeType.PESSIMISTIC_FORCE_INCREMENT, Act.CommitTx, 2, null,
@ -328,64 +328,9 @@ public class TestMixedLockManagerRefreshPermutation
", versionInc= +" + t2VersionInc + ", versionInc= +" + t2VersionInc +
", expectedEx= " + Arrays.toString(t2Exceptions)}; ", expectedEx= " + Arrays.toString(t2Exceptions)};
String t1Message1 = "Refresh in Thread 1"; String t1Message1 = "Refresh in Thread 0";
String t1Message2 = "Refresh in Thread 1 Again"; String t1Message2 = "Refresh in Thread 0 Again";
String t2Message1 = "Refresh in Thread 2"; String t2Message1 = "Refresh in Thread 1";
// 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 = { Object[][] threadMain = {
{Act.CreateEm}, {Act.CreateEm},
@ -394,34 +339,15 @@ public class TestMixedLockManagerRefreshPermutation
{Act.TestEmployee, 1, Default_FirstName}, {Act.TestEmployee, 1, Default_FirstName},
{Act.NewThread, 1 }, {Act.NewThread, 1 },
{Act.NewThread, 2 },
{Act.StartThread, 1 }, {Act.StartThread, 1 },
{Act.Wait}, {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.StartTx},
{Act.UpdateEmployee, 1, t1Message1}, {Act.UpdateEmployee, 1, t1Message1},
{Act.TestEmployee, 1, t1Message1}, {Act.TestEmployee, 1, t1Message1},
{Act.CommitTx}, {Act.CommitTx},
{Act.TestException}, {Act.TestException},
{Act.Notify, 2}, {Act.Notify, 1},
{Act.Wait}, {Act.Wait},
{Act.StartTx}, {Act.StartTx},
@ -432,20 +358,25 @@ public class TestMixedLockManagerRefreshPermutation
{Act.TestEmployee, 1, t1Message2}, {Act.TestEmployee, 1, t1Message2},
{t1IsCommit}, {t1IsCommit},
{Act.Notify, 2},
{Act.Notify, 2},
{Act.Clear}, {Act.Notify, 1},
{Act.WaitAllChildren},
{Act.Find}, {Act.Find},
{Act.TestEmployee, 1, null, t1VersionInc}, {Act.TestEmployee, 1, null, t1VersionInc},
{Act.TestException, 0, t1Exceptions },
{Act.TestException, 1, t2Exceptions },
{Act.CloseEm} {Act.CloseEm}
}; };
Object[][] thread2 = {
Object[][] thread1 = {
{Act.CreateEm}, {Act.CreateEm},
{Act.Find, 1}, {Act.Find, 1},
{Act.SaveVersion}, {Act.SaveVersion},
{Act.TestEmployee, 1, Default_FirstName}, {Act.TestEmployee, 1, Default_FirstName},
{Act.Notify, 1}, {Act.TestException},
{Act.Notify, 0},
{Act.Wait}, {Act.Wait},
{Act.StartTx}, {Act.StartTx},
@ -455,18 +386,12 @@ public class TestMixedLockManagerRefreshPermutation
{Act.TestLockMode, 1, t2Lock}, {Act.TestLockMode, 1, t2Lock},
{Act.TestEmployee, 1, t1Message1}, {Act.TestEmployee, 1, t1Message1},
{Act.Notify, 1}, {Act.Notify, 0},
{Act.Wait}, {Act.Wait},
{t2IsCommit}, {t2IsCommit},
{Act.Wait},
{Act.Clear},
{Act.Find},
{Act.TestEmployee, 1, null, t2VersionInc},
{Act.CloseEm} {Act.CloseEm}
}; };
launchActionSequence(testName, parameters, threadMain, thread1);
launchActionSequence(testName, parameters, threadMain, thread1,
thread2);
} }
} }