chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1181002 - /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/SetAndDeleteContentTest.java
Date Mon, 10 Oct 2011 14:42:39 GMT
Author: fmui
Date: Mon Oct 10 14:42:39 2011
New Revision: 1181002

URL: http://svn.apache.org/viewvc?rev=1181002&view=rev
Log:
CMIS-446: added check if content is required for the test document

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/SetAndDeleteContentTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/SetAndDeleteContentTest.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/SetAndDeleteContentTest.java?rev=1181002&r1=1181001&r2=1181002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/SetAndDeleteContentTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/SetAndDeleteContentTest.java
Mon Oct 10 14:42:39 2011
@@ -34,6 +34,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates;
+import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
 import org.apache.chemistry.opencmis.tck.CmisTestResult;
@@ -68,12 +69,11 @@ public class SetAndDeleteContentTest ext
             Folder testFolder = createTestFolder(session);
             Document doc = createDocument(session, testFolder, "contenttest.txt", CONTENT1);
             Document workDoc = doc;
+            DocumentTypeDefinition docType = (DocumentTypeDefinition) doc.getType();
 
             // test if check out is required and possible
             boolean checkedout = false;
             if (getContentStreamUpdatesCapbility(session) == CapabilityContentStreamUpdates.PWCONLY)
{
-                DocumentTypeDefinition docType = (DocumentTypeDefinition) doc.getType();
-
                 if (!docType.isVersionable()) {
                     addResult(createResult(SKIPPED,
                             "Content stream operations only work if PWCs and the the test
type is not versionable. Test skipped!"));
@@ -85,14 +85,19 @@ public class SetAndDeleteContentTest ext
                 checkedout = true;
             }
 
-            // delete content stream
-            try {
-                workDoc.deleteContentStream(true);
-
-                f = createResult(FAILURE, "Document still has content after deleteContentStream()
has been called!");
-                addResult(assertNull(workDoc.getContentStream(), null, f));
-            } catch (CmisNotSupportedException e) {
-                addResult(createResult(WARNING, "deleteContentStream() is not supported!"));
+            if (docType.getContentStreamAllowed() == ContentStreamAllowed.REQUIRED) {
+                addResult(createResult(SKIPPED,
+                        "A content stream is required for this docuemnt type. deleteContentStream()
test skipped!"));
+            } else {
+                // delete content stream
+                try {
+                    workDoc.deleteContentStream(true);
+
+                    f = createResult(FAILURE, "Document still has content after deleteContentStream()
has been called!");
+                    addResult(assertNull(workDoc.getContentStream(), null, f));
+                } catch (CmisNotSupportedException e) {
+                    addResult(createResult(WARNING, "deleteContentStream() is not supported!"));
+                }
             }
 
             // set a new content stream



Mime
View raw message