1 <?xml version="1.0" encoding="UTF-8"?>
4 <!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->
5 <auth ID="admin@core.collectionspace.org">YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I=</auth>
8 <!-- This tests the UpdateObjectLocationOnMoveEventListener -->
10 <testGroup ID="updateObjectLocationOnMoveEventListener" autoDeletePOSTS="true">
12 <test ID="createCollectionObject1">
14 <uri>/cspace-services/collectionobjects</uri>
15 <filename>listener/collectionobject.xml</filename>
16 <expectedCodes>201</expectedCodes>
19 <test ID="createCollectionObject2">
21 <uri>/cspace-services/collectionobjects</uri>
22 <filename>listener/collectionobject.xml</filename>
23 <expectedCodes>201</expectedCodes>
26 <test ID="createMovement1">
28 <uri>/cspace-services/movements</uri>
29 <filename>listener/movement.xml</filename>
31 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Seattle1358215545509)'Seattle, WA, USA'</var>
32 <var ID="locationDate">1650-01-01</var>
34 <expectedCodes>201</expectedCodes>
37 <test ID="createMovement2">
39 <uri>/cspace-services/movements</uri>
40 <filename>listener/movement.xml</filename>
42 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Portland1358215545512)'Portland, OR, USA'</var>
43 <var ID="locationDate">1700-01-01</var>
45 <expectedCodes>201</expectedCodes>
48 <test ID="createMovement3">
50 <uri>/cspace-services/movements</uri>
51 <filename>listener/movement.xml</filename>
53 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Victoria1358215545515)'Victoria, BC, Canada'</var>
54 <var ID="locationDate">1800-01-01</var>
56 <expectedCodes>201</expectedCodes>
59 <test ID="createMovement4">
61 <uri>/cspace-services/movements</uri>
62 <filename>listener/movement.xml</filename>
64 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Vancouver1358215545518)'Vancouver, BC, Canada'</var>
65 <var ID="locationDate">1900-01-01</var>
67 <expectedCodes>201</expectedCodes>
70 <test ID="createMovement5">
72 <uri>/cspace-services/movements</uri>
73 <filename>listener/movement.xml</filename>
75 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Olympia1358215545521)'Olympia, WA, USA'</var>
76 <var ID="locationDate">2000-01-01</var>
78 <expectedCodes>201</expectedCodes>
81 <test ID="relateCollectionObject1ToMovement1">
83 <uri>/cspace-services/relations</uri>
84 <filename>listener/relation.xml</filename>
86 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
87 <var ID="subjectDocumentType">CollectionObject</var>
88 <var ID="objectCsid">${createMovement1.CSID}</var>
89 <var ID="objectDocumentType">Movement</var>
91 <expectedCodes>201</expectedCodes>
94 <test ID="relateCollectionObject2ToMovement1">
96 <uri>/cspace-services/relations</uri>
97 <filename>listener/relation.xml</filename>
99 <var ID="subjectCsid">${createCollectionObject2.CSID}</var>
100 <var ID="subjectDocumentType">CollectionObject</var>
101 <var ID="objectCsid">${createMovement1.CSID}</var>
102 <var ID="objectDocumentType">Movement</var>
104 <expectedCodes>201</expectedCodes>
107 <!-- Computed current location doesn't appear to be updated -->
108 <!-- merely upon a Relation being created; some intervening action -->
109 <!-- invoking the listener must also occur. This appears to be -->
110 <!-- because newly-created relations aren't being returned in results -->
111 <!-- from the first query - which returns a list of Relation document -->
112 <!-- models - that is made in AbstractUpdateObjectLocationValues.handleEvent() -->
113 <test ID="updateMovement1">
115 <uri>/cspace-services/movements/${createMovement1.CSID}</uri>
116 <filename>listener/movement.xml</filename>
118 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Seattle1358215545509)'Seattle, WA, USA'</var>
119 <var ID="locationDate">1650-02-01</var>
121 <expectedCodes>200</expectedCodes>
124 <test ID="readCollectionObject1AfterMovement1Update">
126 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
128 <expected level="ADDOK" />
129 <filename>listener/res/collectionobject.res.xml</filename>
131 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
134 <expectedCodes>200</expectedCodes>
137 <test ID="readCollectionObject2AfterMovement1Update">
139 <uri>/cspace-services/collectionobjects/${createCollectionObject2.CSID}</uri>
141 <expected level="ADDOK" />
142 <filename>listener/res/collectionobject.res.xml</filename>
144 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
147 <expectedCodes>200</expectedCodes>
150 <test ID="relateMovement2ToCollectionObject1">
151 <method>POST</method>
152 <uri>/cspace-services/relations</uri>
153 <filename>listener/relation.xml</filename>
155 <var ID="subjectCsid">${createMovement2.CSID}</var>
156 <var ID="subjectDocumentType">Movement</var>
157 <var ID="objectCsid">${createCollectionObject1.CSID}</var>
158 <var ID="objectDocumentType">CollectionObject</var>
160 <expectedCodes>201</expectedCodes>
163 <test ID="updateMovement2">
165 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
166 <filename>listener/movement.xml</filename>
168 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Portland1358215545512)'Portland, OR, USA'</var>
169 <var ID="locationDate">1700-02-01</var>
171 <expectedCodes>200</expectedCodes>
174 <test ID="readCollectionObject1AfterMovement2Update">
176 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
178 <expected level="ADDOK" />
179 <filename>listener/res/collectionobject.res.xml</filename>
181 <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>
184 <expectedCodes>200</expectedCodes>
187 <test ID="relateMovement3ToCollectionObject1">
188 <method>POST</method>
189 <uri>/cspace-services/relations</uri>
190 <filename>listener/relation.xml</filename>
192 <var ID="subjectCsid">${createMovement3.CSID}</var>
193 <var ID="subjectDocumentType">Movement</var>
194 <var ID="objectCsid">${createCollectionObject1.CSID}</var>
195 <var ID="objectDocumentType">CollectionObject</var>
197 <expectedCodes>201</expectedCodes>
200 <test ID="updateMovement3">
202 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
203 <filename>listener/movement.xml</filename>
205 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Victoria1358215545515)'Victoria, BC, Canada'</var>
206 <var ID="locationDate">1800-02-01</var>
208 <expectedCodes>200</expectedCodes>
211 <test ID="readCollectionObject1AfterMovement3Update">
213 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
215 <expected level="ADDOK" />
216 <filename>listener/res/collectionobject.res.xml</filename>
218 <var ID="computedCurrentLocationValue">${createMovement3.currentLocation}</var>
221 <expectedCodes>200</expectedCodes>
224 <test ID="relateCollectionObject1ToMovement4">
225 <method>POST</method>
226 <uri>/cspace-services/relations</uri>
227 <filename>listener/relation.xml</filename>
229 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
230 <var ID="subjectDocumentType">CollectionObject</var>
231 <var ID="objectCsid">${createMovement4.CSID}</var>
232 <var ID="objectDocumentType">Movement</var>
234 <expectedCodes>201</expectedCodes>
237 <test ID="relateCollectionObject1ToMovement5">
238 <method>POST</method>
239 <uri>/cspace-services/relations</uri>
240 <filename>listener/relation.xml</filename>
242 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
243 <var ID="subjectDocumentType">CollectionObject</var>
244 <var ID="objectCsid">${createMovement5.CSID}</var>
245 <var ID="objectDocumentType">Movement</var>
247 <expectedCodes>201</expectedCodes>
250 <test ID="updateMovement5">
252 <uri>/cspace-services/movements/${createMovement5.CSID}</uri>
253 <filename>listener/movement.xml</filename>
255 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Olympia1358215545521)'Olympia, WA, USA'</var>
256 <var ID="locationDate">2000-02-02</var>
258 <expectedCodes>200</expectedCodes>
261 <test ID="readCollectionObject1AfterMovement5Update">
263 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
265 <expected level="ADDOK" />
266 <filename>listener/res/collectionobject.res.xml</filename>
268 <var ID="computedCurrentLocationValue">${createMovement5.currentLocation}</var>
271 <expectedCodes>200</expectedCodes>
274 <test ID="softDeleteRelationBetweenCollectionObject1AndMovement5">
276 <uri>/cspace-services/relations/${relateCollectionObject1ToMovement5.CSID}/workflow/delete</uri>
277 <expectedCodes>200</expectedCodes>
278 <filename>relation/res/workflowState.res.xml</filename>
280 <var ID="workflowState">deleted</var>
284 <test ID="updateMovement4">
286 <uri>/cspace-services/movements/${createMovement4.CSID}</uri>
287 <filename>listener/movement.xml</filename>
289 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Vancouver1358215545518)'Vancouver, BC, Canada'</var>
290 <var ID="locationDate">1900-02-01</var>
292 <expectedCodes>200</expectedCodes>
295 <test ID="readCollectionObject1AfterRelationSoftDelete">
297 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
299 <expected level="ADDOK" />
300 <filename>listener/res/collectionobject.res.xml</filename>
302 <var ID="computedCurrentLocationValue">${createMovement4.currentLocation}</var>
305 <expectedCodes>200</expectedCodes>
308 <test ID="softDeleteMovement4">
310 <uri>/cspace-services/movements/${createMovement4.CSID}/workflow/delete</uri>
311 <expectedCodes>200</expectedCodes>
312 <!-- XmlReplay appears to require a filename on PUT. -->
313 <!-- If not present, throws "java.io.FileNotFoundException: File '' does not exist" -->
314 <!-- The contents of that file, sent in the PUT payload, will be ignored by the services. -->
315 <!-- Note that the filename below is in a different module than -->
316 <!-- the present XmlReplay control file. -->
317 <filename>relation/res/workflowState.res.xml</filename>
319 <var ID="workflowState">deleted</var>
323 <test ID="readCollectionObject1AfterMovement4SoftDelete">
325 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
327 <expected level="ADDOK" />
328 <filename>listener/res/collectionobject.res.xml</filename>
330 <var ID="computedCurrentLocationValue">${createMovement3.currentLocation}</var>
333 <expectedCodes>200</expectedCodes>
336 <test ID="updateMovement3WithBlankCurrentLocation">
338 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
339 <filename>listener/movement.xml</filename>
341 <var ID="currentLocation"></var>
342 <var ID="locationDate">1800-02-01</var>
344 <expectedCodes>200</expectedCodes>
348 This test verifies that the computedCurrentLocation field
349 value has been set to null, because that field will *not*
350 be emitted in the response payload when it has a null value.
352 This is an inherently fragile test, in comparing tree structures,
353 and will break if there are any changes to any of the relevant
354 schemas, including collectionspace_core, collectionobjects_common,
355 and account_permission.
357 Uncomment only when working on the computed current location
358 event listener / handler. - ADR - 2013-02-14
361 <test ID="readCollectionObject1AfterMovement3BlankCurrentLocationUpdate">
363 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
365 <filename>listener/res/collectionobject-without-current-location.res.xml</filename>
366 <expected level="TREE" />
369 <label>collectionobjects_common</label>
373 <expectedCodes>200</expectedCodes>
377 <test ID="updateMovement3WithBlankCurrentLocationSecondTime">
379 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
380 <filename>listener/movement.xml</filename>
382 <var ID="currentLocation"></var>
383 <var ID="locationDate">1800-02-01</var>
385 <expectedCodes>200</expectedCodes>
389 Uncomment only when working on the computed current location
390 event listener / handler. - ADR - 2013-02-14
392 (See comments above for more details.)
395 <test ID="readCollectionObject1AfterMovement3BlankCurrentLocationUpdateSecondTime">
397 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
399 <filename>listener/res/collectionobject-without-current-location.res.xml</filename>
400 <expected level="TREE" />
403 <label>collectionobjects_common</label>
407 <expectedCodes>200</expectedCodes>
411 <test ID="updateMovement3WithNonBlankCurrentLocation">
413 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
414 <filename>listener/movement.xml</filename>
416 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ottawa1358215545567)'Ottawa, ON, Canada'</var>
417 <var ID="locationDate">1800-02-01</var>
419 <expectedCodes>200</expectedCodes>
422 <test ID="readCollectionObject1AfterMovement3NonBlankCurrentLocationUpdate">
424 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
426 <expected level="ADDOK" />
427 <filename>listener/res/collectionobject.res.xml</filename>
429 <var ID="computedCurrentLocationValue">${updateMovement3WithNonBlankCurrentLocation.currentLocation}</var>
432 <expectedCodes>200</expectedCodes>
435 <!-- CSPACE-6019: A Movement with a later creation timestamp is -->
436 <!-- deemed to have taken place later than a Movement with an earlier -->
437 <!-- creation timestamp, if both have identical location dates. -->
439 <test ID="createMovement6">
440 <method>POST</method>
441 <uri>/cspace-services/movements</uri>
442 <filename>listener/movement.xml</filename>
444 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Spokane1358215545524)'Spokane, WA, USA'</var>
445 <var ID="locationDate">${updateMovement3WithNonBlankCurrentLocation.locationDate}</var> <!-- Identical to Movement 3 -->
447 <expectedCodes>201</expectedCodes>
449 <test ID="readMovement6">
451 <uri>/cspace-services/movements/${createMovement6.CSID}</uri>
453 <expected level="ADDOK" />
454 <filename>listener/res/movement.res.xml</filename>
456 <var ID="currentLocationValue">${createMovement6.currentLocation}</var>
457 <var ID="locationDateValue">${updateMovement3WithNonBlankCurrentLocation.got("//locationDate")}</var>
460 <expectedCodes>200</expectedCodes>
463 <test ID="relateCollectionObject1ToMovement6">
464 <method>POST</method>
465 <uri>/cspace-services/relations</uri>
466 <filename>listener/relation.xml</filename>
468 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
469 <var ID="subjectDocumentType">CollectionObject</var>
470 <var ID="objectCsid">${createMovement6.CSID}</var>
471 <var ID="objectDocumentType">Movement</var>
473 <expectedCodes>201</expectedCodes>
476 <!-- See comment on updateMovement1 for an explanation of why this -->
477 <!-- update is needed, after creating a new relation -->
478 <test ID="updateMovement6">
480 <uri>/cspace-services/movements/${createMovement6.CSID}</uri>
481 <filename>listener/movement.xml</filename>
483 <var ID="currentLocation">${createMovement6.currentLocation}</var>
484 <var ID="locationDate">${createMovement6.locationDate}</var>
486 <expectedCodes>200</expectedCodes>
489 <test ID="readCollectionObject1AfterBeingRelatedToMovement6">
491 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
493 <expected level="ADDOK" />
494 <filename>listener/res/collectionobject.res.xml</filename>
496 <var ID="computedCurrentLocationValue">${createMovement6.currentLocation}</var>
499 <expectedCodes>200</expectedCodes>
504 <!-- Some of the following tests pertain to CSPACE-5793, not yet -->
505 <!-- resolved as of this writing. - ADR 2013-02-14 -->
507 <testGroup ID="TestsStillUnderDevelopment">
509 <test ID="deleteRelationBetweenCollectionObject1AndMovement3">
510 <method>DELETE</method>
511 <uri>/cspace-services/relations/${relateCollectionObject1ToMovement3.CSID}</uri>
512 <expectedCodes>200</expectedCodes>
515 <test ID="readCollectionObject1AfterRelationDelete">
517 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
519 <expected level="ADDOK" />
520 <filename>listener/res/collectionobject.res.xml</filename>
522 <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>
525 <expectedCodes>200</expectedCodes>
528 <test ID="deleteMovement2">
529 <method>DELETE</method>
530 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
531 <expectedCodes>200</expectedCodes>
534 <test ID="readCollectionObject1AfterMovement2Delete">
536 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
538 <expected level="ADDOK" />
539 <filename>listener/res/collectionobject.res.xml</filename>
541 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
544 <expectedCodes>200</expectedCodes>