Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 50386 invoked from network); 5 Aug 2010 08:45:06 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Aug 2010 08:45:06 -0000 Received: (qmail 72214 invoked by uid 500); 5 Aug 2010 08:45:06 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 72120 invoked by uid 500); 5 Aug 2010 08:45:04 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 72113 invoked by uid 99); 5 Aug 2010 08:45:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Aug 2010 08:45:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Aug 2010 08:45:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B6BDE23888FE; Thu, 5 Aug 2010 08:43:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r982505 - in /jackrabbit/branches/2.1: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java Date: Thu, 05 Aug 2010 08:43:46 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100805084346.B6BDE23888FE@eris.apache.org> Author: jukka Date: Thu Aug 5 08:43:46 2010 New Revision: 982505 URL: http://svn.apache.org/viewvc?rev=982505&view=rev Log: 2.1: Merged revision 955852 (JCR-2341) Modified: jackrabbit/branches/2.1/ (props changed) jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java Propchange: jackrabbit/branches/2.1/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Aug 5 08:43:46 2010 @@ -2,4 +2,4 @@ /jackrabbit/sandbox/JCR-1456:774917-886178 /jackrabbit/sandbox/JCR-2170:812417-816332 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863 -/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646,933694,934405,934412,934849,935557,936668,938099,955222,955229,955307,961487,961626,964362,965539 +/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646,933694,934405,934412,934849,935557,936668,938099,955222,955229,955307,955852,961487,961626,964362,965539 Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=982505&r1=982504&r2=982505&view=diff ============================================================================== --- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original) +++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Thu Aug 5 08:43:46 2010 @@ -314,7 +314,7 @@ public class NodeImpl extends ItemImpl i // make transient (copy-on-write) NodeState transientState = stateMgr.createTransientNodeState( - data.getNodeState(), ItemState.STATUS_EXISTING_MODIFIED); + (NodeState) stateMgr.getItemState(getId()), ItemState.STATUS_EXISTING_MODIFIED); // replace persistent with transient state data.setState(transientState); } catch (ItemStateException ise) { Modified: jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java?rev=982505&r1=982504&r2=982505&view=diff ============================================================================== --- jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java (original) +++ jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java Thu Aug 5 08:43:46 2010 @@ -1874,6 +1874,61 @@ public class XATest extends AbstractJCRT other.save(); utx.commit(); } + + /** + * Tests if it is possible to add-lock a node and unlock-remove it with + * a shared session in different transactions + * (see JCR-2341) + * @throws Exception + */ + public void testAddLockTokenRemoveNode2() throws Exception { + // create new node and lock it + UserTransaction utx = new UserTransactionImpl(superuser); + utx.begin(); + + // add node that is both lockable and referenceable, save + Node rootNode = superuser.getRootNode(); + Node n = rootNode.addNode(nodeName1); + n.addMixin(mixLockable); + n.addMixin(mixReferenceable); + rootNode.save(); + + String uuid = n.getUUID(); + + // lock this new node + Lock lock = n.lock(true, false); + String lockToken = lock.getLockToken(); + + // commit + utx.commit(); + + + // refresh Lock Info + lock = n.getLock(); + + // start new Transaction and try to add lock token unlock the node and then remove it + utx = new UserTransactionImpl(superuser); + utx.begin(); + + Node otherNode = superuser.getNodeByUUID(uuid); + assertTrue("Node not locked", otherNode.isLocked()); + // add lock token + superuser.addLockToken(lockToken); + + // refresh Lock Info + lock = otherNode.getLock(); + + // assert: session must hold lock token + assertTrue("session must hold lock token", containsLockToken(superuser, lockToken)); + + otherNode.unlock(); + + assertFalse("Node is locked", otherNode.isLocked()); + + otherNode.remove(); + superuser.save(); + utx.commit(); + } /** * Test setting the same property multiple times. Exposes an issue where