1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3 <testGroup ID="CreateCollectionObjects" autoDeletePOSTS="true">
5 <!-- Create a set of CollectionObjects -->
8 <!-- (parent of chess board, bags of white and black chess pieces) -->
9 <test ID="CreateChessSetBox" auth="admin@core.collectionspace.org">
11 <uri>/cspace-services/collectionobjects</uri>
12 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
14 <var ID="objectNumber">CSPACE-5518-ChessSetBox</var>
16 <expectedCodes>201</expectedCodes>
18 <!-- Verify the contents of the first CollectionObject record created. -->
19 <!-- Other create requests, below, just check the result code.) -->
20 <test ID="ReadChessSetBox" auth="admin@core.collectionspace.org">
22 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>
23 <expectedCodes>200</expectedCodes>
25 <expected level="TEXT" />
26 <filename>collectionobject/hierarchy/res/collectionobject.res.xml</filename>
28 <var ID="objectNumber">${CreateChessSetBox.objectNumber}</var>
34 <!-- (child of chess set box, sibling of bags of white and black chess pieces) -->
35 <test ID="CreateChessBoard" auth="admin@core.collectionspace.org">
37 <uri>/cspace-services/collectionobjects</uri>
38 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
40 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
42 <expectedCodes>201</expectedCodes>
44 <test ID="ReadChessBoard" auth="admin@core.collectionspace.org">
46 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
47 <expectedCodes>200</expectedCodes>
50 <!-- Bags of white and black chess pieces -->
51 <!-- (child of chess set box, sibling of chess board, parents of chess pieces) -->
52 <test ID="CreateBagOfWhiteChessPieces">
54 <uri>/cspace-services/collectionobjects</uri>
55 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
57 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
59 <expectedCodes>201</expectedCodes>
61 <test ID="ReadBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
63 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
64 <expectedCodes>200</expectedCodes>
67 <test ID="CreateBagOfBlackChessPieces">
69 <uri>/cspace-services/collectionobjects</uri>
70 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
72 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
75 <test ID="ReadBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
77 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
78 <expectedCodes>200</expectedCodes>
81 <!-- Individual chess pieces in those bags -->
82 <test ID="CreateWhiteRook">
84 <uri>/cspace-services/collectionobjects</uri>
85 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
87 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
89 <expectedCodes>201</expectedCodes>
91 <test ID="ReadWhiteRook" auth="admin@core.collectionspace.org">
93 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
94 <expectedCodes>200</expectedCodes>
96 <test ID="CreateWhiteBishop">
98 <uri>/cspace-services/collectionobjects</uri>
99 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
101 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
103 <expectedCodes>201</expectedCodes>
105 <test ID="ReadWhiteBishop" auth="admin@core.collectionspace.org">
107 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
108 <expectedCodes>200</expectedCodes>
110 <test ID="CreateBlackQueen">
111 <method>POST</method>
112 <uri>/cspace-services/collectionobjects</uri>
113 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
115 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
117 <expectedCodes>201</expectedCodes>
119 <test ID="ReadBlackQueen" auth="admin@core.collectionspace.org">
121 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
122 <expectedCodes>200</expectedCodes>
126 <test ID="CreateBlackRook">
127 <method>POST</method>
128 <uri>/cspace-services/collectionobjects</uri>
129 <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
131 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
133 <expectedCodes>201</expectedCodes>
135 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
137 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
138 <expectedCodes>200</expectedCodes>
143 <testGroup ID="CreateStructuredObjectsWithHierarchicalRelations" autoDeletePOSTS="true">
145 <!-- Create a new chess piece, and include in the create payload -->
146 <!-- a list of hierarchical relationships to be created between -->
147 <!-- the various CollectionObjects previously created, in tests above -->
149 <!-- This test is currently failing with a 400 status code -->
150 <!-- due to one or more Exceptions in RemoteDocumentModelHandlerImpl.updateRelations() -->
151 <!-- ADR 2012-09-06 -->
153 <!-- Note also that it *might* not be necessary to set these variables; the original -->
154 <!-- values of CSIDs saved from previous posts, e.g. {CreateChessSetBox.CSID} -->
155 <!-- might still be available for use in request payloads. -->
157 <test ID="CreateBlackRookWithRelations">
158 <method>POST</method>
159 <uri>/cspace-services/collectionobjects</uri>
160 <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
162 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
163 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
164 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
165 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
166 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
167 <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
168 <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
169 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
171 <expectedCodes>201</expectedCodes>
173 <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
175 <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
176 <expectedCodes>200</expectedCodes>
181 <testGroup ID="UpdateStructuredObjectsWithHierarchicalRelations" autoDeletePOSTS="true">
183 <!-- Update one of the existing chess pieces, and add yet one more -->
184 <!-- hierarchical relationship, between that piece and another -->
185 <!-- existing CollectionObject. -->
187 <test ID="UpdateBlackRootWithRelations">
189 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
190 <filename>collectionobject/hierarchy/3-collectionobjects-with-relations-update.xml</filename>
192 <var ID="distinguishingFeatures">This rook has two light brown striations on part of its base.</var>
193 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
194 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
196 <expectedCodes>200</expectedCodes>
201 <!-- Read hierarchical relations via the various query parameters now -->
202 <!-- supported for structured objects and procedures -->
204 <testGroup ID="ReadRelationsOnStructuredObjects" autoDeletePOSTS="true">
206 <!-- Read hierarchical relationships via 'showRelations', -->
207 <!-- which returns direct parent and child relations. -->
209 <test ID="ReadHierarchyForTopLevelItem">
211 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true</uri>
213 <expected level="ADDOK" />
214 <filename>collectionobject/hierarchy/res/show-relations-top-level.res.xml</filename>
216 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
217 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
218 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
219 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
221 <startElement>/document/*[local-name()='relations-common-list']</startElement>
223 <expectedCodes>200</expectedCodes>
226 <test ID="ReadHierarchyForMidLevelItem">
228 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true</uri>
230 <expected level="ADDOK" />
231 <filename>collectionobject/hierarchy/res/show-relations-mid-level.res.xml</filename>
233 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
234 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
235 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
236 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
238 <startElement>/document/*[local-name()='relations-common-list']</startElement>
240 <expectedCodes>200</expectedCodes>
243 <test ID="ReadHierarchyForBottomLevelItem">
245 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showRelations=true</uri>
247 <expected level="ADDOK" />
248 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
250 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
251 <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
253 <startElement>/document/*[local-name()='relations-common-list']</startElement>
255 <expectedCodes>200</expectedCodes>
258 <!-- Read hierarchical relationships via 'showSiblings', -->
259 <!-- which shows sibling relations. -->
261 <test ID="ReadSiblingsForTopLevelItem">
263 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
264 <expectedCodes>200</expectedCodes>
266 <expected level="ADDOK" />
267 <filename>collectionobject/hierarchy/res/show-siblings-top-level.res.xml</filename>
268 <startElement>/document/*[local-name()='relations-common-list']</startElement>
272 <test ID="ReadSiblingsForMidLevelItem">
274 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
275 <expectedCodes>200</expectedCodes>
277 <expected level="ADDOK" />
278 <filename>collectionobject/hierarchy/res/show-siblings-mid-level.res.xml</filename>
280 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
281 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
282 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
284 <startElement>/document/*[local-name()='relations-common-list']</startElement>
288 <test ID="ReadSiblingsForBottomLevelItem">
290 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showSiblings=true</uri>
291 <expectedCodes>200</expectedCodes>
293 <expected level="ADDOK" />
294 <filename>collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml</filename>
296 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
297 <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
299 <startElement>/document/*[local-name()='relations-common-list']</startElement>
303 <!-- Read hierarchical relationships via 'showAllRelations' -->
305 <test ID="ReadAllRelationsForTopLevelItem">
307 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true</uri>
308 <expectedCodes>200</expectedCodes>
310 <expected level="ADDOK" />
311 <filename>collectionobject/hierarchy/res/show-all-relations-top-level.res.xml</filename>
312 <startElement>/document/*[local-name()='relations-common-list']</startElement>
318 <!-- Read hierarchical relationships via the relations service. -->
319 <!-- (This can also serve as a cross-check on the additional read mechanisms, above.) -->
321 <testGroup ID="ReadRelations" autoDeletePOSTS="true">
323 <test ID="GetRelationsAsObjectForTopLevelItem">
325 <uri>/cspace-services/relations?obj=${CreateChessSetBox.CSID}</uri>
326 <expectedCodes>200</expectedCodes>
328 <expected level="TEXT" />
329 <filename>collectionobject/hierarchy/res/relations-as-object-top-level.res.xml</filename>
331 <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
332 <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
333 <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
334 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
336 <startElement>/document/*[local-name()='relations-common-list']</startElement>
340 <!-- Zero (0) total items are expected for the top-level item as a subject, -->
341 <!-- since the tests above created relation records with this top-level -->
342 <!-- solely as an object of those relations. -->
343 <test ID="GetRelationsAsSubjectForTopLevelItem">
345 <uri>/cspace-services/relations?sbj=${CreateChessSetBox.CSID}</uri>
346 <expectedCodes>200</expectedCodes>
348 <expected level="TEXT" />
349 <filename>collectionobject/hierarchy/res/relations-pagination-header.res.xml</filename>
351 <var ID="totalItems">0</var>
358 <!-- Clean up any records that were not automatically deleted by autoDeletePOSTS -->
360 <testGroup ID="Cleanup">
365 <test ID="DeleteHierarchy">
369 <!-- The following is likely unnecessary with 'autoDeletePOSTS="true"' -->
371 <test ID="DeleteBlackRook" auth="admin@core.collectionspace.org">
372 <method>DELETE</method>
373 <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
375 <test ID="DeleteBlackQueen" auth="admin@core.collectionspace.org">
376 <method>DELETE</method>
377 <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
379 <test ID="DeleteWhiteBishop" auth="admin@core.collectionspace.org">
380 <method>DELETE</method>
381 <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
383 <test ID="DeleteWhiteRook" auth="admin@core.collectionspace.org">
384 <method>DELETE</method>
385 <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
387 <test ID="DeleteBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
388 <method>DELETE</method>
389 <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}</uri>
391 <test ID="DeleteBagOfWhiteChessPieces" auth="admin@core.collectionspace.org">
392 <method>DELETE</method>
393 <uri>/cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID}</uri>
395 <test ID="DeleteChessBoard" auth="admin@core.collectionspace.org">
396 <method>DELETE</method>
397 <uri>/cspace-services/collectionobjects/${CreateChessBoard.CSID}</uri>
399 <test ID="DeleteChessSetBox" auth="admin@core.collectionspace.org">
400 <method>DELETE</method>
401 <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}</uri>