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">
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">
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">
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">
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">
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">
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">
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">
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">
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">
148 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
149 <expectedCodes>200</expectedCodes>
153 <!-- Update one of the existing chess pieces, and add yet one more -->
154 <!-- hierarchical relationship, between that piece and another -->
155 <!-- existing CollectionObject. -->
157 <test ID="UpdateBlackRootWithRelations">
159 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
160 <filename>collectionobject/hierarchy/3-collectionobjects-with-relations-update.xml</filename>
162 <var ID="distinguishingFeatures">This rook has two light brown striations on part of its base.</var>
163 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
164 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
166 <expectedCodes>200</expectedCodes>
171 Read hierarchical relations via three query parameters now
172 supported for structured objects and procedures, as well as
180 <!-- Read hierarchical relationships via 'showRelations', -->
181 <!-- which returns direct parent and child relations. -->
183 <test ID="ShowRelationsForTopLevelItem">
185 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
187 <expected level="ADDOK" />
188 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
190 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
191 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
192 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
193 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
195 <startElement>/document/*[local-name()='relations-common-list']</startElement>
197 <expectedCodes>200</expectedCodes>
200 <test ID="ShowRelationsForMidLevelItem">
202 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
204 <expected level="ADDOK" />
205 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
207 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
208 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
209 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
210 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
212 <startElement>/document/*[local-name()='relations-common-list']</startElement>
214 <expectedCodes>200</expectedCodes>
217 <test ID="ShowRelationsForBottomLevelItem">
219 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showRelations=true</uri>
221 <expected level="ADDOK" />
222 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
224 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
225 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
227 <startElement>/document/*[local-name()='relations-common-list']</startElement>
229 <expectedCodes>200</expectedCodes>
232 <!-- Read hierarchical relationships via 'showSiblings', -->
233 <!-- which returns sibling relations. -->
235 <test ID="ShowSiblingsForTopLevelItem">
237 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
238 <expectedCodes>200</expectedCodes>
240 <expected level="ADDOK" />
241 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
242 <startElement>/document/*[local-name()='relations-common-list']</startElement>
246 <test ID="ShowSiblingsForMidLevelItem">
248 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
249 <expectedCodes>200</expectedCodes>
251 <expected level="ADDOK" />
252 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
254 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
255 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
256 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
258 <startElement>/document/*[local-name()='relations-common-list']</startElement>
262 <test ID="ShowSiblingsForBottomLevelItem">
264 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showSiblings=true</uri>
265 <expectedCodes>200</expectedCodes>
267 <expected level="ADDOK" />
268 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
270 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
271 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
273 <startElement>/document/*[local-name()='relations-common-list']</startElement>
277 <!-- Read hierarchical relationships via 'showAllRelations', -->
278 <!-- which returns parent, child, and sibling relationships. -->
280 <test ID="ShowAllRelationsForTopLevelItem">
282 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
283 <expectedCodes>200</expectedCodes>
285 <expected level="ADDOK" />
286 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
287 <startElement>/document/*[local-name()='relations-common-list']</startElement>
291 <!-- The following tests -->
293 <!-- Currently returns only three relations (parent, two children), -->
294 <!-- rather than five (parent, two children, two siblings). - ADR 2012-09-10 -->
296 <test ID="ShowAllRelationsForMidLevelItem">
298 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}?showAllRelations=true</uri>
299 <expectedCodes>200</expectedCodes>
301 <expected level="ADDOK" />
302 <filename>collectionobject/hierarchy/res/show-all-relations-mid-level.res.xml</filename>
304 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
305 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
306 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
307 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
309 <startElement>/document/*[local-name()='relations-common-list']</startElement>
314 <!-- Currently returns only one relation (parent), rather than -->
315 <!-- two (parent, sibling). - ADR 2012-09-10 -->
317 <test ID="ShowAllRelationsForBottomLevelItem">
319 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}?showAllRelations=true</uri>
320 <expectedCodes>200</expectedCodes>
322 <expected level="ADDOK" />
323 <filename>collectionobject/hierarchy/res/show-all-relations-bottom-level.res.xml</filename>
325 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
326 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
327 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
329 <startElement>/document/*[local-name()='relations-common-list']</startElement>
334 <!-- Read hierarchical relationships via the relations service. -->
335 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
337 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
338 <!-- since the tests above created relation records with this top-level -->
339 <!-- solely as an object of those relations. -->
340 <test ID="GetRelationsAsSubjectForTopLevelItem">
342 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
343 <expectedCodes>200</expectedCodes>
345 <expected level="ADDOK" />
346 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
348 <var ID="totalItems">0</var>
353 <test ID="GetRelationsAsObjectForTopLevelItem">
355 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
356 <expectedCodes>200</expectedCodes>
358 <expected level="ADDOK" />
359 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
361 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
362 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
363 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
364 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
366 <startElement>/document/*[local-name()='relations-common-list']</startElement>
370 <!-- Clean up any remaining records that were NOT automatically deleted by autoDeletePOSTS -->
372 <!-- Delete the records of relations to ChessSetBox, from its three children -->
374 <test ID="GetRelationsAsObjectForChessSetBox">
376 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
377 <expectedCodes>200</expectedCodes>
379 <test ID="DeleteChildRelation1ToChessSetBox">
380 <method>DELETE</method>
381 <uri>/cspace-services/relations/${GetRelationsAsObjectForChessSetBox.got("//relation-list-item[1]/csid")}</uri>
383 <test ID="DeleteChildRelation2ToChessSetBox">
384 <method>DELETE</method>
385 <uri>/cspace-services/relations/${GetRelationsAsObjectForChessSetBox.got("//relation-list-item[2]/csid")}</uri>
387 <test ID="DeleteChildRelation3ToChessSetBox">
388 <method>DELETE</method>
389 <uri>/cspace-services/relations/${GetRelationsAsObjectForChessSetBox.got("//relation-list-item[3]/csid")}</uri>
392 <!-- Delete the records of relations to BagOfWhiteChessPieces, from its two children -->
394 <test ID="GetRelationsAsObjectForBagOfWhiteChessPieces">
396 <uri>/cspace-services/relations?obj=${CreateBagOfWhiteChessPieces.CSID}</uri>
397 <expectedCodes>200</expectedCodes>
399 <test ID="DeleteChildRelation1ToBagOfWhiteChessPieces">
400 <method>DELETE</method>
401 <uri>/cspace-services/relations/${GetRelationsAsObjectForBagOfWhiteChessPieces.got("//relation-list-item[1]/csid")}</uri>
403 <test ID="DeleteChildRelation2ToBagOfWhiteChessPieces">
404 <method>DELETE</method>
405 <uri>/cspace-services/relations/${GetRelationsAsObjectForBagOfWhiteChessPieces.got("//relation-list-item[2]/csid")}</uri>
408 <!-- Delete the records of relations to BagOfBlackChessPieces, from its two children -->
410 <test ID="GetRelationsAsObjectForBagOfBlackChessPieces">
412 <uri>/cspace-services/relations?obj=${CreateBagOfBlackChessPieces.CSID}</uri>
413 <expectedCodes>200</expectedCodes>
415 <test ID="DeleteChildRelation1ToBagOfBlackChessPieces">
416 <method>DELETE</method>
417 <uri>/cspace-services/relations/${GetRelationsAsObjectForBagOfBlackChessPieces.got("//relation-list-item[1]/csid")}</uri>
419 <test ID="DeleteChildRelation2ToBagOfBlackChessPieces">
420 <method>DELETE</method>
421 <uri>/cspace-services/relations/${GetRelationsAsObjectForBagOfBlackChessPieces.got("//relation-list-item[2]/csid")}</uri>