From 78b65ccc87ad0faf010c221667ce7f9b339ebbba Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Thu, 13 Sep 2012 18:45:05 -0700 Subject: [PATCH] CSPACE-5518: Completed adding XmlReplay-based tests of structured objects that use refNames ('id' form) to create and update related records, via relations-common-list payloads included in CollectionObjects create and update requests. These test CSID/refName and refName/CSID pairs as subject/object identifiers when creating records, and refName/refName, CSID/refName and refName/CSID pairs when updating records. --- ...ml => collectionobject-hierarchy-csid.xml} | 13 +- .../collectionobject-hierarchy-refname.xml | 522 ++++++++++++++++++ ...object-update-with-parent-child-csids.xml} | 0 ...llectionobject-update-with-parent-csid.xml | 34 -- ...ctionobject-create-with-parent-refname.xml | 42 ++ ...ject-create-with-parent-child-refnames.xml | 60 ++ ...ject-update-with-parent-child-refnames.xml | 73 +++ .../test-data/xmlreplay/xml-replay-master.xml | 3 +- 8 files changed, 706 insertions(+), 41 deletions(-) rename services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/{collectionobject-hierarchy.xml => collectionobject-hierarchy-csid.xml} (98%) create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml rename services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/{5-collectionobject-update-with-parent-child-csids.xml => 4-collectionobject-update-with-parent-child-csids.xml} (100%) delete mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-csid.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/6-collectionobject-create-with-parent-child-refnames.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refnames.xml diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml similarity index 98% rename from services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy.xml rename to services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml index c2683db1b..bd3868c8a 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml @@ -4,14 +4,15 @@ - + - + PUT /cspace-services/collectionobjects/${CreateBlackRook.CSID} - collectionobject/hierarchy/5-collectionobject-update-with-parent-child-csids.xml + collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml This black rook is nearly intact, save for two tiny fragments. ${CreateBlackRook.CSID} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml new file mode 100644 index 000000000..4af2f195b --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml @@ -0,0 +1,522 @@ + + + + + + + + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/1-collectionobject-create.xml + + CSPACE-5518-ChessSetBox + + 201 + + + + + GET + /cspace-services/collectionobjects/${CreateChessSetBox.CSID} + 200 + + + collectionobject/hierarchy/res/collectionobject.res.xml + + ${CreateChessSetBox.objectNumber} + + + + + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml + + CSPACE-5518-ChessBoard + ${CreateChessSetBox.CSID} + ${CreateChessSetBox.objectNumber} + + 201 + + + GET + /cspace-services/collectionobjects/${CreateChessBoard.CSID} + 200 + + + + + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml + + CSPACE-5518-BagOfWhiteChessPieces + ${CreateChessSetBox.CSID} + ${CreateChessSetBox.objectNumber} + + 201 + + + GET + /cspace-services/collectionobjects/${CreateBagOfWhiteChessPieces.CSID} + 200 + + + + + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml + + CSPACE-5518-WhiteRook + ${CreateBagOfWhiteChessPieces.CSID} + ${CreateBagOfWhiteChessPieces.objectNumber} + + 201 + + + GET + /cspace-services/collectionobjects/${CreateWhiteRook.CSID} + 200 + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml + + CSPACE-5518-WhiteBishop + ${CreateBagOfWhiteChessPieces.CSID} + ${CreateBagOfWhiteChessPieces.objectNumber} + + 201 + + + GET + /cspace-services/collectionobjects/${CreateWhiteBishop.CSID} + 200 + + + + + + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/1-collectionobject-create.xml + + CSPACE-5518-BlackQueen + + 201 + + + GET + /cspace-services/collectionobjects/${CreateBlackQueen.CSID} + 200 + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/1-collectionobject-create.xml + + CSPACE-5518-BlackRook + + 201 + + + GET + /cspace-services/collectionobjects/${CreateBlackRook.CSID} + 200 + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/1-collectionobject-create.xml + + CSPACE-5518-BlackRookFragment1 + + 201 + + + GET + /cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID} + 200 + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/1-collectionobject-create.xml + + CSPACE-5518-BlackRookFragment2 + + 201 + + + GET + /cspace-services/collectionobjects/${CreateBlackRookFragment2.CSID} + 200 + + + + + + + + + + + POST + /cspace-services/collectionobjects + collectionobject/hierarchy/6-collectionobject-create-with-parent-child-refnames.xml + + CSPACE-5518-BagOfBlackChessPieces + ${CreateChessSetBox.CSID} + ${CreateChessSetBox.objectNumber} + ${CreateBlackQueen.CSID} + ${CreateBlackQueen.objectNumber} + + + + GET + /cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID} + 200 + + + + + + + + + + PUT + /cspace-services/collectionobjects/${CreateBlackRook.CSID} + collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refNames.xml + + This black rook is nearly intact, save for two tiny fragments. + ${CreateBlackRook.CSID} + ${CreateBlackRook.objectNumber} + ${CreateBagOfBlackChessPieces.CSID} + ${CreateBagOfBlackChessPieces.objectNumber} + ${CreateBlackRookFragment1.CSID} + ${CreateBlackRookFragment1.objectNumber} + ${CreateBlackRookFragment2.CSID} + ${CreateBlackRookFragment2.objectNumber} + + 200 + + + + + + + + + + GET + /cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showRelations=true + + + collectionobject/hierarchy/res/show-relations-top-level.res.xml + + ${CreateChessSetBox.CSID} + ${CreateChessBoard.CSID} + ${CreateBagOfWhiteChessPieces.CSID} + ${CreateBagOfBlackChessPieces.CSID} + + /document/*[local-name()='relations-common-list'] + + 200 + + + + GET + /cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showRelations=true + + + collectionobject/hierarchy/res/show-relations-mid-level.res.xml + + ${CreateChessSetBox.CSID} + ${CreateBagOfBlackChessPieces.CSID} + ${CreateBlackQueen.CSID} + ${CreateBlackRook.CSID} + + /document/*[local-name()='relations-common-list'] + + 200 + + + + GET + /cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showRelations=true + + + collectionobject/hierarchy/res/show-relations-bottom-level.res.xml + + ${CreateBlackRook.CSID} + ${CreateBlackRookFragment1.CSID} + + /document/*[local-name()='relations-common-list'] + + 200 + + + + + + + GET + /cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showSiblings=true + 200 + + + collectionobject/hierarchy/res/show-siblings-top-level.res.xml + /document/*[local-name()='relations-common-list'] + + + + + GET + /cspace-services/collectionobjects/${CreateBagOfBlackChessPieces.CSID}?showSiblings=true + 200 + + + collectionobject/hierarchy/res/show-siblings-mid-level.res.xml + + ${CreateChessSetBox.CSID} + ${CreateChessBoard.CSID} + ${CreateBagOfWhiteChessPieces.CSID} + + /document/*[local-name()='relations-common-list'] + + + + + GET + /cspace-services/collectionobjects/${CreateBlackRookFragment1.CSID}?showSiblings=true + 200 + + + collectionobject/hierarchy/res/show-siblings-bottom-level.res.xml + + ${CreateBlackRook.CSID} + ${CreateBlackRookFragment2.CSID} + + /document/*[local-name()='relations-common-list'] + + + + + + + + GET + /cspace-services/collectionobjects/${CreateChessSetBox.CSID}?showAllRelations=true + 200 + + + collectionobject/hierarchy/res/show-all-relations-top-level.res.xml + /document/*[local-name()='relations-common-list'] + + + + + + + + + + + + + + + + + + + + + GET + /cspace-services/relations?sbj=${CreateChessSetBox.CSID} + 200 + + + collectionobject/hierarchy/res/relations-pagination-header.res.xml + + 0 + + + + + + GET + /cspace-services/relations?obj=${CreateChessSetBox.CSID} + 200 + + + collectionobject/hierarchy/res/relations-as-object-top-level.res.xml + + ${CreateChessSetBox.CSID} + ${CreateChessBoard.CSID} + ${CreateBagOfWhiteChessPieces.CSID} + ${CreateBagOfBlackChessPieces.CSID} + + /document/*[local-name()='relations-common-list'] + + + + + + + + + GET + /cspace-services/relations?obj=${CreateChessSetBox.CSID} + 200 + + + DELETE + /cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[1]/csid")} + + + DELETE + /cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[2]/csid")} + + + DELETE + /cspace-services/relations/${GetRelationsToChessSetBoxAsObject.got("//relation-list-item[3]/csid")} + + + + + + GET + /cspace-services/relations?obj=${CreateBagOfWhiteChessPieces.CSID} + 200 + + + DELETE + /cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[1]/csid")} + + + DELETE + /cspace-services/relations/${GetRelationsToBagOfWhiteChessPiecesAsObject.got("//relation-list-item[2]/csid")} + + + + + + GET + /cspace-services/relations?obj=${CreateBagOfBlackChessPieces.CSID} + 200 + + + DELETE + /cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[1]/csid")} + + + DELETE + /cspace-services/relations/${GetRelationsToBagOfBlackChessPiecesAsObject.got("//relation-list-item[2]/csid")} + + + + + + GET + /cspace-services/relations?obj=${CreateBlackRook.CSID} + 200 + + + DELETE + /cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[1]/csid")} + + + DELETE + /cspace-services/relations/${GetRelationsToBlackRookAsObject.got("//relation-list-item[2]/csid")} + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/5-collectionobject-update-with-parent-child-csids.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml similarity index 100% rename from services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/5-collectionobject-update-with-parent-child-csids.xml rename to services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-csid.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-csid.xml deleted file mode 100644 index 52a19209b..000000000 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-csid.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - ${objectNumber} - ${distinguishingFeatures} - - - - - - - - hasBroader - - ${blackRookCSID} - CollectionObject - - - ${bagOfBlackChessPiecesCSID} - CollectionObject - - - - - - - diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml new file mode 100644 index 000000000..793ab41d0 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/5-collectionobject-create-with-parent-refname.xml @@ -0,0 +1,42 @@ + + + + + ${objectNumber} + + + + + + + + + + + + ${itemCSID} + CollectionObject + + + hasBroader + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${parentCSID})'${parentObjectNumber}' + CollectionObject + + + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/6-collectionobject-create-with-parent-child-refnames.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/6-collectionobject-create-with-parent-child-refnames.xml new file mode 100644 index 000000000..aaadd9d89 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/6-collectionobject-create-with-parent-child-refnames.xml @@ -0,0 +1,60 @@ + + + + + ${objectNumber} + + + + + + + + + + + + + + ${itemCSID} + CollectionObject + + + hasBroader + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${parentCSID})'${parentObjectNumber}' + CollectionObject + + + + + + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${childCSID})'${childObjectNumber}' + CollectionObject + + + hasBroader + + + ${itemCSID} + CollectionObject + + + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refnames.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refnames.xml new file mode 100644 index 000000000..dee12f791 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refnames.xml @@ -0,0 +1,73 @@ + + + + + ${objectNumber} + ${distinguishingFeatures} + + + + + + + + + + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${currentItemCSID})'${currentItemObjectNumber}' + CollectionObject + + + hasBroader + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${parentCSID})'${parentObjectNumber}' + CollectionObject + + + + + + + + + ${child1CSID} + CollectionObject + + + hasBroader + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${currentItemCSID})'${currentItemObjectNumber}' + CollectionObject + + + + + + + + + urn:cspace:core.collectionspace.org:collectionobjects:id(${child2CSID})'${child2ObjectNumber}' + CollectionObject + + + hasBroader + + + ${currentItemCSID} + CollectionObject + + + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml index 64bc4a853..59d7377db 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml @@ -37,7 +37,8 @@ - + + -- 2.47.3