Author: mircea.markus
Date: 2008-08-27 09:56:58 -0400 (Wed, 27 Aug 2008)
New Revision: 6627
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java
Log:
fixed test
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-08-27 13:21:43
UTC (rev 6626)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-08-27 13:56:58
UTC (rev 6627)
@@ -400,9 +400,24 @@
public int getNumberOfNodes()
{
- return numNodes(root) - 1;
+ if (!usingMvcc) return numNodes(root) - 1;
+ return numNodesMvcc(rootInternal) - 1;
}
+ private int numNodesMvcc(InternalNode node)
+ {
+ int count = 1; //for 'node'
+ if (node != null)
+ {
+ Set<InternalNode> children = node.getChildren();
+ for (InternalNode child : children)
+ {
+ count += numNodesMvcc((InternalNode) child);
+ }
+ }
+ return count;
+ }
+
private int numNodes(NodeSPI n)
{
int count = 1;// for n
Modified: core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-08-27
13:21:43 UTC (rev 6626)
+++ core/trunk/src/test/java/org/jboss/cache/factories/LifeCycleTest.java 2008-08-27
13:56:58 UTC (rev 6627)
@@ -74,9 +74,11 @@
assertEquals(0, c[0].getNumberOfLocksHeld());
}
- public void testLocalRestartWithTransactions() throws Exception
+ public void testLocalRestartWithTransactionsPessimistic() throws Exception
{
- createAndRegisterCache(Configuration.CacheMode.LOCAL, true);
+ createAndRegisterCache(Configuration.CacheMode.LOCAL, false);
+
c[0].getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
+ c[0].start();
TransactionManager tm = beginTransaction();