Hi,

it's not a bug, it's my mistake. I had somehow managed to mess up whatever memory the Jackrabbit-JUnit-Tests use (nodes with same name...).
Sorry for bothering.

Dominik

Am 29.09.2010 10:18, schrieb Stefan Guggisberg:
hi dominik,

On Mon, Sep 27, 2010 at 7:42 PM, Dominik Klaholt<[email protected]>  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();
            }
        }
    }

Reply via email to