1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="CreateUpdateReadStructuredObjects" autoDeletePOSTS="true">
6 <!-- Create a set of CollectionObjects -->
9 <!-- (parent of chess board, bags of white and black chess pieces) -->
10 <test ID="CreateChessSetBox" auth="admin@core.collectionspace.org">
12 <uri>/cspace-services/collectionobjects</uri>
13 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
15 <var ID="objectNumber">CSPACE-5518-ChessSetBox</var>
17 <expectedCodes>201</expectedCodes>
19 <!-- Verify the contents of the first CollectionObject record created. -->
20 <!-- Other create requests, below, just check the result code.) -->
21 <test ID="ReadChessSetBox" auth="admin@core.collectionspace.org">
23 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>
24 <expectedCodes>200</expectedCodes>
26 <expected level="TEXT" />
27 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
29 <var ID="objectNumber">${CreateChessSetBox.objectNumber}</var>
35 <!-- (child of chess set box, sibling of bags of white and black chess pieces) -->
36 <test ID="CreateChessBoard" auth="admin@core.collectionspace.org">
38 <uri>/cspace-services/collectionobjects</uri>
39 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
41 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
42 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
44 <expectedCodes>201</expectedCodes>
46 <test ID="ReadChessBoard" auth="admin@core.collectionspace.org">
48 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
49 <expectedCodes>200</expectedCodes>
52 <!-- Bags of white and black chess pieces -->
53 <!-- (child of chess set box, sibling of chess board, parents of chess pieces) -->
55 <test ID="CreateBagOfWhiteChessPieces">
57 <uri>/cspace-services/collectionobjects</uri>
58 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
60 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
61 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
63 <expectedCodes>201</expectedCodes>
65 <test ID="ReadBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
67 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
68 <expectedCodes>200</expectedCodes>
71 <test ID="CreateBagOfBlackChessPieces">
73 <uri>/cspace-services/collectionobjects</uri>
74 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
76 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
77 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
80 <test ID="ReadBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
82 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
83 <expectedCodes>200</expectedCodes>
86 <!-- Individual chess pieces in those bags -->
88 <test ID="CreateWhiteRook">
90 <uri>/cspace-services/collectionobjects</uri>
91 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
93 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
94 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
96 <expectedCodes>201</expectedCodes>
98 <test ID="ReadWhiteRook" auth="admin@core.collectionspace.org">
100 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
101 <expectedCodes>200</expectedCodes>
104 <test ID="CreateWhiteBishop">
105 <method>POST</method>
106 <uri>/cspace-services/collectionobjects</uri>
107 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
109 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
110 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
112 <expectedCodes>201</expectedCodes>
114 <test ID="ReadWhiteBishop" auth="admin@core.collectionspace.org">
116 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
117 <expectedCodes>200</expectedCodes>
120 <test ID="CreateBlackQueen">
121 <method>POST</method>
122 <uri>/cspace-services/collectionobjects</uri>
123 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
125 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
126 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
128 <expectedCodes>201</expectedCodes>
130 <test ID="ReadBlackQueen" auth="admin@core.collectionspace.org">
132 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
133 <expectedCodes>200</expectedCodes>
136 <test ID="CreateBlackRook">
137 <method>POST</method>
138 <uri>/cspace-services/collectionobjects</uri>
139 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
141 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
142 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
144 <expectedCodes>201</expectedCodes>
146 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
148 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
149 <expectedCodes>200</expectedCodes>
152 <test ID="ReadHierarchyForTopLevelItem">
154 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
156 <expected level="ADDOK" />
157 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
159 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
160 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
161 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
162 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
164 <startElement>/document/*[local-name()='relations-common-list']</startElement>
166 <expectedCodes>200</expectedCodes>
169 <!-- Update one of the existing chess pieces, and add yet one more -->
170 <!-- hierarchical relationship, between that piece and another -->
171 <!-- existing CollectionObject. -->
173 <test ID="UpdateBlackRootWithRelations">
175 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
176 <filename>collectionobject/hierarchy/3-collectionobjects-with-relations-update.xml</filename>
178 <var ID="distinguishingFeatures">This rook has two light brown striations on part of its base.</var>
179 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
180 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
182 <expectedCodes>200</expectedCodes>
186 <!-- Read hierarchical relations via the various query parameters now -->
187 <!-- supported for structured objects and procedures -->
189 <!-- Read hierarchical relationships via 'showRelations', -->
190 <!-- which returns direct parent and child relations. -->
192 <test ID="ReadHierarchyForTopLevelItem">
194 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
196 <expected level="ADDOK" />
197 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
199 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
200 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
201 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
202 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
204 <startElement>/document/*[local-name()='relations-common-list']</startElement>
206 <expectedCodes>200</expectedCodes>
209 <test ID="ReadHierarchyForMidLevelItem">
211 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
213 <expected level="ADDOK" />
214 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
216 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
217 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
218 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
219 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
221 <startElement>/document/*[local-name()='relations-common-list']</startElement>
223 <expectedCodes>200</expectedCodes>
226 <test ID="ReadHierarchyForBottomLevelItem">
228 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showRelations=true</uri>
230 <expected level="ADDOK" />
231 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
233 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
234 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
236 <startElement>/document/*[local-name()='relations-common-list']</startElement>
238 <expectedCodes>200</expectedCodes>
241 <!-- Read hierarchical relationships via 'showSiblings', -->
242 <!-- which shows sibling relations. -->
244 <test ID="ReadSiblingsForTopLevelItem">
246 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
247 <expectedCodes>200</expectedCodes>
249 <expected level="ADDOK" />
250 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
251 <startElement>/document/*[local-name()='relations-common-list']</startElement>
255 <test ID="ReadSiblingsForMidLevelItem">
257 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
258 <expectedCodes>200</expectedCodes>
260 <expected level="ADDOK" />
261 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
263 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
264 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
265 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
267 <startElement>/document/*[local-name()='relations-common-list']</startElement>
271 <test ID="ReadSiblingsForBottomLevelItem">
273 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showSiblings=true</uri>
274 <expectedCodes>200</expectedCodes>
276 <expected level="ADDOK" />
277 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
279 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
280 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
282 <startElement>/document/*[local-name()='relations-common-list']</startElement>
286 <!-- Read hierarchical relationships via 'showAllRelations' -->
288 <test ID="ReadAllRelationsForTopLevelItem">
290 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
291 <expectedCodes>200</expectedCodes>
293 <expected level="ADDOK" />
294 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
295 <startElement>/document/*[local-name()='relations-common-list']</startElement>
299 <!-- Read hierarchical relationships via the relations service. -->
300 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
302 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
303 <!-- since the tests above created relation records with this top-level -->
304 <!-- solely as an object of those relations. -->
305 <test ID="GetRelationsAsSubjectForTopLevelItem">
307 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
308 <expectedCodes>200</expectedCodes>
310 <expected level="ADDOK" />
311 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
313 <var ID="totalItems">0</var>
318 <test ID="GetRelationsAsObjectForTopLevelItem">
320 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
321 <expectedCodes>200</expectedCodes>
323 <expected level="ADDOK" />
324 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
326 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
327 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
328 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
329 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
331 <startElement>/document/*[local-name()='relations-common-list']</startElement>
337 <!-- Clean up any records that were not automatically deleted by autoDeletePOSTS -->
339 <testGroup ID="Cleanup">
344 <test ID="DeleteHierarchy">
348 <!-- The following is likely unnecessary with 'autoDeletePOSTS="true"' -->
350 <test ID="DeleteBlackRook" auth="admin@core.collectionspace.org">
351 <method>DELETE</method>
352 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
354 <test ID="DeleteBlackQueen" auth="admin@core.collectionspace.org">
355 <method>DELETE</method>
356 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
358 <test ID="DeleteWhiteBishop" auth="admin@core.collectionspace.org">
359 <method>DELETE</method>
360 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
362 <test ID="DeleteWhiteRook" auth="admin@core.collectionspace.org">
363 <method>DELETE</method>
364 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
366 <test ID="DeleteBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
367 <method>DELETE</method>
368 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
370 <test ID="DeleteBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
371 <method>DELETE</method>
372 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
374 <test ID="DeleteChessBoard" auth="admin@core.collectionspace.org">
375 <method>DELETE</method>
376 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
378 <test ID="DeleteChessSetBox" auth="admin@core.collectionspace.org">
379 <method>DELETE</method>
380 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>