1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="DisplayNameChangesReflectedInRefNames" autoDeletePOSTS="true">
7 Tests that updates of the display name field for CollectionObject
10 By default in the current demo tenants, the the objectNumber field
11 is configured in services tenant bindings as the display name field:
13 <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
15 <service:SupportsHierarchy>true</service:SupportsHierarchy>
16 <service:RefnameDisplayNameField>
17 <service:element>objectNumber</service:element>
19 This test reuses some payloads from one or more existing tests.
22 <!-- Create two CollectionObject records, and a parent/child relation between them -->
24 <test ID="CreateMotherElephant">
26 <uri>/cspace-services/collectionobjects</uri>
27 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
29 <var ID="objectNumber">CSPACE-5504-MotherElephant</var>
31 <expectedCodes>201</expectedCodes>
33 <test ID="ReadMotherElephant">
35 <uri>/cspace-services/collectionobjects/${CreateMotherElephant.CSID}</uri>
36 <expectedCodes>200</expectedCodes>
38 <expected level="TEXT" />
39 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
41 <var ID="objectNumber">${CreateMotherElephant.objectNumber}</var>
46 <test ID="CreateBabyElephant">
48 <uri>/cspace-services/collectionobjects</uri>
49 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
51 <var ID="objectNumber">CSPACE-5504-BabyElephant</var>
52 <var ID="parentCSID">${CreateMotherElephant.CSID}</var>
54 <expectedCodes>201</expectedCodes>
56 <test ID="ReadBabyElephant">
58 <uri>/cspace-services/collectionobjects/${CreateBabyElephant.CSID}</uri>
59 <expectedCodes>200</expectedCodes>
61 <expected level="TEXT" />
62 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
64 <var ID="objectNumber">${CreateBabyElephant.objectNumber}</var>
69 <!-- Update one of the records' display names -->
70 <test ID="UpdateBabyElephantDisplayName">
72 <uri>/cspace-services/collectionobjects/${CreateBabyElephant.CSID}</uri>
73 <!-- This 'create' payload is also suitable for use with an update request -->
74 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
76 <var ID="objectNumber">CSPACE-5504-BabyElephant-With-Ears</var>
78 <expectedCodes>200</expectedCodes>
80 <test ID="ReadUpdatedBabyElephantDisplayName">
82 <uri>/cspace-services/collectionobjects/${CreateBabyElephant.CSID}</uri>
83 <expectedCodes>200</expectedCodes>
85 <expected level="TEXT" />
86 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
88 <var ID="objectNumber">${UpdateBabyElephantDisplayName.objectNumber}</var>
93 <!-- Verify that the updated display name is present in the refName -->
94 <!-- in the collectionspace_core metadata for this record. -->
95 <test ID="VerifyUpdatedDisplayNameInCollectionSpaceCore">
97 <uri>/cspace-services/collectionobjects/${CreateBabyElephant.CSID}</uri>
98 <expectedCodes>200</expectedCodes>
100 <expected level="TEXT" />
101 <filename>collectionobject/res/collectionspace-core-refname.res.xml</filename>
103 <var ID="itemCSID">${CreateBabyElephant.CSID}</var>
104 <var ID="updatedDisplayName">${UpdateBabyElephantDisplayName.objectNumber}</var>
106 <startElement>/document/*[local-name()='collectionspace_core']</startElement>
110 <!-- Verify that the updated display name is present in the relevant -->
111 <!-- refName in the relations record linking these two records. -->
112 <test ID="VerifyUpdatedDisplayNameInRelation">
114 <uri>/cspace-services/relations?sbj=${CreateBabyElephant.CSID}&obj=${CreateMotherElephant.CSID}</uri>
115 <expectedCodes>200</expectedCodes>
117 <expected level="TEXT" />
118 <filename>collectionobject/res/relationship-refname.res.xml</filename>
120 <var ID="childCSID">${CreateBabyElephant.CSID}</var>
121 <var ID="parentCSID">${CreateMotherElephant.CSID}</var>
122 <var ID="updatedDisplayName">${UpdateBabyElephantDisplayName.objectNumber}</var>
127 <!-- Clean up any remaining records that were NOT automatically deleted by autoDeletePOSTS -->
129 <test ID="GetRelationsToMotherElephantAsObject">
131 <uri>/cspace-services/relations?obj=${CreateMotherElephant.CSID}</uri>
132 <expectedCodes>200</expectedCodes>
134 <test ID="DeleteChildRelationToMotherElephant">
135 <method>DELETE</method>
136 <uri>/cspace-services/relations/${GetRelationsToMotherElephantAsObject.got("//relation-list-item[1]/csid")}</uri>