1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4 <testGroup ID="CreateUpdateReadStructuredObjects" autoDeletePOSTS="true">
7 Create and test a structured set of ten (10) CollectionObjects,
8 with these hierarchical relationsips to one another:
12 |__ BagOfWhiteChessPieces
15 |__ BagOfBlackChessPieces
18 |__ BlackRookFragment1
19 |__ BlackRookFragment2
22 <!-- Chess set box -->
23 <!-- (parent of chess board, bag of white chess pieces, and bag of black chess pieces) -->
24 <test ID="CreateChessSetBox">
26 <uri>/cspace-services/collectionobjects</uri>
27 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
29 <var ID="objectNumber">CSPACE-5518-ChessSetBox</var>
31 <expectedCodes>201</expectedCodes>
33 <!-- Verify the contents of the first CollectionObject record created. -->
34 <!-- Other create requests, below, just check the result code.) -->
35 <test ID="ReadChessSetBox">
37 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>
38 <expectedCodes>200</expectedCodes>
40 <expected level="TEXT" />
41 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
43 <var ID="objectNumber">${CreateChessSetBox.objectNumber}</var>
49 <!-- (child of chess set box, sibling of bag of white chess pieces and bag of black chess pieces) -->
50 <test ID="CreateChessBoard">
52 <uri>/cspace-services/collectionobjects</uri>
53 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
55 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
56 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
58 <expectedCodes>201</expectedCodes>
60 <test ID="ReadChessBoard">
62 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
63 <expectedCodes>200</expectedCodes>
66 <!-- Bag of white chess pieces -->
67 <!-- (child of chess set box, sibling of chess board and bag -->
68 <!-- of black chess pieces, parent of white chess pieces) -->
70 <test ID="CreateBagOfWhiteChessPieces">
72 <uri>/cspace-services/collectionobjects</uri>
73 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
75 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
76 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
78 <expectedCodes>201</expectedCodes>
80 <test ID="ReadBagOfWhiteChessPieces">
82 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
83 <expectedCodes>200</expectedCodes>
86 <!-- Individual chess pieces in the bag of white chess pieces, -->
87 <!-- each created along with relations to their parent -->
89 <test ID="CreateWhiteRook">
91 <uri>/cspace-services/collectionobjects</uri>
92 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
94 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
95 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
97 <expectedCodes>201</expectedCodes>
99 <test ID="ReadWhiteRook">
101 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
102 <expectedCodes>200</expectedCodes>
105 <test ID="CreateWhiteBishop">
106 <method>POST</method>
107 <uri>/cspace-services/collectionobjects</uri>
108 <filename>collectionobject/hierarchy/2-collectionobject-create-with-parent-csid.xml</filename>
110 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
111 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
113 <expectedCodes>201</expectedCodes>
115 <test ID="ReadWhiteBishop">
117 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
118 <expectedCodes>200</expectedCodes>
121 <!-- Individual chess pieces in the bag of black chess pieces, -->
122 <!-- each created initially without any relations. -->
124 <test ID="CreateBlackQueen">
125 <method>POST</method>
126 <uri>/cspace-services/collectionobjects</uri>
127 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
129 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
131 <expectedCodes>201</expectedCodes>
133 <test ID="ReadBlackQueen">
135 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
136 <expectedCodes>200</expectedCodes>
139 <test ID="CreateBlackRook">
140 <method>POST</method>
141 <uri>/cspace-services/collectionobjects</uri>
142 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
144 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
146 <expectedCodes>201</expectedCodes>
148 <test ID="ReadBlackRook">
150 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
151 <expectedCodes>200</expectedCodes>
154 <test ID="CreateBlackRookFragment1">
155 <method>POST</method>
156 <uri>/cspace-services/collectionobjects</uri>
157 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
159 <var ID="objectNumber">CSPACE-5518-BlackRookFragment1</var>
161 <expectedCodes>201</expectedCodes>
163 <test ID="ReadBlackRookFragment">
165 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}</uri>
166 <expectedCodes>200</expectedCodes>
169 <test ID="CreateBlackRookFragment2">
170 <method>POST</method>
171 <uri>/cspace-services/collectionobjects</uri>
172 <filename>collectionobject/hierarchy/1-collectionobject-create.xml</filename>
174 <var ID="objectNumber">CSPACE-5518-BlackRookFragment2</var>
176 <expectedCodes>201</expectedCodes>
178 <test ID="ReadBlackRookFragment2">
180 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment2.CSID}</uri>
181 <expectedCodes>200</expectedCodes>
184 <!-- Bag of black chess pieces -->
185 <!-- (child of chess set box, sibling of chess board and bag -->
186 <!-- of white chess pieces, parents of black chess pieces) -->
189 This piece is created along with relations to:
190 * Its parent (the chess set box)
191 * One of its children (the black queen), created previously above
194 <test ID="CreateBagOfBlackChessPieces">
195 <method>POST</method>
196 <uri>/cspace-services/collectionobjects</uri>
197 <filename>collectionobject/hierarchy/3-collectionobject-create-with-parent-child-csids.xml</filename>
199 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
200 <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
201 <var ID="childCSID">${CreateBlackQueen.CSID}</var>
204 <test ID="ReadBagOfBlackChessPieces">
206 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
207 <expectedCodes>200</expectedCodes>
211 <!-- Update one of the existing chess pieces, and add hierarchical -->
212 <!-- relationships between that piece and both its parent and child. -->
215 This piece is updated along with adding relations to:
216 * Its parent (the bag of black chess pieces)
217 * Its children (black rook fragment1, black rook fragment2)
220 <test ID="UpdateBlackRootWithRelations">
222 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
223 <filename>collectionobject/hierarchy/5-collectionobject-update-with-parent-child-csids.xml</filename>
225 <var ID="distinguishingFeatures">This black rook is nearly intact, save for two tiny fragments.</var>
226 <var ID="currentItemCSID">${CreateBlackRook.CSID}</var>
227 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
228 <var ID="child1CSID">${CreateBlackRookFragment1.CSID}</var>
229 <var ID="child2CSID">${CreateBlackRookFragment2.CSID}</var>
231 <expectedCodes>200</expectedCodes>
236 Read hierarchical relations via three query parameters now
237 supported for structured objects and procedures, as well as
245 <!-- Read hierarchical relationships via 'showRelations', -->
246 <!-- which returns direct parent and child relations. -->
248 <test ID="ShowRelationsForTopLevelItem">
250 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
252 <expected level="ADDOK" />
253 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
255 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
256 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
257 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
258 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
260 <startElement>/document/*[local-name()='relations-common-list']</startElement>
262 <expectedCodes>200</expectedCodes>
265 <test ID="ShowRelationsForMidLevelItem">
267 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
269 <expected level="ADDOK" />
270 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
272 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
273 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
274 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
275 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
277 <startElement>/document/*[local-name()='relations-common-list']</startElement>
279 <expectedCodes>200</expectedCodes>
282 <test ID="ShowRelationsForBottomLevelItem">
284 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showRelations=true</uri>
286 <expected level="ADDOK" />
287 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
289 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
290 <var ID="blackRookFragment1CSID">${CreateBlackRookFragment1.CSID}</var>
292 <startElement>/document/*[local-name()='relations-common-list']</startElement>
294 <expectedCodes>200</expectedCodes>
297 <!-- Read hierarchical relationships via 'showSiblings', -->
298 <!-- which returns sibling relations. -->
300 <test ID="ShowSiblingsForTopLevelItem">
302 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
303 <expectedCodes>200</expectedCodes>
305 <expected level="ADDOK" />
306 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
307 <startElement>/document/*[local-name()='relations-common-list']</startElement>
311 <test ID="ShowSiblingsForMidLevelItem">
313 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
314 <expectedCodes>200</expectedCodes>
316 <expected level="ADDOK" />
317 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
319 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
320 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
321 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
323 <startElement>/document/*[local-name()='relations-common-list']</startElement>
327 <test ID="ShowSiblingsForBottomLevelItem">
329 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showSiblings=true</uri>
330 <expectedCodes>200</expectedCodes>
332 <expected level="ADDOK" />
333 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
335 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
336 <var ID="blackRookFragment2CSID">${CreateBlackRookFragment2.CSID}</var>
338 <startElement>/document/*[local-name()='relations-common-list']</startElement>
342 <!-- Read hierarchical relationships via 'showAllRelations', -->
343 <!-- which returns parent, child, and sibling relationships. -->
345 <test ID="ShowAllRelationsForTopLevelItem">
347 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
348 <expectedCodes>200</expectedCodes>
350 <expected level="ADDOK" />
351 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
352 <startElement>/document/*[local-name()='relations-common-list']</startElement>
356 <!-- The following tests -->
358 <!-- Currently returns only three relations (parent, two children), -->
359 <!-- rather than five (parent, two children, two siblings). - ADR 2012-09-10 -->
361 <test ID="ShowAllRelationsForMidLevelItem">
363 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}?showAllRelations=true</uri>
364 <expectedCodes>200</expectedCodes>
366 <expected level="ADDOK" />
367 <filename>collectionobject/hierarchy/res/show-all-relations-mid-level.res.xml</filename>
369 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
370 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
371 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
372 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
374 <startElement>/document/*[local-name()='relations-common-list']</startElement>
379 <!-- Currently returns only one relation (parent), rather than -->
380 <!-- two (parent, sibling). - ADR 2012-09-10 -->
382 <test ID="ShowAllRelationsForBottomLevelItem">
384 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}?showAllRelations=true</uri>
385 <expectedCodes>200</expectedCodes>
387 <expected level="ADDOK" />
388 <filename>collectionobject/hierarchy/res/show-all-relations-bottom-level.res.xml</filename>
390 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
391 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
392 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
394 <startElement>/document/*[local-name()='relations-common-list']</startElement>
399 <!-- Read hierarchical relationships via the relations service. -->
400 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
402 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
403 <!-- since the tests above created relation records with this top-level -->
404 <!-- solely as an object of those relations. -->
405 <test ID="GetRelationsAsSubjectForTopLevelItem">
407 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
408 <expectedCodes>200</expectedCodes>
410 <expected level="ADDOK" />
411 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
413 <var ID="totalItems">0</var>
418 <test ID="GetRelationsAsObjectForTopLevelItem">
420 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
421 <expectedCodes>200</expectedCodes>
423 <expected level="ADDOK" />
424 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
426 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
427 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
428 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
429 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
431 <startElement>/document/*[local-name()='relations-common-list']</startElement>
435 <!-- Clean up any remaining records that were NOT automatically deleted by autoDeletePOSTS -->
437 <!-- Delete the records of relations to ChessSetBox, from its three children -->
439 <test ID="GetRelationsToChessSetBoxAsObject">
441 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
442 <expectedCodes>200</expectedCodes>
444 <test ID="DeleteChildRelation1ToChessSetBox">
445 <method>DELETE</method>
446 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[1]/csid")}</uri>
448 <test ID="DeleteChildRelation2ToChessSetBox">
449 <method>DELETE</method>
450 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[2]/csid")}</uri>
452 <test ID="DeleteChildRelation3ToChessSetBox">
453 <method>DELETE</method>
454 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[3]/csid")}</uri>
457 <!-- Delete the records of relations to BagOfWhiteChessPieces, from its two children -->
459 <test ID="GetRelationsToBagOfWhiteChessPiecesAsObject">
461 <uri>/cspace-services/relations?obj=${CreateBagOfWhiteChessPieces.CSID}</uri>
462 <expectedCodes>200</expectedCodes>
464 <test ID="DeleteChildRelation1ToBagOfWhiteChessPieces">
465 <method>DELETE</method>
466 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
468 <test ID="DeleteChildRelation2ToBagOfWhiteChessPieces">
469 <method>DELETE</method>
470 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
473 <!-- Delete the records of relations to BagOfBlackChessPieces, from its two children -->
475 <test ID="GetRelationsToBagOfBlackChessPiecesAsObject">
477 <uri>/cspace-services/relations?obj=${CreateBagOfBlackChessPieces.CSID}</uri>
478 <expectedCodes>200</expectedCodes>
480 <test ID="DeleteChildRelation1ToBagOfBlackChessPieces">
481 <method>DELETE</method>
482 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
484 <test ID="DeleteChildRelation2ToBagOfBlackChessPieces">
485 <method>DELETE</method>
486 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
489 <!-- Delete the records of a relation to BlackRook, from its teo children -->
491 <test ID="GetRelationsToBlackRookAsObject">
493 <uri>/cspace-services/relations?obj=${CreateBlackRook.CSID}</uri>
494 <expectedCodes>200</expectedCodes>
496 <test ID="DeleteChildRelation1ToBlackRook">
497 <method>DELETE</method>
498 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[1]/csid")}</uri>
500 <test ID="DeleteChildRelation2ToBlackRook">
501 <method>DELETE</method>
502 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[2]/csid")}</uri>