[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/replicated ...
Brian Stansberry
brian.stansberry at jboss.com
Tue Jan 2 23:03:48 EST 2007
User: bstansberry
Date: 07/01/02 23:03:48
Modified: tests/functional/org/jboss/cache/replicated
SyncReplTxTest.java AsyncReplTest.java
Log:
[JBCACHE-920] Port multiplexer integration tests to HEAD
Revision Changes Path
1.17 +33 -1 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.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- SyncReplTxTest.java 30 Dec 2006 17:50:05 -0000 1.16
+++ SyncReplTxTest.java 3 Jan 2007 04:03:48 -0000 1.17
@@ -14,6 +14,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.AbstractCacheListener;
+import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
@@ -40,7 +41,7 @@
* Note: we use DummyTransactionManager for Tx purpose instead of relying on
* jta.
*
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
*/
public class SyncReplTxTest extends TestCase
{
@@ -101,8 +102,39 @@
cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
cache1.getConfiguration().setLockAcquisitionTimeout(5000);
cache2.getConfiguration().setLockAcquisitionTimeout(5000);
+
+ configureMultiplexer(cache1);
+ configureMultiplexer(cache2);
+
cache1.start();
cache2.start();
+
+ validateMultiplexer(cache1);
+ validateMultiplexer(cache2);
+ }
+
+ /**
+ * Provides a hook for multiplexer integration. This default implementation
+ * is a no-op; subclasses that test mux integration would override
+ * to integrate the given cache with a multiplexer.
+ *
+ * param cache a cache that has been configured but not yet created.
+ */
+ protected void configureMultiplexer(Cache cache) throws Exception
+ {
+ // default does nothing
+ }
+
+ /**
+ * Provides a hook to check that the cache's channel came from the
+ * multiplexer, or not, as expected. This default impl asserts that
+ * the channel did not come from the multiplexer.
+ *
+ * @param cache a cache that has already been started
+ */
+ protected void validateMultiplexer(Cache cache)
+ {
+ assertFalse("Cache is not using multiplexer", cache.getConfiguration().isUsingMultiplexer());
}
private void destroyCaches()
1.14 +34 -1 JBossCache/tests/functional/org/jboss/cache/replicated/AsyncReplTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AsyncReplTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/replicated/AsyncReplTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- AsyncReplTest.java 30 Dec 2006 19:48:47 -0000 1.13
+++ AsyncReplTest.java 3 Jan 2007 04:03:48 -0000 1.14
@@ -13,6 +13,8 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+
+import org.jboss.cache.Cache;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.factories.XmlConfigurationParser;
@@ -24,7 +26,7 @@
* Unit test for replicated async CacheImpl. Use locking and multiple threads to test
* concurrent access to the tree.
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public class AsyncReplTest extends TestCase
{
@@ -52,11 +54,42 @@
CacheImpl cache = new CacheImpl();
cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replAsync-service.xml"));
cache.getConfiguration().setClusterName(name);
+
+ // Call the hook that allows mux integration
+ configureMultiplexer(cache);
+
cache.create();
cache.start();
+
+ validateMultiplexer(cache);
+
return cache;
}
+ /**
+ * Provides a hook for multiplexer integration. This default implementation
+ * is a no-op; subclasses that test mux integration would override
+ * to integrate the given cache with a multiplexer.
+ *
+ * param cache a cache that has been configured but not yet created.
+ */
+ protected void configureMultiplexer(Cache cache) throws Exception
+ {
+ // default does nothing
+ }
+
+ /**
+ * Provides a hook to check that the cache's channel came from the
+ * multiplexer, or not, as expected. This default impl asserts that
+ * the channel did not come from the multiplexer.
+ *
+ * @param cache a cache that has already been started
+ */
+ protected void validateMultiplexer(Cache cache)
+ {
+ assertFalse("Cache is not using multiplexer", cache.getConfiguration().isUsingMultiplexer());
+ }
+
protected void tearDown() throws Exception
{
super.tearDown();
More information about the jboss-cvs-commits
mailing list