[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/lock ...
Manik Surtani
msurtani at jboss.com
Thu Jan 11 08:49:22 EST 2007
User: msurtani
Date: 07/01/11 08:49:22
Modified: tests/functional/org/jboss/cache/lock
AcquireAllTest.java UpgradeLockTest.java
BreakDeadMemberLocksTest.java LockReleaseTest.java
Log:
Changed CacheImpl ctor to be protected, and changed cache factories accordingly
Revision Changes Path
1.10 +3 -2 JBossCache/tests/functional/org/jboss/cache/lock/AcquireAllTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AcquireAllTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/AcquireAllTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- AcquireAllTest.java 4 Jan 2007 05:35:36 -0000 1.9
+++ AcquireAllTest.java 11 Jan 2007 13:49:22 -0000 1.10
@@ -4,6 +4,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
@@ -13,7 +14,7 @@
/**
* @author Bela Ban
- * @version $Id: AcquireAllTest.java,v 1.9 2007/01/04 05:35:36 msurtani Exp $
+ * @version $Id: AcquireAllTest.java,v 1.10 2007/01/11 13:49:22 msurtani Exp $
*/
public class AcquireAllTest extends TestCase
{
@@ -97,7 +98,7 @@
CacheImpl createCache(Configuration.CacheMode mode, IsolationLevel level) throws Exception
{
- CacheImpl c = new CacheImpl();
+ CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
c.getConfiguration().setCacheMode(mode);
c.getConfiguration().setIsolationLevel(level);
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
1.7 +9 -4 JBossCache/tests/functional/org/jboss/cache/lock/UpgradeLockTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UpgradeLockTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/UpgradeLockTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- UpgradeLockTest.java 30 Dec 2006 17:49:58 -0000 1.6
+++ UpgradeLockTest.java 11 Jan 2007 13:49:22 -0000 1.7
@@ -13,6 +13,7 @@
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.transaction.DummyTransactionManager;
import javax.naming.Context;
@@ -24,7 +25,7 @@
* Tests upgrade locks from read -> write
*
* @author Bela Ban
- * @version $Id: UpgradeLockTest.java,v 1.6 2006/12/30 17:49:58 msurtani Exp $
+ * @version $Id: UpgradeLockTest.java,v 1.7 2007/01/11 13:49:22 msurtani Exp $
*/
public class UpgradeLockTest extends TestCase
{
@@ -64,7 +65,9 @@
{
super.tearDown();
if (cache != null)
+ {
cache.stop();
+ }
// BW. kind of a hack to destroy jndi binding and thread local tx before next run.
DummyTransactionManager.destroy();
@@ -89,7 +92,7 @@
CacheImpl createCache(IsolationLevel level) throws Exception
{
- CacheImpl c = new CacheImpl();
+ CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
c.getConfiguration().setClusterName("test");
c.getConfiguration().setInitialStateRetrievalTimeout(10000);
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.JBossTransactionManagerLookup");
@@ -169,8 +172,8 @@
assertEquals(VAL1, cache.get(NODE1, KEY));
assertEquals(VAL1, cache.get(NODE2, KEY));
- cache.put(NODE1, KEY, VAL2); // causes read lock to upgrade to r/w lock
- cache.put(NODE2, KEY, VAL2); // causes read lock to upgrade to r/w lock
+ cache.put(NODE1, KEY, VAL2);// causes read lock to upgrade to r/w lock
+ cache.put(NODE2, KEY, VAL2);// causes read lock to upgrade to r/w lock
assertEquals(VAL2, cache.get(NODE1, KEY));
assertEquals(VAL2, cache.get(NODE2, KEY));
tx.commit();
@@ -178,8 +181,10 @@
catch (Throwable t)
{
if (tx != null)
+ {
tx.rollback();
}
+ }
assertEquals(VAL2, cache.get(NODE1, KEY));
assertEquals(VAL2, cache.get(NODE2, KEY));
}
1.6 +6 -2 JBossCache/tests/functional/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BreakDeadMemberLocksTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/BreakDeadMemberLocksTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- BreakDeadMemberLocksTest.java 10 Jan 2007 15:39:52 -0000 1.5
+++ BreakDeadMemberLocksTest.java 11 Jan 2007 13:49:22 -0000 1.6
@@ -24,9 +24,9 @@
import junit.framework.TestCase;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheFactory;
-import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.misc.TestingUtil;
import javax.transaction.Synchronization;
@@ -104,8 +104,10 @@
t.start();
while (!sync.hung)
+ {
monitor.wait(500);
}
+ }
tm.suspend();
@@ -140,9 +142,11 @@
protected CacheImpl createCache(String cacheID) throws Exception
{
if (caches.get(cacheID) != null)
+ {
throw new IllegalStateException(cacheID + " already created");
+ }
- CacheImpl cache = new CacheImpl();
+ CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
cache.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
cache.create();
1.7 +5 -2 JBossCache/tests/functional/org/jboss/cache/lock/LockReleaseTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LockReleaseTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/LockReleaseTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- LockReleaseTest.java 30 Dec 2006 17:49:58 -0000 1.6
+++ LockReleaseTest.java 11 Jan 2007 13:49:22 -0000 1.7
@@ -13,6 +13,7 @@
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.transaction.DummyTransactionManager;
@@ -26,7 +27,7 @@
* Verifies that there are no read locks held when a transaction ends.
*
* @author Bela Ban
- * @version $Id: LockReleaseTest.java,v 1.6 2006/12/30 17:49:58 msurtani Exp $
+ * @version $Id: LockReleaseTest.java,v 1.7 2007/01/11 13:49:22 msurtani Exp $
*/
public class LockReleaseTest extends TestCase
{
@@ -66,7 +67,9 @@
{
super.tearDown();
if (cache != null)
+ {
cache.stop();
+ }
// BW. kind of a hack to destroy jndi binding and thread local tx before next run.
DummyTransactionManager.destroy();
@@ -91,7 +94,7 @@
CacheImpl createCache(IsolationLevel level) throws Exception
{
- CacheImpl c = new CacheImpl();
+ CacheImpl c = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
c.getConfiguration().setClusterName("test");
c.getConfiguration().setInitialStateRetrievalTimeout(10000);
c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.JBossTransactionManagerLookup");
More information about the jboss-cvs-commits
mailing list