[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/replicated ...
Manik Surtani
msurtani at jboss.com
Thu Jul 20 06:54:01 EDT 2006
User: msurtani
Date: 06/07/20 06:54:01
Modified: tests/functional/org/jboss/cache/replicated
SyncReplTxTest.java
Log:
Fixed some broken UTs to use the new xml parsers, cache factories, etc.
Revision Changes Path
1.11 +62 -56 JBossCache/tests/functional/org/jboss/cache/replicated/SyncReplTxTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SyncReplTxTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/replicated/SyncReplTxTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- SyncReplTxTest.java 18 Jul 2006 10:50:47 -0000 1.10
+++ SyncReplTxTest.java 20 Jul 2006 10:54:01 -0000 1.11
@@ -13,16 +13,22 @@
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
-import org.jboss.cache.AbstractCacheListener;
-import org.jboss.cache.aop.AOPInstance;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.transaction.DummyTransactionManager;
import javax.naming.Context;
-import javax.transaction.*;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
import java.util.Map;
/**
@@ -30,12 +36,12 @@
* Note: we use DummyTransactionManager for Tx purpose instead of relying on
* jta.
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public class SyncReplTxTest extends TestCase {
private static Log log = LogFactory.getLog(SyncReplTxTest.class);
TreeCache cache1, cache2;
- int caching_mode=TreeCache.REPL_SYNC;
+ Configuration.CacheMode caching_mode= Configuration.CacheMode.REPL_SYNC;
final String group_name="TreeCacheTestGroup";
String props=
"UDP(ip_mcast=true;ip_ttl=64;loopback=false;mcast_addr=228.1.2.3;" +
@@ -91,23 +97,23 @@
return tx;
}
- void initCaches(int caching_mode) throws Exception {
+ void initCaches(Configuration.CacheMode caching_mode) throws Exception {
this.caching_mode=caching_mode;
cache1=new TreeCache();
cache2=new TreeCache();
- cache1.setCacheMode(caching_mode);
- cache2.setCacheMode(caching_mode);
- cache1.setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache2.setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache1.getConfiguration().setCacheMode(caching_mode);
+ cache2.getConfiguration().setCacheMode(caching_mode);
+ cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
+ cache2.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache1.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
- cache2.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+ cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+ cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
/*
cache1.setTransactionManagerLookupClass("org.jboss.cache.JBossTransactionManagerLookup");
cache2.setTransactionManagerLookupClass("org.jboss.cache.JBossTransactionManagerLookup");
*/
- cache1.setLockAcquisitionTimeout(5000);
- cache2.setLockAcquisitionTimeout(5000);
+ cache1.getConfiguration().setLockAcquisitionTimeout(5000);
+ cache2.getConfiguration().setLockAcquisitionTimeout(5000);
cache1.start();
cache2.start();
}
@@ -122,8 +128,8 @@
}
public void testLockRemoval() throws Exception {
- initCaches(TreeCache.REPL_SYNC);
- cache1.setSyncCommitPhase(true);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
+ cache1.getConfiguration().setSyncCommitPhase(true);
cache1.releaseAllLocks("/");
Transaction tx=beginTransaction();
cache1.put("/bela/ban", "name", "Bela Ban");
@@ -141,9 +147,9 @@
Transaction tx;
try {
- initCaches(TreeCache.REPL_SYNC);
- cache1.setSyncCommitPhase(true);
- cache2.setSyncCommitPhase(true);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
+ cache1.getConfiguration().setSyncCommitPhase(true);
+ cache2.getConfiguration().setSyncCommitPhase(true);
// assertEquals(2, cache1.getMembers().size());
@@ -177,7 +183,7 @@
Integer age;
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
cache1.put("/JSESSION/localhost/192.168.1.10:32882/Courses/0", "Instructor", "Ben Wang");
@@ -196,7 +202,7 @@
final Fqn NODE3=Fqn.fromString("/one/two/three/fourI");
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
tx=beginTransaction();
cache1.put(NODE1, "age", new Integer(38));
@@ -235,10 +241,10 @@
final Fqn NODE2=Fqn.fromString("/eins/zwei/drei");
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
- cache1.setSyncCommitPhase(true);
- cache2.setSyncCommitPhase(true);
+ cache1.getConfiguration().setSyncCommitPhase(true);
+ cache2.getConfiguration().setSyncCommitPhase(true);
tx=beginTransaction();
cache1.put(NODE1, "age", new Integer(38));
@@ -291,7 +297,7 @@
final Fqn NODE=Fqn.fromString("/one/two/three");
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
tx=beginTransaction();
cache1.put(NODE, "age", new Integer(38));
System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
@@ -331,10 +337,10 @@
final Fqn NODE2=Fqn.fromString("/eins/zwei/drei");
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
- cache1.setSyncRollbackPhase(true);
- cache2.setSyncRollbackPhase(true);
+ cache1.getConfiguration().setSyncRollbackPhase(true);
+ cache2.getConfiguration().setSyncRollbackPhase(true);
tx=beginTransaction();
cache1.put(NODE1, "age", new Integer(38));
@@ -380,10 +386,10 @@
final Fqn NODE1=Fqn.fromString("/one/two/three");
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
- cache1.setSyncRollbackPhase(true);
- cache2.setSyncRollbackPhase(true);
+ cache1.getConfiguration().setSyncRollbackPhase(true);
+ cache2.getConfiguration().setSyncRollbackPhase(true);
// Test with a rollback on the sending side
@@ -472,10 +478,10 @@
final Fqn NODE1=Fqn.fromString("/one/two/three");
try {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
- cache1.setSyncRollbackPhase(true);
- cache2.setSyncRollbackPhase(true);
+ cache1.getConfiguration().setSyncRollbackPhase(true);
+ cache2.getConfiguration().setSyncRollbackPhase(true);
// Test with a rollback on the remote side
@@ -523,7 +529,7 @@
Integer age;
Transaction tx;
- initCaches(TreeCache.REPL_ASYNC);
+ initCaches(Configuration.CacheMode.REPL_ASYNC);
try {
tx=beginTransaction();
@@ -579,8 +585,8 @@
* @throws Exception
*/
public void testConcurrentPuts() throws Exception {
- initCaches(TreeCache.REPL_SYNC);
- cache1.setSyncCommitPhase(true);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
+ cache1.getConfiguration().setSyncCommitPhase(true);
Thread t1=new Thread("Thread1") {
Transaction tx;
@@ -663,18 +669,18 @@
final TreeCache c1=new TreeCache();
final TreeCache c2=new TreeCache();
- c1.setClusterName("TempCluster");
- c2.setClusterName("TempCluster");
- c1.setCacheMode(TreeCache.REPL_SYNC);
- c2.setCacheMode(TreeCache.REPL_SYNC);
- c1.setSyncCommitPhase(true);
- c2.setSyncCommitPhase(true);
- c1.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- c2.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- c1.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
- c2.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
- c1.setLockAcquisitionTimeout(5000);
- c2.setLockAcquisitionTimeout(5000);
+ c1.getConfiguration().setClusterName("TempCluster");
+ c2.getConfiguration().setClusterName("TempCluster");
+ c1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
+ c2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
+ c1.getConfiguration().setSyncCommitPhase(true);
+ c2.getConfiguration().setSyncCommitPhase(true);
+ c1.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
+ c2.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
+ c1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+ c2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+ c1.getConfiguration().setLockAcquisitionTimeout(5000);
+ c2.getConfiguration().setLockAcquisitionTimeout(5000);
c1.start();
c2.start();
@@ -752,7 +758,7 @@
* Conncurrent put on 2 different instances.
*/
public void testConcurrentPutsOnTwoInstances() throws Exception {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
final TreeCache c1=this.cache1;
final TreeCache c2=this.cache2;
@@ -810,7 +816,7 @@
public void testPut() throws Exception {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
final TreeCache c1=this.cache1;
@@ -905,9 +911,9 @@
Transaction tx=null;
try {
- initCaches(TreeCache.REPL_SYNC);
- cache1.setSyncCommitPhase(true);
- cache2.setSyncCommitPhase(true);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
+ cache1.getConfiguration().setSyncCommitPhase(true);
+ cache2.getConfiguration().setSyncCommitPhase(true);
tx=beginTransaction();
cache1.put("/a/b/c", "age", new Integer(38));
cache1.put("/a/b/c", "age", new Integer(39));
@@ -936,7 +942,7 @@
* released.
*/
public void testPutTx1() throws Exception {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
final TreeCache c1=this.cache1;
Thread t1=new Thread() {
public void run() {
@@ -1022,7 +1028,7 @@
public void testPutTxWithRollback() throws Exception {
- initCaches(TreeCache.REPL_SYNC);
+ initCaches(Configuration.CacheMode.REPL_SYNC);
final TreeCache c2=this.cache1;
Thread t1=new Thread() {
public void run() {
More information about the jboss-cvs-commits
mailing list