1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="CreateCollectionObjects"> <!-- 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/1-collectionobject.xml</filename>
41 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
43 <expectedCodes>201</expectedCodes>
45 <test ID="ReadChessBoard" auth="admin@core.collectionspace.org">
47 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
48 <expectedCodes>200</expectedCodes>
51 <!-- Bags of white and black chess pieces -->
52 <!-- (child of chess set box, sibling of chess board, parents of chess pieces) -->
53 <test ID="CreateBagOfWhiteChessPieces">
55 <uri>/cspace-services/collectionobjects</uri>
56 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
58 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
60 <expectedCodes>201</expectedCodes>
62 <test ID="ReadBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
64 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
65 <expectedCodes>200</expectedCodes>
68 <test ID="CreateBagOfBlackChessPieces">
70 <uri>/cspace-services/collectionobjects</uri>
71 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
73 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
76 <test ID="ReadBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
78 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
79 <expectedCodes>200</expectedCodes>
82 <!-- Individual chess pieces in those bags -->
83 <test ID="CreateWhiteRook">
85 <uri>/cspace-services/collectionobjects</uri>
86 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
88 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
90 <expectedCodes>201</expectedCodes>
92 <test ID="ReadWhiteRook" auth="admin@core.collectionspace.org">
94 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
95 <expectedCodes>200</expectedCodes>
97 <test ID="CreateWhiteBishop">
99 <uri>/cspace-services/collectionobjects</uri>
100 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
102 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
104 <expectedCodes>201</expectedCodes>
106 <test ID="ReadWhiteBishop" auth="admin@core.collectionspace.org">
108 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
109 <expectedCodes>200</expectedCodes>
111 <test ID="CreateBlackQueen">
112 <method>POST</method>
113 <uri>/cspace-services/collectionobjects</uri>
114 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
116 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
118 <expectedCodes>201</expectedCodes>
120 <test ID="ReadBlackQueen" auth="admin@core.collectionspace.org">
122 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
123 <expectedCodes>200</expectedCodes>
127 <test ID="CreateBlackRookWithRelations">
128 <method>POST</method>
129 <uri>/cspace-services/collectionobjects</uri>
130 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
132 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
134 <expectedCodes>201</expectedCodes>
136 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
138 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
139 <expectedCodes>200</expectedCodes>
143 <!-- Create a new chess piece, and include in the create payload -->
144 <!-- a list of hierarchical relationships to be created between -->
145 <!-- the various CollectionObjects previously created, in tests above -->
147 <!-- Note also that it *might* not be necessary to set these variables; the original -->
148 <!-- values of CSIDs saved from previous posts, e.g. {CreateChessSetBox.CSID} -->
149 <!-- might still be available for use in request payloads. -->
151 <test ID="CreateBlackRookWithRelations">
152 <method>POST</method>
153 <uri>/cspace-services/collectionobjects</uri>
154 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
156 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
157 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
158 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
159 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
160 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
161 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
162 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
163 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
165 <expectedCodes>201</expectedCodes>
167 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
169 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
170 <expectedCodes>200</expectedCodes>
173 <test ID="ReadHierarchyForTopLevelItem">
175 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
177 <expected level="ADDOK" />
178 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
180 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
181 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
182 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
183 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
185 <startElement>/document/*[local-name()='relations-common-list']</startElement>
187 <expectedCodes>200</expectedCodes>
190 <!-- Update one of the existing chess pieces, and add yet one more -->
191 <!-- hierarchical relationship, between that piece and another -->
192 <!-- existing CollectionObject. -->
194 <test ID="UpdateBlackRootWithRelations">
196 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
197 <filename>collectionobject/hierarchy/3-collectionobjects-with-relations-update.xml</filename>
199 <var ID="distinguishingFeatures">This rook has two light brown striations on part of its base.</var>
200 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
201 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
203 <expectedCodes>200</expectedCodes>
207 <!-- Read hierarchical relations via the various query parameters now -->
208 <!-- supported for structured objects and procedures -->
210 <!-- Read hierarchical relationships via 'showRelations', -->
211 <!-- which returns direct parent and child relations. -->
213 <test ID="ReadHierarchyForTopLevelItem">
215 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
217 <expected level="ADDOK" />
218 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
220 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
221 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
222 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
223 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
225 <startElement>/document/*[local-name()='relations-common-list']</startElement>
227 <expectedCodes>200</expectedCodes>
230 <test ID="ReadHierarchyForMidLevelItem">
232 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
234 <expected level="ADDOK" />
235 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
237 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
238 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
239 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
240 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
242 <startElement>/document/*[local-name()='relations-common-list']</startElement>
244 <expectedCodes>200</expectedCodes>
247 <test ID="ReadHierarchyForBottomLevelItem">
249 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}?showRelations=true</uri>
251 <expected level="ADDOK" />
252 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
254 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
255 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
257 <startElement>/document/*[local-name()='relations-common-list']</startElement>
259 <expectedCodes>200</expectedCodes>
262 <!-- Read hierarchical relationships via 'showSiblings', -->
263 <!-- which shows sibling relations. -->
265 <test ID="ReadSiblingsForTopLevelItem">
267 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
268 <expectedCodes>200</expectedCodes>
270 <expected level="ADDOK" />
271 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
272 <startElement>/document/*[local-name()='relations-common-list']</startElement>
276 <test ID="ReadSiblingsForMidLevelItem">
278 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
279 <expectedCodes>200</expectedCodes>
281 <expected level="ADDOK" />
282 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
284 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
285 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
286 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
288 <startElement>/document/*[local-name()='relations-common-list']</startElement>
292 <test ID="ReadSiblingsForBottomLevelItem">
294 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}?showSiblings=true</uri>
295 <expectedCodes>200</expectedCodes>
297 <expected level="ADDOK" />
298 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
300 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
301 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
303 <startElement>/document/*[local-name()='relations-common-list']</startElement>
307 <!-- Read hierarchical relationships via 'showAllRelations' -->
309 <test ID="ReadAllRelationsForTopLevelItem">
311 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
312 <expectedCodes>200</expectedCodes>
314 <expected level="ADDOK" />
315 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
316 <startElement>/document/*[local-name()='relations-common-list']</startElement>
320 <!-- Read hierarchical relationships via the relations service. -->
321 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
323 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
324 <!-- since the tests above created relation records with this top-level -->
325 <!-- solely as an object of those relations. -->
326 <test ID="GetRelationsAsSubjectForTopLevelItem">
328 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
329 <expectedCodes>200</expectedCodes>
331 <expected level="TEXT" />
332 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
334 <var ID="totalItems">0</var>
339 <test ID="GetRelationsAsObjectForTopLevelItem">
341 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
342 <expectedCodes>200</expectedCodes>
344 <expected level="TEXT" />
345 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
347 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
348 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
349 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
350 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
352 <startElement>/document/*[local-name()='relations-common-list']</startElement>
358 <!-- Clean up any records that were not automatically deleted by autoDeletePOSTS -->
360 <testGroup ID="Cleanup">
365 <test ID="DeleteHierarchy">
369 <!-- The following is likely unnecessary with 'autoDeletePOSTS="true"' -->
371 <test ID="DeleteBlackRook" auth="admin@core.collectionspace.org">
372 <method>DELETE</method>
373 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
375 <test ID="DeleteBlackQueen" auth="admin@core.collectionspace.org">
376 <method>DELETE</method>
377 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
379 <test ID="DeleteWhiteBishop" auth="admin@core.collectionspace.org">
380 <method>DELETE</method>
381 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
383 <test ID="DeleteWhiteRook" auth="admin@core.collectionspace.org">
384 <method>DELETE</method>
385 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
387 <test ID="DeleteBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
388 <method>DELETE</method>
389 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
391 <test ID="DeleteBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
392 <method>DELETE</method>
393 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
395 <test ID="DeleteChessBoard" auth="admin@core.collectionspace.org">
396 <method>DELETE</method>
397 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
399 <test ID="DeleteChessSetBox" auth="admin@core.collectionspace.org">
400 <method>DELETE</method>
401 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>