Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 67827 invoked from network); 6 Nov 2008 11:11:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2008 11:11:15 -0000 Received: (qmail 18041 invoked by uid 500); 6 Nov 2008 11:11:22 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 18017 invoked by uid 500); 6 Nov 2008 11:11:21 -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 18004 invoked by uid 99); 6 Nov 2008 11:11:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2008 03:11:21 -0800 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, 06 Nov 2008 11:10:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C1BAB238889E; Thu, 6 Nov 2008 03:10:53 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r711841 - in /jackrabbit/trunk: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/ jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/ Date: Thu, 06 Nov 2008 11:10:45 -0000 To: commits@jackrabbit.apache.org From: angela@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081106111053.C1BAB238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: angela Date: Thu Nov 6 03:10:39 2008 New Revision: 711841 URL: http://svn.apache.org/viewvc?rev=711841&view=rev Log: JCR-1590: JSR 283 Locking (work in progress) - add extended/new interfaces to api - add comment and dummy methods to existing LockImpl Added: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java (with props) jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java (with props) jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java (with props) jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java (with props) jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java (with props) jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java (with props) jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java (with props) Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java Added: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java (added) +++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +/** + * This interface holds extensions made in JCR 2.0 while work + * is in progress implementing JCR 2.0. + * + * @since JCR 2.0 + */ +public interface Lock extends javax.jcr.lock.Lock { + + /** + * Returns the seconds remaining until this locks times out + * ({@link Long#MAX_VALUE} if the timeout is unknown or infinite). + * @return a long + * @since JCR 2.0 + */ + public long getSecondsRemaining(); + + /** + * Returns true if the current session is the owner of this + * lock, either because it is session-scoped and bound to this session or + * open-scoped and this session currently holds the token for this lock. + * Returns false otherwise. + * + * @return a boolean. + * @since JCR 2.0 + */ + public boolean isLockOwningSession(); + +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/Lock.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java (added) +++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,256 @@ +/* + * $Id$ + * + * Copyright 1997-2005 Day Management AG + * Barfuesserplatz 6, 4001 Basel, Switzerland + * All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Day Management AG, ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Day. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +import javax.jcr.lock.LockException; +import javax.jcr.RepositoryException; +import javax.jcr.UnsupportedRepositoryOperationException; +import javax.jcr.AccessDeniedException; +import javax.jcr.InvalidItemStateException; + +/** + * This interface holds extensions made in JCR 2.0 while work + * is in progress implementing JCR 2.0. It encapsulates methods for the + * management of locks. + * + * @since JCR 2.0 + */ + +public interface LockManager{ + + /** + * Adds the specified lock token to the current Session. + * Holding a lock token makes the current Session the owner + * of the lock specified by that particular lock token. + *

