chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r1005186 - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/or...
Date Wed, 06 Oct 2010 17:47:26 GMT
Author: fguillaume
Date: Wed Oct  6 17:47:25 2010
New Revision: 1005186

URL: http://svn.apache.org/viewvc?rev=1005186&view=rev
Log:
Better copy() API, FIT tests for copy and move

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java?rev=1005186&r1=1005185&r2=1005186&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
Wed Oct  6 17:47:25 2010
@@ -27,7 +27,7 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * CMIS Document.
- * 
+ *
  * Domain Model 2.4
  */
 public interface Document extends FileableCmisObject {
@@ -41,7 +41,7 @@ public interface Document extends Fileab
 
     /**
      * Retrieves the content stream of this document.
-     * 
+     *
      * @return the content stream, or {@code null}
      */
     ContentStream getContentStream();
@@ -49,7 +49,7 @@ public interface Document extends Fileab
     /**
      * Retrieves the content stream that is associated with the given stream id.
      * This is usually a rendition of the document.
-     * 
+     *
      * @return the content stream, or {@code null}
      */
     ContentStream getContentStream(String streamId);
@@ -69,7 +69,7 @@ public interface Document extends Fileab
     /**
      * Checks out the document and returns the object id of the PWC (private
      * working copy).
-     * 
+     *
      * @return PWC id
      */
     ObjectId checkOut(); // returns the PWC id
@@ -83,7 +83,7 @@ public interface Document extends Fileab
     /**
      * If this is a PWC (private working copy) it performs a check in. If this
      * is not a PWC it an exception will be thrown.
-     * 
+     *
      * @return new document id
      */
     ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream contentStream,
String checkinComment,
@@ -92,18 +92,18 @@ public interface Document extends Fileab
     /**
      * If this is a PWC (private working copy) it performs a check in. If this
      * is not a PWC it an exception will be thrown.
-     * 
+     *
      * @return new document id
      */
     ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream contentStream,
String checkinComment);
 
     /**
      * Fetches the latest major or minor version of this document.
-     * 
+     *
      * @param major
      *            if <code>true</code> the latest major version will be
      *            returned, otherwise the very last version will be returned
-     * 
+     *
      * @return the latest document object
      */
     Document getObjectOfLatestVersion(boolean major);
@@ -111,11 +111,11 @@ public interface Document extends Fileab
     /**
      * Fetches the latest major or minor version of this document using the
      * given {@link OperationContext}.
-     * 
+     *
      * @param major
      *            if <code>true</code> the latest major version will be
      *            returned, otherwise the very last version will be returned
-     * 
+     *
      * @return the latest document object
      */
     Document getObjectOfLatestVersion(boolean major, OperationContext context);
@@ -131,6 +131,23 @@ public interface Document extends Fileab
      */
     List<Document> getAllVersions(OperationContext context);
 
+    /**
+     * Creates a copy of this document, including content.
+     *
+     * @return the new document object
+     */
+    Document copy(ObjectId targetFolderId);
+
+    /**
+     * Creates a copy of this document, including content.
+     *
+     * @return the new document object or {@code null} if the parameter
+     *         {@code context} was set to {@code null}
+     */
+    Document copy(ObjectId targetFolderId, Map<String, ?> properties,
+            VersioningState versioningState, List<Policy> policies,
+            List<Ace> addACEs, List<Ace> removeACEs, OperationContext context);
+
     // document specific properties
 
     Boolean isImmutable(); // cmis:isImmutable
@@ -161,14 +178,4 @@ public interface Document extends Fileab
 
     String getContentStreamId(); // cmis:contentStreamId
 
