]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5677: Added rudimentary initial XmlReplay-based tests of newly-added versionin...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 26 Oct 2012 23:54:14 +0000 (16:54 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 26 Oct 2012 23:54:14 +0000 (16:54 -0700)
services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/movement.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/res/movement-list.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/res/movement.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/versioning.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml

diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/movement.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/movement.xml
new file mode 100644 (file)
index 0000000..fa33e4f
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<document name="movements">
+<ns2:movements_common xmlns:ns2="http://collectionspace.org/services/movement">
+  <currentLocation>${currentLocationValue}</currentLocation>
+  <currentLocationNote>${currentLocationNoteValue}</currentLocationNote>
+</ns2:movements_common>
+</document>
+
+
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/res/movement-list.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/res/movement-list.res.xml
new file mode 100644 (file)
index 0000000..0021996
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">
+    <totalItems>1</totalItems>
+</ns2:abstract-common-list>
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/res/movement.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/res/movement.res.xml
new file mode 100644 (file)
index 0000000..0f230be
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<document name="movements">
+    <ns2:movements_common xmlns:ns2="http://collectionspace.org/services/movement">
+        <currentLocationNote>${currentLocationNoteValue}</currentLocationNote>
+    </ns2:movements_common>
+</document>
+
+
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/versioning.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/versioning/versioning.xml
new file mode 100644 (file)
index 0000000..310f507
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmlReplay>
+  <!-- Authenticate into the lifesci tenant for extension testing -->
+  <auths default="admin@lifesci.collectionspace.org">
+    <auth ID="admin@lifesci.collectionspace.org"
+      >YWRtaW5AbGlmZXNjaS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I=</auth>
+  </auths>
+
+  <testGroup ID="Versioning" autoDeletePOSTS="true">
+  
+    <test ID="CreateMovement" auth="admin@lifesci.collectionspace.org">
+      <method>POST</method>
+      <uri>/cspace-services/movements/</uri>
+      <filename>versioning/movement.xml</filename>
+      <vars>
+        <!-- The currentLocation value should properly be a Storage Location or Organization -->
+        <!-- refName, but for the test-only function served by this temporary record, this -->
+        <!-- value is instead an arbitrary string.  (That string must also be unique among all -->
+        <!-- Movement records for this test to succeed. -->
+        <var ID="currentLocationValue">jlmbsoqtqbfjotldjlmbsoq</var>
+        <var ID="currentLocationNoteValue">old current location note</var>
+      </vars>
+      <expectedCodes>201</expectedCodes>
+    </test>
+    
+    <test ID="UpdateMovement" auth="admin@lifesci.collectionspace.org">
+      <method>PUT</method>
+      <uri>/cspace-services/movements/${CreateMovement.CSID}</uri>
+      <filename>versioning/movement.xml</filename>
+      <vars>
+        <var ID="currentLocationValue">${CreateMovement.currentLocationValue}</var>
+        <var ID="currentLocationNoteValue">new current location note</var>
+      </vars>
+      <expectedCodes>200</expectedCodes>
+    </test>
+    
+    <!-- A keyword search on the current location value should retrieve only one -->
+    <!-- document, even though there are now two documents extant: the current -->
+    <!-- version and one past version, which was created as a result of the update. -->
+    <test ID="SearchReturnsOnlyCurrentVersion">
+      <method>GET</method>
+      <uri>/cspace-services/movements?kw=${CreateMovement.currentLocationValue}</uri>
+      <response>
+        <expected level="ADDOK"/>
+        <filename>versioning/res/movement-list.res.xml</filename>
+      </response>
+    </test>
+    
+    <!-- Retrieving the document via a read (GET) request should also verify that only the -->
+    <!-- current version, containing the most recently updated value(s), is returned. -->
+    <test ID="ReadReturnsOnlyCurrentVersion">
+      <method>GET</method>
+      <uri>/cspace-services/movements/${CreateMovement.CSID}</uri>
+      <vars>
+        <var ID="currentLocationNoteValue">${UpdateMovement.currentLocationNoteValue}</var>
+      </vars>
+      <response>
+        <expected level="ADDOK"/>
+        <filename>versioning/res/movement.res.xml</filename>
+      </response>
+    </test>
+
+  </testGroup>
+
+</xmlReplay>
+
index 415bdba78fdb7ce4d00c56923a56139fb2904052..e5b14a767e7037a93160373212b70a69003601e0 100644 (file)
@@ -41,6 +41,9 @@
     <run controlFile="collectionobject/collectionobject-hierarchy-refname.xml" testGroup="CreateUpdateReadStructuredObjects" />\r
     <run controlFile="collectionobject/collectionobject-displayname-update.xml" testGroup="DisplayNameChangesReflectedInRefNames" />\r
     \r
+    <run controlFile="versioning/versioning.xml" testGroup="Versioning" />\r
+\r
+    \r
     <!-- Broken tests -->\r
     \r
     <!-- After most tests above were re-enabled in August 2012, the Batch test -->\r