[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/loader/deadlock ...
Manik Surtani
msurtani at jboss.com
Thu Jul 20 02:04:56 EDT 2006
User: msurtani
Date: 06/07/20 02:04:56
Modified: tests/functional/org/jboss/cache/loader/deadlock
ConcurrentCreationDeadlockTest.java
Log:
Fixed some broken UTs to use the new xml parsers, cache factories, etc.
Revision Changes Path
1.3 +29 -26 JBossCache/tests/functional/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConcurrentCreationDeadlockTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ConcurrentCreationDeadlockTest.java 21 Mar 2006 23:40:19 -0000 1.2
+++ ConcurrentCreationDeadlockTest.java 20 Jul 2006 06:04:56 -0000 1.3
@@ -2,12 +2,13 @@
import EDU.oswego.cs.dl.util.concurrent.Latch;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.PropertyConfigurator;
import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.XmlConfigurationParser;
+import org.jboss.cache.loader.AbstractCacheLoaderTestBase;
+import org.jboss.cache.transaction.DummyTransactionManager;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -59,7 +60,7 @@
* </ul>
*
*/
-public class ConcurrentCreationDeadlockTest extends TestCase {
+public class ConcurrentCreationDeadlockTest extends AbstractCacheLoaderTestBase {
/** The number of worker threads to start concurrently. */
private static final int NUM_WORKERS = 10;
/** The number of test runs to perform. */
@@ -106,10 +107,12 @@
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);
DummyTransactionManager.getInstance();
m_cache = new TreeCache();
- PropertyConfigurator config = new PropertyConfigurator();
- config.configure(m_cache, "META-INF/replSync-service.xml");
- m_cache.setTransactionManagerLookupClass(
- "org.jboss.cache.DummyTransactionManagerLookup");
+
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ Configuration c = parser.parseFile("META-INF/replSync-service.xml");
+ m_cache.setConfiguration(c);
+
+ c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
}
/**
@@ -134,11 +137,11 @@
* @param cacheLoaderClass The name of the cache loader class.
* @throws Exception Any exception if thrown by the cache.
*/
- private void startCache(int cacheMode, String cacheLoaderClass)
+ private void startCache(Configuration.CacheMode cacheMode, String cacheLoaderClass)
throws Exception {
- m_cache.setCacheMode(cacheMode);
+ m_cache.getConfiguration().setCacheModeInt(cacheMode);
if (cacheLoaderClass != null) {
- m_cache.setCacheLoaderClass(cacheLoaderClass);
+ m_cache.getConfiguration().setClusterConfig(getSingleCacheLoaderConfig("", cacheLoaderClass, "", false, false, false));
}
m_cache.createService();
m_cache.startService();
@@ -152,7 +155,7 @@
* @throws Exception Any exception if thrown by the cache.
*/
public void disabledtestLocalNoCacheLoader1Modification() throws Exception {
- startCache(TreeCache.LOCAL, null);
+ startCache(Configuration.CacheMode.LOCAL, null);
performTest(1);
}
@@ -165,7 +168,7 @@
*/
public void disabledtestLocalNoCacheLoader2Modifications()
throws Exception {
- startCache(TreeCache.LOCAL, null);
+ startCache(Configuration.CacheMode.LOCAL, null);
performTest(2);
}
@@ -177,7 +180,7 @@
* @throws Exception Any exception if thrown by the cache.
*/
public void disabledtestLocalCacheLoader1Modification() throws Exception {
- startCache(TreeCache.LOCAL, "org.jboss.cache.loader.DummyCacheLoader");
+ startCache(Configuration.CacheMode.LOCAL, "org.jboss.cache.loader.DummyCacheLoader");
performTest(1);
}
@@ -189,7 +192,7 @@
* @throws Exception Any exception if thrown by the cache.
*/
public void testLocalCacheLoader2Modifications() throws Exception {
- startCache(TreeCache.LOCAL, "org.jboss.cache.loader.DummyCacheLoader");
+ startCache(Configuration.CacheMode.LOCAL, "org.jboss.cache.loader.DummyCacheLoader");
performTest(2);
}
@@ -202,7 +205,7 @@
*/
public void disabledtestReplAsyncNoCacheLoader1Modification()
throws Exception {
- startCache(TreeCache.REPL_ASYNC, null);
+ startCache(Configuration.CacheMode.REPL_ASYNC, null);
performTest(1);
}
@@ -215,7 +218,7 @@
*/
public void disabledtestReplAsyncNoCacheLoader2Modifications()
throws Exception {
- startCache(TreeCache.REPL_ASYNC, null);
+ startCache(Configuration.CacheMode.REPL_ASYNC, null);
performTest(2);
}
@@ -228,7 +231,7 @@
*/
public void disabledtestReplAsyncCacheLoader1Modification()
throws Exception {
- startCache(TreeCache.REPL_ASYNC, "org.jboss.cache.loader.DummyCacheLoader");
+ startCache(Configuration.CacheMode.REPL_ASYNC, "org.jboss.cache.loader.DummyCacheLoader");
performTest(1);
}
@@ -242,7 +245,7 @@
*/
public void disabledtestReplAsyncCacheLoader2Modifications()
throws Exception {
- startCache(TreeCache.REPL_ASYNC, "org.jboss.cache.loader.DummyCacheLoader");
+ startCache(Configuration.CacheMode.REPL_ASYNC, "org.jboss.cache.loader.DummyCacheLoader");
performTest(2);
}
@@ -255,7 +258,7 @@
*/
public void disabledtestReplSyncNoCacheLoader1Modification()
throws Exception {
- startCache(TreeCache.REPL_SYNC, null);
+ startCache(Configuration.CacheMode.REPL_SYNC, null);
performTest(1);
}
@@ -268,7 +271,7 @@
*/
public void disabledtestReplSyncNoCacheLoader2Modifications()
throws Exception {
- startCache(TreeCache.REPL_SYNC, null);
+ startCache(Configuration.CacheMode.REPL_SYNC, null);
performTest(2);
}
@@ -280,7 +283,7 @@
* @throws Exception Any exception if thrown by the cache.
*/
public void disabledtestReplSyncCacheLoader1Modification() throws Exception {
- startCache(TreeCache.REPL_SYNC, "org.jboss.cache.loader.DummyCacheLoader");
+ startCache(Configuration.CacheMode.REPL_SYNC, "org.jboss.cache.loader.DummyCacheLoader");
performTest(1);
}
@@ -293,7 +296,7 @@
*/
public void testReplSyncCacheLoader2Modifications()
throws Exception {
- startCache(TreeCache.REPL_SYNC, "org.jboss.cache.loader.DummyCacheLoader");
+ startCache(Configuration.CacheMode.REPL_SYNC, "org.jboss.cache.loader.DummyCacheLoader");
performTest(2);
}
@@ -354,8 +357,8 @@
* @author Marian Nikolov
* @author $Author: msurtani $
* @version $RCSfile: ConcurrentCreationDeadlockTest.java,v $
- * @version $Revision: 1.2 $
- * @version $Date: 2006/03/21 23:40:19 $
+ * @version $Revision: 1.3 $
+ * @version $Date: 2006/07/20 06:04:56 $
*/
private class Worker extends Thread {
/** Used to fire all workers at the same time. */
More information about the jboss-cvs-commits
mailing list