jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@day.com>
Subject Re: Is a node still locked after session.move()?
Date Wed, 29 Sep 2010 08:18:28 GMT
hi dominik,

On Mon, Sep 27, 2010 at 7:42 PM, Dominik Klaholt <dokla@mail.upb.de> wrote:
> Hello,
>
> I have written a test-method that deals with moving a locked node and can be
> executed within XATest.java (
> http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java
> ) - it is attached below this email.
> The test-method locks a node, moves this node and then tests whether it is
> still locked. Checking the locked-status of the node by using its identifier
> yields that it is still locked. However, checking the locked-status of the
> node by using its new path yields that it is no longer locked.

this seems to be a bug.  could you please post a jira issue?

thanks
stefan

> Is this intended due to some reason I don't see right now? Is something
> wrong with my test-case?
>
> Thanks
> Dominik
>
>
> public void testLockedOrUnlocked() throws Exception {
>        Session session = null;
>        try {
>            session = getHelper().getSuperuserSession();
>
>            // prerequisite of test
>            if (session.getRootNode().hasNode("testParent")) {
>                session.getRootNode().getNode("testParent").remove();
>            }
>
>  session.getRootNode().addNode("testParent").addNode("testNode").addMixin(NodeType.MIX_LOCKABLE);
>            session.save();
>
>            // ids of the two nodes
>            String testParentId =
> session.getRootNode().getNode("testParent").getIdentifier();
>            String testNodeId =
> session.getNodeByIdentifier(testParentId).getNode("testNode").getIdentifier();
>
>            // lock 'testNode'
>
>  session.getWorkspace().getLockManager().lock(session.getNodeByIdentifier(testNodeId).getPath(),
> false,
>                    true, 0L, null);
>            // confirm lock
>            assertTrue(session.getWorkspace().getLockManager().isLocked(
>                    session.getNodeByIdentifier(testNodeId).getPath()));
>
>            // move 'testNode'
>            session.move(session.getNodeByIdentifier(testNodeId).getPath(),
> session.getRootNode().getPath()
>                    + "testNode");
>            session.save();
>            // is 'testNode' still locked?
>            // this call says, it's locked
>            assertTrue(session.getWorkspace().getLockManager().isLocked(
>                    session.getNodeByIdentifier(testNodeId).getPath()));
>            // this call says, it's not
>            assertTrue(session.getWorkspace().getLockManager().isLocked(
>                    session.getRootNode().getNode("testNode").getPath()));
>        } finally {
>            if (session != null) {
>                session.logout();
>            }
>        }
>    }
>

Mime
View raw message