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(
"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 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";
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.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},
{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.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.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},
launchActionSequence(testName, parameters, threadMain, thread1,
thread2);
{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.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},
{Act.CloseEm}
};
launchActionSequence(testName, parameters, threadMain, thread1);
}
}