]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5024: Simplified response files, added location vocabulary tests (currently...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 20 Apr 2012 20:50:14 +0000 (13:50 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 20 Apr 2012 20:50:14 +0000 (13:50 -0700)
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/locationitem.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/keywordSearchAuthorityItems1.res.xml [deleted file]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/keywordSearchAuthorityItems2.res.xml [deleted file]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationauthorityWord1.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/partialTermSearchAuthorityItems1.res.xml [deleted file]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/partialTermSearchAuthorityItems2.res.xml [deleted file]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personauthorityWord1.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personauthorityWord2.res.xml [new file with mode: 0644]

index a04bc107bc015f0eeb216dd9aba13327801fc321..a9ad6275d5249a6641e05be647e6a0eab55dd1b9 100644 (file)
         <!--
             Create three new vocabularies: two in the Person Authority,
             and one in the Storage Location Authority.
-        -->
+       
+       -->
         <test ID="createPersonAuthority1">
             <expectedCodes>201</expectedCodes>
             <method>POST</method>
             <uri>/cspace-services/personauthorities</uri>
             <filename>authority/personauthority.xml</filename>
             <vars>
-                <var ID="identifier1">jlmbsoq</var>
-                <var ID="identifier2">tqbfjotld</var>
-                <var ID="identifier1PartialTerm">jlmb</var>
-                <var ID="identifier2PartialTerm">tqbf</var>
-                <var ID="authDisplayName">${identifier1}</var>
-                <var ID="authShortIdentifier">${identifier1}</var>
-           </vars>
+                <!-- Nonsense words (terms, strings, tokens ...) to build short -->
+                <!-- identifiers and display names, and to populate text field(s). -->
+                <var ID="word1">jlmbsoq</var>
+                <var ID="word2">tqbfjotld</var>
+                <!-- Partial term searches using one or more of those words. -->
+                <var ID="word1PartialTermStem">jlmb</var>
+                <var ID="word2PartialTermStem">tqbf</var>
+                <var ID="word2PartialTermMid">fjotl</var>
+                <!-- Populate the current record with those words. -->
+                <var ID="authDisplayName">${word1}auth1</var>
+                <var ID="authShortIdentifier">${word1}auth2</var>
+            </vars>
         </test>
-
         <test ID="createPersonAuthority2">
             <expectedCodes>201</expectedCodes>
             <method>POST</method>
             <uri>/cspace-services/personauthorities</uri>
             <filename>authority/personauthority.xml</filename>
             <vars>
-                <var ID="authDisplayName">${createPersonAuthority1.identifier2}</var>
-                <var ID="authShortIdentifier">${createPersonAuthority1.identifier2}</var>
+                <var ID="authDisplayName">${createPersonAuthority1.word2}auth2</var>
+                <var ID="authShortIdentifier">${createPersonAuthority1.word2}auth2</var>
             </vars>
         </test>
                 
             <uri>/cspace-services/locationauthorities</uri>
             <filename>authority/locationauthority.xml</filename>
             <vars>
-                <var ID="authDisplayName">${createPersonAuthority1.identifier1}</var>
-                <var ID="authShortIdentifier">${createPersonAuthority1.identifier1}</var>
+                <var ID="authDisplayName">${createPersonAuthority1.word1}auth1</var>
+                <var ID="authShortIdentifier">${createPersonAuthority1.word1}auth2</var>
             </vars>
         </test>
         
         <!-- Create at least one item in each of those vocabularies. -->
         
-        <!-- Create two items in the first Person Authority -->
-        
-        <test ID="createPersonItem1" auth="test">
+        <!-- Create two items in the first vocabulary in the Person Authority -->
+        <test ID="createPersonItem1">
             <expectedCodes>201</expectedCodes>
             <method>POST</method>
             <uri>/cspace-services/personauthorities/${createPersonAuthority1.CSID}/items</uri>
             <filename>authority/personitem.xml</filename>
             <vars>
-                <var ID="itemDisplayName">${createPersonAuthority1.identifier2} ${createPersonAuthority1.identifier1}</var>
-                <var ID="itemShortIdentifier">${createPersonAuthority1.identifier1}1</var>
-            </vars>
+                <var ID="itemDisplayName">${createPersonAuthority1.word2} ${createPersonAuthority1.word1}</var>
+                <var ID="itemShortIdentifier">${createPersonAuthority1.word1}item1</var>
+           </vars>
         </test>
-        <test ID="createPersonItem2" auth="test">
+        <test ID="createPersonItem2">
             <expectedCodes>201</expectedCodes>
             <method>POST</method>
             <uri>/cspace-services/personauthorities/${createPersonAuthority1.CSID}/items</uri>
             <filename>authority/personitem.xml</filename>
             <vars>
-                <var ID="itemDisplayName">${createPersonAuthority1.identifier1}</var>
-                <var ID="itemShortIdentifier">${createPersonAuthority1.identifier1}2</var>
+                <var ID="itemDisplayName">${createPersonAuthority1.word1}</var>
+                <var ID="itemShortIdentifier">${createPersonAuthority1.word1}item2</var>
             </vars>
         </test>
         
-        <!-- Create one item in the second Person Authority -->
-        <test ID="createPersonItem3" auth="test">
+        <!-- Create one item in the second vocabulary in the Person Authority -->
+        <test ID="createPersonItem3">
             <expectedCodes>201</expectedCodes>
             <method>POST</method>
             <uri>/cspace-services/personauthorities/${createPersonAuthority2.CSID}/items</uri>
             <filename>authority/personitem.xml</filename>
             <vars>
-                <var ID="itemDisplayName">${createPersonAuthority1.identifier1} ${createPersonAuthority1.identifier2}</var>
-                <var ID="itemShortIdentifier">${createPersonAuthority1.identifier1}3</var>
+                <var ID="itemDisplayName">${createPersonAuthority1.word1} ${createPersonAuthority1.word2}</var>
+                <var ID="itemShortIdentifier">${createPersonAuthority1.word1}item3</var>
             </vars>
         </test>
                 
-        <!-- Create one item in the Location Authority -->
-        <test ID="createLocationItem" auth="test">
+        <!-- Create one item in a vocabulary in the Location Authority -->
+        <test ID="createLocationItem1">
             <expectedCodes>201</expectedCodes>
             <method>POST</method>
             <uri>/cspace-services/locationauthorities/${createLocationAuthority.CSID}/items</uri>
             <filename>authority/locationitem.xml</filename>
             <vars>
-                <var ID="itemDisplayName">${createPersonAuthority1.identifier1} ${createPersonAuthority1.identifier2}</var>
-                <var ID="itemShortIdentifier">${createPersonAuthority1.identifier1}</var>
+                <var ID="itemDisplayName">${createPersonAuthority1.word1} ${createPersonAuthority1.word2}</var>
+                <var ID="itemShortIdentifier">${createPersonAuthority1.word1}item1</var>
             </vars>
         </test>
         
             expected items were returned by each search.
         -->
         
-        <!-- Keyword search -->
-        <test ID="keywordSearchAuthorityItems1">
+        <!-- Keyword searches -->
+        
+        <!-- On first word -->
+        <test ID="kwSearchPersonItems1">
             <expectedCodes>200</expectedCodes>
             <method>GET</method>
-            <uri>/cspace-services/personauthorities/_ALL_/items?kw=${createPersonAuthority1.identifier1}</uri>
-            <vars>
-                <var ID="shortIdentifierBase">${createPersonAuthority1.identifier1}</var>
-            </vars>
+            <uri>/cspace-services/personauthorities/_ALL_/items?kw=${createPersonAuthority1.word1}</uri>
             <response>
                 <expected level="TEXT"/>
-                <filename>authority/res/keywordSearchAuthorityItems1.res.xml</filename>
+                <filename>authority/res/personauthorityWord1.res.xml</filename>
             </response>
         </test>
-         <test ID="keywordSearchAuthorityItems2">
+        <!-- On second word -->
+        <test ID="kwSearchPersonItems2">
             <expectedCodes>200</expectedCodes>
             <method>GET</method>
-            <uri>/cspace-services/personauthorities/_ALL_/items?kw=${createPersonAuthority1.identifier2}</uri>
-            <vars>
-                <var ID="shortIdentifierBase">${createPersonAuthority1.identifier1}</var>
-            </vars>
+            <uri>/cspace-services/personauthorities/_ALL_/items?kw=${createPersonAuthority1.word2}</uri>
             <response>
                 <expected level="TEXT"/>
-                <filename>authority/res/keywordSearchAuthorityItems2.res.xml</filename>
+                <filename>authority/res/personauthorityWord2.res.xml</filename>
             </response>
         </test>
         
-        <!-- Partial term search -->
-        <test ID="partialTermSearchAuthorityItems">
+        <!-- Partial term searches -->
+        
+        <!-- Stem matching on first word -->
+        <test ID="ptStemSearchPersonItems">
             <expectedCodes>200</expectedCodes>
             <method>GET</method>
-            <uri>/cspace-services/personauthorities/_ALL_/items?pt=${createPersonAuthority1.identifier2PartialTerm}</uri>
+            <uri>/cspace-services/personauthorities/_ALL_/items?pt=${createPersonAuthority1.word1PartialTermStem}</uri>
             <response>
                 <expected level="TEXT"/>
-                <filename>authority/res/partialTermSearchAuthorityItems1.res.xml</filename>
+                <filename>authority/res/personauthorityWord1.res.xml</filename>
+            </response>
+        </test>
+        <!-- Stem matching on second word -->
+        <test ID="ptStemSearchPersonItems">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/personauthorities/_ALL_/items?pt=${createPersonAuthority1.word2PartialTermStem}</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/personauthorityWord2.res.xml</filename>
+            </response>
+        </test>
+        <!-- Middle-of-term matching on second word -->
+        <test ID="ptMiddleSearchPersonItems">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/personauthorities/_ALL_/items?pt=${createPersonAuthority1.word2PartialTermMid}</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/personauthorityWord2.res.xml</filename>
             </response>
         </test>
-        -->
                 
         <!-- Advanced search -->
+        
+        <!-- On first word -->
+        <test ID="advSearchPersonItems1">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/personauthorities/_ALL_/items?as=persons_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/personauthorityWord1.res.xml</filename>
+            </response>
+        </test>
+        <!-- On second word -->
+        <test ID="advSearchPersonItems2">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/personauthorities/_ALL_/items?as=persons_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.word2}%25%27</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/personauthorityWord2.res.xml</filename>
+            </response>
+        </test>
+        <!-- In a field other than display name -->
+        <test ID="advSearchPersonItems3">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/personauthorities/_ALL_/items?as=persons_common%3AforeName%20ILIKE%20%27%25${createPersonAuthority1.word2}%25%27</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/personauthorityWord2.res.xml</filename>
+            </response>
+        </test>
+        
+        <!-- Verify that tests work in an authority other than Person Authority -->
+        
         <!--
-        <test ID="advancedTermSearchAuthorityItems">
+        <test ID="kwSearchLocationItems">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/locationauthorities/_ALL_/items?kw=${createPersonAuthority1.word1}</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/locationauthorityWord1.res.xml</filename>
+            </response>
+        </test>
+        <test ID="ptStemSearchLocationItems">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/locationauthorities/_ALL_/items?pt=${createPersonAuthority1.word1PartialTermStem}</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/locationauthorityWord1.res.xml</filename>
+            </response>
+        </test>
+         <test ID="advSearchLocationItems">
+            <expectedCodes>200</expectedCodes>
+            <method>GET</method>
+            <uri>/cspace-services/locationauthorities/_ALL_/items?as=locations_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27</uri>
+            <response>
+                <expected level="TEXT"/>
+                <filename>authority/res/locationauthorityWord1.res.xml</filename>
+            </response>
+        </test>   
+        <test ID="advSearchLocationItems">
             <expectedCodes>200</expectedCodes>
             <method>GET</method>
-            <uri>/cspace-services/authorities/_ALL_/items?as=persons_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.name1}%25%27</uri>
+            <uri>/cspace-services/locationauthorities/_ALL_/items?as=locations_common%3Adescription%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27</uri>
             <response>
