1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="HierarchicCollectionObject" autoDeletePOSTS="false">
6 <testGroup ID="CreateCollectionObjects"> <!-- autoDeletePOSTS="true" -->
8 <!-- Create a set of CollectionObjects -->
10 <!-- Chess set box -->
11 <!-- (parent of chess board, bags of white and black chess pieces) -->
12 <test ID="CreateChessSetBox" auth="admin@core.collectionspace.org">
14 <uri>/cspace-services/collectionobjects</uri>
15 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
17 <var ID="objectNumber">CSPACE-5518-ChessSetBox</var>
19 <expectedCodes>201</expectedCodes>
21 <!-- Verify the contents of the first CollectionObject record created. -->
22 <!-- Other create requests, below, just check the result code.) -->
23 <test ID="ReadChessSetBox" auth="admin@core.collectionspace.org">
25 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>
26 <expectedCodes>200</expectedCodes>
28 <expected level="TEXT" />
29 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
31 <var ID="objectNumber">${CreateChessSetBox.objectNumber}</var>
37 <!-- (child of chess set box, sibling of bags of white and black chess pieces) -->
38 <test ID="CreateChessBoard" auth="admin@core.collectionspace.org">
40 <uri>/cspace-services/collectionobjects</uri>
41 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
43 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
45 <expectedCodes>201</expectedCodes>
47 <test ID="ReadChessBoard" auth="admin@core.collectionspace.org">
49 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
50 <expectedCodes>200</expectedCodes>
53 <!-- Bags of white and black chess pieces -->
54 <!-- (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/1-collectionobject.xml</filename>
60 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
62 <expectedCodes>201</expectedCodes>
64 <test ID="ReadBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
66 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
67 <expectedCodes>200</expectedCodes>
70 <test ID="CreateBagOfBlackChessPieces">
72 <uri>/cspace-services/collectionobjects</uri>
73 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
75 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
78 <test ID="ReadBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
80 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
81 <expectedCodes>200</expectedCodes>
84 <!-- Individual chess pieces in those bags -->
85 <test ID="CreateWhiteRook">
87 <uri>/cspace-services/collectionobjects</uri>
88 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
90 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
92 <expectedCodes>201</expectedCodes>
94 <test ID="ReadWhiteRook" auth="admin@core.collectionspace.org">
96 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
97 <expectedCodes>200</expectedCodes>
99 <test ID="CreateWhiteBishop">
100 <method>POST</method>
101 <uri>/cspace-services/collectionobjects</uri>
102 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
104 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
106 <expectedCodes>201</expectedCodes>
108 <test ID="ReadWhiteBishop" auth="admin@core.collectionspace.org">
110 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
111 <expectedCodes>200</expectedCodes>
113 <test ID="CreateBlackQueen">
114 <method>POST</method>
115 <uri>/cspace-services/collectionobjects</uri>
116 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
118 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
120 <expectedCodes>201</expectedCodes>
122 <test ID="ReadBlackQueen" auth="admin@core.collectionspace.org">
124 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
125 <expectedCodes>200</expectedCodes>
129 <test ID="CreateBlackRookWithRelations">
130 <method>POST</method>
131 <uri>/cspace-services/collectionobjects</uri>
132 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
134 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
136 <expectedCodes>201</expectedCodes>
138 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
140 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
141 <expectedCodes>200</expectedCodes>
145 <!-- Create a new chess piece, and include in the create payload -->
146 <!-- a list of hierarchical relationships to be created between -->
147 <!-- the various CollectionObjects previously created, in tests above -->
149 <!-- Note also that it *might* not be necessary to set these variables; the original -->
150 <!-- values of CSIDs saved from previous posts, e.g. {CreateChessSetBox.CSID} -->
151 <!-- might still be available for use in request payloads. -->
153 <test ID="CreateBlackRookWithRelations">
154 <method>POST</method>
155 <uri>/cspace-services/collectionobjects</uri>
156 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
158 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
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>
163 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
164 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
165 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
167 <expectedCodes>201</expectedCodes>
169 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
171 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
172 <expectedCodes>200</expectedCodes>
175 <test ID="ReadHierarchyForTopLevelItem">
177 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
179 <expected level="ADDOK" />
180 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
182 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
183 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
184 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
185 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
187 <startElement>/document/*[local-name()='relations-common-list']</startElement>
189 <expectedCodes>200</expectedCodes>
192 <!-- Update one of the existing chess pieces, and add yet one more -->
193 <!-- hierarchical relationship, between that piece and another -->
194 <!-- existing CollectionObject. -->
196 <test ID="UpdateBlackRootWithRelations">
198 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
199 <filename>collectionobject/hierarchy/3-collectionobjects-with-relations-update.xml</filename>
201 <var ID="distinguishingFeatures">This rook has two light brown striations on part of its base.</var>
202 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
203 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
205 <expectedCodes>200</expectedCodes>
209 <!-- Read hierarchical relations via the various query parameters now -->
210 <!-- supported for structured objects and procedures -->
212 <!-- Read hierarchical relationships via 'showRelations', -->
213 <!-- which returns direct parent and child relations. -->
215 <test ID="ReadHierarchyForTopLevelItem">
217 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
219 <expected level="ADDOK" />
220 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
222 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
223 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
224 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
225 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
227 <startElement>/document/*[local-name()='relations-common-list']</startElement>
229 <expectedCodes>200</expectedCodes>
232 <test ID="ReadHierarchyForMidLevelItem">
234 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
236 <expected level="ADDOK" />
237 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
239 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
240 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
241 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
242 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
244 <startElement>/document/*[local-name()='relations-common-list']</startElement>
246 <expectedCodes>200</expectedCodes>
249 <test ID="ReadHierarchyForBottomLevelItem">
251 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}?showRelations=true</uri>
253 <expected level="ADDOK" />
254 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
256 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
257 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
259 <startElement>/document/*[local-name()='relations-common-list']</startElement>
261 <expectedCodes>200</expectedCodes>
264 <!-- Read hierarchical relationships via 'showSiblings', -->
265 <!-- which shows sibling relations. -->
267 <test ID="ReadSiblingsForTopLevelItem">
269 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
270 <expectedCodes>200</expectedCodes>
272 <expected level="ADDOK" />
273 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
274 <startElement>/document/*[local-name()='relations-common-list']</startElement>
278 <test ID="ReadSiblingsForMidLevelItem">
280 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
281 <expectedCodes>200</expectedCodes>
283 <expected level="ADDOK" />
284 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
286 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
287 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
288 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
290 <startElement>/document/*[local-name()='relations-common-list']</startElement>
294 <test ID="ReadSiblingsForBottomLevelItem">
296 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}?showSiblings=true</uri>
297 <expectedCodes>200</expectedCodes>
299 <expected level="ADDOK" />
300 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
302 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
303 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
305 <startElement>/document/*[local-name()='relations-common-list']</startElement>
309 <!-- Read hierarchical relationships via 'showAllRelations' -->
311 <test ID="ReadAllRelationsForTopLevelItem">
313 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
314 <expectedCodes>200</expectedCodes>
316 <expected level="ADDOK" />
317 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
318 <startElement>/document/*[local-name()='relations-common-list']</startElement>
322 <!-- Read hierarchical relationships via the relations service. -->
323 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
325 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
326 <!-- since the tests above created relation records with this top-level -->
327 <!-- solely as an object of those relations. -->
328 <test ID="GetRelationsAsSubjectForTopLevelItem">
330 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
331 <expectedCodes>200</expectedCodes>
333 <expected level="TEXT" />
334 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
336 <var ID="totalItems">0</var>
341 <test ID="GetRelationsAsObjectForTopLevelItem">
343 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
344 <expectedCodes>200</expectedCodes>
346 <expected level="TEXT" />
347 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
349 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
350 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
351 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
352 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
354 <startElement>/document/*[local-name()='relations-common-list']</startElement>
360 <!-- Clean up any records that were not automatically deleted by autoDeletePOSTS -->
362 <testGroup ID="Cleanup">
367 <test ID="DeleteHierarchy">
371 <!-- The following is likely unnecessary with 'autoDeletePOSTS="true"' -->
373 <test ID="DeleteBlackRook" auth="admin@core.collectionspace.org">
374 <method>DELETE</method>
375 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
377 <test ID="DeleteBlackQueen" auth="admin@core.collectionspace.org">
378 <method>DELETE</method>
379 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
381 <test ID="DeleteWhiteBishop" auth="admin@core.collectionspace.org">
382 <method>DELETE</method>
383 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
385 <test ID="DeleteWhiteRook" auth="admin@core.collectionspace.org">
386 <method>DELETE</method>
387 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
389 <test ID="DeleteBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
390 <method>DELETE</method>
391 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
393 <test ID="DeleteBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
394 <method>DELETE</method>
395 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
397 <test ID="DeleteChessBoard" auth="admin@core.collectionspace.org">
398 <method>DELETE</method>
399 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
401 <test ID="DeleteChessSetBox" auth="admin@core.collectionspace.org">
402 <method>DELETE</method>
403 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>