]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5520: Corrected XmlReplay-based tests of structured objects to create parent...
authorAron Roberts <aron@socrates.berkeley.edu>
Mon, 10 Sep 2012 23:20:26 +0000 (16:20 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Mon, 10 Sep 2012 23:20:26 +0000 (16:20 -0700)
services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/res/show-siblings-top-level.res.xml

index c68322b37a9c51794e2764c092f1d37c17a8d9cd..253074284c76a75e3d7ad1d056bcf04a04eccdfa 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <xmlReplay>
     
-    <testGroup ID="CreateUpdateReadStructuredObjects" autoDeletePOSTS="false">
+    <testGroup ID="CreateUpdateReadStructuredObjects" autoDeletePOSTS="true">
         
         <!-- Create a set of CollectionObjects -->
         
         </test>
         
         <!-- Chess board -->
-        <!-- (child of chess set box, sibling of bags of white and black chess pieces) --> 
+        <!-- (child of chess set box, sibling of bags of white and black chess pieces) -->
         <test ID="CreateChessBoard" auth="admin@core.collectionspace.org">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
+            <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-ChessBoard</var>
+                <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
             </vars>
             <expectedCodes>201</expectedCodes>
         </test>
         
         <!-- Bags of white and black chess pieces -->
         <!-- (child of chess set box, sibling of chess board, parents of chess pieces) --> 
+        
         <test ID="CreateBagOfWhiteChessPieces">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
+            <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-BagOfWhiteChessPieces</var>
+                <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
             </vars>
             <expectedCodes>201</expectedCodes>
         </test>
         <test ID="CreateBagOfBlackChessPieces">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
+            <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-BagOfBlackChessPieces</var>
+                <var ID="parentCSID">${CreateChessSetBox.CSID}</var>
             </vars>
         </test>
         <test ID="ReadBagOfBlackChessPieces" auth="admin@core.collectionspace.org">
         </test>
         
         <!-- Individual chess pieces in those bags -->
+        
         <test ID="CreateWhiteRook">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
+            <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-WhiteRook</var>
-            </vars>
+                 <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
+           </vars>
             <expectedCodes>201</expectedCodes>
         </test>
         <test ID="ReadWhiteRook" auth="admin@core.collectionspace.org">
             <uri>/cspace-services/collectionobjects/${CreateWhiteRook.CSID}</uri>
             <expectedCodes>200</expectedCodes>
         </test>
+        
         <test ID="CreateWhiteBishop">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
+            <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-WhiteBishop</var>
+                <var ID="parentCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
             </vars>
             <expectedCodes>201</expectedCodes>
         </test>
             <uri>/cspace-services/collectionobjects/${CreateWhiteBishop.CSID}</uri>
             <expectedCodes>200</expectedCodes>
         </test>
+        
         <test ID="CreateBlackQueen">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
+            <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-BlackQueen</var>
+                <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
             </vars>
             <expectedCodes>201</expectedCodes>
         </test>
             <uri>/cspace-services/collectionobjects/${CreateBlackQueen.CSID}</uri>
             <expectedCodes>200</expectedCodes>
         </test>
-        
-        <!--
-        <test ID="CreateBlackRookWithRelations">
-            <method>POST</method>
-            <uri>/cspace-services/collectionobjects</uri>
-            <filename>collectionobject/hierarchy/1-collectionobject.xml</filename>
-            <vars>
-                <var ID="objectNumber">CSPACE-5518-BlackRook</var>
-            </vars>
-            <expectedCodes>201</expectedCodes>
-        </test>
-        <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
-            <method>GET</method>
-            <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
-            <expectedCodes>200</expectedCodes>
-        </test>
-        -->
        
-        <!-- Create a new chess piece, and include in the create payload -->
-        <!-- a list of hierarchical relationships to be created between -->
-        <!-- the various CollectionObjects previously created, in tests above -->
-       
-        <!-- Note also that it *might* not be necessary to set these variables; the original -->
-        <!-- values of CSIDs saved from previous posts, e.g. {CreateChessSetBox.CSID} -->
-        <!-- might still be available for use in request payloads. -->
-       
-        <test ID="CreateBlackRookWithRelations">
+        <test ID="CreateBlackRook">
             <method>POST</method>
             <uri>/cspace-services/collectionobjects</uri>
             <filename>collectionobject/hierarchy/2-collectionobjects-with-relations-create.xml</filename>
             <vars>
                 <var ID="objectNumber">CSPACE-5518-BlackRook</var>
-                <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
-                <var ID="chessBoardCSID">${CreateChessBoard.CSID}</var>
-                <var ID="bagOfWhiteChessPiecesCSID">${CreateBagOfWhiteChessPieces.CSID}</var>
-                <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
-                <var ID="whiteRookCSID">${CreateWhiteRook.CSID}</var>
-                <var ID="whiteBishopCSID">${CreateWhiteBishop.CSID}</var>
-                <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
+                <var ID="parentCSID">${CreateBagOfBlackChessPieces.CSID}</var>
             </vars>
             <expectedCodes>201</expectedCodes>
         </test>
         <test ID="ReadBlackRook" auth="admin@core.collectionspace.org">
             <method>GET</method>
-            <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
+            <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
             <expectedCodes>200</expectedCodes>
         </test>
         
         
         <test ID="UpdateBlackRootWithRelations">
             <method>PUT</method>
-            <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
+            <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
             <filename>collectionobject/hierarchy/3-collectionobjects-with-relations-update.xml</filename>
             <vars>
                 <var ID="distinguishingFeatures">This rook has two light brown striations on part of its base.</var>
+                <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
                 <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
-                <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
             </vars>
             <expectedCodes>200</expectedCodes>
         </test>
                     <var ID="chessSetBoxCSID">${CreateChessSetBox.CSID}</var>
                     <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
                     <var ID="blackQueenCSID">${CreateBlackQueen.CSID}</var>
-                    <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
+                    <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
                 </vars>
                 <startElement>/document/*[local-name()='relations-common-list']</startElement>
             </response>
         
         <test ID="ReadHierarchyForBottomLevelItem">
             <method>GET</method>
-            <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}?showRelations=true</uri>
+            <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showRelations=true</uri>
             <response>
                 <expected level="ADDOK" />
                 <filename>collectionobject/hierarchy/res/show-relations-bottom-level.res.xml</filename>
                 <vars>
                     <var ID="bagOfBlackChessPiecesCSID">${CreateBagOfBlackChessPieces.CSID}</var>
-                    <var ID="blackRookCSID">${CreateBlackRookWithRelations.CSID}</var>
+                    <var ID="blackRookCSID">${CreateBlackRook.CSID}</var>
                 </vars>
                 <startElement>/document/*[local-name()='relations-common-list']</startElement>
             </response>
 
         <test ID="ReadSiblingsForTopLevelItem">
             <method>GET</method>
-            <uri>/cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true</uri>
+            <uri>/cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true</uri>
             <expectedCodes>200</expectedCodes>
             <response>
                 <expected level="ADDOK" />
         
         <test ID="ReadSiblingsForBottomLevelItem">
             <method>GET</method>
-            <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}?showSiblings=true</uri>
+            <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}?showSiblings=true</uri>
             <expectedCodes>200</expectedCodes>
             <response>
                 <expected level="ADDOK" />
         <!--
         <test ID="DeleteBlackRook" auth="admin@core.collectionspace.org">
             <method>DELETE</method>
-            <uri>/cspace-services/collectionobjects/${CreateBlackRookWithRelations.CSID}</uri>
+            <uri>/cspace-services/collectionobjects/${CreateBlackRook.CSID}</uri>
         </test>
         <test ID="DeleteBlackQueen" auth="admin@core.collectionspace.org">
             <method>DELETE</method>
index 24773151f60e3cacb14d8bd1310341ff0715c567..a7a875090e74065e4555d682c6c8527a9e08eb89 100644 (file)
         <!-- and its three children: the chess board, and the bags of white -->
         <!-- and black chess pieces -->
         
-        <relation-list-item>
-            <predicate>hasBroader</predicate>
-            <subject>
-                <csid>${chessBoardCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </subject>
-            <object>
-                <csid>${chessSetBoxCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </object>
-        </relation-list-item>
-        
-        <relation-list-item>
-            <predicate>hasBroader</predicate>
-            <subject>
-                <csid>${bagOfWhiteChessPiecesCSID}</csid>
-                <documentType>CollectionObject</documentType>
-           </subject>
-            <object>
-                <csid>${chessSetBoxCSID}</csid>
-                <documentType>CollectionObject</documentType>
-           </object>
-        </relation-list-item>
-        
-        <relation-list-item>
-            <predicate>hasBroader</predicate>
-            <subject>
-                <csid>${bagOfBlackChessPiecesCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </subject>
-            <object>
-                <csid>${chessSetBoxCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </object>
-        </relation-list-item>
-        
-        <!--
-            Create hierarchical relationships between the bags of white 
-            and black chess pieces, and the pieces they contain.
+        <!-- 
+             ${itemCSID} is a convention understood by the Relations service,
+             which is replaced by the CSID of the item being created.  (This
+             applies to all items, including object and procedural records,
+             not just to authority item records).
+             
+             As such, ${itemCSID} does NOT get expanded by XmlReplay. 
+             It passes through, and then the service deals with it.
         -->
-        
-        <relation-list-item>
-            <predicate>hasBroader</predicate>
-            <subject>
-                <csid>${whiteRookCSID}</csid>
-                <documentType>CollectionObject</documentType>
-           </subject>
-            <object>
-                <csid>${bagOfWhiteChessPiecesCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </object>
-        </relation-list-item>
-
-        <relation-list-item>
-            <predicate>hasBroader</predicate>
-            <subject>
-                <csid>${whiteBishopCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </subject>
-            <object>
-                <csid>${bagOfWhiteChessPiecesCSID}</csid>
-                <documentType>CollectionObject</documentType>
-            </object>
-        </relation-list-item>
-
         <relation-list-item>
             <predicate>hasBroader</predicate>
             <subject>
-                <csid>${blackQueenCSID}</csid>
+                <csid>${itemCSID}</csid>
                 <documentType>CollectionObject</documentType>
             </subject>
             <object>
-                <csid>${bagOfBlackChessPiecesCSID}</csid>
+                <csid>${parentCSID}</csid>
                 <documentType>CollectionObject</documentType>
             </object>
         </relation-list-item>
         
-        <!-- The relationship between the bag of black pieces -->
-        <!-- and the black rook is set in a separate payload. -->
-        
     </ns3:relations-common-list>
 </document>
 
index 037092af7c12f27066182c1892dd7dbc31801a13..5be49bd9a5d9df6859da548f4c82813811da0b24 100644 (file)
@@ -7,10 +7,7 @@
         Siblings of the chess board box:
         (none)
     -->
-    <ns3:relations-common-list xmlns:ns3="http://collectionspace.org/services/relation" xmlns:ns2="http://collectionspace.org/services/jaxb">
-        <pageNum>0</pageNum>
-        <itemsInPage>0</itemsInPage>
-        <totalItems>0</totalItems>
-    </ns3:relations-common-list>
+    <!-- Note: the relations-common-list part is NOT returned -->
+    <!-- in calls to showSiblings when there are no matching items. -->
 </document>