[jbosscache-commits] JBoss Cache SVN: r4579 - in core/trunk/src: test/java/org/jboss/cache/api and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Oct 8 19:15:49 EDT 2007
Author: mircea.markus
Date: 2007-10-08 19:15:49 -0400 (Mon, 08 Oct 2007)
New Revision: 4579
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
Log:
solved following issue:
cache.move(sameNode, sameNode) removes sameNode
utest added
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-10-08 18:12:07 UTC (rev 4578)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-10-08 23:15:49 UTC (rev 4579)
@@ -211,8 +211,13 @@
{
lockManager.getLock(n).releaseAll(Thread.currentThread());
}
- ((CacheImpl) cache).realRemove(fqn, true);
-
+ //CacheIml._move internally removes the source node. 'if clause' solve the scenario when a node is
+ // moved in the same place, i.e. it will be removed from the source - which is also destination - so it ends
+ // up being removed for good
+ if (!(MethodDeclarations.moveMethodLocal_id == m.getMethodId()))
+ {
+ ((CacheImpl) cache).realRemove(fqn, true);
+ }
}
else
if (m.getMethodId() == MethodDeclarations.commitMethod_id || isOnePhaseCommitPrepareMehod(m) || m.getMethodId() == MethodDeclarations.rollbackMethod_id)
Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2007-10-08 18:12:07 UTC (rev 4578)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeMoveAPITest.java 2007-10-08 23:15:49 UTC (rev 4579)
@@ -484,7 +484,7 @@
}
- @Test(groups = {"functional"}, enabled=false)
+ @Test(groups = {"functional"})
public void testConcurrency() throws InterruptedException
{
// TODO: investigate intermittent failure when in optimistic mode.
@@ -601,6 +601,18 @@
assertFalse("Should have only found y once", found_y_again);
}
+ @Test(groups = {"functional"})
+ public void testMoveInSamePlace()
+ {
+ final Fqn<String> FQN_X = Fqn.fromString("/x");
+ // set up the initial structure.
+ Node aNode = rootNode.addChild(A);
+ Node xNode = aNode.addChild(FQN_X);
+ assertEquals(aNode.getChildren().size(), 1);
+ cache.move(xNode.getFqn(), aNode.getFqn());
+ assertEquals(aNode.getChildren().size(), 1);
+ }
+
protected CacheLoaderConfig getSingleCacheLoaderConfig(boolean passivation, String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared, boolean purgeOnStartup) throws Exception
{
String xml = "<config>\n" +
More information about the jbosscache-commits
mailing list