chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1629260 - in /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck: impl/ tests/crud/
Date Fri, 03 Oct 2014 17:00:10 GMT
Author: fmui
Date: Fri Oct  3 17:00:10 2014
New Revision: 1629260

URL: http://svn.apache.org/r1629260
Log:
TCK: added test, which checks if spaces in document names are supported

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/WhitespaceInNameTest.java
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java?rev=1629260&r1=1629259&r2=1629260&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
Fri Oct  3 17:00:10 2014
@@ -162,7 +162,9 @@ public abstract class AbstractCmisTest i
             return "null";
         }
 
-        if (o instanceof Calendar) {
+        if (o instanceof String) {
+            return "'" + o + "'";
+        } else if (o instanceof Calendar) {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
             return sdf.format(((Calendar) o).getTime());
         }
@@ -287,7 +289,7 @@ public abstract class AbstractCmisTest i
         }
 
         return addResultChild(failure,
-                createResult(CmisTestResultStatus.INFO, "Collection does not contain '" +
formatValue(value) + "'"));
+                createResult(CmisTestResultStatus.INFO, "Collection does not contain " +
formatValue(value)));
     }
 
     protected CmisTestResult assertEqualLists(List<?> expected, List<?> actual,
CmisTestResult success,

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java?rev=1629260&r1=1629259&r2=1629260&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Fri Oct  3 17:00:10 2014
@@ -455,7 +455,8 @@ public abstract class AbstractSessionTes
             try {
                 ContentStream contentStream = result.getContentStream();
 
-                f = createResult(WARNING, "Document filename does not match!", false);
+                f = createResult(WARNING, "Document filename and the filename of the content
stream do not match!",
+                        false);
                 addResult(assertEquals(name, contentStream.getFileName(), null, f));
 
                 f = createResult(WARNING,

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java?rev=1629260&r1=1629259&r2=1629260&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java
Fri Oct  3 17:00:10 2014
@@ -39,6 +39,7 @@ public class CRUDTestGroup extends Abstr
         addTest(new CreateDocumentWithoutContent());
         addTest(new CreateInvalidTypeTest());
         addTest(new NameCharsetTest());
+        addTest(new WhitespaceInNameTest());
         addTest(new CreateAndDeleteRelationshipTest());
         addTest(new CreateAndDeleteItemTest());
         addTest(new PropertyFilterTest());

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/WhitespaceInNameTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/WhitespaceInNameTest.java?rev=1629260&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/WhitespaceInNameTest.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/WhitespaceInNameTest.java
Fri Oct  3 17:00:10 2014
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.tck.tests.crud;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+
+public class WhitespaceInNameTest extends AbstractSessionTest {
+
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Whitespace in Name Test");
+        setDescription("Creates documents with spaces in cmis:name.");
+    }
+
+    @Override
+    public void run(Session session) {
+        // create a test folder
+        Folder testFolder = createTestFolder(session);
+
+        try {
+            testCenterSpaceSpace(session, testFolder);
+            testLeadingSpace(session, testFolder);
+            testTrailingSpace(session, testFolder);
+        } finally {
+            // delete the test folder
+            deleteTestFolder();
+        }
+    }
+
+    private void testLeadingSpace(Session session, Folder testFolder) {
+        String name = "leading.txt";
+
+        try {
+            Document doc = createDocument(session, testFolder, " " + name, "");
+
+            if (doc.getName().equals(" " + name)) {
+                addResult(createInfoResult("Repository does supports document names with
a leading space."));
+            } else {
+                if (doc.getName().equals(name)) {
+                    addResult(createInfoResult("Repository removes leading space from document
name."));
+                } else {
+                    addResult(createInfoResult("Repository renames documents with a leading
space."));
+                }
+            }
+        } catch (CmisBaseException e) {
+            addResult(createInfoResult("Repository does not support document names with a
leading space. Exception: "
+                    + e.toString()));
+        }
+    }
+
+    private void testTrailingSpace(Session session, Folder testFolder) {
+        String name = "trailing.txt";
+
+        try {
+            Document doc = createDocument(session, testFolder, name + " ", "");
+
+            if (doc.getName().equals(name + " ")) {
+                addResult(createInfoResult("Repository does supports document names with
a trailing space."));
+            } else {
+                if (doc.getName().equals(name)) {
+                    addResult(createInfoResult("Repository removes trailing space from document
name."));
+                } else {
+                    addResult(createInfoResult("Repository renames documents with a trailing
space."));
+                }
+            }
+        } catch (CmisBaseException e) {
+            addResult(createInfoResult("Repository does not support document names with a
trailing space. Exception: "
+                    + e.toString()));
+        }
+    }
+
+    private void testCenterSpaceSpace(Session session, Folder testFolder) {
+        String name = "center space.txt";
+
+        try {
+            Document doc = createDocument(session, testFolder, name, "");
+
+            if (doc.getName().equals(name)) {
+                addResult(createInfoResult("Repository does supports document names with
a space."));
+            } else {
+                if (doc.getName().equals("centerspace.txt")) {
+                    addResult(createInfoResult("Repository removes spaces from document name."));
+                } else {
+                    addResult(createInfoResult("Repository renames documents with a space."));
+                }
+            }
+        } catch (CmisBaseException e) {
+            addResult(createInfoResult("Repository does not support document names with a
space. Exception: "
+                    + e.toString()));
+        }
+    }
+}



Mime
View raw message