+ * A LockException is thrown if the specified lock token is + * already held by another Session and the implementation + * does not support simultaneous ownership of open-scoped locks. + * @param lockToken a lock token (a string). + * @throws LockException if the specified lock token is already held by + * another Session and the implementation + * does not support simultaneous ownership of open-scoped + * locks. + * @throws RepositoryException if another error occurs. + */ + public void addLockToken(String lockToken) throws LockException, RepositoryException; + + /** + * Returns the Lock object that applies to the node at the + * specified absPath. This may be either a lock on that node + * itself or a deep lock on a node above that node. + *

+ * If the node is not locked (no lock applies to this node), a + * LockException is thrown. + *

+ * If the current session does not have sufficient privileges to get the + * lock, an AccessDeniedException is thrown. + *

+ * An UnsupportedRepositoryOperationException is thrown if + * this implementation does not support locking. + *

+ * A RepositoryException is thrown if another error occurs. + * + * @param absPath absolute path of node for which to obtain the lock + * @return The applicable Lock object. + * @throws UnsupportedRepositoryOperationException if this implementation does not support locking. + * @throws LockException if no lock applies to this node. + * @throws AccessDeniedException if the current session does not have permission to get the lock. + * @throws RepositoryException if another error occurs. + */ + public Lock getLock(String absPath) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, RepositoryException; + + /** + * Returns an array containing all lock tokens currently held by the + * current Session. Note that any such tokens will represent + * open-scoped locks, since session-scoped locks do not have tokens. + * + * @return an array of lock tokens (strings) + * @throws RepositoryException if an error occurs. + */ + public String[] getLockTokens() throws RepositoryException; + + /** + * Returns true if the node at absPath holds a + * lock; otherwise returns false. To hold a lock means + * that this node has actually had a lock placed on it specifically, as + * opposed to just having a lock apply to it due to a deep lock held + * by a node above. + * + * @param absPath absolute path of node + * @return a boolean. + * @throws RepositoryException if an error occurs. + */ + public boolean holdsLock(String absPath) throws RepositoryException; + + /** + *

+ * Places a lock on the node at absPath. + * If successful, the node is said to hold the lock. + *

+ *

+ * If isDeep is true then the lock + * applies to the specified node and all its descendant nodes; + * if false, the lock applies only to the specified node. + * On a successful lock, the jcr:isDeep property of the + * locked node is set to this value. + *

+ *

+ * If isSessionScoped is true then this lock + * will expire upon the expiration of the current session (either + * through an automatic or explicit Session.logout); + * if false, this lock does not expire until it is explicitly unlocked, + * it times out, or it is automatically unlocked due to a + * implementation-specific limitation. + *

+ *

+ * The timeout parameter specifies the number of seconds until the lock times out + * (if it is not refreshed with Lock.refresh in the meantime). + * An implementation may use this information as a hint or ignore it altogether. + * Clients can discover the actual timeout by inspecting the returned Lock + * object. + *

+ *

+ * The ownerInfo parameter can be used to pass a string holding + * owner information relevant to the client. An implementation may either use + * or ignore this parameter. If it uses the parameter it must set the + * jcr:lockOwner property of the locked node to this value and + * return this value on Lock.getLockOwner. If it ignores this + * parameter the jcr:lockOwner property (and the value returned + * by Lock.getLockOwner) is set to either the value returned by + * Session.getUserID of the owning session or an + * implementation-specific string identifying the owner. + *

+ *

+ * The method returns a Lock object representing the new lock. + * If the lock is open-scoped the returned lock will include a lock token. + * The lock token is also automatically added to the set of lock tokens held + * by the current session. + *

+ *

+ * The addition or change of the properties jcr:isDeep + * and jcr:lockOwner are persisted immediately; there is no + * need to call save. + *

+ *

+ * It is possible to lock a node even if it is checked-in. + *

+ *

+ * If this node is not of mixin node type mix:lockable then an + * LockException is thrown. + *

+ * If this node is already locked (either because it holds a lock or a + * lock above it applies to it), a LockException is thrown. + *

+ * If isDeep is true and a descendant node of + * this node already holds a lock, then a LockException is + * thrown. + *

+ * If this node does not have a persistent state (has never been saved + * or otherwise persisted), a LockException is thrown. + *

+ * If the current session does not have sufficient privileges to place the + * lock, an AccessDeniedException is thrown. + *

+ * An UnsupportedRepositoryOperationException is thrown if + * this implementation does not support locking. + *

+ * An InvalidItemStateException is thrown if this node has pending unsaved + * changes. + *

+ * A RepositoryException is thrown if another error occurs. + * + * @param absPath absolute path of node to be locked + * @param isDeep if true this lock will apply to this node and all its descendants; if + * false, it applies only to this node. + * @param isSessionScoped if true, this lock expires with the current session; if false it + * expires when explicitly or automatically unlocked for some other reason. + * @param timeoutHint desired lock timeout in seconds (servers are free to + * ignore this value); specify {@link Long#MAX_VALUE} for no timeout. + * @param ownerInfo a string containing owner information + * supplied by the client; servers are free to ignore this value. + * @return A Lock object containing a lock token. + * @throws UnsupportedRepositoryOperationException if this implementation does not support locking. + * @throws LockException if this node is not mix:lockable or this node is already locked or + * isDeep is true and a descendant node of this node already holds a lock. + * @throws AccessDeniedException if this session does not have permission to lock this node. + * @throws InvalidItemStateException if this node has pending unsaved changes. + * @throws RepositoryException if another error occurs. + */ + public Lock lock(String absPath, boolean isDeep, boolean isSessionScoped, + long timeoutHint, String ownerInfo) throws RepositoryException; + + /** + * Returns true if the node at absPath is locked + * either as a result of a lock held by that node or by a deep + * lock on a node above that node; otherwise returns false. + * + * @param absPath absolute path of node + * @return a boolean. + * @throws RepositoryException if an error occurs. + */ + public boolean isLocked(String absPath) throws RepositoryException; + + /** + * Removes the specified lock token from this Session. + *

+ * A LockException is thrown if the current Session + * does not hold the specified lock token. + *

+ * A RepositoryException is thrown if another error occurs. + * + * @param lockToken a lock token (a string) + * @throws LockException if the current Session does not hold + * the specified lock token. + * @throws RepositoryException if another error occurs. + */ + public void removeLockToken(String lockToken) throws LockException, RepositoryException; + + /** + * Removes the lock on the node at absPath. Also removes + * the properties jcr:lockOwner and jcr:lockIsDeep + * from that node. As well, the corresponding lock token is removed from + * the set of lock tokens held by the current Session. + *

+ * If the node does not currently hold a lock or holds a lock for which + * this Session is not the owner, then a + * LockException is thrown. Note however that the system + * may give permission to a non-owning session to unlock a lock. Typically + * such "lock-superuser" capability is intended to facilitate + * administrational clean-up of orphaned open-scoped locks. + *

+ * Note that it is possible to unlock a node even if it is checked-in (the + * lock-related properties will be changed despite the checked-in status). + *

+ * If the current session does not have sufficient privileges to remove the + * lock, an AccessDeniedException is thrown. + *

+ * An InvalidItemStateException is thrown if this node has + * pending unsaved changes. + *

+ * An UnsupportedRepositoryOperationException is thrown if + * this implementation does not support locking. + *

+ * A RepositoryException is thrown if another error occurs. + * + * @param absPath absolute path of node to be unlocked + * @throws UnsupportedRepositoryOperationException if this implementation does not support locking. + * @throws LockException if this node does not currently hold a lock or holds a lock for which this Session does not have the correct lock token + * @throws AccessDeniedException if the current session does not have permission to unlock this node. + * @throws InvalidItemStateException if this node has pending unsaved changes. + * @throws RepositoryException if another error occurs. + */ + public void unlock(String absPath) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException; +} + Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/lock/LockManager.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java?rev=711841&r1=711840&r2=711841&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java Thu Nov 6 03:10:39 2008 @@ -25,7 +25,7 @@ * Implementation of a Lock that gets returned to clients asking * for a lock. */ -class LockImpl implements Lock { +class LockImpl implements org.apache.jackrabbit.api.jsr283.lock.Lock { /** * Lock info containing latest information @@ -54,6 +54,8 @@ * {@inheritDoc} */ public String getLockOwner() { + // TODO: TOBEFIXED for 2.0 + // TODO - respect ownerInfo supplied by the client -> see LockManager#lock return info.lockOwner; } @@ -75,6 +77,14 @@ * {@inheritDoc} */ public String getLockToken() { + // TODO: TOBEFIXED for 2.0 + // TODO - token must not be exposed for session-scoped locks (-> adjust tests and derived projects first) + // TODO - openScoped tokens *may* be exposed even if session is not lock holder + /* + if (info.isSessionScoped()) { + return null; + } + */ try { return info.getLockToken(node.getSession()); } catch (RepositoryException e) { @@ -108,18 +118,27 @@ if (getLockToken() == null) { throw new LockException("Session does not hold lock."); } + // TODO: TOBEFIXED for 2.0 + // TODO - add refresh if timeout is supported -> see #getSecondsRemaining // since a lock has no expiration date no other action is required } //--------------------------------------------------< new JSR 283 methods > + /** - * Returns true if the current session is the owner of this - * lock, either because it is session-scoped and bound to this session or - * open-scoped and this session currently holds the token for this lock. - * Returns false otherwise. + * Always returns {@link Long#MAX_VALUE}. * - * @return a boolean. - * @since JCR 2.0 + * @return Always returns {@link Long#MAX_VALUE}. + * @see org.apache.jackrabbit.api.jsr283.lock.Lock#getSecondsRemaining() + */ + public long getSecondsRemaining() { + // TODO: TOBEFIXED for 2.0 + // TODO - add support for timeout specified by the API user -> LockManager#lock + return Long.MAX_VALUE; + } + + /** + * @see org.apache.jackrabbit.api.jsr283.lock.Lock#isLockOwningSession() */ public boolean isLockOwningSession() { try { Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java (added) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.test.AbstractJCRTest; +import org.apache.jackrabbit.test.NotExecutableException; + +import javax.jcr.Node; +import javax.jcr.Session; +import javax.jcr.RepositoryException; +import javax.jcr.lock.*; + +/** AbstractLockTest... */ +public abstract class AbstractLockTest extends AbstractJCRTest { + + private static Logger log = LoggerFactory.getLogger(AbstractLockTest.class); + + protected Node lockedNode; + protected Node childNode; + protected Lock lock; + + protected abstract boolean isSessionScoped(); + protected abstract boolean isDeep(); + + protected void setUp() throws Exception { + super.setUp(); + + lockedNode = testRootNode.addNode(nodeName1, testNodeType); + lockedNode.addMixin(mixLockable); + childNode = lockedNode.addNode(nodeName2, testNodeType); + testRootNode.save(); + + // TODO: remove cast + // TODO: replace by LockManager#lock call + lock = (Lock) lockedNode.lock(isDeep(), isSessionScoped()); + } + + protected void tearDown() throws Exception { + // make sure all locks are removed + try { + lockedNode.unlock(); + } catch (RepositoryException e) { + // ignore + } + super.tearDown(); + } + + /** + * + */ + public void testIsDeep() { + assertEquals("Lock.isDeep must be consistent with lock call.", isDeep(), lock.isDeep()); + } + + /** + * + */ + public void testIsSessionScoped() { + assertEquals("Lock.isSessionScoped must be consistent with lock call.", isSessionScoped(), lock.isSessionScoped()); + } + + /** + * + * @throws RepositoryException + */ + public void testIsLockOwningSession() throws RepositoryException { + assertTrue("Session must be lock owner", lock.isLockOwningSession()); + assertTrue("Session must be lock owner", ((Lock) lockedNode.getLock()).isLockOwningSession()); + + Session otherSession = helper.getReadOnlySession(); + try { + Lock lck = (Lock) ((Node) otherSession.getItem(lockedNode.getPath())).getLock(); + assertFalse("Session must not be lock owner", lck.isLockOwningSession()); + } finally { + otherSession.logout(); + } + } + + /** + * + */ + public void testGetSecondsRemaining() { + assertTrue("Seconds remaining must be a positive long or 0.", lock.getSecondsRemaining() >= 0); + } +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/AbstractLockTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java (added) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.test.AbstractJCRTest; +import org.apache.jackrabbit.test.NotExecutableException; + +/** LockManagerTest... */ +public class LockManagerTest extends AbstractJCRTest { + + private static Logger log = LoggerFactory.getLogger(LockManagerTest.class); + + // TODO - timeout hint + // TODO - ownerInfo hint + +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/LockManagerTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java (added) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.test.AbstractJCRTest; +import org.apache.jackrabbit.test.NotExecutableException; + +/** OpenScopedLockTest... */ +public class OpenScopedLockTest extends AbstractLockTest { + + private static Logger log = LoggerFactory.getLogger(OpenScopedLockTest.class); + + protected boolean isSessionScoped() { + return false; + } + + protected boolean isDeep() { + return false; + } + + /** + * + */ + public void testGetLockToken() { + assertNotNull("A open scoped lock must expose the token to the lock holder.", lock.getLockToken()); + } +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/OpenScopedLockTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java (added) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.test.AbstractJCRTest; +import org.apache.jackrabbit.test.NotExecutableException; + +import javax.jcr.lock.LockException; +import javax.jcr.AccessDeniedException; +import javax.jcr.UnsupportedRepositoryOperationException; +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.Node; + +/** SessionScopedLockTest... */ +public class SessionScopedLockTest extends AbstractLockTest { + + private static Logger log = LoggerFactory.getLogger(SessionScopedLockTest.class); + + protected boolean isSessionScoped() { + return true; + } + + protected boolean isDeep() { + return false; + } + + /** + * + */ + public void testGetLockToken() { + assertNull("A session scoped lock may never expose the token.", lock.getLockToken()); + } + +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/SessionScopedLockTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java?rev=711841&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java (added) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java Thu Nov 6 03:10:39 2008 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.api.jsr283.lock; + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** TestAll... */ +public class TestAll extends TestCase { + + private static Logger log = LoggerFactory.getLogger(TestAll.class); + + public static Test suite() { + TestSuite suite = new TestSuite("org.apache.jackrabbit.api.jsr283.lock tests"); + + /* + // TODO uncomment as soon as 283 lock impl is completed. + suite.addTestSuite(LockManagerTest.class); + suite.addTestSuite(OpenScopedLockTest.class); + suite.addTestSuite(SessionScopedLockTest.class); + */ + + return suite; + } +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/lock/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url