]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-573 Added tests to test the new order field, to ensure that this order field...
authorLaramie Crocker <laramie@berkeley.edu>
Wed, 1 Jun 2011 00:49:33 +0000 (00:49 +0000)
committerLaramie Crocker <laramie@berkeley.edu>
Wed, 1 Jun 2011 00:49:33 +0000 (00:49 +0000)
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/ServiceResult.java
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplay.java
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayEval.java
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayReport.java
services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-all.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/1-vocab.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/2-item.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/res/GetVocabularyItems.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml

index 26b877cec8ff4d56610f55cda102ab6708f8d634..77a93ea08d0d3cd432d36a7a84170ea31e58a1ab 100755 (executable)
@@ -57,6 +57,7 @@ public class ServiceResult {
     public String payloadStrictness = "";\r
     public long contentLength = 0;\r
     public String failureReason = "";\r
+    public String expectedContentExpanded = "";\r
     public Header[] responseHeaders = new Header[0];\r
     public List<Integer> expectedCodes = new ArrayList<Integer>();\r
     public Map<String,String>  vars = new HashMap<String,String>();\r
index ebf19c30e36e457a736b8f2602aa9c05f321d6a4..41c18d30c2029ca11c7c2e57a2711adf97e8bba4 100755 (executable)
@@ -413,6 +413,7 @@ public class XmlReplay {
         String expectedPartContent = new String(b);\r
         Map<String,String> vars = expectedResponseParts.varsList.get(0);  //just one part, so just one varsList.  Must be there, even if empty.\r
         expectedPartContent = evalStruct.eval(expectedPartContent, serviceResultsMap, vars, evalStruct.jexl, evalStruct.jc);\r
+        serviceResult.expectedContentExpanded = expectedPartContent;\r
         String label = "NOLABEL";\r
         String leftID  = "{from expected part, label:"+label+" filename: "+expectedResponseParts.responseFilename+"}";\r
         String rightID = "{from server, label:"+label\r
index bd34f2fa4b00494ce708794830ccaf1ae909449b..7e482471e7916cf9e2eeec9f2af6122d5028e9e5 100755 (executable)
@@ -72,6 +72,7 @@ public class XmlReplayEval {
                     String key = entry.getKey();\r
                     try {\r
                         value = parse(value, jexl, jc);\r
+                        vars.put(key, value); //replace template value with actual value.\r
                     } catch (Exception e){\r
                         value = "ERROR: "+e;\r
                     }\r
index 14485619666a1c0d6a42aa554847b78dcdcf5f44..6bbdb80ff67f5178accfa679eb08118313fa5431 100644 (file)
@@ -196,6 +196,7 @@ public class XmlReplayReport {
         appendPayload(fb, serviceResult.requestPayload, "REQUEST", "REQUEST" + tocID);
         appendPayload(fb, serviceResult.requestPayloadsRaw, "REQUEST (RAW)", "REQUESTRAW" + tocID);
         appendPayload(fb, serviceResult.result, "RESPONSE", "RESPONSE" + tocID);
+        appendPayload(fb, serviceResult.expectedContentExpanded, "EXPECTED", "EXPECTED" + tocID);
         fb.append(BR);
 
         return fb.toString();
index d4bc7a2b0c845379424eb7e961f542a599e9c6c5..a3850b9fac20f7f9f67b93cafc298c6056afa692 100644 (file)
     <run controlFile="organization/organization-hierarchy.xml" testGroup="HierarchicOrganization" />\r
     <run controlFile="location/location-hierarchy.xml" testGroup="HierarchicLocation" />\r
     <run controlFile="person/person.xml" testGroup="PersonAddRelsDeleteRels" />\r
+    <run controlFile="location/location-2-authorities.xml" testGroup="HierarchicLocation" />\r
+    <run controlFile="location/location-mixed-hierarchy.xml" testGroup="HierarchicLocation" />\r
+    <run controlFile="batch/batch.xml" />\r
+    <run controlFile="vocabulary/vocabulary.xml" testGroup="TestOrder" />\r
     \r
 </xmlReplayMaster>\r
 \r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/1-vocab.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/1-vocab.xml
new file mode 100644 (file)
index 0000000..a53be47
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document name="vocabularies">
+  <ns3:vocabularies_common xmlns:ns3="http://collectionspace.org/services/vocabulary"
+  xmlns:ns2="http://collectionspace.org/services/jaxb">
+    <displayName>TestOrder Vocabulary</displayName>
+    <shortIdentifier>TestOrderVocab</shortIdentifier>
+    <refName>
+    urn:cspace:org.collectionspace.demo:vocabulary:name(TestOrderVocab)'TestOrder Vocabulary'</refName>
+    <vocabType>enum</vocabType>
+  </ns3:vocabularies_common>
+</document>
+
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/2-item.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/2-item.xml
new file mode 100644 (file)
index 0000000..e1a48f8
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document name="vocabularyitems">
+  <ns3:vocabularyitems_common xmlns:ns3="http://collectionspace.org/services/vocabulary"
+  xmlns:ns2="http://collectionspace.org/services/jaxb">
+    <displayName>${displayName}</displayName>
+    <shortIdentifier>${itemID}</shortIdentifier>
+    <refName>urn:cspace:org.collectionspace.demo:vocabulary:name(TestOrderVocab):item:name(${itemID})'${displayName}'</refName>
+    <order>${order}</order>
+  </ns3:vocabularyitems_common>
+</document>
+
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/res/GetVocabularyItems.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/res/GetVocabularyItems.res.xml
new file mode 100644 (file)
index 0000000..f8c7874
--- /dev/null
@@ -0,0 +1,31 @@
+<ns3:vocabularyitems-common-list xmlns:ns3="http://collectionspace.org/services/vocabulary" xmlns:ns2="http://collectionspace.org/services/jaxb">
+    <!-- This test result is dependent on test group vocabulary/vocabulary.xml::TestOrder
+         and the vars defined there.  
+         Do not use this expected result with any other tests.
+    -->
+       <pageNum>0</pageNum>
+    <itemsInPage>3</itemsInPage>
+    <totalItems>3</totalItems>
+    <fieldsReturned>displayName|refName|shortIdentifier|order|uri|csid</fieldsReturned>
+    <vocabularyitem_list_item>
+        <displayName>${Item3DupeOrder.displayName}</displayName>
+        <shortIdentifier>${Item3DupeOrder.itemID}</shortIdentifier>
+        <order>${Item3DupeOrder.order}</order>
+        <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item3DupeOrder.CSID}</uri>
+        <csid>${Item3DupeOrder.CSID}</csid>
+    </vocabularyitem_list_item>
+    <vocabularyitem_list_item>
+        <displayName>${Item2.displayName}</displayName>
+        <shortIdentifier>${Item2.itemID}</shortIdentifier>
+        <order>${Item2.order}</order>
+        <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item2.CSID}</uri>
+        <csid>${Item2.CSID}</csid>
+    </vocabularyitem_list_item>
+    <vocabularyitem_list_item>
+        <displayName>${Item1.displayName}</displayName>
+        <shortIdentifier>${Item1.itemID}</shortIdentifier>
+        <order>${Item1.order}</order>
+        <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item1.CSID}</uri>
+        <csid>${Item1.CSID}</csid>
+    </vocabularyitem_list_item>
+</ns3:vocabularyitems-common-list>
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml
new file mode 100644 (file)
index 0000000..8b22814
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmlReplay>
+       <auths>
+               <!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->
+               <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>
+               <auth ID="testAdministator">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>
+       </auths>
+       <testGroup ID="TestOrder" autoDeletePOSTS="true">
+        <!-- The purpose of this testGroup is to test the new "order" field
+             that was added in http://issues.collectionspace.org/browse/CSPACE-573
+             and to ensure that this order field is returned in list results, 
+             and that duplicate values for the order field is accepted.
+           -->
+               <test ID="Vocabulary1" auth="test">
+                       <method>POST</method>
+                       <uri>/cspace-services/vocabularies/</uri>
+                       <filename>vocabulary/1-vocab.xml</filename>
+               </test>
+               <test ID="Item1" auth="test">
+                       <method>POST</method>
+                       <uri>/cspace-services/vocabularies/${Vocabulary1.CSID}/items/</uri>
+                       <filename>vocabulary/2-item.xml</filename>
+                       <vars>
+                               <var ID="itemID">VocabItem1</var>
+                               <var ID="order">1</var>
+                               <var ID="displayName">TestOrder item ${itemID} order ${order}</var>
+                       </vars>
+               </test>
+               <test ID="Item2" auth="test">
+                       <method>POST</method>
+                       <uri>/cspace-services/vocabularies/${Vocabulary1.CSID}/items/</uri>
+                       <filename>vocabulary/2-item.xml</filename>
+                       <vars>
+                               <var ID="itemID">VocabItem2</var>
+                               <var ID="order">2</var>
+                               <var ID="displayName">TestOrder item ${itemID} order ${order}</var>
+                       </vars>
+               </test>
+               <test ID="Item3DupeOrder" auth="test">
+                       <method>POST</method>
+                       <uri>/cspace-services/vocabularies/${Vocabulary1.CSID}/items/</uri>
+                       <filename>vocabulary/2-item.xml</filename>
+                       <vars>
+                               <var ID="itemID">VocabItem3</var>
+                               <var ID="order">1</var>
+                               <var ID="displayName">TestOrder item ${itemID} order ${order}</var>
+                       </vars>
+               </test>
+               
+               <test ID="GetVocabularies" auth="admin@collectionspace.org">
+            <method>GET</method>
+            <uri>/cspace-services/vocabularies/</uri>
+        </test>
+        
+        <test ID="GetVocabularyItems" auth="admin@collectionspace.org">
+            <method>GET</method>
+            <uri>/cspace-services/vocabularies/${Vocabulary1.CSID}/items/</uri>
+            <response>
+                <expected level="ADDOK" />
+                <filename>vocabulary/res/GetVocabularyItems.res.xml</filename>
+                <vars>
+                                       <var ID="I3displayName">${Item3DupeOrder.displayName}</var>
+                               </vars>
+                <!--<startElement>//vocabulary-list-item[./exitNumber='checkList-1234']</startElement>-->
+             </response>
+        </test>
+               
+       </testGroup>
+</xmlReplay>
+
index fdd89e3da6336d3129fe378a95cb600bbb229a93..6b29eeb880d3dbcb92892275cc785c0278e4e97f 100755 (executable)
@@ -46,8 +46,8 @@
     <run controlFile="person/person.xml" testGroup="PersonAddRelsDeleteRels" />\r
     <run controlFile="location/location-hierarchy.xml" testGroup="HierarchicLocation" />\r
     <run controlFile="organization/organization-hierarchy.xml" testGroup="HierarchicOrganization" />\r
-               <run controlFile="batch/batch.xml" />\r
-        \r
+    <run controlFile="batch/batch.xml" />\r
+    <run controlFile="vocabulary/vocabulary.xml" testGroup="TestOrder" />\r
     \r
     \r
 </xmlReplayMaster>\r