You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2013/07/09 23:15:21 UTC

svn commit: r1501552 - in /chemistry/opencmis/branches/inmemory-refactoring/src: main/java/org/apache/chemistry/opencmis/inmemory/server/ main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ test/java/org/apache/chemistry/opencmis/inmemory/...

Author: jens
Date: Tue Jul  9 21:15:21 2013
New Revision: 1501552

URL: http://svn.apache.org/r1501552
Log:
Fix a few bugs with version label [CMIS-687], [CMIS-688], [CMIS-689]

Modified:
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java?rev=1501552&r1=1501551&r2=1501552&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Tue Jul  9 21:15:21 2013
@@ -95,6 +95,9 @@ public class InMemoryVersioningServiceIm
         if (contentStream != null && contentStream.getStream() == null)
             contentStream = null;
 
+        if (null == major) 
+            major = true;
+        
         verDoc.checkIn(major, properties, contentStream, checkinComment, policies, user);
 
         // To be able to provide all Atom links in the response we need

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1501552&r1=1501551&r2=1501552&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Tue Jul  9 21:15:21 2013
@@ -52,7 +52,6 @@ public class DocumentVersionImpl extends
     private String fComment; // checkin comment
     boolean fIsMajor;
     boolean fIsPwc; // true if this is the PWC
-    String label;
 
     public DocumentVersionImpl(String repositoryId, VersionedDocument container, ContentStream content,
             VersioningState verState, ObjectStoreImpl objStore) {
@@ -70,8 +69,6 @@ public class DocumentVersionImpl extends
                 fProperties.put(prop.getKey(), prop.getValue());
             }
         }
-
-        label = createVersionLabel();
     }
 
     @Override
@@ -119,7 +116,7 @@ public class DocumentVersionImpl extends
     }
 
     private String createVersionLabel() {
-        int majorNo = 1;
+        int majorNo = 0;
         int minorNo = 0;
         List<DocumentVersion> allVersions = fContainer.getAllVersions();
         for (DocumentVersion ver : allVersions) {
@@ -133,7 +130,7 @@ public class DocumentVersionImpl extends
                 break;
             }
         }
-        String label = "V " + majorNo + "." + minorNo;
+        String label = majorNo + "." + minorNo;
         return label;
     }
 
@@ -317,7 +314,7 @@ public class DocumentVersionImpl extends
 
     @Override
 	public String getVersionLabel() {
-        return label;
+        return createVersionLabel();
     }
 
     @Override

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java?rev=1501552&r1=1501551&r2=1501552&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java Tue Jul  9 21:15:21 2013
@@ -903,13 +903,13 @@ public class EvalQueryTest extends Abstr
         assertEquals(2, res.getObjects().size());
         assertTrue(resultContains("ver123", UnitTestTypeSystemCreator.VERSION_PROPERTY_ID, res));
         assertTrue(resultContains("ver456", UnitTestTypeSystemCreator.VERSION_PROPERTY_ID, res));
-        assertTrue(resultContains("V 1.0", PropertyIds.VERSION_LABEL, res));
-        assertTrue(resultContains("V 2.0", PropertyIds.VERSION_LABEL, res));
+        assertTrue(resultContains("1.0", PropertyIds.VERSION_LABEL, res));
+        assertTrue(resultContains("2.0", PropertyIds.VERSION_LABEL, res));
 
         res = doQuery(statement);
         assertEquals(1, res.getObjects().size());
-        assertFalse(resultContains("V 1.0", PropertyIds.VERSION_LABEL, res));
-        assertTrue(resultContains("V 2.0", PropertyIds.VERSION_LABEL, res));
+        assertFalse(resultContains("1.0", PropertyIds.VERSION_LABEL, res));
+        assertTrue(resultContains("2.0", PropertyIds.VERSION_LABEL, res));
         log.debug("...Stop testLastestVersionsWithQuery.");
     }
 
@@ -922,12 +922,12 @@ public class EvalQueryTest extends Abstr
         ObjectList res = doQuery(statement);
         assertEquals(1, res.getObjects().size());
         assertTrue(resultContains("ver456", UnitTestTypeSystemCreator.VERSION_PROPERTY_ID, res));
-        assertTrue(resultContains("V 2.0", PropertyIds.VERSION_LABEL, res));
+        assertTrue(resultContains("2.0", PropertyIds.VERSION_LABEL, res));
 
         res = doQuery(statement);
         assertEquals(1, res.getObjects().size());
-        assertFalse(resultContains("V 1.0", PropertyIds.VERSION_LABEL, res));
-        assertTrue(resultContains("V 2.0", PropertyIds.VERSION_LABEL, res));
+        assertFalse(resultContains("1.0", PropertyIds.VERSION_LABEL, res));
+        assertTrue(resultContains("2.0", PropertyIds.VERSION_LABEL, res));
         log.debug("...Stop testLastestVersionsWithQuery.");
     }