-    /**
-     * Creates a (content) copy of this document.
-     */
-    Document copy(List<Property<?>> properties, VersioningState versioningState,
List<Policy> policies,
-            List<Ace> addACEs, List<Ace> removeACEs);
-    /**
-     * Creates a (content) copy of this document.
-     */
-    Document copy(List<Property<?>> properties, VersioningState versioningState);
-
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java?rev=1005186&r1=1005185&r2=1005186&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/SimpleReadWriteTests.java
Wed Oct  6 17:47:25 2010
@@ -26,7 +26,6 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class SimpleReadWriteTests extends AbstractSimpleReadWriteTests {
 
@@ -40,6 +39,7 @@ public class SimpleReadWriteTests extend
         fTests.add(TEST_UPDATE_PROPERTIES);
         fTests.add(TEST_DELETE_TREE);
         fTests.add(TEST_MOVE_OBJECT);
+        // fTests.add(TEST_COPY_OBJECT);
         fTests.add(TEST_VERSIONING);
     }
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java?rev=1005186&r1=1005185&r2=1005186&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java
Wed Oct  6 17:47:25 2010
@@ -27,6 +27,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.ObjectInFolderData;
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates;
@@ -37,9 +38,8 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * Simple read-write test.
- * 
+ *
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public abstract class AbstractSimpleReadWriteTests extends AbstractCmisTestCase {
 
@@ -50,6 +50,7 @@ public abstract class AbstractSimpleRead
     public static final String TEST_UPDATE_PROPERTIES = "updateProperties";
     public static final String TEST_DELETE_TREE = "deleteTree";
     public static final String TEST_MOVE_OBJECT = "moveObject";
+    public static final String TEST_COPY_OBJECT = "copyObject";
     public static final String TEST_VERSIONING = "versioning";
 
     private static final byte[] CONTENT = "My document test content!".getBytes();
@@ -330,6 +331,44 @@ public abstract class AbstractSimpleRead
     }
 
     /**
+     * Tests copy object.
+     */
+    public void testCopyObject() throws Exception {
+        if (!isEnabled(TEST_COPY_OBJECT)) {
+            return;
+        }
+
+        // create folders
+        String folder1 = createDefaultFolder(getTestRootFolder(), "folder1");
+        String folder2 = createDefaultFolder(getTestRootFolder(), "folder2");
+
+        // create document
+        String docId = createDefaultDocument(folder1, "testdoc.txt",
+                CONTENT_TYPE, CONTENT);
+
+        // copy it with new properties
+        List<PropertyData<?>> updatePropList = new ArrayList<PropertyData<?>>();
+        updatePropList.add(getObjectFactory().createPropertyStringData(
+                PropertyIds.NAME, "newdocname"));
+        Properties updateProperties = getObjectFactory().createPropertiesData(
+                updatePropList);
+
+        String copyId = getBinding().getObjectService().createDocumentFromSource(
+                getTestRepositoryId(), docId, updateProperties, folder2, null,
+                null, null, null, null);
+        assertNotNull(copyId);
+
+        assertTrue(existsObject(copyId));
+        ObjectInFolderData copy = getChild(folder2, copyId);
+        String updatedName = (String) copy.getObject().getProperties().getProperties().get(
+                PropertyIds.NAME).getFirstValue();
+        assertEquals("newdocname", updatedName);
+
+        deleteTree(folder1);
+        deleteTree(folder2);
+    }
+
+    /**
      * Test check-in/check-out.
      */
     public void testVersioning() throws Exception {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java?rev=1005186&r1=1005185&r2=1005186&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/webservices/SimpleReadWriteTests.java
Wed Oct  6 17:47:25 2010
@@ -26,7 +26,6 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class SimpleReadWriteTests extends AbstractSimpleReadWriteTests {
 
@@ -41,6 +40,7 @@ public class SimpleReadWriteTests extend
         fTests.add(TEST_UPDATE_PROPERTIES);
         fTests.add(TEST_DELETE_TREE);
         fTests.add(TEST_MOVE_OBJECT);
+        fTests.add(TEST_COPY_OBJECT);
         fTests.add(TEST_VERSIONING);
     }
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java?rev=1005186&r1=1005185&r2=1005186&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentDocumentImpl.java
Wed Oct  6 17:47:25 2010
@@ -32,7 +32,6 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.ObjectType;
 import org.apache.chemistry.opencmis.client.api.OperationContext;
 import org.apache.chemistry.opencmis.client.api.Policy;
-import org.apache.chemistry.opencmis.client.api.Property;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
@@ -40,6 +39,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 
@@ -114,9 +114,37 @@ public class PersistentDocumentImpl exte
 
     // operations
 
-    public Document copy(List<Property<?>> properties, VersioningState versioningState,
List<Policy> policies,
-            List<Ace> addACEs, List<Ace> removeACEs) {
-        throw new CmisRuntimeException("not implemented");
+    public Document copy(ObjectId targetFolderId, Map<String, ?> properties,
+            VersioningState versioningState, List<Policy> policies,
+            List<Ace> addACEs, List<Ace> removeACEs, OperationContext context)
{
+        if (targetFolderId == null || targetFolderId.getId() == null) {
+            throw new CmisInvalidArgumentException("Target must be set");
+        }
+
+        ObjectFactory factory = getObjectFactory();
+        Set<Updatability> updatability = new HashSet<Updatability>();
+        updatability.add(Updatability.READWRITE);
+
+        String newId = getBinding().getObjectService().createDocumentFromSource(
+                getRepositoryId(), getId(),
+                factory.convertProperties(properties, getType(), updatability),
+                targetFolderId.getId(), versioningState, factory.convertPolicies(policies),
+                factory.convertAces(addACEs), factory.convertAces(removeACEs), null);
+
+        // if no context is provided the object will not be fetched
+        if (context == null || newId == null) {
+            return null;
+        }
+        // get the new object
+        CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+        if (!(object instanceof Document)) {
+            throw new CmisRuntimeException("Newly created object is not a document! New id:
" + newId);
+        }
+        return (Document) object;    }
+
+    public Document copy(ObjectId targetFolderId) {
+        return copy(targetFolderId, null, null, null, null, null,
+                getSession().getDefaultContext());
     }
 
     public void deleteAllVersions() {
@@ -337,8 +365,4 @@ public class PersistentDocumentImpl exte
     public ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream
contentStream, String checkinComment) {
         return this.checkIn(major, properties, contentStream, checkinComment, null, null,
null);
     }
-
-    public Document copy(List<Property<?>> properties, VersioningState versioningState)
{
-        return this.copy(properties, versioningState, null, null, null);
-    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java?rev=1005186&r1=1005185&r2=1005186&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java
Wed Oct  6 17:47:25 2010
@@ -117,7 +117,7 @@ public class PersistentFolderImpl extend
         // get the type of the source document
         ObjectType type = null;
         if (source instanceof CmisObject) {
-            type = ((CmisObject) source).getBaseType();
+            type = ((CmisObject) source).getType();
         } else {
             CmisObject sourceObj = getSession().getObject(source);
             type = sourceObj.getType();

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java?rev=1005186&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
Wed Oct  6 17:47:25 2010
@@ -0,0 +1,68 @@
+/*
+ * 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.fit.runtime;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+
+import java.util.HashMap;
+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.ObjectId;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.junit.Test;
+
+public abstract class AbstractWriteObjectCopyIT extends AbstractSessionTest {
+
+    @Test
+    public void copyDocument() {
+        String pathr = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
+        Folder testRoot = (Folder) this.session.getObjectByPath(pathr);
+
+        // create a folder to copy into
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put(PropertyIds.NAME, "newfolder");
+        properties.put(PropertyIds.OBJECT_TYPE_ID,
+                FixtureData.FOLDER_TYPE_ID.value());
+        ObjectId folderId = session.createFolder(properties, testRoot);
+        assertNotNull(folderId);
+
+        // get the document
+        String pathd = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
+                + FixtureData.DOCUMENT1_NAME;
+        Document document = (Document) session.getObjectByPath(pathd);
+
+        // copy the document
+        properties = new HashMap<String, Object>();
+        properties.put(PropertyIds.NAME, "newdocname");
+        Document copy = document.copy(folderId, properties, null, null, null, null, session.getDefaultContext());
+
+        assertEquals(folderId.getId(), copy.getParents().get(0).getId());
+        assertEquals("newdocname", copy.getPropertyValue(PropertyIds.NAME));
+
+        // old doc still unchanged
+        session.clear();
+        document = (Document) session.getObjectByPath(pathd);
+        assertNotSame("newdocname", document.getPropertyValue(PropertyIds.NAME));
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectCopyIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java?rev=1005186&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
Wed Oct  6 17:47:25 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.fit.runtime;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.client.api.FileableCmisObject;
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.junit.Test;
+
+public abstract class AbstractWriteObjectMoveIT extends AbstractSessionTest {
+
+    @Test
+    public void moveObject() {
+        String pathr = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
+        Folder testRoot = (Folder) this.session.getObjectByPath(pathr);
+
+        // create a folder to move into
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put(PropertyIds.NAME, "newfolder");
+        properties.put(PropertyIds.OBJECT_TYPE_ID,
+                FixtureData.FOLDER_TYPE_ID.value());
+        ObjectId folderId = session.createFolder(properties, testRoot);
+        assertNotNull(folderId);
+
+        // get the document
+        String pathd = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
+                + FixtureData.DOCUMENT1_NAME;
+        Document document = (Document) session.getObjectByPath(pathd);
+
+        // move document into new folder
+        FileableCmisObject newdoc = document.move(testRoot, folderId);
+
+        assertEquals(pathr + "/newfolder/" + FixtureData.DOCUMENT1_NAME,
+                newdoc.getPaths().get(0));
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractWriteObjectMoveIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java?rev=1005186&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
Wed Oct  6 17:47:25 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.fit.runtime.atom;
+
+import org.apache.chemistry.opencmis.fit.runtime.AbstractWriteObjectCopyIT;
+import org.apache.chemistry.opencmis.fit.runtime.Fixture;
+import org.junit.Ignore;
+
+// not implemented in AtomPub
+@Ignore
+public class WriteObjectCopyAtomPubIT extends AbstractWriteObjectCopyIT {
+
+    @Override
+    public void initFixture(Fixture fixture) {
+        fixture.enableAtomPub();
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectCopyAtomPubIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java?rev=1005186&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
Wed Oct  6 17:47:25 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.fit.runtime.atom;
+
+import org.apache.chemistry.opencmis.fit.runtime.AbstractWriteObjectMoveIT;
+import org.apache.chemistry.opencmis.fit.runtime.Fixture;
+
+public class WriteObjectMoveAtomPubIT extends AbstractWriteObjectMoveIT {
+
+    @Override
+    public void initFixture(Fixture fixture) {
+        fixture.enableAtomPub();
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/atom/WriteObjectMoveAtomPubIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java?rev=1005186&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
Wed Oct  6 17:47:25 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.fit.runtime.webservices;
+
+import org.apache.chemistry.opencmis.fit.runtime.AbstractWriteObjectCopyIT;
+import org.apache.chemistry.opencmis.fit.runtime.Fixture;
+
+public class WriteObjectCopyWebServicesIT extends AbstractWriteObjectCopyIT {
+
+    @Override
+    public void initFixture(Fixture fixture) {
+        fixture.enableWebServices();
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectCopyWebServicesIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java?rev=1005186&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
Wed Oct  6 17:47:25 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.fit.runtime.webservices;
+
+import org.apache.chemistry.opencmis.fit.runtime.AbstractWriteObjectMoveIT;
+import org.apache.chemistry.opencmis.fit.runtime.Fixture;
+
+public class WriteObjectMoveWebServicesIT extends AbstractWriteObjectMoveIT {
+
+    @Override
+    public void initFixture(Fixture fixture) {
+        fixture.enableWebServices();
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/webservices/WriteObjectMoveWebServicesIT.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message