jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gamba <holger.bre...@handelshof.de>
Subject Re: Own nodes with mix:lockable
Date Thu, 20 Aug 2009 07:58:04 GMT

Here is my Test. I'm using a Junit-Test and the rmi-server-jar of jackrabbit. 
But the result is the same. The nod I locked is still locked after the
session.logout():

@Test
public void testSessionScopedLock()
	throws Exception
{		
	Context context = new InitialContext();
	Repository repository;
	Session session;
		
	
	// Get Repository-Instance over RMI
	ClientAdapterFactory adapter = new ClientAdapterFactory();
        RemoteRepository rr = (RemoteRepository)
context.lookup("jnp://localhost:1099/jcrServer");
        repository = adapter.getRepository(rr);    
    
        // Get a session
        session = repository.login (new SimpleCredentials("portal",
"edv9052".toCharArray()), "default");
		
        // Get node to update ...
        Node rootNode   = session.getRootNode();
	Node nodeToLock = rootNode.getNode("HMG");
		
	// start node-locking
	nodeToLock.lock(true, true);

	// Ensure that folder does not exist
        if (!nodeToLock.hasNode("TEST")) {
		nodeToLock.addNode("TEST", "hmg:folder");
			
		// only with this snippet unlocking is performed
		// nodeToLock.unlock();
	}    
    
	// stop node-locking on logout(), because of  session-scoped lock ... I
thought ...
	session.save();
	session.logout();
	
        // LockExcpetion is thrown	
	assertFalse("Node is still logged, after session-logout",
nodeToLock.isLocked());
}
-- 
View this message in context: http://www.nabble.com/Own-nodes-with-mix%3Alockable-tp25056308p25057614.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message