[jbosscache-commits] JBoss Cache SVN: r4664 - in core/trunk/src/test/java/org/jboss/cache: misc and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Oct 22 19:57:26 EDT 2007
Author: manik.surtani at jboss.com
Date: 2007-10-22 19:57:26 -0400 (Mon, 22 Oct 2007)
New Revision: 4664
Modified:
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
Log:
Refactored test
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-10-22 23:08:18 UTC (rev 4663)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2007-10-22 23:57:26 UTC (rev 4664)
@@ -9,7 +9,6 @@
import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
@@ -21,12 +20,8 @@
import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.xml.XmlHelper;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
@@ -45,11 +40,19 @@
public class InvalidationInterceptorTest
{
private static Log log = LogFactory.getLog(InvalidationInterceptorTest.class);
+ CacheImpl<Object, Object> cache1, cache2;
+ @AfterMethod
+ public void tearDown()
+ {
+ TestingUtil.killCaches(cache1);
+ TestingUtil.killCaches(cache2);
+ }
+
public void testPessimisticNonTransactional() throws Exception
{
- CacheImpl<Object, Object> cache1 = createCache(false);
- CacheImpl<Object, Object> cache2 = createCache(false);
+ cache1 = createCache(false);
+ cache2 = createCache(false);
Fqn fqn = Fqn.fromString("/a/b");
cache1.put(fqn, "key", "value");
@@ -65,28 +68,20 @@
// since the node already exists even PL will not remove it - but will invalidate it's data
Node n = cache1.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
+ assertHasBeenInvalidated(n, "Should have been invalidated");
Assert.assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation:
cache1.put(fqn, "key2", "value2");
Assert.assertEquals("value2", cache1.get(fqn, "key2"));
n = cache2.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
-
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
+ assertHasBeenInvalidated(n, "Should have been invalidated");
}
public void testUnnecessaryEvictions() throws Exception
{
- CacheImpl<Object, Object> cache1 = createCache(false);
- CacheImpl<Object, Object> cache2 = createCache(false);
+ cache1 = createCache(false);
+ cache2 = createCache(false);
Fqn fqn1 = Fqn.fromString("/a/b/c");
Fqn fqn2 = Fqn.fromString("/a/b/d");
@@ -107,19 +102,13 @@
assertEquals("world", cache2.get(fqn2, "hello"));
assertNull(cache1.get(fqn1, "hello"));
assertNull(cache1.get(fqn2, "hello"));
-
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
-
}
public void testPessimisticNonTransactionalAsync() throws Exception
{
- CacheImpl<Object, Object> cache1 = createUnstartedCache(false);
- CacheImpl<Object, Object> cache2 = createUnstartedCache(false);
+ cache1 = createUnstartedCache(false);
+ cache2 = createUnstartedCache(false);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC);
cache1.start();
@@ -140,8 +129,7 @@
// since the node already exists even PL will not remove it - but will invalidate it's data
Node n = cache1.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
+ assertHasBeenInvalidated(n, "Should have been invalidated");
Assert.assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation:
@@ -151,21 +139,14 @@
// since the node already exists even PL will not remove it - but will invalidate it's data
n = cache2.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
-
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
+ assertHasBeenInvalidated(n, "Should have been invalidated");
}
public void testPessimisticTransactional() throws Exception
{
- CacheImpl<Object, Object> cache1 = createCache(false);
- CacheImpl<Object, Object> cache2 = createCache(false);
+ cache1 = createCache(false);
+ cache2 = createCache(false);
Fqn fqn = Fqn.fromString("/a/b");
cache1.put(fqn, "key", "value");
@@ -188,8 +169,7 @@
// since the node already exists even PL will not remove it - but will invalidate it's data
Node n = cache1.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
+ assertHasBeenInvalidated(n, "Should have been invalidated");
Assert.assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation again
@@ -204,8 +184,7 @@
Assert.assertEquals("value2", cache1.get(fqn, "key2"));
// since the node already exists even PL will not remove it - but will invalidate it's data
n = cache2.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
+ assertHasBeenInvalidated(n, "Should have been invalidated");
// test a rollback
txm = cache2.getTransactionManager();
@@ -218,22 +197,14 @@
Assert.assertEquals("value2", cache1.get(fqn, "key2"));
n = cache2.get(fqn);
- assert n != null : "Should not be null";
- assert n.getKeys().isEmpty() : "Should not contain any data";
-
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
-
+ assertHasBeenInvalidated(n, "Should have been invalidated");
}
public void testOptSyncUnableToEvict() throws Exception
{
- CacheImpl<Object, Object> cache1 = createCache(true);
- CacheImpl<Object, Object> cache2 = createCache(true);
+ cache1 = createCache(true);
+ cache2 = createCache(true);
Fqn fqn = Fqn.fromString("/a/b");
@@ -275,17 +246,12 @@
{
Assert.assertTrue("Ought to have failed!", true);
}
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
}
public void testPessTxSyncUnableToEvict() throws Exception
{
- CacheImpl<Object, Object> cache1 = createCache(false);
- CacheImpl<Object, Object> cache2 = createCache(false);
+ cache1 = createCache(false);
+ cache2 = createCache(false);
Fqn fqn = Fqn.fromString("/a/b");
@@ -325,17 +291,12 @@
{
Assert.assertTrue("Ought to have succeeded!", false);
}
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
}
public void testPessTxAsyncUnableToEvict() throws Exception
{
- CacheImpl<Object, Object> cache1 = createUnstartedCache(false);
- CacheImpl<Object, Object> cache2 = createUnstartedCache(false);
+ cache1 = createUnstartedCache(false);
+ cache2 = createUnstartedCache(false);
cache1.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC);
cache2.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC);
cache1.start();
@@ -379,11 +340,6 @@
{
Assert.assertTrue("Ought to have succeeded!", false);
}
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
}
public void testPessimisticNodeRemoval() throws Exception
@@ -399,76 +355,55 @@
@SuppressWarnings("unchecked")
private void nodeRemovalTest(boolean optimistic) throws Exception
{
- CacheImpl<Object, Object> cache1 = null;
- CacheImpl<Object, Object> cache2 = null;
- try
- {
- cache1 = createCache(optimistic);
- cache2 = createCache(optimistic);
-
- Node root1 = cache1.getRoot();
- Node root2 = cache2.getRoot();
-
- // this fqn is relative, but since it is from the root it may as well be absolute
- Fqn<String> fqn = Fqn.fromString("/test/fqn");
- cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache1.put(fqn, "key", "value");
- assertEquals("value", cache1.get(fqn, "key"));
- cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache2.put(fqn, "key", "value");
- assertEquals("value", cache2.get(fqn, "key"));
+ cache1 = createCache(optimistic);
+ cache2 = createCache(optimistic);
+
+ Node root1 = cache1.getRoot();
+ Node root2 = cache2.getRoot();
+
+ // this fqn is relative, but since it is from the root it may as well be absolute
+ Fqn<String> fqn = Fqn.fromString("/test/fqn");
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache1.put(fqn, "key", "value");
+ assertEquals("value", cache1.get(fqn, "key"));
+ cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache2.put(fqn, "key", "value");
+ assertEquals("value", cache2.get(fqn, "key"));
+
+ assertEquals(true, cache1.removeNode(fqn));
+ assertFalse(root1.hasChild(fqn));
+ Node remoteNode = root2.getChild(fqn);
+ checkRemoteNodeIsRemoved(remoteNode);
+ assertEquals(false, cache1.removeNode(fqn));
+
+ Fqn<String> child = Fqn.fromString("/test/fqn/child");
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache1.put(child, "key", "value");
+ assertEquals("value", cache1.get(child, "key"));
+ cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache2.put(child, "key", "value");
+ assertEquals("value", cache2.get(child, "key"));
+
+ assertEquals(true, cache1.removeNode(fqn));
+ assertFalse(root1.hasChild(fqn));
+ remoteNode = root2.getChild(fqn);
+ checkRemoteNodeIsRemoved(remoteNode);
+ assertEquals(false, cache1.removeNode(fqn));
+ }
- assertEquals(true, cache1.removeNode(fqn));
- assertFalse(root1.hasChild(fqn));
- Node remoteNode = root2.getChild(fqn);
- checkRemoteNodeIsRemoved(remoteNode);
- assertEquals(false, cache1.removeNode(fqn));
-
- Fqn<String> child = Fqn.fromString("/test/fqn/child");
- cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache1.put(child, "key", "value");
- assertEquals("value", cache1.get(child, "key"));
- cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache2.put(child, "key", "value");
- assertEquals("value", cache2.get(child, "key"));
-
- assertEquals(true, cache1.removeNode(fqn));
- assertFalse(root1.hasChild(fqn));
- remoteNode = root2.getChild(fqn);
- checkRemoteNodeIsRemoved(remoteNode);
- assertEquals(false, cache1.removeNode(fqn));
- }
- finally
+ private void checkRemoteNodeIsRemoved(Node<Object, Object> remoteNode)
+ {
+ assertHasBeenInvalidated(remoteNode, "Should have been removed");
+ // Recursively check any children
+ if (remoteNode != null)
{
- if (cache1 != null)
+ for (Node<Object, Object> child : remoteNode.getChildren())
{
- cache1.stop();
- cache1.destroy();
+ checkRemoteNodeIsRemoved(child);
}
- if (cache2 != null)
- {
- cache2.stop();
- cache2.destroy();
- }
-
}
-
}
- private void checkRemoteNodeIsRemoved(Node<Object, Object> remoteNode) {
-
- assertNotNull("remoteNode " + remoteNode.getFqn() +" is not null", remoteNode);
- // FIXME A simple isValid() check should suffice,
- // but that's not implemented
- //assertFalse("remoteNode is not valid", remoteNode.isValid());
- assertEquals("remoteNode " + remoteNode.getFqn() +" has no keys", 0, remoteNode.getKeys().size());
- // Recursively check any children
- for (Node<Object, Object> child : remoteNode.getChildren())
- {
- checkRemoteNodeIsRemoved(child);
- }
- }
-
public void testPessimisticNodeResurrection() throws Exception {
nodeResurrectionTest(false);
}
@@ -479,66 +414,46 @@
private void nodeResurrectionTest(boolean optimistic) throws Exception
{
- CacheImpl<Object, Object> cache1 = null;
- CacheImpl<Object, Object> cache2 = null;
- try
- {
- cache1 = createCache(optimistic);
- cache2 = createCache(optimistic);
-
- // this fqn is relative, but since it is from the root it may as well be absolute
- Fqn<String> fqn = Fqn.fromString("/test/fqn1");
- cache1.put(fqn, "key", "value");
- assertEquals("value", cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
- // Change the value in order to increment the version if Optimistic is used
- cache1.put(fqn, "key", "newValue");
- assertEquals("newValue", cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
-
- assertEquals(true, cache1.removeNode(fqn));
- assertEquals(null, cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
-
- // Restore locally
- cache1.put(fqn, "key", "value");
- assertEquals("value", cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
-
- // Repeat, but now restore the node on the remote cache
- fqn = Fqn.fromString("/test/fqn2");
- cache1.put(fqn, "key", "value");
- assertEquals("value", cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
- // Change the value in order to increment the version if Optimistic is used
- cache1.put(fqn, "key", "newValue");
- assertEquals("newValue", cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
-
- assertEquals(true, cache1.removeNode(fqn));
- assertEquals(null, cache1.get(fqn, "key"));
- assertEquals(null, cache2.get(fqn, "key"));
-
- // Restore on remote cache
- cache2.put(fqn, "key", "value");
- assertEquals("value", cache2.get(fqn, "key"));
- assertEquals(null, cache1.get(fqn, "key"));
- }
- finally
- {
- if (cache1 != null)
- {
- cache1.stop();
- cache1.destroy();
- }
- if (cache2 != null)
- {
- cache2.stop();
- cache2.destroy();
- }
-
- }
-
+ cache1 = createCache(optimistic);
+ cache2 = createCache(optimistic);
+
+ // this fqn is relative, but since it is from the root it may as well be absolute
+ Fqn<String> fqn = Fqn.fromString("/test/fqn1");
+ cache1.put(fqn, "key", "value");
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+ // Change the value in order to increment the version if Optimistic is used
+ cache1.put(fqn, "key", "newValue");
+ assertEquals("newValue", cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+
+ assertEquals(true, cache1.removeNode(fqn));
+ assertEquals(null, cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+
+ // Restore locally
+ cache1.put(fqn, "key", "value");
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+
+ // Repeat, but now restore the node on the remote cache
+ fqn = Fqn.fromString("/test/fqn2");
+ cache1.put(fqn, "key", "value");
+ assertEquals("value", cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+ // Change the value in order to increment the version if Optimistic is used
+ cache1.put(fqn, "key", "newValue");
+ assertEquals("newValue", cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+
+ assertEquals(true, cache1.removeNode(fqn));
+ assertEquals(null, cache1.get(fqn, "key"));
+ assertEquals(null, cache2.get(fqn, "key"));
+
+ // Restore on remote cache
+ cache2.put(fqn, "key", "value");
+ assertEquals("value", cache2.get(fqn, "key"));
+ assertEquals(null, cache1.get(fqn, "key"));
}
private void dumpVersionInfo(CacheSPI c1, CacheSPI c2, Fqn fqn)
@@ -554,8 +469,8 @@
public void testOptimistic() throws Exception
{
- CacheImpl<Object, Object> cache1 = createCache(true);
- CacheImpl<Object, Object> cache2 = createCache(true);
+ cache1 = createCache(true);
+ cache2 = createCache(true);
Fqn fqn = Fqn.fromString("/a/b");
cache1.put(fqn, "key", "value");
@@ -574,8 +489,8 @@
dumpVersionInfo(cache1, cache2, fqn);
Node n1 = cache1.get(fqn);
- assert n1 != null : "Should NOT be null; we need to have version info on all instances.";
- assert n1.get("key") == null : "Data should not have replicated!";
+ assertHasBeenInvalidated(n1, "Should have been invalidated");
+ assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");
Assert.assertEquals("value", cache2.get(fqn, "key"));
@@ -586,9 +501,8 @@
Assert.assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.get(fqn);
- assert n2 != null : "Should NOT be null; we need to have version info on all instances.";
- assert n2.get("key") == null : "Data should have invalidated!";
- assert n2.get("key2") == null : "Data should have invalidated!";
+ assertHasBeenInvalidated(n2, "Should have been invalidated");
+ assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
// with tx's
TransactionManager txm = cache2.getTransactionManager();
@@ -600,8 +514,8 @@
txm.commit();
n1 = cache1.get(fqn);
- assert n1 != null : "Should NOT be null; we need to have version info on all instances.";
- assert n1.get("key") == null : "Data should be null!";
+ assertHasBeenInvalidated(n1, "Should have been invalidated");
+ assertHasBeenInvalidated(cache1.peek(fqn, false, false), "Should have been invalidated");
Assert.assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation again
@@ -615,8 +529,8 @@
Assert.assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.get(fqn);
- assert n2 != null : "Should NOT be null; we need to have version info on all instances.";
- assert n2.get("key2") == null : "Data should have invalidated!";
+ assertHasBeenInvalidated(n2, "Should have been invalidated");
+ assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
// test a rollback
txm = cache2.getTransactionManager();
@@ -629,20 +543,15 @@
Assert.assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.get(fqn);
- assert n2 != null : "Should NOT be null; we need to have version info on all instances.";
- assert n2.get("key2") == null : "Should not have committed!";
-
- // clean up.
- cache1.stop();
- cache2.stop();
- cache1 = null;
- cache2 = null;
-
+ assertHasBeenInvalidated(n2, "Should have been invalidated");
+ assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
}
public void testPessimisticNonTransactionalWithCacheLoader() throws Exception
{
List<CacheImpl<Object, Object>> caches = createCachesWithSharedCL(false);
+ cache1 = caches.get(0);
+ cache2 = caches.get(1);
Fqn fqn = Fqn.fromString("/a/b");
caches.get(0).put(fqn, "key", "value");
@@ -661,19 +570,13 @@
Assert.assertEquals("value2", caches.get(1).get(fqn, "key2"));
Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
Assert.assertEquals("value", caches.get(1).get(fqn, "key"));
-
- // clean up.
- caches.get(0).remove(fqn);
- caches.get(1).remove(fqn);
- caches.get(0).stop();
- caches.get(1).stop();
- caches.set(0, null);
- caches.set(1, null);
}
public void testPessimisticTransactionalWithCacheLoader() throws Exception
{
List<CacheImpl<Object,Object>> caches = createCachesWithSharedCL(false);
+ cache1 = caches.get(0);
+ cache2 = caches.get(1);
Fqn fqn = Fqn.fromString("/a/b");
TransactionManager mgr = caches.get(0).getTransactionManager();
@@ -694,19 +597,13 @@
Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
Assert.assertNull("Should be null", caches.get(0).get(fqn, "key2"));
Assert.assertNull("Should be null", caches.get(1).get(fqn, "key2"));
-
- // clean up.
- caches.get(0).remove(fqn);
- caches.get(1).remove(fqn);
- caches.get(0).stop();
- caches.get(1).stop();
- caches.set(0, null);
- caches.set(1, null);
}
public void testOptimisticWithCacheLoader() throws Exception
{
List<CacheImpl<Object, Object>> caches = createCachesWithSharedCL(true);
+ cache1 = caches.get(0);
+ cache2 = caches.get(1);
Fqn fqn = Fqn.fromString("/a/b");
TransactionManager mgr = caches.get(0).getTransactionManager();
@@ -729,14 +626,6 @@
Assert.assertEquals("value", caches.get(0).get(fqn, "key"));
Assert.assertNull("Should be null", caches.get(0).get(fqn, "key2"));
Assert.assertNull("Should be null", caches.get(1).get(fqn, "key2"));
-
- // clean up.
- caches.get(0).remove(fqn);
- caches.get(1).remove(fqn);
- caches.get(0).stop();
- caches.get(1).stop();
- caches.set(0, null);
- caches.set(1, null);
}
public void testInvalidationWithRegionBasedMarshalling() throws Exception
@@ -754,6 +643,8 @@
List<CacheImpl<Object,Object>> caches = new ArrayList<CacheImpl<Object, Object>>();
caches.add(createUnstartedCache(false));
caches.add(createUnstartedCache(false));
+ cache1 = caches.get(0);
+ cache2 = caches.get(1);
caches.get(0).getConfiguration().setUseRegionBasedMarshalling(true);
caches.get(1).getConfiguration().setUseRegionBasedMarshalling(true);
@@ -792,14 +683,7 @@
caches.get(1).put(fqn, "key", "value2");
assertEquals("expecting value2", "value2", caches.get(1).get(fqn, "key"));
n = caches.get(0).get(fqn);
- assert n != null : "Should NOT be null";
- assert n.getKeys().isEmpty() : "but should be empty";
-
- // clean up.
- caches.get(0).remove(fqn);
- caches.get(1).remove(fqn);
- caches.get(0).stop();
- caches.get(1).stop();
+ assertHasBeenInvalidated(n, "Should have been invalidated");
}
protected CacheImpl<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
@@ -852,4 +736,17 @@
Element element = XmlHelper.stringToElement(xml);
return XmlConfigurationParser.parseCacheLoaderConfig(element);
}
+
+ protected void assertHasBeenInvalidated(Node n, String message)
+ {
+ // depending on how n was retrieved!
+ if (n == null)
+ {
+ assert true : message;
+ }
+ else
+ {
+ assert !n.isValid() : message;
+ }
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2007-10-22 23:08:18 UTC (rev 4663)
+++ core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2007-10-22 23:57:26 UTC (rev 4664)
@@ -411,6 +411,7 @@
}
}
+ ci.stop();
ci.destroy();
}
}
More information about the jbosscache-commits
mailing list