Locking Scenarios

As part of my process of reviewing the specification, I have developed a 
set of lock usage scenarios which at least Yaron and I agree upon.  I'm 
posting them to the list so that people can use them to refine their 
understanding of the specification, possibly detect errors in the 
specification, and potentially use these scenarios as test cases for 
testing WebDAV servers.

Also, if anyone on the list has some interesting test cases in addition to 
these, please send them along.

First, some setup.

For the scenarios, I'll be using the following tree ("tree A"):

/A/
/A/X/
/A/X/foo.html
/A/Y/
/A/Y/bar.html

Another tree is also used in some examples ("tree B"):

/B/
/B/K/
/B/K/dav.html


The initial state of each scenario is tree A as listed above, with no locks 
on any members, and tree B as listed above, with no locks on any members. 
Expected outcomes of operations are in parenthesis.

LOCK INTERACTIONS:

1) Exclusive write lock tree A, depth infinity (success).  Exclusive write 
lock bar.html (fails). Shared write lock bar.html (fails).

2) Exclusive write lock bar.html (success).  Exclusive write lock tree A, 
depth infinity (fails, no locks granted at all)

ADD NEW MEMBER TO A LOCK

3) Exclusive write lock tree A, depth infinity (success). PUT /A/Y/blah.gif 
without Lock-Token header (fails).  PUT /A/Y/blah.gif with correct 
Lock-Token header (success, /A/Y/blah.gif is now part of the lock).

4) Exclusive write lock tree A, depth infinity (success).  COPY 
/B/K/dav.html to /A/X/dav.html without Lock-Token header (fails). COPY 
/B/K/dav.html to /A/X/dav.html with correct Lock-Token header (success, 
/A/X/dav.html is now part of the lock).

5) Exclusive write lock tree A, depth infinity (success).  MOVE 
/B/K/dav.html to /A/X/dav.html without Lock-Token header (fails). MOVE 
/B/K/dav.html to /A/X/dav.html with correct Lock-Token header (success, 
/A/X/dav.html is now part of the lock).

6) Exclusive write lock tree A, depth infinity (success).  MKCOL /A/Z/ 
without Lock-Token header (fails).  MKCOL /A/Z/ with correct Lock-Token 
header (success, and /A/Z/ is now part of the lock).

MOVE, COPY OUT OF THE LOCK

7) Exclusive write lock tree A, depth infinity (success).  COPY 
/A/X/foo.html to /B/K/foo.html without Lock-Token header (success -- 
doesn't modify state of /A/X/foo.html, and /B/K/foo.html is not locked).

8) Exclusive write lock tree A, depth infinity (success).  MOVE 
/A/X/foo.html to /B/K/foo.html without Lock-Token header (fails).  MOVE 
/A/X/foo.html to /B/K/foo.html with correct Lock-Token header (success, 
/B/K/foo.html is not locked).

9) Collection /F/ does not exist, i.e., is null.  Exclusive write lock tree 
A, depth infinity (success).  MOVE /A/ with depth infinity to /F/, with no 
Lock-Token header (fails). MOVE /A/ with depth infinity to /F/ with Lock 
Token for tree A lock (success, collection at /F/ is not locked.)

MOVE, COPY BETWEEN TWO LOCKED COLLECTIONS

10) Exclusive write lock tree A, depth infinity (success).  Exclusive write 
lock tree B, depth infinity (success).  COPY /A/X/foo.html to 
/B/K/foo.html, with no Lock-Token header (fails). COPY /A/X/foo.html to 
/B/K/foo.html with Lock-Token header with lock token for tree A lock, but 
not tree B lock (fails).  COPY /A/X/foo.html to /B/K/foo.html with 
Lock-Token header with lock token for tree B lock but not tree A lock 
(success, /B/K/foo.html now belongs to tree B lock).

11) Exclusive write lock tree A, depth infinity (success).  Exclusive write 
lock tree B, depth infinity (success).  MOVE /A/X/foo.html to 
/B/K/foo.html, with no Lock-Token header (fails). MOVE /A/X/foo.html to 
/B/K/foo.html with Lock-Token header with lock token for tree A lock, but 
not tree B lock (fails).  MOVE /A/X/foo.html to /B/K/foo.html with 
Lock-Token header with lock token for tree B lock but not tree A lock 
(fails).  MOVE /A/X/foo.html to /B/K/foo.html with lock token for tree A 
and tree B (success, /B/K/foo.html now belongs to tree B lock).

12) Exclusive write lock tree A, depth infinity (success).  Exclusive write 
lock tree B, depth infinity (success).  MOVE /B/, depth infinity, to /A/G/, 
with no Lock Token (fails).  MOVE /B/, depth infinity, to /A/G/, with Lock 
Token for tree A lock and tree B lock (success, subtree /A/G/ now belongs 
to tree A lock).

13) Exclusive write lock tree A, depth infinity (success).  Exclusive write 
lock tree B, depth infinity (success).  COPY /B/, depth infinity, to /A/G/, 
with no Lock Token (fails).  COPY /B/, depth infinity, to /A/G/, with Lock 
Token for tree A lock (success, subtree /A/G/ now belongs to tree A lock).

- Jim

Received on Thursday, 19 February 1998 13:16:33 UTC