1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="CreateUpdateReadStructuredObjects" autoDeletePOSTS="true">
7 Using CSIDs and the 'id' form of identifiers, create
8 and test a structured set of ten (10) CollectionObjects,
9 with these hierarchical relationsips to one another:
13 |__ BagOfWhiteChessPieces
16 |__ BagOfBlackChessPieces
19 |__ BlackRookFragment1
20 |__ BlackRookFragment2
23 <!-- Chess set box -->
24 <!-- (parent of chess board, bag of white chess pieces, and bag of black chess pieces) -->
25 <test ID="CreateChessSetBox">
27 <uri>/cspace-services/collectionobjects</uri>
28 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
30 <var ID="objectNumber">CSPACE-5518-ChessSetBox</var>
32 <expectedCodes>201</expectedCodes>
34 <!-- Verify the contents of the first CollectionObject record created. -->
35 <!-- Other create requests, below, just check the result code.) -->
36 <test ID="ReadChessSetBox">
38 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>
39 <expectedCodes>200</expectedCodes>
41 <expected level="TEXT" />
42 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
44 <var ID="objectNumber">${CreateChessSetBox.objectNumber}</var>
50 <!-- (child of chess set box, sibling of bag of white chess pieces and bag of black chess pieces) -->
51 <test ID="CreateChessBoard">
53 <uri>/cspace-services/collectionobjects</uri>
54 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
56 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
57 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
59 <expectedCodes>201</expectedCodes>
61 <test ID="ReadChessBoard">
63 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
64 <expectedCodes>200</expectedCodes>
67 <!-- Bag of white chess pieces -->
68 <!-- (child of chess set box, sibling of chess board and bag -->
69 <!-- of black chess pieces, parent of white chess pieces) -->
71 <test ID="CreateBagOfWhiteChessPieces">
73 <uri>/cspace-services/collectionobjects</uri>
74 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
76 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
77 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
79 <expectedCodes>201</expectedCodes>
81 <test ID="ReadBagOfWhiteChessPieces">
83 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
84 <expectedCodes>200</expectedCodes>
87 <!-- Individual chess pieces in the bag of white chess pieces, -->
88 <!-- each created along with relations to their parent -->
90 <test ID="CreateWhiteRook">
92 <uri>/cspace-services/collectionobjects</uri>
93 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
95 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
96 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
98 <expectedCodes>201</expectedCodes>
100 <test ID="ReadWhiteRook">
102 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
103 <expectedCodes>200</expectedCodes>
106 <test ID="CreateWhiteBishop">
107 <method>POST</method>
108 <uri>/cspace-services/collectionobjects</uri>
109 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
111 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
112 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
114 <expectedCodes>201</expectedCodes>
116 <test ID="ReadWhiteBishop">
118 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
119 <expectedCodes>200</expectedCodes>
122 <!-- Individual chess pieces in the bag of black chess pieces, -->
123 <!-- each created initially without any relations. -->
125 <test ID="CreateBlackQueen">
126 <method>POST</method>
127 <uri>/cspace-services/collectionobjects</uri>
128 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
130 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
132 <expectedCodes>201</expectedCodes>
134 <test ID="ReadBlackQueen">
136 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
137 <expectedCodes>200</expectedCodes>
140 <test ID="CreateBlackRook">
141 <method>POST</method>
142 <uri>/cspace-services/collectionobjects</uri>
143 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
145 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
147 <expectedCodes>201</expectedCodes>
149 <test ID="ReadBlackRook">
151 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
152 <expectedCodes>200</expectedCodes>
155 <test ID="CreateBlackRookFragment1">
156 <method>POST</method>
157 <uri>/cspace-services/collectionobjects</uri>
158 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
160 <var ID="objectNumber">CSPACE-5518-BlackRookFragment1</var>
162 <expectedCodes>201</expectedCodes>
164 <test ID="ReadBlackRookFragment">
166 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}</uri>
167 <expectedCodes>200</expectedCodes>
170 <test ID="CreateBlackRookFragment2">
171 <method>POST</method>
172 <uri>/cspace-services/collectionobjects</uri>
173 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
175 <var ID="objectNumber">CSPACE-5518-BlackRookFragment2</var>
177 <expectedCodes>201</expectedCodes>
179 <test ID="ReadBlackRookFragment2">
181 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment2.CSID}</uri>
182 <expectedCodes>200</expectedCodes>
185 <!-- Bag of black chess pieces -->
186 <!-- (child of chess set box, sibling of chess board and bag -->
187 <!-- of white chess pieces, parent of black chess pieces) -->
190 This piece is created along with relations to:
191 * Its parent (the chess set box)
192 * One of its children (the black queen), created previously above
195 <test ID="CreateBagOfBlackChessPieces">
196 <method>POST</method>
197 <uri>/cspace-services/collectionobjects</uri>
198 <filename>collectionobject/hierarchy/3-collectionobject-create-with-parent-child-csids.xml</filename>
200 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
201 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
202 <var ID="childCSID">${CreateBlackQueen.CSID}</var>
205 <test ID="ReadBagOfBlackChessPieces">
207 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
208 <expectedCodes>200</expectedCodes>
212 <!-- Update one of the existing chess pieces, and add hierarchical -->
213 <!-- relationships between that piece and both its parent and child. -->
216 This piece is updated along with adding relations to:
217 * Its parent (the bag of black chess pieces)
218 * Its children (black rook fragment1, black rook fragment2)
221 <test ID="UpdateBlackRookWithRelations">
223 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
224 <filename>collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml</filename>
226 <var ID="distinguishingFeatures">This black rook is nearly intact, save for two tiny fragments.</var>
227 <var ID="currentItemCSID">${CreateBlackRook.CSID}</var>
228 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
229 <var ID="child1CSID">${CreateBlackRookFragment1.CSID}</var>
230 <var ID="child2CSID">${CreateBlackRookFragment2.CSID}</var>
232 <expectedCodes>200</expectedCodes>
237 Read hierarchical relations via three query parameters now
238 supported for structured objects and procedures, as well as
246 <!-- Read hierarchical relationships via 'showRelations', -->
247 <!-- which returns direct parent and child relations. -->
249 <test ID="ShowRelationsForTopLevelItem">
251 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
253 <expected level="ADDOK" />
254 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
256 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
257 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
258 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
259 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
261 <startElement>/document/*[local-name()='relations-common-list']</startElement>
263 <expectedCodes>200</expectedCodes>
266 <test ID="ShowRelationsForMidLevelItem">
268 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
270 <expected level="ADDOK" />
271 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
273 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
274 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
275 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
276 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
278 <startElement>/document/*[local-name()='relations-common-list']</startElement>
280 <expectedCodes>200</expectedCodes>
283 <test ID="ShowRelationsForBottomLevelItem">
285 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showRelations=true</uri>
287 <expected level="ADDOK" />
288 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
290 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
291 <var ID="blackRookFragment1CSID">${CreateBlackRookFragment1.CSID}</var>
293 <startElement>/document/*[local-name()='relations-common-list']</startElement>
295 <expectedCodes>200</expectedCodes>
298 <!-- Read hierarchical relationships via 'showSiblings', -->
299 <!-- which returns sibling relations. -->
301 <test ID="ShowSiblingsForTopLevelItem">
303 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
304 <expectedCodes>200</expectedCodes>
306 <expected level="ADDOK" />
307 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
308 <startElement>/document/*[local-name()='relations-common-list']</startElement>
312 <test ID="ShowSiblingsForMidLevelItem">
314 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
315 <expectedCodes>200</expectedCodes>
317 <expected level="ADDOK" />
318 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
320 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
321 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
322 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
324 <startElement>/document/*[local-name()='relations-common-list']</startElement>
328 <test ID="ShowSiblingsForBottomLevelItem">
330 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showSiblings=true</uri>
331 <expectedCodes>200</expectedCodes>
333 <expected level="ADDOK" />
334 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
336 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
337 <var ID="blackRookFragment2CSID">${CreateBlackRookFragment2.CSID}</var>
339 <startElement>/document/*[local-name()='relations-common-list']</startElement>
343 <!-- Read hierarchical relationships via 'showAllRelations', -->
344 <!-- which returns parent, child, and sibling relationships. -->
346 <test ID="ShowAllRelationsForTopLevelItem">
348 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
349 <expectedCodes>200</expectedCodes>
351 <expected level="ADDOK" />
352 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
353 <startElement>/document/*[local-name()='relations-common-list']</startElement>
357 <!-- The following tests -->
359 <!-- Currently returns only three relations (parent, two children), -->
360 <!-- rather than five (parent, two children, two siblings). - ADR 2012-09-10 -->
362 <test ID="ShowAllRelationsForMidLevelItem">
364 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}?showAllRelations=true</uri>
365 <expectedCodes>200</expectedCodes>
367 <expected level="ADDOK" />
368 <filename>collectionobject/hierarchy/res/show-all-relations-mid-level.res.xml</filename>
370 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
371 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
372 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
373 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
375 <startElement>/document/*[local-name()='relations-common-list']</startElement>
380 <!-- Currently returns only one relation (parent), rather than -->
381 <!-- two (parent, sibling). - ADR 2012-09-10 -->
383 <test ID="ShowAllRelationsForBottomLevelItem">
385 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}?showAllRelations=true</uri>
386 <expectedCodes>200</expectedCodes>
388 <expected level="ADDOK" />
389 <filename>collectionobject/hierarchy/res/show-all-relations-bottom-level.res.xml</filename>
391 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
392 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
393 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
395 <startElement>/document/*[local-name()='relations-common-list']</startElement>
400 <!-- Read hierarchical relationships via the relations service. -->
401 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
403 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
404 <!-- since the tests above created relation records with this top-level -->
405 <!-- solely as an object of those relations. -->
406 <test ID="GetRelationsAsSubjectForTopLevelItem">
408 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
409 <expectedCodes>200</expectedCodes>
411 <expected level="ADDOK" />
412 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
414 <var ID="totalItems">0</var>
419 <test ID="GetRelationsAsObjectForTopLevelItem">
421 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
422 <expectedCodes>200</expectedCodes>
424 <expected level="ADDOK" />
425 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
427 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
428 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
429 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
430 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
432 <startElement>/document/*[local-name()='relations-common-list']</startElement>
436 <!-- Clean up any remaining records that were NOT automatically deleted by autoDeletePOSTS -->
438 <!-- Delete the records of relations to ChessSetBox, from its three children -->
440 <test ID="GetRelationsToChessSetBoxAsObject">
442 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
443 <expectedCodes>200</expectedCodes>
445 <test ID="DeleteChildRelation1ToChessSetBox">
446 <method>DELETE</method>
447 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[1]/csid")}</uri>
449 <test ID="DeleteChildRelation2ToChessSetBox">
450 <method>DELETE</method>
451 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[2]/csid")}</uri>
453 <test ID="DeleteChildRelation3ToChessSetBox">
454 <method>DELETE</method>
455 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[3]/csid")}</uri>
458 <!-- Delete the records of relations to BagOfWhiteChessPieces, from its two children -->
460 <test ID="GetRelationsToBagOfWhiteChessPiecesAsObject">
462 <uri>/cspace-services/relations?obj=${CreateBagOfWhiteChessPieces.CSID}</uri>
463 <expectedCodes>200</expectedCodes>
465 <test ID="DeleteChildRelation1ToBagOfWhiteChessPieces">
466 <method>DELETE</method>
467 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
469 <test ID="DeleteChildRelation2ToBagOfWhiteChessPieces">
470 <method>DELETE</method>
471 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
474 <!-- Delete the records of relations to BagOfBlackChessPieces, from its two children -->
476 <test ID="GetRelationsToBagOfBlackChessPiecesAsObject">
478 <uri>/cspace-services/relations?obj=${CreateBagOfBlackChessPieces.CSID}</uri>
479 <expectedCodes>200</expectedCodes>
481 <test ID="DeleteChildRelation1ToBagOfBlackChessPieces">
482 <method>DELETE</method>
483 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
485 <test ID="DeleteChildRelation2ToBagOfBlackChessPieces">
486 <method>DELETE</method>
487 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
490 <!-- Delete the records of a relation to BlackRook, from its teo children -->
492 <test ID="GetRelationsToBlackRookAsObject">
494 <uri>/cspace-services/relations?obj=${CreateBlackRook.CSID}</uri>
495 <expectedCodes>200</expectedCodes>
497 <test ID="DeleteChildRelation1ToBlackRook">
498 <method>DELETE</method>
499 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[1]/csid")}</uri>
501 <test ID="DeleteChildRelation2ToBlackRook">
502 <method>DELETE</method>
503 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[2]/csid")}</uri>