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 in the CollectionObject record will NOT be set to null,
351 if the most recent movement has an empty (blank) current location.
354 <test ID="readCollectionObject1AfterMovement3BlankCurrentLocationUpdate">
356 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
358 <expected level="ADDOK" />
359 <filename>listener/res/collectionobject.res.xml</filename>
361 <!-- The current location value most recently stored in this -->
362 <!-- CollectionObject should still be present. -->
363 <var ID="computedCurrentLocationValue">${updateMovement3.currentLocation}</var>
366 <expectedCodes>200</expectedCodes>
369 <test ID="updateMovement3WithNonBlankCurrentLocation">
371 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
372 <filename>listener/movement.xml</filename>
374 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ottawa1358215545567)'Ottawa, ON, Canada'</var>
375 <var ID="locationDate">1800-02-01</var>
377 <expectedCodes>200</expectedCodes>
380 <test ID="readCollectionObject1AfterMovement3NonBlankCurrentLocationUpdate">
382 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
384 <expected level="ADDOK" />
385 <filename>listener/res/collectionobject.res.xml</filename>
387 <var ID="computedCurrentLocationValue">${updateMovement3WithNonBlankCurrentLocation.currentLocation}</var>
390 <expectedCodes>200</expectedCodes>
393 <!-- CSPACE-6309: A Movement with a later update timestamp is -->
394 <!-- deemed to have taken place later than a Movement with an earlier -->
395 <!-- update timestamp, if both have identical location dates. -->
397 <!-- The following block is temporarily commented out while sorting out CSPACE-6338 -->
399 <test ID="createMovement6">
400 <method>POST</method>
401 <uri>/cspace-services/movements</uri>
402 <filename>listener/movement.xml</filename>
404 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Spokane1358215545524)'Spokane, WA, USA'</var>
405 <Note: value below is identical to that of Movement 3:>
406 <var ID="locationDate">${updateMovement3WithNonBlankCurrentLocation.locationDate}</var>
408 <expectedCodes>201</expectedCodes>
410 <test ID="readMovement6">
412 <uri>/cspace-services/movements/${createMovement6.CSID}</uri>
414 <expected level="ADDOK" />
415 <filename>listener/res/movement.res.xml</filename>
417 <var ID="currentLocationValue">${createMovement6.currentLocation}</var>
418 <var ID="locationDateValue">${updateMovement3WithNonBlankCurrentLocation.got("//locationDate")}</var>
421 <expectedCodes>200</expectedCodes>
424 <test ID="relateCollectionObject1ToMovement6">
425 <method>POST</method>
426 <uri>/cspace-services/relations</uri>
427 <filename>listener/relation.xml</filename>
429 <var ID="subjectCsid">${createCollectionObject1.CSID}</var>
430 <var ID="subjectDocumentType">CollectionObject</var>
431 <var ID="objectCsid">${createMovement6.CSID}</var>
432 <var ID="objectDocumentType">Movement</var>
434 <expectedCodes>201</expectedCodes>
438 <!-- See comment on updateMovement1 for an explanation of why this -->
439 <!-- update is needed, after creating a new relation -->
441 <!-- The following block is temporarily commented out while sorting out CSPACE-6338 -->
443 <test ID="updateMovement6">
445 <uri>/cspace-services/movements/${createMovement6.CSID}</uri>
446 <filename>listener/movement.xml</filename>
448 <var ID="currentLocation">${createMovement6.currentLocation}</var>
449 <var ID="locationDate">${createMovement6.locationDate}</var>
451 <expectedCodes>200</expectedCodes>
454 <test ID="readCollectionObject1AfterBeingRelatedToMovement6">
456 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
458 <expected level="ADDOK" />
459 <filename>listener/res/collectionobject.res.xml</filename>
461 <var ID="computedCurrentLocationValue">${createMovement6.currentLocation}</var>
464 <expectedCodes>200</expectedCodes>
467 <test ID="updateMovement3">
469 <uri>/cspace-services/movements/${createMovement3.CSID}</uri>
470 <filename>listener/movement.xml</filename>
472 <var ID="currentLocation">${createMovement3.currentLocation}</var>
473 <Note: value below is identical to that of Movement 6:>
474 <var ID="locationDate">${updateMovement3WithNonBlankCurrentLocation.locationDate}</var>
476 <expectedCodes>200</expectedCodes>
479 <test ID="readCollectionObject1AfterUpdateOfMovement3">
481 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
483 <expected level="ADDOK" />
484 <filename>listener/res/collectionobject.res.xml</filename>
486 <var ID="computedCurrentLocationValue">${createMovement3.currentLocation}</var>
489 <expectedCodes>200</expectedCodes>
495 <!-- These tests verify that updates to the computed current location values -->
496 <!-- in CollectionObject records succeed, even in tenants where Movement -->
497 <!-- records are configured to be versioned. See CSPACE-6171 for more details. -->
498 <testGroup ID="updateObjectLocationOnMoveInVersioningEnabledTenant" autoDeletePOSTS="true">
500 <test ID="createCollectionObjectInVersioningTenant" auth="admin@lifesci.collectionspace.org">
501 <method>POST</method>
502 <uri>/cspace-services/collectionobjects</uri>
503 <filename>listener/collectionobject.xml</filename>
504 <expectedCodes>201</expectedCodes>
507 <test ID="createMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
508 <method>POST</method>
509 <uri>/cspace-services/movements</uri>
510 <filename>listener/movement.xml</filename>
512 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ecatepec13582155455560)'Ecatepec, Mexico'</var>
513 <var ID="locationDate">2000-01-01</var>
515 <expectedCodes>201</expectedCodes>
518 <test ID="relateCollectionObjectToMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
519 <method>POST</method>
520 <uri>/cspace-services/relations</uri>
521 <filename>listener/relation.xml</filename>
523 <var ID="subjectCsid">${createCollectionObjectInVersioningTenant.CSID}</var>
524 <var ID="subjectDocumentType">CollectionObject</var>
525 <var ID="objectCsid">${createMovementInVersioningTenant.CSID}</var>
526 <var ID="objectDocumentType">Movement</var>
528 <expectedCodes>201</expectedCodes>
531 <!-- See comment on updateMovement1 in the updateObjectLocationOnMoveEventListener -->
532 <!-- test group for an explanation of why this update is needed, after -->
533 <!-- creating a new relation -->
534 <test ID="updateMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
536 <uri>/cspace-services/movements/${createMovementInVersioningTenant.CSID}</uri>
537 <filename>listener/movement.xml</filename>
539 <var ID="currentLocation">${createMovementInVersioningTenant.currentLocation}</var>
540 <var ID="locationDate">${createMovementInVersioningTenant.locationDate}</var>
542 <expectedCodes>200</expectedCodes>
545 <test ID="readCollectionObjectAfterRelatingToMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
547 <uri>/cspace-services/collectionobjects/${createCollectionObjectInVersioningTenant.CSID}</uri>
549 <expected level="ADDOK" />
550 <filename>listener/res/collectionobject.res.xml</filename>
552 <var ID="computedCurrentLocationValue">${createMovementInVersioningTenant.currentLocation}</var>
555 <expectedCodes>200</expectedCodes>
558 <test ID="modifyMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
560 <uri>/cspace-services/movements/${createMovementInVersioningTenant.CSID}</uri>
561 <filename>listener/movement.xml</filename>
563 <var ID="currentLocation">urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Guadalajara13582155455562)'Guadalajara, Mexico'</var>
564 <var ID="locationDate">2000-01-02</var>
566 <expectedCodes>200</expectedCodes>
569 <test ID="readCollectionObjectAfterModifyingMovementInVersioningTenant" auth="admin@lifesci.collectionspace.org">
571 <uri>/cspace-services/collectionobjects/${createCollectionObjectInVersioningTenant.CSID}</uri>
573 <expected level="ADDOK" />
574 <filename>listener/res/collectionobject.res.xml</filename>
576 <var ID="computedCurrentLocationValue">${modifyMovementInVersioningTenant.currentLocation}</var>
579 <expectedCodes>200</expectedCodes>
584 <!-- Some of the following tests pertain to CSPACE-5793, not yet -->
585 <!-- resolved as of this writing. - ADR 2013-02-14 -->
587 <testGroup ID="TestsStillUnderDevelopment">
589 <test ID="deleteRelationBetweenCollectionObject1AndMovement3">
590 <method>DELETE</method>
591 <uri>/cspace-services/relations/${relateCollectionObject1ToMovement3.CSID}</uri>
592 <expectedCodes>200</expectedCodes>
595 <test ID="readCollectionObject1AfterRelationDelete">
597 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
599 <expected level="ADDOK" />
600 <filename>listener/res/collectionobject.res.xml</filename>
602 <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>
605 <expectedCodes>200</expectedCodes>
608 <test ID="deleteMovement2">
609 <method>DELETE</method>
610 <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
611 <expectedCodes>200</expectedCodes>
614 <test ID="readCollectionObject1AfterMovement2Delete">
616 <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
618 <expected level="ADDOK" />
619 <filename>listener/res/collectionobject.res.xml</filename>
621 <var ID="computedCurrentLocationValue">${createMovement1.currentLocation}</var>
624 <expectedCodes>200</expectedCodes>