-                <expected level="ADDOK"/>
-                <filename>authority/res/advancedSearchAuthorityItems.res.xml</filename>
+                <expected level="TEXT"/>
+                <filename>authority/res/locationauthorityWord1.res.xml</filename>
             </response>
         </test>
         -->
index a26181039205015737dd07eec61e7d45fb03ef76..c5a13e2fc155e0096549a6022e091a8f4e6419fe 100644 (file)
@@ -3,7 +3,7 @@
     <ns2:locations_common xmlns:ns2="http://collectionspace.org/services/location" xmlns:ns3="http://collectionspace.org/services/jaxb">
         <displayName>${itemDisplayName}</displayName>
         <shortIdentifier>${itemShortIdentifier}</shortIdentifier>
-        <description>This is a test Location Authority item.</description>
+        <description>This is a test Location Authority item, whose description contains: ${itemDisplayName}</description>
     </ns2:locations_common>
 </document>
 
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/keywordSearchAuthorityItems1.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/keywordSearchAuthorityItems1.res.xml
deleted file mode 100644 (file)
index f3555df..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
-<totalItems>3</totalItems>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}1</shortIdentifier>\r
-</list-item>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}2</shortIdentifier>\r
-</list-item>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}3</shortIdentifier>\r
-</list-item>\r
-</ns2:abstract-common-list>\r
-\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/keywordSearchAuthorityItems2.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/keywordSearchAuthorityItems2.res.xml
deleted file mode 100644 (file)
index b875b94..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
-<totalItems>2</totalItems>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}1</shortIdentifier>\r
-</list-item>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}3</shortIdentifier>\r
-</list-item>\r
-</ns2:abstract-common-list>\r
-\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationauthorityWord1.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationauthorityWord1.res.xml
new file mode 100644 (file)
index 0000000..f297cec
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <totalItems>1</totalItems>\r
+    <list-item>\r
+        <shortIdentifier>${createPersonAuthority1.word1}item1</shortIdentifier>\r
+    </list-item>\r
+</ns2:abstract-common-list>\r
+\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/partialTermSearchAuthorityItems1.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/partialTermSearchAuthorityItems1.res.xml
deleted file mode 100644 (file)
index b875b94..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
-<totalItems>2</totalItems>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}1</shortIdentifier>\r
-</list-item>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}3</shortIdentifier>\r
-</list-item>\r
-</ns2:abstract-common-list>\r
-\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/partialTermSearchAuthorityItems2.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/partialTermSearchAuthorityItems2.res.xml
deleted file mode 100644 (file)
index a5f533d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
-<totalItems>1</totalItems>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}1</shortIdentifier>\r
-</list-item>\r
-<list-item>\r
-    <shortIdentifier>${createPersonAuthority1.identifier1}3</shortIdentifier>\r
-</list-item>\r
-</ns2:abstract-common-list>\r
-\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personauthorityWord1.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personauthorityWord1.res.xml
new file mode 100644 (file)
index 0000000..5a5e13d
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <totalItems>3</totalItems>\r
+    <!--\r
+      Note that tests verifying this specific response may fail if the order\r
+      of list items below - which assumes reverse chronological order by\r
+      update timestamp (collectionspace_core:updatedAt) - changes.\r
+    -->\r
+    <list-item>\r
+        <shortIdentifier>${createPersonAuthority1.word1}item3</shortIdentifier>\r
+    </list-item>\r
+    <list-item>\r
+        <shortIdentifier>${createPersonAuthority1.word1}item2</shortIdentifier>\r
+    </list-item>\r
+    <list-item>\r
+        <shortIdentifier>${createPersonAuthority1.word1}item1</shortIdentifier>\r
+    </list-item>\r
+</ns2:abstract-common-list>\r
+\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personauthorityWord2.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personauthorityWord2.res.xml
new file mode 100644 (file)
index 0000000..ed45b35
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <totalItems>2</totalItems>\r
+    <!--\r
+      Note that tests verifying this specific response may fail if the order\r
+      of list items below - which assumes reverse chronological order by\r
+      update timestamp (collectionspace_core:updatedAt) - changes.\r
+    -->\r
+    <list-item>\r
+        <shortIdentifier>${createPersonAuthority1.word1}item3</shortIdentifier>\r
+    </list-item>\r
+    <list-item>\r
+        <shortIdentifier>${createPersonAuthority1.word1}item1</shortIdentifier>\r
+    </list-item>\r
+</ns2:abstract-common-list>\r
+\r