[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/statetransfer ...
Manik Surtani
msurtani at jboss.com
Wed Jan 3 12:50:31 EST 2007
User: msurtani
Date: 07/01/03 12:50:31
Modified: tests/functional/org/jboss/cache/statetransfer
ForcedStateTransferTest.java
Log:
added more rich nodeModified callback
Revision Changes Path
1.12 +68 -78 JBossCache/tests/functional/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ForcedStateTransferTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/ForcedStateTransferTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- ForcedStateTransferTest.java 9 Oct 2006 08:14:05 -0000 1.11
+++ ForcedStateTransferTest.java 3 Jan 2007 17:50:31 -0000 1.12
@@ -22,12 +22,6 @@
package org.jboss.cache.statetransfer;
-import java.util.Map;
-
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
@@ -35,6 +29,11 @@
import org.jboss.cache.Version;
import org.jboss.cache.misc.TestingUtil;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.Map;
+
/**
* Tests the ability to force a state transfer in the presence of
@@ -127,7 +126,9 @@
abstract boolean isDone();
- void finalCleanup() {}
+ void finalCleanup()
+ {
+ }
boolean isAsleep()
{
@@ -162,7 +163,7 @@
tx.setRollbackOnly();
asleep = true;
- TestingUtil.sleepThread((long)25000);
+ TestingUtil.sleepThread((long) 25000);
done = true;
}
@@ -195,7 +196,7 @@
this.toHang = toHang;
}
- public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map data)
+ public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, ModificationType modType, Map data)
{
if (!pre) hangThread(fqn);
}
@@ -207,7 +208,7 @@
asleep = true;
//System.out.println("Hanging thread changing node " + fqn);
alreadyHung = true;
- TestingUtil.sleepThread((long)30000);
+ TestingUtil.sleepThread((long) 30000);
done = true;
asleep = false;
}
@@ -279,7 +280,7 @@
void hang()
{
asleep = true;
- TestingUtil.sleepThread((long)30000);
+ TestingUtil.sleepThread((long) 30000);
done = true;
}
@@ -332,7 +333,7 @@
*/
public void testActiveTransaction() throws Exception
{
- String[] values = { "A", "B", "C" };
+ String[] values = {"A", "B", "C"};
transactionTest(values, false, "REPEATABLE_READ");
}
@@ -344,7 +345,7 @@
*/
public void testRollbackOnlyTransaction() throws Exception
{
- String[] values = { "A", "B", "C" };
+ String[] values = {"A", "B", "C"};
transactionTest(values, true, "REPEATABLE_READ");
}
@@ -356,7 +357,6 @@
* @param rollback should the transactions be marked rollback-only
* before hanging
* @param isolationLevel cache's isolation level
- *
* @throws Exception
*/
private void transactionTest(String[] values,
@@ -385,9 +385,7 @@
* @param isolationLevel cache's isolation level
* @param replSync is cache REPL_SYNC?
* @param useMarshalling is the activateRegion() API to be used?
- *
* @return the cache
- *
* @throws Exception
*/
private CacheSPI initializeSender(String isolationLevel,
@@ -415,7 +413,6 @@
* Fqn of the new node will be /rootFqn/value
* @param rollback <code>true</code> if the tx should be marked
* rollback-only before the thread goes to sleep
- *
* @return the TaskRunner threads
*/
private TxRunner[] initializeTransactionRunners(String[] values,
@@ -445,7 +442,7 @@
// Loop until it executes its put and goes to sleep (i.e. hangs)
long start = System.currentTimeMillis();
- while(!(runner.isAsleep()))
+ while (!(runner.isAsleep()))
{
assertTrue(runner.getClass().getName() + " " + runner.value +
" is alive", runner.isAlive());
@@ -464,7 +461,6 @@
* @param runners the task runners
* @param allowValues true if the runners' values are expected to
* be in the cache state; false otherwise
- *
* @throws CacheException
*/
private void checkResults(CacheSPI receiver,
@@ -512,7 +508,7 @@
CacheSPI sender = initializeSender("REPEATABLE_READ", false, false);
// Start threads that will do operations on the cache and then hang
- String[] values = { "A", "B", "C" };
+ String[] values = {"A", "B", "C"};
HangThreadRunner[] runners = initializeHangThreadRunners(values, sender, "/LOCK");
// Create and start the cache that requests a state transfer
@@ -532,7 +528,6 @@
* @param sender the cache on which the put should be done
* @param rootFqn Fqn under which the new node should be inserted -- the
* Fqn of the new node will be /rootFqn/value
- *
* @return the TaskRunner threads
*/
private HangThreadRunner[] initializeHangThreadRunners(String[] values,
@@ -582,14 +577,13 @@
* @param hangBefore <code>true</code> if the thread should hang in
* <code>beforeCompletion()</code>, <code>false</code>
* if it should hang in <code>afterCompletion</code>
- *
* @throws Exception
*/
private void synchronizationTest(boolean hangBefore) throws Exception
{
CacheSPI sender = initializeSender("REPEATABLE_READ", false, false);
- String[] values = { "A", "B", "C" };
+ String[] values = {"A", "B", "C"};
SynchronizationTxRunner[] runners =
initializeSynchronizationTxRunners(values, sender, "/LOCK", hangBefore);
@@ -612,7 +606,6 @@
* @param hangBefore <code>true</code> if the thread should hang in
* <code>beforeCompletion()</code>, <code>false</code>
* if it should hang in <code>afterCompletion</code>
- *
* @return the TaskRunner threads
*/
private SynchronizationTxRunner[] initializeSynchronizationTxRunners(String[] values,
@@ -699,23 +692,23 @@
// since the child node created by it will be gone as well.
// This is really a REPEATABLE_READ bug that this test isn't intended
// to catch; will create a separate locking test that shows it
- String[] val1 = { "A", "B", "C" };
+ String[] val1 = {"A", "B", "C"};
SynchronizationTxRunner[] after =
initializeSynchronizationTxRunners(val1, sender, rootFqn, false);
- String[] val2 = { "D", "E", "F" };
+ String[] val2 = {"D", "E", "F"};
SynchronizationTxRunner[] before =
initializeSynchronizationTxRunners(val2, sender, rootFqn, true);
- String[] val3 = { "G", "H", "I" };
+ String[] val3 = {"G", "H", "I"};
TxRunner[] active =
initializeTransactionRunners(val3, sender, rootFqn, false);
- String[] val4 = { "J", "K", "L" };
+ String[] val4 = {"J", "K", "L"};
TxRunner[] rollback =
initializeTransactionRunners(val4, sender, rootFqn, true);
- String[] val5 = { "M", "N", "O" };
+ String[] val5 = {"M", "N", "O"};
HangThreadRunner[] threads =
initializeHangThreadRunners(val5, sender, rootFqn);
@@ -740,9 +733,7 @@
* @param isolationLevel
* @param replSync
* @param useMarshalling
- *
* @return the receiver cache
- *
* @throws Exception
*/
private CacheSPI startReceiver(String isolationLevel,
@@ -793,5 +784,4 @@
}
-
}
More information about the jboss-cvs-commits
mailing list