]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3237: Added minimal test verifying that data enclosed in double-quotes can...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 4 Feb 2011 00:50:25 +0000 (00:50 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 4 Feb 2011 00:50:25 +0000 (00:50 +0000)
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/collectionobject/client/src/test/resources/test-data/cspace-3237-double-quotes.xml [new file with mode: 0644]

index d4be6c1658d9ea7886e399818630f929f76aec3e..07ffd2ef6c6613a3c3f4432416f25e4045a35a43 100644 (file)
@@ -218,6 +218,31 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         Assert.assertTrue(descriptions.size() > 0);
     }
 
+     // Verify that values are preserved when enclosed in double quote marks.
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+        dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace3237group"})
+    public void doubleQuotesEnclosingFieldContents(String testName) throws Exception {
+        if (logger.isDebugEnabled()) {
+            logger.debug(testBanner(testName, CLASS_NAME));
+        }
+        String newId =
+            createFromXmlFile(testName, "./test-data/cspace-3237-double-quotes.xml", true);
+        CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId);
+
+        Assert.assertTrue(collectionObject.getDistinguishingFeatures().matches("^\\\".+?\\\""));
+
+        BriefDescriptionList descriptionList = collectionObject.getBriefDescriptions();
+        List<String> descriptions = descriptionList.getBriefDescription();
+        Assert.assertTrue(descriptions.size() > 0);
+        Assert.assertNotNull(descriptions.get(0));
+        Assert.assertTrue(descriptions.get(0).matches("^\\\".+?\\\""));
+
+        if (logger.isDebugEnabled()) {
+            logger.debug(objectAsXmlString(collectionObject,
+                    CollectionobjectsCommon.class));
+        }
+    }
+
     /**
      * Creates the from xml rfw s1.
      *
diff --git a/services/collectionobject/client/src/test/resources/test-data/cspace-3237-double-quotes.xml b/services/collectionobject/client/src/test/resources/test-data/cspace-3237-double-quotes.xml
new file mode 100644 (file)
index 0000000..ac2dd96
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Document   : cspace-3237-double-quotes.xml
+    Created on : 
+    Author     : 
+    Description: Test data for http://issues.collectionspace.org/browse/CSPACE-3237
+-->
+
+<ns2:collectionobjects_common
+    xmlns:ns2="http://collectionspace.org/services/collectionobject"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://collectionspace.org/services/collectionobject http://services.collectionspace.org/collectionobject/collectionobjects_common.xsd">
+    <objectNumber>2</objectNumber>
+    <distinguishingFeatures>"this is enclosed in double quotes"</distinguishingFeatures>
+    <briefDescriptions>
+        <!-- First value instance of this repeatable field is blank -->
+        <briefDescription>"this is enclosed in double quotes"</briefDescription>
+        <briefDescription>  "this is enclosed in double quotes, prefixed and suffixed by horizontal space chars"  </briefDescription>
+        <briefDescription>some text "this is enclosed in double quotes" some text</briefDescription>
+    </briefDescriptions>
+</ns2:collectionobjects_common>