1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="CreateUpdateReadStructuredObjects" autoDeletePOSTS="true">
7 Using refNames with 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/5-collectionobject-create-with-parent-refname.xml</filename>
56 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
57 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
58 <var ID="parentObjectNumber">${CreateChessSetBox.objectNumber}</var>
60 <expectedCodes>201</expectedCodes>
62 <test ID="ReadChessBoard">
64 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
65 <expectedCodes>200</expectedCodes>
68 <!-- Bag of white chess pieces -->
69 <!-- (child of chess set box, sibling of chess board and bag -->
70 <!-- of black chess pieces, parent of white chess pieces) -->
72 <test ID="CreateBagOfWhiteChessPieces">
74 <uri>/cspace-services/collectionobjects</uri>
75 <filename>collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml</filename>
77 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
78 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
79 <var ID="parentObjectNumber">${CreateChessSetBox.objectNumber}</var>
81 <expectedCodes>201</expectedCodes>
83 <test ID="ReadBagOfWhiteChessPieces">
85 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
86 <expectedCodes>200</expectedCodes>
90 <!-- Individual chess pieces in the bag of white chess pieces, -->
91 <!-- each created along with relations to their parent -->
93 <test ID="CreateWhiteRook">
95 <uri>/cspace-services/collectionobjects</uri>
96 <filename>collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml</filename>
98 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
99 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
100 <var ID="parentObjectNumber">${CreateBagOfWhiteChessPieces.objectNumber}</var>
102 <expectedCodes>201</expectedCodes>
104 <test ID="ReadWhiteRook">
106 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
107 <expectedCodes>200</expectedCodes>
110 <test ID="CreateWhiteBishop">
111 <method>POST</method>
112 <uri>/cspace-services/collectionobjects</uri>
113 <filename>collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml</filename>
115 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
116 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
117 <var ID="parentObjectNumber">${CreateBagOfWhiteChessPieces.objectNumber}</var>
119 <expectedCodes>201</expectedCodes>
121 <test ID="ReadWhiteBishop">
123 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
124 <expectedCodes>200</expectedCodes>
129 <!-- Individual chess pieces in the bag of black chess pieces, -->
130 <!-- each created initially without any relations. -->
132 <test ID="CreateBlackQueen">
133 <method>POST</method>
134 <uri>/cspace-services/collectionobjects</uri>
135 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
137 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
139 <expectedCodes>201</expectedCodes>
141 <test ID="ReadBlackQueen">
143 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
144 <expectedCodes>200</expectedCodes>
147 <test ID="CreateBlackRook">
148 <method>POST</method>
149 <uri>/cspace-services/collectionobjects</uri>
150 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
152 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
154 <expectedCodes>201</expectedCodes>
156 <test ID="ReadBlackRook">
158 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
159 <expectedCodes>200</expectedCodes>
162 <test ID="CreateBlackRookFragment1">
163 <method>POST</method>
164 <uri>/cspace-services/collectionobjects</uri>
165 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
167 <var ID="objectNumber">CSPACE-5518-BlackRookFragment1</var>
169 <expectedCodes>201</expectedCodes>
171 <test ID="ReadBlackRookFragment1">
173 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}</uri>
174 <expectedCodes>200</expectedCodes>
177 <test ID="CreateBlackRookFragment2">
178 <method>POST</method>
179 <uri>/cspace-services/collectionobjects</uri>
180 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
182 <var ID="objectNumber">CSPACE-5518-BlackRookFragment2</var>
184 <expectedCodes>201</expectedCodes>
186 <test ID="ReadBlackRookFragment2">
188 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment2.CSID}</uri>
189 <expectedCodes>200</expectedCodes>
193 <!-- Bag of black chess pieces -->
194 <!-- (child of chess set box, sibling of chess board and bag -->
195 <!-- of white chess pieces, parents of black chess pieces) -->
198 This piece is created along with relations to:
199 * Its parent (the chess set box)
200 * One of its children (the black queen), created previously above
203 <test ID="CreateBagOfBlackChessPieces">
204 <method>POST</method>
205 <uri>/cspace-services/collectionobjects</uri>
206 <filename>collectionobject/hierarchy/6-collectionobject-create-with-parent-child-refnames.xml</filename>
208 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
209 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
210 <var ID="parentObjectNumber">${CreateChessSetBox.objectNumber}</var>
211 <var ID="childCSID">${CreateBlackQueen.CSID}</var>
212 <var ID="childObjectNumber">${CreateBlackQueen.objectNumber}</var>
215 <test ID="ReadBagOfBlackChessPieces">
217 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
218 <expectedCodes>200</expectedCodes>
222 <!-- Update one of the existing chess pieces, and add hierarchical -->
223 <!-- relationships between that piece and both its parent and child. -->
226 This piece is updated along with adding relations to:
227 * Its parent (the bag of black chess pieces)
228 * Its children (black rook fragment1, black rook fragment2)
231 <test ID="UpdateBlackRookWithRelations">
233 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
234 <filename>collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refNames.xml</filename>
236 <var ID="distinguishingFeatures">This black rook is nearly intact, save for two tiny fragments.</var>
237 <var ID="currentItemCSID">${CreateBlackRook.CSID}</var>
238 <var ID="currentItemObjectNumber">${CreateBlackRook.objectNumber}</var>
239 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
240 <var ID="parentObjectNumber">${CreateBagOfBlackChessPieces.objectNumber}</var>
241 <var ID="child1CSID">${CreateBlackRookFragment1.CSID}</var>
242 <var ID="child1ObjectNumber">${CreateBlackRookFragment1.objectNumber}</var>
243 <var ID="child2CSID">${CreateBlackRookFragment2.CSID}</var>
244 <var ID="child2ObjectNumber">${CreateBlackRookFragment2.objectNumber}</var>
246 <expectedCodes>200</expectedCodes>
251 Read hierarchical relations via three query parameters now
252 supported for structured objects and procedures, as well as
260 <!-- Read hierarchical relationships via 'showRelations', -->
261 <!-- which returns direct parent and child relations. -->
263 <test ID="ShowRelationsForTopLevelItem">
265 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
267 <expected level="ADDOK" />
268 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
270 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
271 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
272 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
273 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
275 <startElement>/document/*[local-name()='relations-common-list']</startElement>
277 <expectedCodes>200</expectedCodes>
280 <test ID="ShowRelationsForMidLevelItem">
282 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
284 <expected level="ADDOK" />
285 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
287 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
288 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
289 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
290 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
292 <startElement>/document/*[local-name()='relations-common-list']</startElement>
294 <expectedCodes>200</expectedCodes>
297 <test ID="ShowRelationsForBottomLevelItem">
299 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showRelations=true</uri>
301 <expected level="ADDOK" />
302 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
304 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
305 <var ID="blackRookFragment1CSID">${CreateBlackRookFragment1.CSID}</var>
307 <startElement>/document/*[local-name()='relations-common-list']</startElement>
309 <expectedCodes>200</expectedCodes>
312 <!-- Read hierarchical relationships via 'showSiblings', -->
313 <!-- which returns sibling relations. -->
315 <test ID="ShowSiblingsForTopLevelItem">
317 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
318 <expectedCodes>200</expectedCodes>
320 <expected level="ADDOK" />
321 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
322 <startElement>/document/*[local-name()='relations-common-list']</startElement>
326 <test ID="ShowSiblingsForMidLevelItem">
328 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
329 <expectedCodes>200</expectedCodes>
331 <expected level="ADDOK" />
332 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
334 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
335 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
336 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
338 <startElement>/document/*[local-name()='relations-common-list']</startElement>
342 <test ID="ShowSiblingsForBottomLevelItem">
344 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showSiblings=true</uri>
345 <expectedCodes>200</expectedCodes>
347 <expected level="ADDOK" />
348 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
350 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
351 <var ID="blackRookFragment2CSID">${CreateBlackRookFragment2.CSID}</var>
353 <startElement>/document/*[local-name()='relations-common-list']</startElement>
357 <!-- Read hierarchical relationships via 'showAllRelations', -->
358 <!-- which returns parent, child, and sibling relationships. -->
360 <test ID="ShowAllRelationsForTopLevelItem">
362 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
363 <expectedCodes>200</expectedCodes>
365 <expected level="ADDOK" />
366 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
367 <startElement>/document/*[local-name()='relations-common-list']</startElement>
371 <!-- The following tests -->
373 <!-- Currently returns only three relations (parent, two children), -->
374 <!-- rather than five (parent, two children, two siblings). - ADR 2012-09-10 -->
376 <test ID="ShowAllRelationsForMidLevelItem">
378 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}?showAllRelations=true</uri>
379 <expectedCodes>200</expectedCodes>
381 <expected level="ADDOK" />
382 <filename>collectionobject/hierarchy/res/show-all-relations-mid-level.res.xml</filename>
384 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
385 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
386 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
387 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
389 <startElement>/document/*[local-name()='relations-common-list']</startElement>
394 <!-- Currently returns only one relation (parent), rather than -->
395 <!-- two (parent, sibling). - ADR 2012-09-10 -->
397 <test ID="ShowAllRelationsForBottomLevelItem">
399 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}?showAllRelations=true</uri>
400 <expectedCodes>200</expectedCodes>
402 <expected level="ADDOK" />
403 <filename>collectionobject/hierarchy/res/show-all-relations-bottom-level.res.xml</filename>
405 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
406 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
407 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
409 <startElement>/document/*[local-name()='relations-common-list']</startElement>
414 <!-- Read hierarchical relationships via the relations service. -->
415 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
417 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
418 <!-- since the tests above created relation records with this top-level -->
419 <!-- solely as an object of those relations. -->
420 <test ID="GetRelationsAsSubjectForTopLevelItem">
422 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
423 <expectedCodes>200</expectedCodes>
425 <expected level="ADDOK" />
426 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
428 <var ID="totalItems">0</var>
433 <test ID="GetRelationsAsObjectForTopLevelItem">
435 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
436 <expectedCodes>200</expectedCodes>
438 <expected level="ADDOK" />
439 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
441 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
442 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
443 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
444 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
446 <startElement>/document/*[local-name()='relations-common-list']</startElement>
450 <!-- Clean up any remaining records that were NOT automatically deleted by autoDeletePOSTS -->
452 <!-- Delete the records of relations to ChessSetBox, from its three children -->
454 <test ID="GetRelationsToChessSetBoxAsObject">
456 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
457 <expectedCodes>200</expectedCodes>
459 <test ID="DeleteChildRelation1ToChessSetBox">
460 <method>DELETE</method>
461 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[1]/csid")}</uri>
463 <test ID="DeleteChildRelation2ToChessSetBox">
464 <method>DELETE</method>
465 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[2]/csid")}</uri>
467 <test ID="DeleteChildRelation3ToChessSetBox">
468 <method>DELETE</method>
469 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[3]/csid")}</uri>
472 <!-- Delete the records of relations to BagOfWhiteChessPieces, from its two children -->
474 <test ID="GetRelationsToBagOfWhiteChessPiecesAsObject">
476 <uri>/cspace-services/relations?obj=${CreateBagOfWhiteChessPieces.CSID}</uri>
477 <expectedCodes>200</expectedCodes>
479 <test ID="DeleteChildRelation1ToBagOfWhiteChessPieces">
480 <method>DELETE</method>
481 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
483 <test ID="DeleteChildRelation2ToBagOfWhiteChessPieces">
484 <method>DELETE</method>
485 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
488 <!-- Delete the records of relations to BagOfBlackChessPieces, from its two children -->
490 <test ID="GetRelationsToBagOfBlackChessPiecesAsObject">
492 <uri>/cspace-services/relations?obj=${CreateBagOfBlackChessPieces.CSID}</uri>
493 <expectedCodes>200</expectedCodes>
495 <test ID="DeleteChildRelation1ToBagOfBlackChessPieces">
496 <method>DELETE</method>
497 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
499 <test ID="DeleteChildRelation2ToBagOfBlackChessPieces">
500 <method>DELETE</method>
501 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
504 <!-- Delete the records of a relation to BlackRook, from its teo children -->
506 <test ID="GetRelationsToBlackRookAsObject">
508 <uri>/cspace-services/relations?obj=${CreateBlackRook.CSID}</uri>
509 <expectedCodes>200</expectedCodes>
511 <test ID="DeleteChildRelation1ToBlackRook">
512 <method>DELETE</method>
513 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[1]/csid")}</uri>
515 <test ID="DeleteChildRelation2ToBlackRook">
516 <method>DELETE</method>
517 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[2]/csid")}</uri>