chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1539100 - /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/ChangeTokenTest.java
Date Tue, 05 Nov 2013 18:59:58 GMT
Author: fmui
Date: Tue Nov  5 18:59:58 2013
New Revision: 1539100

URL: http://svn.apache.org/r1539100
Log:
TCK: added change token test for folders

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

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/ChangeTokenTest.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/ChangeTokenTest.java?rev=1539100&r1=1539099&r2=1539100&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/ChangeTokenTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/ChangeTokenTest.java
Tue Nov  5 18:59:58 2013
@@ -59,23 +59,27 @@ public class ChangeTokenTest extends Abs
         Folder testFolder = createTestFolder(session);
 
         try {
-            // update properties test
-            runUpdateTest(session, testFolder);
+            // update document properties test
+            runUpdateDocumentTest(session, testFolder);
 
             // content update test
             runContentTest(session, testFolder);
+
+            // update folder properties test
+            runUpdateFolderTest(session, testFolder);
         } finally {
             // delete the test folder
             deleteTestFolder();
         }
     }
 
-    private void runUpdateTest(Session session, Folder testFolder) {
+    private void runUpdateDocumentTest(Session session, Folder testFolder) {
         Document doc = createDocument(session, testFolder, "update1.txt", "Hello World!");
 
         try {
             if (doc.getChangeToken() == null) {
-                addResult(createResult(SKIPPED, "Repository does not provide change tokens.
Test skipped!"));
+                addResult(createResult(SKIPPED,
+                        "Repository does not provide change tokens for documents. Test skipped!"));
                 return;
             }
 
@@ -124,7 +128,8 @@ public class ChangeTokenTest extends Abs
 
         try {
             if (doc.getChangeToken() == null) {
-                addResult(createResult(SKIPPED, "Repository does not provide change tokens.
Test skipped!"));
+                addResult(createResult(SKIPPED,
+                        "Repository does not provide change tokens for documents. Test skipped!"));
                 return;
             }
 
@@ -178,4 +183,39 @@ public class ChangeTokenTest extends Abs
             deleteObject(doc);
         }
     }
+
+    private void runUpdateFolderTest(Session session, Folder testFolder) {
+        Folder folder = createFolder(session, testFolder, "folder1");
+
+        try {
+            if (folder.getChangeToken() == null) {
+                addResult(createResult(SKIPPED, "Repository does not provide change tokens
for folders. Test skipped!"));
+                return;
+            }
+
+            if (!folder.getAllowableActions().getAllowableActions().contains(Action.CAN_UPDATE_PROPERTIES))
{
+                addResult(createResult(SKIPPED, "Folder name can't be changed. Test skipped!"));
+                return;
+            }
+
+            // the first update should succeed
+            Map<String, Object> properties2 = new HashMap<String, Object>();
+            properties2.put(PropertyIds.NAME, "folder2");
+            folder.updateProperties(properties2, false);
+
+            try {
+                Map<String, Object> properties3 = new HashMap<String, Object>();
+                properties3.put(PropertyIds.NAME, "folder3");
+                folder.updateProperties(properties3, false);
+
+                addResult(createResult(FAILURE, "Updating properties a second time with the
same change token "
+                        + "should result in an UpdateConflict exception!"));
+            } catch (CmisUpdateConflictException e) {
+                // expected exception
+            }
+
+        } finally {
+            deleteObject(folder);
+        }
+    }
 }



Mime
View raw message