[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/statetransfer ...
Manik Surtani
msurtani at jboss.com
Thu Jul 20 05:03:55 EDT 2006
User: msurtani
Date: 06/07/20 05:03:55
Modified: tests/functional/org/jboss/cache/statetransfer
FailedStateTransferTest.java
ForcedStateTransferTest.java
Log:
Fixed some broken UTs to use the new xml parsers, cache factories, etc.
Revision Changes Path
1.2 +6 -7 JBossCache/tests/functional/org/jboss/cache/statetransfer/FailedStateTransferTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FailedStateTransferTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/statetransfer/FailedStateTransferTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- FailedStateTransferTest.java 18 Mar 2006 06:30:23 -0000 1.1
+++ FailedStateTransferTest.java 20 Jul 2006 09:03:55 -0000 1.2
@@ -26,7 +26,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.PropertyConfigurator;
import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheMBean;
import org.jboss.cache.Version;
import org.jboss.cache.lock.TimeoutException;
@@ -41,13 +40,13 @@
public void testFailedStateTransfer() throws Exception
{
- TreeCacheMBean tree =new SecretiveStateCache();
+ TreeCache tree =new SecretiveStateCache();
PropertyConfigurator config=new PropertyConfigurator();
config.configure(tree, "META-INF/replAsync-service.xml");
- tree.setClusterName("VersionedTestBase");
- tree.setReplicationVersion(getReplicationVersion());
+ tree.getConfiguration().setClusterName("VersionedTestBase");
+ tree.getConfiguration().setReplVersionString(getReplicationVersion());
// Use a long timeout to facilitate setting debugger breakpoints
- tree.setInitialStateRetrievalTimeout(60000);
+ tree.getConfiguration().setInitialStateRetrievalTimeout(60000);
// Put the cache in the map before starting, so if it fails in
// start it can still be destroyed later
@@ -56,7 +55,7 @@
tree.createService();
tree.startService();
- TreeCacheMBean recipient = createCache("recipient", false, false, false, false, false);
+ TreeCache recipient = createCache("recipient", false, false, false, false, false);
try
{
recipient.startService();
1.9 +29 -29 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.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ForcedStateTransferTest.java 18 Jul 2006 10:50:47 -0000 1.8
+++ ForcedStateTransferTest.java 20 Jul 2006 09:03:55 -0000 1.9
@@ -25,7 +25,7 @@
import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
-import org.jboss.cache.TreeCacheMBean;
+import org.jboss.cache.TreeCache;
import org.jboss.cache.Version;
import org.jboss.cache.misc.TestingUtil;
@@ -51,11 +51,11 @@
*/
static class CacheStarter extends Thread
{
- TreeCacheMBean cache;
+ TreeCache cache;
boolean useMarshalling;
Exception failure;
- CacheStarter(TreeCacheMBean cache, boolean useMarshalling)
+ CacheStarter(TreeCache cache, boolean useMarshalling)
{
this.cache = cache;
this.useMarshalling = useMarshalling;
@@ -89,13 +89,13 @@
*/
static abstract class TaskRunner extends Thread
{
- TreeCacheMBean cache;
+ TreeCache cache;
Fqn fqn;
String value;
Exception failure;
boolean asleep = false;
- TaskRunner(TreeCacheMBean cache, String rootFqn, String value)
+ TaskRunner(TreeCache cache, String rootFqn, String value)
{
this.cache = cache;
this.value = value;
@@ -143,7 +143,7 @@
boolean rollback = false;
boolean done = true;
- TxRunner(TreeCacheMBean cache, String rootFqn, String value, boolean rollback)
+ TxRunner(TreeCache cache, String rootFqn, String value, boolean rollback)
{
super(cache, rootFqn, value);
this.rollback = rollback;
@@ -220,7 +220,7 @@
{
HangThreadListener listener;
- HangThreadRunner(TreeCacheMBean cache, String rootFqn, String value)
+ HangThreadRunner(TreeCache cache, String rootFqn, String value)
{
super(cache, rootFqn, value);
listener = new HangThreadListener(fqn);
@@ -293,7 +293,7 @@
Transaction tx = null;
HangThreadSynchronization sync;
- SynchronizationTxRunner(TreeCacheMBean cache, String rootFqn, String value, boolean hangBefore)
+ SynchronizationTxRunner(TreeCache cache, String rootFqn, String value, boolean hangBefore)
{
super(cache, rootFqn, value);
this.sync = new HangThreadSynchronization(hangBefore);
@@ -363,14 +363,14 @@
String isolationLevel) throws Exception
{
// Create the cache from which state will be requested
- TreeCacheMBean sender = initializeSender(isolationLevel, false, false);
+ TreeCache sender = initializeSender(isolationLevel, false, false);
// Start threads that will do operations on the cache and then hang
TxRunner[] runners =
initializeTransactionRunners(values, sender, "/LOCK", rollback);
// Create and start the cache that requests a state transfer
- TreeCacheMBean receiver = startReceiver(isolationLevel, false, false);
+ TreeCache receiver = startReceiver(isolationLevel, false, false);
// Confirm the receiver got the expected state and the threads are OK
checkResults(receiver, runners, false);
@@ -389,11 +389,11 @@
*
* @throws Exception
*/
- private TreeCacheMBean initializeSender(String isolationLevel,
+ private TreeCache initializeSender(String isolationLevel,
boolean replSync,
boolean useMarshalling) throws Exception
{
- TreeCacheMBean sender = createCache("sender", isolationLevel, replSync, useMarshalling, true);
+ TreeCache sender = createCache("sender", isolationLevel, replSync, useMarshalling, true);
if (useMarshalling)
sender.activateRegion("/");
@@ -418,7 +418,7 @@
* @return the TaskRunner threads
*/
private TxRunner[] initializeTransactionRunners(String[] values,
- TreeCacheMBean sender,
+ TreeCache sender,
String rootFqn,
boolean rollback)
{
@@ -466,7 +466,7 @@
*
* @throws CacheException
*/
- private void checkResults(TreeCacheMBean receiver,
+ private void checkResults(TreeCache receiver,
TaskRunner[] runners,
boolean allowValues) throws CacheException
{
@@ -508,14 +508,14 @@
public void testHungThread() throws Exception
{
// Create the cache from which state will be requested
- TreeCacheMBean sender = initializeSender("REPEATABLE_READ", false, false);
+ TreeCache sender = initializeSender("REPEATABLE_READ", false, false);
// Start threads that will do operations on the cache and then hang
String[] values = { "A", "B", "C" };
HangThreadRunner[] runners = initializeHangThreadRunners(values, sender, "/LOCK");
// Create and start the cache that requests a state transfer
- TreeCacheMBean receiver = startReceiver("REPEATABLE_READ", false, false);
+ TreeCache receiver = startReceiver("REPEATABLE_READ", false, false);
// Confirm the receiver got the expected state and the threads are OK
checkResults(receiver, runners, true);
@@ -535,7 +535,7 @@
* @return the TaskRunner threads
*/
private HangThreadRunner[] initializeHangThreadRunners(String[] values,
- TreeCacheMBean sender,
+ TreeCache sender,
String rootFqn)
{
HangThreadRunner[] runners = new HangThreadRunner[values.length];
@@ -586,13 +586,13 @@
*/
private void synchronizationTest(boolean hangBefore) throws Exception
{
- TreeCacheMBean sender = initializeSender("REPEATABLE_READ", false, false);
+ TreeCache sender = initializeSender("REPEATABLE_READ", false, false);
String[] values = { "A", "B", "C" };
SynchronizationTxRunner[] runners =
initializeSynchronizationTxRunners(values, sender, "/LOCK", hangBefore);
- TreeCacheMBean receiver = startReceiver("REPEATABLE_READ", false, false);
+ TreeCache receiver = startReceiver("REPEATABLE_READ", false, false);
checkResults(receiver, runners, !hangBefore);
}
@@ -615,7 +615,7 @@
* @return the TaskRunner threads
*/
private SynchronizationTxRunner[] initializeSynchronizationTxRunners(String[] values,
- TreeCacheMBean sender,
+ TreeCache sender,
String rootFqn,
boolean hangBefore)
{
@@ -691,7 +691,7 @@
boolean replSync,
boolean useMarshalling) throws Exception
{
- TreeCacheMBean sender = initializeSender(isolationLevel, replSync, useMarshalling);
+ TreeCache sender = initializeSender(isolationLevel, replSync, useMarshalling);
// Do the "after" nodes first, otherwise if there is a /LOCK parent
// node, the rollback of a tx will remove it causing the test to fail
@@ -718,7 +718,7 @@
HangThreadRunner[] threads =
initializeHangThreadRunners(val5, sender, rootFqn);
- TreeCacheMBean receiver = startReceiver(isolationLevel, replSync, useMarshalling);
+ TreeCache receiver = startReceiver(isolationLevel, replSync, useMarshalling);
checkResults(receiver, active, false);
checkResults(receiver, rollback, false);
@@ -744,11 +744,11 @@
*
* @throws Exception
*/
- private TreeCacheMBean startReceiver(String isolationLevel,
+ private TreeCache startReceiver(String isolationLevel,
boolean replSync,
boolean useMarshalling) throws Exception
{
- TreeCacheMBean receiver = createCache("receiver", isolationLevel, replSync, useMarshalling, false);
+ TreeCache receiver = createCache("receiver", isolationLevel, replSync, useMarshalling, false);
// Start the cache in a separate thread so we can kill the
// thread if the cache doesn't start properly
@@ -772,18 +772,18 @@
* Override the superclass version to set an unlimited state transfer timeout
* and a 1 sec lock acquisition timeout.
*/
- private TreeCacheMBean createCache(String cacheID,
+ private TreeCache createCache(String cacheID,
String isolationLevel,
boolean replSync,
boolean useMarshalling,
boolean startCache)
throws Exception
{
- TreeCacheMBean result = super.createCache(cacheID, replSync,
+ TreeCache result = super.createCache(cacheID, replSync,
useMarshalling, false, false, false);
- result.setInitialStateRetrievalTimeout(0);
- result.setLockAcquisitionTimeout(1000);
- result.setIsolationLevel(isolationLevel);
+ result.getConfiguration().setInitialStateRetrievalTimeout(0);
+ result.getConfiguration().setLockAcquisitionTimeout(1000);
+ result.getConfiguration().setIsolationLevel(isolationLevel);
if (startCache)
result.start();
More information about the jboss-cvs-commits
mailing list