You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Sauganth Vijayappan (JIRA)" <ji...@apache.org> on 2010/10/07 22:31:35 UTC

[jira] Issue Comment Edited: (CMIS-258) testSetAndDeleteContent doesnt work

    [ https://issues.apache.org/jira/browse/CMIS-258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919052#action_12919052 ] 

Sauganth Vijayappan edited comment on CMIS-258 at 10/7/10 4:30 PM:
-------------------------------------------------------------------

### Eclipse Workspace Patch 1.0

#P opencmis

Index: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java

===================================================================

--- chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java	(revision 995861)

+++ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java	(working copy)

@@ -171,7 +171,7 @@

     }
 
     /**
-     * Tests property updates.
+     * Tests setting and deleting content stream.
      */
     public void testSetAndDeleteContent() throws Exception {
         if (!isEnabled(TEST_SET_AND_DELETE_CONTENT)) {
@@ -185,37 +185,34 @@

         String docId = createDefaultDocument(getTestRootFolder(), "testcontent.txt", CONTENT_TYPE, CONTENT);
 
         // if a check out is required, do it
+        Holder<String> docIdHolder = new Holder<String>(docId); 
         if (requiresCheckOut) {
             if (isVersionable) {
-                getBinding().getVersioningService().checkOut(getTestRepositoryId(), new Holder<String>(docId), null,
-                        null);
+                getBinding().getVersioningService().checkOut(getTestRepositoryId(), docIdHolder, null,
+                        null);              
             } else {
                 warning("Default document type is not versionable!");
                 delete(docId, true);
                 return;
             }
         }
-
-        // delete content
-        Holder<String> docIdHolder = new Holder<String>(docId);
+        String docIdWorkingCopy = docIdHolder.getValue(); 
+       // delete content
         try {
-            getBinding().getObjectService().deleteContentStream(getTestRepositoryId(), docIdHolder, null, null);
+            getBinding().getObjectService().deleteContentStream(getTestRepositoryId(), docIdHolder, null, null); 
         } catch (CmisNotSupportedException e) {
             warning("deleteContentStream not supported!");
         }
-
+       
         // set content
         ContentStream contentStream2 = createContentStreamData(CONTENT_TYPE, CONTENT2);
 
-        docIdHolder = new Holder<String>(docId);
+        docIdHolder = new Holder<String>(docIdWorkingCopy);  
         getBinding().getObjectService().setContentStream(getTestRepositoryId(), docIdHolder, true, null,
                 contentStream2, null);
 
         // read and assert content
-        if (docIdHolder.getValue() != null) {
-            docId = docIdHolder.getValue();
-        }
-        ContentStream contentStream3 = getContent(docId, null);
+        ContentStream contentStream3 = getContent(docIdWorkingCopy, null);
         assertMimeType(CONTENT_TYPE, contentStream3.getMimeType());
         if (contentStream3.getBigLength() != null) {
             assertEquals(CONTENT2.length, contentStream3.getBigLength().intValue());
@@ -226,11 +223,11 @@

 
         // if it has been checked out, cancel that
         if (requiresCheckOut) {
-            getBinding().getVersioningService().cancelCheckOut(getTestRepositoryId(), docId, null);
+            getBinding().getVersioningService().cancelCheckOut(getTestRepositoryId(), docIdWorkingCopy, null); 
         }
 
         // delete document
-        delete(docId, true);
+        delete(docId, true); 
     }
 
     /**

      was (Author: sauganth):
    ### Eclipse Workspace Patch 1.0

#P opencmis

Index: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java

===================================================================

--- chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java	(revision 995861)

+++ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java	(working copy)

@@ -171,7 +171,7 @@

     }
 
     /**
-     * Tests property updates.
+     * Tests setting and deleting content stream.
      */
     public void testSetAndDeleteContent() throws Exception {
         if (!isEnabled(TEST_SET_AND_DELETE_CONTENT)) {
@@ -185,37 +185,34 @@

         String docId = createDefaultDocument(getTestRootFolder(), "testcontent.txt", CONTENT_TYPE, CONTENT);
 
         // if a check out is required, do it
+        Holder<String> docIdHolder = new Holder<String>(docId); 
         if (requiresCheckOut) {
             if (isVersionable) {
-                getBinding().getVersioningService().checkOut(getTestRepositoryId(), new Holder<String>(docId), null,
-                        null);
+                getBinding().getVersioningService().checkOut(getTestRepositoryId(), docIdHolder, null,
+                        null);              
             } else {
                 warning("Default document type is not versionable!");
                 delete(docId, true);
                 return;
             }
         }
-
-        // delete content
-        Holder<String> docIdHolder = new Holder<String>(docId);
+        String docIdWorkingCopy = docIdHolder.getValue(); 
+       // delete content
         try {
-            getBinding().getObjectService().deleteContentStream(getTestRepositoryId(), docIdHolder, null, null);
+            getBinding().getObjectService().deleteContentStream(getTestRepositoryId(), docIdHolder, null, null); 
         } catch (CmisNotSupportedException e) {
             warning("deleteContentStream not supported!");
         }
-
+       
         // set content
         ContentStream contentStream2 = createContentStreamData(CONTENT_TYPE, CONTENT2);
 
-        docIdHolder = new Holder<String>(docId);
+        docIdHolder = new Holder<String>(docIdWorkingCopy);  
         getBinding().getObjectService().setContentStream(getTestRepositoryId(), docIdHolder, true, null,
                 contentStream2, null);
 
         // read and assert content
-        if (docIdHolder.getValue() != null) {
-            docId = docIdHolder.getValue();
-        }
-        ContentStream contentStream3 = getContent(docId, null);
+        ContentStream contentStream3 = getContent(docIdWorkingCopy, null);
         assertMimeType(CONTENT_TYPE, contentStream3.getMimeType());
         if (contentStream3.getBigLength() != null) {
             assertEquals(CONTENT2.length, contentStream3.getBigLength().intValue());
@@ -226,11 +223,11 @@

 
         // if it has been checked out, cancel that
         if (requiresCheckOut) {
-            getBinding().getVersioningService().cancelCheckOut(getTestRepositoryId(), docId, null);
+            getBinding().getVersioningService().cancelCheckOut(getTestRepositoryId(), docIdWorkingCopy, null); 
         }
 
         // delete document
-        delete(docId, true);
+        delete(docId, true); 
     }
 
     /**

  
> testSetAndDeleteContent doesnt work
> -----------------------------------
>
>                 Key: CMIS-258
>                 URL: https://issues.apache.org/jira/browse/CMIS-258
>             Project: Chemistry
>          Issue Type: Bug
>          Components: opencmis-client-bindings
>            Reporter: Sauganth Vijayappan
>            Priority: Blocker
>
> The code for test "testSetAndDeleteContent" has the following problem:
> The checkout call returns a document id of the working copy which is ignored and the actual document id is used instead to set and delete content in the subsequent steps.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.