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>
203 <var ID="relationshipMetaType">Item in a set</var>
206 <test ID="ReadBagOfBlackChessPieces">
208 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
209 <expectedCodes>200</expectedCodes>
213 <!-- Update one of the existing chess pieces, and add hierarchical -->
214 <!-- relationships between that piece and both its parent and child. -->
217 This piece is updated along with adding relations to:
218 * Its parent (the bag of black chess pieces)
219 * Its children (black rook fragment1, black rook fragment2)
222 <test ID="UpdateBlackRookWithRelations">
224 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
225 <filename>collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml</filename>
227 <var ID="distinguishingFeatures">This black rook is nearly intact, save for two tiny fragments.</var>
228 <var ID="currentItemCSID">${CreateBlackRook.CSID}</var>
229 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
230 <var ID="child1CSID">${CreateBlackRookFragment1.CSID}</var>
231 <var ID="child2CSID">${CreateBlackRookFragment2.CSID}</var>
232 <var ID="relationshipMetaType">set</var>
234 <expectedCodes>200</expectedCodes>
239 Read hierarchical relations via three query parameters now
240 supported for structured objects and procedures, as well as
248 <!-- Read hierarchical relationships via 'showRelations', -->
249 <!-- which returns direct parent and child relations. -->
251 <test ID="ShowRelationsForTopLevelItem">
253 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
255 <expected level="ADDOK" />
256 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
258 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
259 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
260 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
261 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
263 <startElement>/document/*[local-name()='relations-common-list']</startElement>
265 <expectedCodes>200</expectedCodes>
268 <test ID="ShowRelationsForMidLevelItem">
270 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
272 <expected level="ADDOK" />
273 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
275 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
276 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
277 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
278 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
280 <startElement>/document/*[local-name()='relations-common-list']</startElement>
282 <expectedCodes>200</expectedCodes>
285 <test ID="ShowRelationsForBottomLevelItem">
287 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showRelations=true</uri>
289 <expected level="ADDOK" />
290 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
292 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
293 <var ID="blackRookFragment1CSID">${CreateBlackRookFragment1.CSID}</var>
295 <startElement>/document/*[local-name()='relations-common-list']</startElement>
297 <expectedCodes>200</expectedCodes>
300 <!-- Read hierarchical relationships via 'showSiblings', -->
301 <!-- which returns sibling relations. -->
303 <test ID="ShowSiblingsForTopLevelItem">
305 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
306 <expectedCodes>200</expectedCodes>
308 <expected level="ADDOK" />
309 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
310 <startElement>/document/*[local-name()='relations-common-list']</startElement>
314 <test ID="ShowSiblingsForMidLevelItem">
316 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
317 <expectedCodes>200</expectedCodes>
319 <expected level="ADDOK" />
320 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
322 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
323 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
324 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
326 <startElement>/document/*[local-name()='relations-common-list']</startElement>
330 <test ID="ShowSiblingsForBottomLevelItem">
332 <uri>/cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showSiblings=true</uri>
333 <expectedCodes>200</expectedCodes>
335 <expected level="ADDOK" />
336 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
338 <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
339 <var ID="blackRookFragment2CSID">${CreateBlackRookFragment2.CSID}</var>
341 <startElement>/document/*[local-name()='relations-common-list']</startElement>
345 <!-- Read hierarchical relationships via 'showAllRelations', -->
346 <!-- which returns parent, child, and sibling relationships. -->
348 <test ID="ShowAllRelationsForTopLevelItem">
350 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
351 <expectedCodes>200</expectedCodes>
353 <expected level="ADDOK" />
354 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
355 <startElement>/document/*[local-name()='relations-common-list']</startElement>
359 <!-- The following tests -->
361 <!-- Currently returns only three relations (parent, two children), -->
362 <!-- rather than five (parent, two children, two siblings). - ADR 2012-09-10 -->
364 <test ID="ShowAllRelationsForMidLevelItem">
366 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}?showAllRelations=true</uri>
367 <expectedCodes>200</expectedCodes>
369 <expected level="ADDOK" />
370 <filename>collectionobject/hierarchy/res/show-all-relations-mid-level.res.xml</filename>
372 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
373 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
374 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
375 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
377 <startElement>/document/*[local-name()='relations-common-list']</startElement>
382 <!-- Currently returns only one relation (parent), rather than -->
383 <!-- two (parent, sibling). - ADR 2012-09-10 -->
385 <test ID="ShowAllRelationsForBottomLevelItem">
387 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}?showAllRelations=true</uri>
388 <expectedCodes>200</expectedCodes>
390 <expected level="ADDOK" />
391 <filename>collectionobject/hierarchy/res/show-all-relations-bottom-level.res.xml</filename>
393 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
394 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
395 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
397 <startElement>/document/*[local-name()='relations-common-list']</startElement>
402 <!-- Read hierarchical relationships via the relations service. -->
403 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
405 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
406 <!-- since the tests above created relation records with this top-level -->
407 <!-- solely as an object of those relations. -->
408 <test ID="GetRelationsAsSubjectForTopLevelItem">
410 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
411 <expectedCodes>200</expectedCodes>
413 <expected level="ADDOK" />
414 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
416 <var ID="totalItems">0</var>
421 <test ID="GetRelationsAsObjectForTopLevelItem">
423 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
424 <expectedCodes>200</expectedCodes>
426 <expected level="ADDOK" />
427 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
429 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
430 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
431 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
432 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
434 <startElement>/document/*[local-name()='relations-common-list']</startElement>
439 <!-- Verify that the value of the relationshipMetaType field was set -->
440 <!-- correctly and can be successfully retrieved -->
441 <test ID="GetRelationshipMetaType">
443 <uri>/cspace-services/relations?sbj=${CreateBlackQueen.CSID}&obj=${CreateBagOfBlackChessPieces.CSID}</uri>
444 <expectedCodes>200</expectedCodes>
446 <expected level="ADDOK" />
447 <filename>collectionobject/hierarchy/res/relationship-metatype.res.xml</filename>
449 <var ID="relationshipMetaType">${CreateBagOfBlackChessPieces.relationshipMetaType}</var>
450 <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
451 <var ID="childCSID">${CreateBlackQueen.CSID}</var>
456 <!-- Clean up any remaining records that were NOT automatically deleted by autoDeletePOSTS -->
458 <!-- Delete the records of relations to ChessSetBox, from its three children -->
460 <test ID="GetRelationsToChessSetBoxAsObject">
462 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
463 <expectedCodes>200</expectedCodes>
465 <test ID="DeleteChildRelation1ToChessSetBox">
466 <method>DELETE</method>
467 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[1]/csid")}</uri>
469 <test ID="DeleteChildRelation2ToChessSetBox">
470 <method>DELETE</method>
471 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[2]/csid")}</uri>
473 <test ID="DeleteChildRelation3ToChessSetBox">
474 <method>DELETE</method>
475 <uri>/cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[3]/csid")}</uri>
478 <!-- Delete the records of relations to BagOfWhiteChessPieces, from its two children -->
480 <test ID="GetRelationsToBagOfWhiteChessPiecesAsObject">
482 <uri>/cspace-services/relations?obj=${CreateBagOfWhiteChessPieces.CSID}</uri>
483 <expectedCodes>200</expectedCodes>
485 <test ID="DeleteChildRelation1ToBagOfWhiteChessPieces">
486 <method>DELETE</method>
487 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
489 <test ID="DeleteChildRelation2ToBagOfWhiteChessPieces">
490 <method>DELETE</method>
491 <uri>/cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
494 <!-- Delete the records of relations to BagOfBlackChessPieces, from its two children -->
496 <test ID="GetRelationsToBagOfBlackChessPiecesAsObject">
498 <uri>/cspace-services/relations?obj=${CreateBagOfBlackChessPieces.CSID}</uri>
499 <expectedCodes>200</expectedCodes>
501 <test ID="DeleteChildRelation1ToBagOfBlackChessPieces">
502 <method>DELETE</method>
503 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[1]/csid")}</uri>
505 <test ID="DeleteChildRelation2ToBagOfBlackChessPieces">
506 <method>DELETE</method>
507 <uri>/cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[2]/csid")}</uri>
510 <!-- Delete the records of a relation to BlackRook, from its teo children -->
512 <test ID="GetRelationsToBlackRookAsObject">
514 <uri>/cspace-services/relations?obj=${CreateBlackRook.CSID}</uri>
515 <expectedCodes>200</expectedCodes>
517 <test ID="DeleteChildRelation1ToBlackRook">
518 <method>DELETE</method>
519 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[1]/csid")}</uri>
521 <test ID="DeleteChildRelation2ToBlackRook">
522 <method>DELETE</method>
523 <uri>/cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[2]/csid")}</uri>