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>
6 <auth ID="admin@lifesci.collectionspace.org">YWRtaW5AbGlmZXNjaS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I=</auth>
9 <!-- This tests the UpdateObjectLocationOnMoveEventListener -->
11 <testGroup ID="updateObjectLocationOnMoveEventListener" autoDeletePOSTS="true">
13 <test ID="createCollectionObject1">
15 <uri>/cspace-services/collectionobjects</uri>
16 <filename>listener/collectionobject.xml</filename>
17 <expectedCodes>201</expectedCodes>
20 <test ID="createCollectionObject2">
22 <uri>/cspace-services/collectionobjects</uri>
23 <filename>listener/collectionobject.xml</filename>
24 <expectedCodes>201</expectedCodes>
27 <test ID="createMovement1">
29 <uri>/cspace-services/movements</uri>
30 <filename>listener/movement.xml</filename>
32 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Seattle1358215545509)'Seattle, WA, USA'</var>
33 <var ID="locationDate">1650-01-01</var>
35 <expectedCodes>201</expectedCodes>
38 <test ID="createMovement2">
40 <uri>/cspace-services/movements</uri>
41 <filename>listener/movement.xml</filename>
43 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Portland1358215545512)'Portland, OR, USA'</var>
44 <var ID="locationDate">1700-01-01</var>
46 <expectedCodes>201</expectedCodes>
49 <test ID="createMovement3">
51 <uri>/cspace-services/movements</uri>
52 <filename>listener/movement.xml</filename>
54 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Victoria1358215545515)'Victoria, BC, Canada'</var>
55 <var ID="locationDate">1800-01-01</var>
57 <expectedCodes>201</expectedCodes>
60 <test ID="createMovement4">
62 <uri>/cspace-services/movements</uri>
63 <filename>listener/movement.xml</filename>
65 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Vancouver1358215545518)'Vancouver, BC, Canada'</var>
66 <var ID="locationDate">1900-01-01</var>
68 <expectedCodes>201</expectedCodes>
71 <test ID="createMovement5">
73 <uri>/cspace-services/movements</uri>
74 <filename>listener/movement.xml</filename>
76 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Olympia1358215545521)'Olympia, WA, USA'</var>
77 <var ID="locationDate">2000-01-01</var>
79 <expectedCodes>201</expectedCodes>
82 <test ID="relateCollectionObject1ToMovement1">
84 <uri>/cspace-services/relations</uri>
85 <filename>listener/relation.xml</filename>
87 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
88 <var ID="subjectDocumentType">CollectionObject</var>
89 <var ID="objectCsid">${createMovement1.CSID}</var>
90 <var ID="objectDocumentType">Movement</var>
92 <expectedCodes>201</expectedCodes>
95 <test ID="relateCollectionObject2ToMovement1">
97 <uri>/cspace-services/relations</uri>
98 <filename>listener/relation.xml</filename>
100 <var ID="subjectCsid">${createCollectionObject2.CSID}</var>
101 <var ID="subjectDocumentType">CollectionObject</var>
102 <var ID="objectCsid">${createMovement1.CSID}</var>
103 <var ID="objectDocumentType">Movement</var>
105 <expectedCodes>201</expectedCodes>
108 <!-- Computed current location doesn't appear to be updated -->
109 <!-- merely upon a Relation being created; some intervening action -->
110 <!-- invoking the listener must also occur. This appears to be -->
111 <!-- because newly-created relations aren't being returned in results -->
112 <!-- from the first query - which returns a list of Relation document -->
113 <!-- models - that is made in AbstractUpdateObjectLocationValues.handleEvent() -->
114 <test ID="updateMovement1">
116 <uri>/cspace-services/movements/${createMovement1.CSID}</uri>
117 <filename>listener/movement.xml</filename>
119 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Seattle1358215545509)'Seattle, WA, USA'</var>
120 <var ID="locationDate">1650-02-01</var>
122 <expectedCodes>200</expectedCodes>
125 <test ID="readCollectionObject1AfterMovement1Update">
127 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
129 <expected level="ADDOK" />
130 <filename>listener/res/collectionobject.res.xml</filename>
132 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
135 <expectedCodes>200</expectedCodes>
138 <test ID="readCollectionObject2AfterMovement1Update">
140 <uri>/cspace-services/collectionobjects/${createCollectionObject2.CSID}</uri>
142 <expected level="ADDOK" />
143 <filename>listener/res/collectionobject.res.xml</filename>
145 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
148 <expectedCodes>200</expectedCodes>
151 <test ID="relateMovement2ToCollectionObject1">
152 <method>POST</method>
153 <uri>/cspace-services/relations</uri>
154 <filename>listener/relation.xml</filename>
156 <var ID="subjectCsid">${createMovement2.CSID}</var>
157 <var ID="subjectDocumentType">Movement</var>
158 <var ID="objectCsid">${createCollectionObject1.CSID}</var>
159 <var ID="objectDocumentType">CollectionObject</var>
161 <expectedCodes>201</expectedCodes>
164 <test ID="updateMovement2">
166 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
167 <filename>listener/movement.xml</filename>
169 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Portland1358215545512)'Portland, OR, USA'</var>
170 <var ID="locationDate">1700-02-01</var>
172 <expectedCodes>200</expectedCodes>
175 <test ID="readCollectionObject1AfterMovement2Update">
177 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
179 <expected level="ADDOK" />
180 <filename>listener/res/collectionobject.res.xml</filename>
182 <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>
185 <expectedCodes>200</expectedCodes>
188 <test ID="relateMovement3ToCollectionObject1">
189 <method>POST</method>
190 <uri>/cspace-services/relations</uri>
191 <filename>listener/relation.xml</filename>
193 <var ID="subjectCsid">${createMovement3.CSID}</var>
194 <var ID="subjectDocumentType">Movement</var>
195 <var ID="objectCsid">${createCollectionObject1.CSID}</var>
196 <var ID="objectDocumentType">CollectionObject</var>
198 <expectedCodes>201</expectedCodes>
201 <test ID="updateMovement3">
203 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
204 <filename>listener/movement.xml</filename>
206 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Victoria1358215545515)'Victoria, BC, Canada'</var>
207 <var ID="locationDate">1800-02-01</var>
209 <expectedCodes>200</expectedCodes>
212 <test ID="readCollectionObject1AfterMovement3Update">
214 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
216 <expected level="ADDOK" />
217 <filename>listener/res/collectionobject.res.xml</filename>
219 <var ID="computedCurrentLocationValue">${createMovement3.currentLocation}</var>
222 <expectedCodes>200</expectedCodes>
225 <test ID="relateCollectionObject1ToMovement4">
226 <method>POST</method>
227 <uri>/cspace-services/relations</uri>
228 <filename>listener/relation.xml</filename>
230 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
231 <var ID="subjectDocumentType">CollectionObject</var>
232 <var ID="objectCsid">${createMovement4.CSID}</var>
233 <var ID="objectDocumentType">Movement</var>
235 <expectedCodes>201</expectedCodes>
238 <test ID="relateCollectionObject1ToMovement5">
239 <method>POST</method>
240 <uri>/cspace-services/relations</uri>
241 <filename>listener/relation.xml</filename>
243 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
244 <var ID="subjectDocumentType">CollectionObject</var>
245 <var ID="objectCsid">${createMovement5.CSID}</var>
246 <var ID="objectDocumentType">Movement</var>
248 <expectedCodes>201</expectedCodes>
251 <test ID="updateMovement5">
253 <uri>/cspace-services/movements/${createMovement5.CSID}</uri>
254 <filename>listener/movement.xml</filename>
256 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Olympia1358215545521)'Olympia, WA, USA'</var>
257 <var ID="locationDate">2000-02-02</var>
259 <expectedCodes>200</expectedCodes>
262 <test ID="readCollectionObject1AfterMovement5Update">
264 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
266 <expected level="ADDOK" />
267 <filename>listener/res/collectionobject.res.xml</filename>
269 <var ID="computedCurrentLocationValue">${createMovement5.currentLocation}</var>
272 <expectedCodes>200</expectedCodes>
275 <test ID="softDeleteRelationBetweenCollectionObject1AndMovement5">
277 <uri>/cspace-services/relations/${relateCollectionObject1ToMovement5.CSID}/workflow/delete</uri>
278 <expectedCodes>200</expectedCodes>
279 <filename>relation/res/workflowState.res.xml</filename>
281 <var ID="workflowState">deleted</var>
285 <test ID="updateMovement4">
287 <uri>/cspace-services/movements/${createMovement4.CSID}</uri>
288 <filename>listener/movement.xml</filename>
290 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Vancouver1358215545518)'Vancouver, BC, Canada'</var>
291 <var ID="locationDate">1900-02-01</var>
293 <expectedCodes>200</expectedCodes>
296 <test ID="readCollectionObject1AfterRelationSoftDelete">
298 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
300 <expected level="ADDOK" />
301 <filename>listener/res/collectionobject.res.xml</filename>
303 <var ID="computedCurrentLocationValue">${createMovement4.currentLocation}</var>
306 <expectedCodes>200</expectedCodes>
309 <test ID="softDeleteMovement4">
311 <uri>/cspace-services/movements/${createMovement4.CSID}/workflow/delete</uri>
312 <expectedCodes>200</expectedCodes>
313 <!-- XmlReplay appears to require a filename on PUT. -->
314 <!-- If not present, throws "java.io.FileNotFoundException: File '' does not exist" -->
315 <!-- The contents of that file, sent in the PUT payload, will be ignored by the services. -->
316 <!-- Note that the filename below is in a different module than -->
317 <!-- the present XmlReplay control file. -->
318 <filename>relation/res/workflowState.res.xml</filename>
320 <var ID="workflowState">deleted</var>
324 <test ID="readCollectionObject1AfterMovement4SoftDelete">
326 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
328 <expected level="ADDOK" />
329 <filename>listener/res/collectionobject.res.xml</filename>
331 <var ID="computedCurrentLocationValue">${createMovement3.currentLocation}</var>
334 <expectedCodes>200</expectedCodes>
337 <test ID="updateMovement3WithBlankCurrentLocation">
339 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
340 <filename>listener/movement.xml</filename>
342 <var ID="currentLocation"></var>
343 <var ID="locationDate">1800-02-01</var>
345 <expectedCodes>200</expectedCodes>
349 This test verifies that the computedCurrentLocation field
350 value has been set to null, because that field will *not*
351 be emitted in the response payload when it has a null value.
353 This is an inherently fragile test, in comparing tree structures,
354 and will break if there are any changes to any of the relevant
355 schemas, including collectionspace_core, collectionobjects_common,
356 and account_permission.
358 Uncomment only when working on the computed current location
359 event listener / handler. - ADR - 2013-02-14
362 <test ID="readCollectionObject1AfterMovement3BlankCurrentLocationUpdate">
364 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
366 <filename>listener/res/collectionobject-without-current-location.res.xml</filename>
367 <expected level="TREE" />
370 <label>collectionobjects_common</label>
374 <expectedCodes>200</expectedCodes>
378 <test ID="updateMovement3WithBlankCurrentLocationSecondTime">
380 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
381 <filename>listener/movement.xml</filename>
383 <var ID="currentLocation"></var>
384 <var ID="locationDate">1800-02-01</var>
386 <expectedCodes>200</expectedCodes>
390 Uncomment only when working on the computed current location
391 event listener / handler. - ADR - 2013-02-14
393 (See comments above for more details.)
396 <test ID="readCollectionObject1AfterMovement3BlankCurrentLocationUpdateSecondTime">
398 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
400 <filename>listener/res/collectionobject-without-current-location.res.xml</filename>
401 <expected level="TREE" />
404 <label>collectionobjects_common</label>
408 <expectedCodes>200</expectedCodes>
412 <test ID="updateMovement3WithNonBlankCurrentLocation">
414 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
415 <filename>listener/movement.xml</filename>
417 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ottawa1358215545567)'Ottawa, ON, Canada'</var>
418 <var ID="locationDate">1800-02-01</var>
420 <expectedCodes>200</expectedCodes>
423 <test ID="readCollectionObject1AfterMovement3NonBlankCurrentLocationUpdate">
425 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
427 <expected level="ADDOK" />
428 <filename>listener/res/collectionobject.res.xml</filename>
430 <var ID="computedCurrentLocationValue">${updateMovement3WithNonBlankCurrentLocation.currentLocation}</var>
433 <expectedCodes>200</expectedCodes>
436 <!-- CSPACE-6019: A Movement with a later creation timestamp is -->
437 <!-- deemed to have taken place later than a Movement with an earlier -->
438 <!-- creation timestamp, if both have identical location dates. -->
440 <test ID="createMovement6">
441 <method>POST</method>
442 <uri>/cspace-services/movements</uri>
443 <filename>listener/movement.xml</filename>
445 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Spokane1358215545524)'Spokane, WA, USA'</var>
446 <var ID="locationDate">${updateMovement3WithNonBlankCurrentLocation.locationDate}</var> <!-- Identical to Movement 3 -->
448 <expectedCodes>201</expectedCodes>
450 <test ID="readMovement6">
452 <uri>/cspace-services/movements/${createMovement6.CSID}</uri>
454 <expected level="ADDOK" />
455 <filename>listener/res/movement.res.xml</filename>
457 <var ID="currentLocationValue">${createMovement6.currentLocation}</var>
458 <var ID="locationDateValue">${updateMovement3WithNonBlankCurrentLocation.got("//locationDate")}</var>
461 <expectedCodes>200</expectedCodes>
464 <test ID="relateCollectionObject1ToMovement6">
465 <method>POST</method>
466 <uri>/cspace-services/relations</uri>
467 <filename>listener/relation.xml</filename>
469 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
470 <var ID="subjectDocumentType">CollectionObject</var>
471 <var ID="objectCsid">${createMovement6.CSID}</var>
472 <var ID="objectDocumentType">Movement</var>
474 <expectedCodes>201</expectedCodes>
477 <!-- See comment on updateMovement1 for an explanation of why this -->
478 <!-- update is needed, after creating a new relation -->
479 <test ID="updateMovement6">
481 <uri>/cspace-services/movements/${createMovement6.CSID}</uri>
482 <filename>listener/movement.xml</filename>
484 <var ID="currentLocation">${createMovement6.currentLocation}</var>
485 <var ID="locationDate">${createMovement6.locationDate}</var>
487 <expectedCodes>200</expectedCodes>
490 <test ID="readCollectionObject1AfterBeingRelatedToMovement6">
492 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
494 <expected level="ADDOK" />
495 <filename>listener/res/collectionobject.res.xml</filename>
497 <var ID="computedCurrentLocationValue">${createMovement6.currentLocation}</var>
500 <expectedCodes>200</expectedCodes>
505 <!-- These tests verify that updates to the computed current location values -->
506 <!-- in CollectionObject records succeed, even in tenants where Movement -->
507 <!-- records are configured to be versioned. See CSPACE-6171 for more details. -->
508 <testGroup ID="updateObjectLocationOnMoveInVersioningEnabledTenant" autoDeletePOSTS="true">
510 <test ID="createCollectionObjectInVersioningTenant" auth="admin@lifesci.collectionspace.org">
511 <method>POST</method>
512 <uri>/cspace-services/collectionobjects</uri>
513 <filename>listener/collectionobject.xml</filename>
514 <expectedCodes>201</expectedCodes>
517 <test ID="createMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
518 <method>POST</method>
519 <uri>/cspace-services/movements</uri>
520 <filename>listener/movement.xml</filename>
522 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ecatepec13582155455560)'Ecatepec, Mexico'</var>
523 <var ID="locationDate">2000-01-01</var>
525 <expectedCodes>201</expectedCodes>
528 <test ID="relateCollectionObjectToMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
529 <method>POST</method>
530 <uri>/cspace-services/relations</uri>
531 <filename>listener/relation.xml</filename>
533 <var ID="subjectCsid">${createCollectionObjectInVersioningTenant.CSID}</var>
534 <var ID="subjectDocumentType">CollectionObject</var>
535 <var ID="objectCsid">${createMovementInVersioningTenant.CSID}</var>
536 <var ID="objectDocumentType">Movement</var>
538 <expectedCodes>201</expectedCodes>
541 <!-- See comment on updateMovement1 in the updateObjectLocationOnMoveEventListener -->
542 <!-- test group for an explanation of why this update is needed, after -->
543 <!-- creating a new relation -->
544 <test ID="updateMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
546 <uri>/cspace-services/movements/${createMovementInVersioningTenant.CSID}</uri>
547 <filename>listener/movement.xml</filename>
549 <var ID="currentLocation">${createMovementInVersioningTenant.currentLocation}</var>
550 <var ID="locationDate">${createMovementInVersioningTenant.locationDate}</var>
552 <expectedCodes>200</expectedCodes>
555 <test ID="readCollectionObjectAfterRelatingToMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
557 <uri>/cspace-services/collectionobjects/${createCollectionObjectInVersioningTenant.CSID}</uri>
559 <expected level="ADDOK" />
560 <filename>listener/res/collectionobject.res.xml</filename>
562 <var ID="computedCurrentLocationValue">${createMovementInVersioningTenant.currentLocation}</var>
565 <expectedCodes>200</expectedCodes>
568 <test ID="modifyMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
570 <uri>/cspace-services/movements/${createMovementInVersioningTenant.CSID}</uri>
571 <filename>listener/movement.xml</filename>
573 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Guadalajara13582155455562)'Guadalajara, Mexico'</var>
574 <var ID="locationDate">2000-01-02</var>
576 <expectedCodes>200</expectedCodes>
579 <test ID="readCollectionObjectAfterModifyingMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
581 <uri>/cspace-services/collectionobjects/${createCollectionObjectInVersioningTenant.CSID}</uri>
583 <expected level="ADDOK" />
584 <filename>listener/res/collectionobject.res.xml</filename>
586 <var ID="computedCurrentLocationValue">${modifyMovementInVersioningTenant.currentLocation}</var>
589 <expectedCodes>200</expectedCodes>
594 <!-- Some of the following tests pertain to CSPACE-5793, not yet -->
595 <!-- resolved as of this writing. - ADR 2013-02-14 -->
597 <testGroup ID="TestsStillUnderDevelopment">
599 <test ID="deleteRelationBetweenCollectionObject1AndMovement3">
600 <method>DELETE</method>
601 <uri>/cspace-services/relations/${relateCollectionObject1ToMovement3.CSID}</uri>
602 <expectedCodes>200</expectedCodes>
605 <test ID="readCollectionObject1AfterRelationDelete">
607 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
609 <expected level="ADDOK" />
610 <filename>listener/res/collectionobject.res.xml</filename>
612 <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>
615 <expectedCodes>200</expectedCodes>
618 <test ID="deleteMovement2">
619 <method>DELETE</method>
620 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
621 <expectedCodes>200</expectedCodes>
624 <test ID="readCollectionObject1AfterMovement2Delete">
626 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
628 <expected level="ADDOK" />
629 <filename>listener/res/collectionobject.res.xml</filename>
631 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
634 <expectedCodes>200</expectedCodes>