chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1646011 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src: main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ test/java/org/apache/chemistry/opencmis/inmemory/
Date Tue, 16 Dec 2014 17:11:05 GMT
Author: jens
Date: Tue Dec 16 17:11:04 2014
New Revision: 1646011

URL: http://svn.apache.org/r1646011
Log:
InMemory: fix allowing rename to same name

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1646011&r1=1646010&r2=1646011&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
Tue Dec 16 17:11:04 2014
@@ -760,6 +760,9 @@ public class ObjectStoreImpl implements
             if (so.getId().equals(fRootFolder.getId())) {
                 throw new CmisInvalidArgumentException("Root folder cannot be renamed.");
             }
+            if (so.getName().equals(newName)) {
+            	return;
+            }
             if (so instanceof Fileable) {
                 for (String folderId : ((Fileable)so).getParentIds()) {
                     Folder folder = (Folder) getObjectById(folderId);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java?rev=1646011&r1=1646010&r2=1646011&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
Tue Dec 16 17:11:04 2014
@@ -105,12 +105,24 @@ public class FolderTest extends TestCase
         assertEquals(getPath(f11), "/Folder 1/Folder B");
         assertNull(fStore.getObjectByPath(oldPath, USER));
         assertEquals(f11, fStore.getObjectByPath("/Folder 1/Folder B", USER));
+
+        // rename to existing name
         try {
+        	newName = f3.getName();
             fStore.rename(f2, newName, USER);
             fail("Should not allow to rename a folder to an existing name");
         } catch (Exception e) {
         }
 
+        // rename to same name
+        try {
+            newName = f2.getName();
+        	fStore.rename(f2, f2.getName(), USER);
+            assertEquals(f2.getName(), newName);
+        } catch (Exception e) {
+            fail("Rename with same name as before should succeed.");
+        }
+
         // rename root folder
         try {
             fStore.rename(fRoot, "abc", USER);



Mime
View raw message