<!-- This tests the UpdateObjectLocationBatchJob -->\r
\r
<testGroup ID="testSingleRecordBatchUpdate" autoDeletePOSTS="true">\r
+ \r
+ <!-- Tests with CollectionObject->Movement relations -->\r
\r
<test ID="createBatchRecord">\r
<method>POST</method>\r
<expectedCodes>201</expectedCodes>\r
</test>\r
\r
- <test ID="relateMovement1ToCollectionObject">\r
+ <test ID="relateCollectionObjectToMovement1">\r
<method>POST</method>\r
<uri>/cspace-services/relations</uri>\r
<filename>batch/relation.xml</filename>\r
<expectedCodes>201</expectedCodes>\r
</test>\r
\r
- <test ID="relateMovement2ToCollectionObject">\r
+ <test ID="relateCollectionObjectToMovement2">\r
<method>POST</method>\r
<uri>/cspace-services/relations</uri>\r
<filename>batch/relation.xml</filename>\r
<expectedCodes>201</expectedCodes>\r
</test>\r
\r
- <test ID="relateMovement3ToCollectionObject">\r
+ <test ID="relateCollectionObjectToMovement3">\r
<method>POST</method>\r
<uri>/cspace-services/relations</uri>\r
<filename>batch/relation.xml</filename>\r
<!-- computedCurrentLocation field in the CollectionObject record has -->\r
<!-- been updated to the appropriate value, reflecting the most recent -->\r
<!-- movement (e.g. the Movement record with the most recent locationDate). -->\r
- <test ID="readUpdatedCollectionObjectRecord1">\r
+ <test ID="readUpdatedCollectionObjectRecord">\r
<method>GET</method>\r
<uri>/cspace-services/collectionobjects/${createCollectionObject.CSID}</uri>\r
<filename>batch/updateobjloc.xml</filename>\r
<expectedCodes>200</expectedCodes>\r
</test>\r
\r
+ <!-- Tests with Movement->CollectionObject relations -->\r
+ \r
<!-- The currentLocation value of this new Movement record, which now -->\r
<!-- has the most recent locationDate value, should thus be -->\r
<!-- reflected in the computedCurrentLocation value in the -->\r
<expectedCodes>201</expectedCodes>\r
</test>\r
\r
- <!-- Represents a reversal of the (subject-object) direction of the relationship -->\r
- <test ID="relateCollectionObjectToMovement4">\r
+ <!-- Note that this payload reflects a reversal of the subject-object directionality -->\r
+ <!-- of the relationship: this is a Movement->CollectionObject relationship, -->\r
+ <!-- rather than a CollectionObject->Movement relationship. -->\r
+ <test ID="relateMovement4ToCollectionObject">\r
<method>POST</method>\r
<uri>/cspace-services/relations</uri>\r
<filename>batch/relation.xml</filename>\r
<expectedCodes>200</expectedCodes>\r
</test>\r
\r
- <!--\r
<test ID="readUpdatedCollectionObjectRecordAfterAddingReverseRelation">\r
<method>GET</method>\r
<uri>/cspace-services/collectionobjects/${createCollectionObject.CSID}</uri>\r
</response>\r
<expectedCodes>200</expectedCodes>\r
</test>\r
- -->\r
\r
</testGroup>\r
\r
logger.info("Identified " + relatedMovements.getTotalItems()
+ " movement records related to CollectionObject record " + csid);
}
- if (relatedMovements.getTotalItems() == 0) {
- // continue;
- }
- // FIXME: Get the reciprocal relation records, via rtSbj=, as well,
- // and remove duplicates
+ // FIXME: Get relation records in the reverse direction as well,
+ // via rtSbj=, merge with records obtained above, and remove duplicates
- // FIXME Temporary for testing, until we integrate the two list results
queryString = "rtSbj=" + csid;
uri = new URI(null, null, null, queryString, null);
uriInfo = createUriInfo(uri.getRawQuery());
- relatedMovements = movementResource.getList(uriInfo);
+ AbstractCommonList reverseRelatedMovements = movementResource.getList(uriInfo);
if (logger.isInfoEnabled()) {
- logger.info("Identified " + relatedMovements.getTotalItems()
- + " movement records related to CollectionObject record " + csid);
+ logger.info("Identified " + reverseRelatedMovements.getTotalItems()
+ + " movement records related in the reverse to CollectionObject record " + csid);
}
- if (relatedMovements.getTotalItems() == 0) {
+
+ if ((relatedMovements.getTotalItems() == 0) && reverseRelatedMovements.getTotalItems() == 0) {
continue;
}
+
+ // Merge the two lists
+ relatedMovements.getListItem().addAll(reverseRelatedMovements.getListItem());
// Get the latest movement record from among those, and extract
// its current location value