Author: bstansberry(a)jboss.com
Date: 2007-12-24 11:01:02 -0500 (Mon, 24 Dec 2007)
New Revision: 14265
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java
Log:
Fix the evictRemoveAll tests for the optimistic case
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
---
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-12-24
15:19:46 UTC (rev 14264)
+++
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-12-24
16:01:02 UTC (rev 14265)
@@ -433,7 +433,7 @@
Node regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -442,7 +442,7 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -476,7 +476,7 @@
regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingInvalidation()) {
@@ -500,26 +500,27 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
if (isUsingInvalidation()) {
- // JBC seems broken: see
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=121408
- // FIXME replace with the following when JBCACHE-1199 and JBCACHE-1200 are
done:
- //assertFalse(regionRoot.isValid());
- checkNodeIsEmpty(regionRoot);
+ // Region root should have 1 child -- the one we added above
+ assertEquals(1, getValidChildrenCount(regionRoot));
}
else {
// Same assertion, just different assertion msg
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
}
assertTrue(regionRoot.isResident());
assertNull("local is clean", localAccessStrategy.get(KEY,
System.currentTimeMillis()));
- assertNull("remote is clean", remoteAccessStrategy.get(KEY,
System.currentTimeMillis()));
+ assertEquals("remote is correct", (isUsingInvalidation() ? VALUE1 :
null), remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
- private void checkNodeIsEmpty(Node node) {
- assertEquals(node.getFqn() + " should not have keys", 0,
node.getKeys().size());
+ private int getValidChildrenCount(Node node) {
+ int result = 0;
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- checkNodeIsEmpty((Node) it.next());
+ if (((Node) it.next()).isValid()) {
+ result++;
+ }
}
+ return result;
}
private void rollback() {
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java
===================================================================
---
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24
15:19:46 UTC (rev 14264)
+++
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24
16:01:02 UTC (rev 14265)
@@ -55,15 +55,5 @@
assertTrue("Using Optimistic locking", isUsingOptimisticLocking());
assertTrue("Synchronous mode", isSynchronous());
}
-
- // Known failures
-
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
}
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java
===================================================================
---
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java 2007-12-24
15:19:46 UTC (rev 14264)
+++
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java 2007-12-24
16:01:02 UTC (rev 14265)
@@ -54,15 +54,5 @@
assertTrue("Using Optimistic locking", isUsingOptimisticLocking());
assertTrue("Synchronous mode", isSynchronous());
}
-
- // Known failures
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
-
}
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
---
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-12-24
15:19:46 UTC (rev 14264)
+++
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-12-24
16:01:02 UTC (rev 14265)
@@ -24,6 +24,7 @@
package org.hibernate.test.cache.jbc2.entity;
import java.util.Iterator;
+import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -640,7 +641,7 @@
Node regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -649,7 +650,7 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -685,7 +686,7 @@
regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingInvalidation()) {
@@ -709,26 +710,27 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
if (isUsingInvalidation()) {
- // JBC seems broken: see
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=121408
- // FIXME replace with the following when JBCACHE-1199 and JBCACHE-1200 are
done:
- //assertFalse(regionRoot.isValid());
- checkNodeIsEmpty(regionRoot);
+ // Region root should have 1 child -- the one we added above
+ assertEquals(1, getValidChildrenCount(regionRoot));
}
else {
// Same assertion, just different assertion msg
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
}
assertTrue(regionRoot.isResident());
assertNull("local is clean", localAccessStrategy.get(KEY,
System.currentTimeMillis()));
- assertNull("remote is clean", remoteAccessStrategy.get(KEY,
System.currentTimeMillis()));
+ assertEquals("remote is correct", (isUsingInvalidation() ? VALUE1 :
null), remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
- private void checkNodeIsEmpty(Node node) {
- assertEquals(node.getFqn() + " should not have keys", 0,
node.getKeys().size());
+ private int getValidChildrenCount(Node node) {
+ int result = 0;
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- checkNodeIsEmpty((Node) it.next());
+ if (((Node) it.next()).isValid()) {
+ result++;
+ }
}
+ return result;
}
protected void rollback() {
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java
===================================================================
---
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24
15:19:46 UTC (rev 14264)
+++
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24
16:01:02 UTC (rev 14265)
@@ -55,13 +55,4 @@
assertTrue("Synchronous mode", isSynchronous());
}
- // Known failures
-
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
}
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java
===================================================================
---
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java 2007-12-24
15:19:46 UTC (rev 14264)
+++
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java 2007-12-24
16:01:02 UTC (rev 14265)
@@ -54,15 +54,5 @@
assertTrue("Using Optimistic locking", isUsingOptimisticLocking());
assertTrue("Synchronous mode", isSynchronous());
}
-
- // Known failures
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
-
}