You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/02/23 15:36:37 UTC

svn commit: r1571019 - in /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/main/java/org/apache/c...

Author: fmui
Date: Sun Feb 23 14:36:37 2014
New Revision: 1571019

URL: http://svn.apache.org/r1571019
Log:
added Session.getLatestDocumentVersion()

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/CmisBinding.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=1571019&r1=1571018&r2=1571019&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java Sun Feb 23 14:36:37 2014
@@ -462,6 +462,58 @@ public interface Session extends Seriali
     CmisObject getObjectByPath(String path, OperationContext context);
 
     /**
+     * Returns the latest version in a version series.
+     * 
+     * @param objectId
+     *            the document ID of an arbitrary version in the version series
+     * 
+     * @return the latest document version
+     * 
+     * @cmis 1.0
+     */
+    Document getLatestDocumentVersion(ObjectId objectId);
+
+    /**
+     * Returns the latest version in a version series.
+     * 
+     * @param objectId
+     *            the document ID of an arbitrary version in the version series
+     * @param context
+     *            the {@link OperationContext} to use
+     * 
+     * @return the latest document version
+     * 
+     * @cmis 1.0
+     */
+    Document getLatestDocumentVersion(ObjectId objectId, OperationContext context);
+
+    /**
+     * Returns the latest version in a version series.
+     * 
+     * @param objectId
+     *            the document ID of an arbitrary version in the version series
+     * 
+     * @return the latest document version
+     * 
+     * @cmis 1.0
+     */
+    Document getLatestDocumentVersion(String objectId);
+
+    /**
+     * Returns the latest version in a version series.
+     * 
+     * @param objectId
+     *            the document ID of an arbitrary version in the version series
+     * @param context
+     *            the {@link OperationContext} to use
+     * 
+     * @return the latest document version
+     * 
+     * @cmis 1.0
+     */
+    Document getLatestDocumentVersion(String objectId, OperationContext context);
+
+    /**
      * Removes the given object from the cache.
      * 
      * @param objectId

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java?rev=1571019&r1=1571018&r2=1571019&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java Sun Feb 23 14:36:37 2014
@@ -26,6 +26,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpi;
 import org.apache.chemistry.opencmis.client.bindings.spi.SessionAwareAuthenticationProvider;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
 import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.impl.ClassLoaderUtil;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
@@ -170,6 +171,19 @@ public final class CmisBindingImpl imple
         return session.getSessionId();
     }
 
+    public BindingType getBindingType() {
+        Object bindingType = session.get(SessionParameter.BINDING_TYPE);
+        if (!(bindingType instanceof String)) {
+            return BindingType.CUSTOM;
+        }
+
+        try {
+            return BindingType.fromValue((String) bindingType);
+        } catch (IllegalArgumentException e) {
+            return BindingType.CUSTOM;
+        }
+    }
+
     public RepositoryService getRepositoryService() {
         checkSession();
         return repositoryServiceWrapper;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1571019&r1=1571018&r2=1571019&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java Sun Feb 23 14:36:37 2014
@@ -57,6 +57,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.runtime.util.CollectionIterable;
 import org.apache.chemistry.opencmis.client.runtime.util.TreeImpl;
 import org.apache.chemistry.opencmis.client.util.OperationContextUtils;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.Acl;
@@ -64,12 +65,14 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.ObjectList;
+import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
 import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
@@ -266,7 +269,7 @@ public class SessionImpl implements Sess
         lock.writeLock().lock();
         try {
             // create new object cache
-            this.cache = createCache();
+            cache = createCache();
 
             // clear object type cache
             objectTypeCache = new IdentityHashMap<TypeDefinition, ObjectType>();
@@ -363,7 +366,7 @@ public class SessionImpl implements Sess
         }
 
         final DiscoveryService discoveryService = getBinding().getDiscoveryService();
-        final ObjectFactory of = this.getObjectFactory();
+        final ObjectFactory of = getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
 
         return new CollectionIterable<ChangeEvent>(new AbstractPageFetcher<ChangeEvent>(Integer.MAX_VALUE) {
@@ -439,7 +442,7 @@ public class SessionImpl implements Sess
     public OperationContext getDefaultContext() {
         lock.readLock().lock();
         try {
-            return this.context;
+            return context;
         } finally {
             lock.readLock().unlock();
         }
@@ -448,7 +451,7 @@ public class SessionImpl implements Sess
     public void setDefaultContext(OperationContext context) {
         lock.writeLock().lock();
         try {
-            this.context = (context == null ? DEFAULT_CONTEXT : context);
+            context = (context == null ? DEFAULT_CONTEXT : context);
         } finally {
             lock.writeLock().unlock();
         }
@@ -472,7 +475,7 @@ public class SessionImpl implements Sess
     }
 
     public Locale getLocale() {
-        return this.locale;
+        return locale;
     }
 
     public CmisObject getObject(ObjectId objectId) {
@@ -480,8 +483,8 @@ public class SessionImpl implements Sess
     }
 
     public CmisObject getObject(ObjectId objectId, OperationContext context) {
-        if ((objectId == null) || (objectId.getId() == null)) {
-            throw new IllegalArgumentException("Object Id must be set!");
+        if (objectId == null || objectId.getId() == null) {
+            throw new IllegalArgumentException("Object ID must be set!");
         }
 
         return getObject(objectId.getId(), context);
@@ -493,7 +496,7 @@ public class SessionImpl implements Sess
 
     public CmisObject getObject(String objectId, OperationContext context) {
         if (objectId == null) {
-            throw new IllegalArgumentException("Object Id must be set!");
+            throw new IllegalArgumentException("Object ID must be set!");
         }
         if (context == null) {
             throw new IllegalArgumentException("Operation context must be set!");
@@ -503,14 +506,14 @@ public class SessionImpl implements Sess
 
         // ask the cache first
         if (context.isCacheEnabled()) {
-            result = this.cache.getById(objectId, context.getCacheKey());
+            result = cache.getById(objectId, context.getCacheKey());
             if (result != null) {
                 return result;
             }
         }
 
         // get the object
-        ObjectData objectData = this.binding.getObjectService().getObject(getRepositoryId(), objectId,
+        ObjectData objectData = binding.getObjectService().getObject(getRepositoryId(), objectId,
                 context.getFilterString(), context.isIncludeAllowableActions(), context.getIncludeRelationships(),
                 context.getRenditionFilterString(), context.isIncludePolicies(), context.isIncludeAcls(), null);
 
@@ -518,7 +521,7 @@ public class SessionImpl implements Sess
 
         // put into cache
         if (context.isCacheEnabled()) {
-            this.cache.put(result, context.getCacheKey());
+            cache.put(result, context.getCacheKey());
         }
 
         return result;
@@ -540,14 +543,14 @@ public class SessionImpl implements Sess
 
         // ask the cache first
         if (context.isCacheEnabled() && !cachePathOmit) {
-            result = this.cache.getByPath(path, context.getCacheKey());
+            result = cache.getByPath(path, context.getCacheKey());
             if (result != null) {
                 return result;
             }
         }
 
         // get the object
-        ObjectData objectData = this.binding.getObjectService().getObjectByPath(getRepositoryId(), path,
+        ObjectData objectData = binding.getObjectService().getObjectByPath(getRepositoryId(), path,
                 context.getFilterString(), context.isIncludeAllowableActions(), context.getIncludeRelationships(),
                 context.getRenditionFilterString(), context.isIncludePolicies(), context.isIncludeAcls(), null);
 
@@ -555,12 +558,102 @@ public class SessionImpl implements Sess
 
         // put into cache
         if (context.isCacheEnabled()) {
-            this.cache.putPath(path, result, context.getCacheKey());
+            cache.putPath(path, result, context.getCacheKey());
         }
 
         return result;
     }
 
+    public Document getLatestDocumentVersion(ObjectId objectId) {
+        return getLatestDocumentVersion(objectId, getDefaultContext());
+    }
+
+    public Document getLatestDocumentVersion(String objectId, OperationContext context) {
+        if (objectId == null) {
+            throw new IllegalArgumentException("Object ID must be set!");
+        }
+
+        return getLatestDocumentVersion(createObjectId(objectId), context);
+    }
+
+    public Document getLatestDocumentVersion(String objectId) {
+        if (objectId == null) {
+            throw new IllegalArgumentException("Object ID must be set!");
+        }
+
+        return getLatestDocumentVersion(createObjectId(objectId), getDefaultContext());
+    }
+
+    public Document getLatestDocumentVersion(ObjectId objectId, OperationContext context) {
+        if (objectId == null || objectId.getId() == null) {
+            throw new IllegalArgumentException("Object ID must be set!");
+        }
+
+        if (context == null) {
+            throw new IllegalArgumentException("Operation context must be set!");
+        }
+
+        CmisObject result = null;
+
+        String versionSeriesId = null;
+        BindingType bindingType = getBinding().getBindingType();
+        if (bindingType == BindingType.WEBSERVICES || bindingType == BindingType.CUSTOM) {
+            if (objectId instanceof Document) {
+                versionSeriesId = ((Document) objectId).getVersionSeriesId();
+            }
+
+            if (versionSeriesId == null) {
+                // ask the cache
+                if (context.isCacheEnabled()) {
+                    CmisObject sourceDoc = cache.getById(objectId.getId(), context.getCacheKey());
+                    if (sourceDoc instanceof Document) {
+                        versionSeriesId = ((Document) sourceDoc).getVersionSeriesId();
+                    }
+                }
+            }
+
+            if (versionSeriesId == null) {
+                // get the document to find the version series ID
+                ObjectData sourceObjectData = binding.getObjectService().getObject(getRepositoryId(),
+                        objectId.getId(), PropertyIds.OBJECT_ID + "," + PropertyIds.VERSION_SERIES_ID, false,
+                        IncludeRelationships.NONE, "cmis:none", false, false, null);
+
+                if (sourceObjectData.getProperties() != null
+                        && sourceObjectData.getProperties().getProperties() != null) {
+                    PropertyData<?> verionsSeriesIdProp = sourceObjectData.getProperties().getProperties()
+                            .get(PropertyIds.VERSION_SERIES_ID);
+                    if (verionsSeriesIdProp != null && verionsSeriesIdProp.getFirstValue() instanceof String) {
+                        versionSeriesId = (String) verionsSeriesIdProp.getFirstValue();
+                    }
+                }
+            }
+
+            if (versionSeriesId == null) {
+                throw new IllegalArgumentException("Object is not a document or not versionable!");
+            }
+        }
+
+        // get the object
+        ObjectData objectData = binding.getVersioningService().getObjectOfLatestVersion(getRepositoryId(),
+                objectId.getId(), versionSeriesId, false, context.getFilterString(),
+                context.isIncludeAllowableActions(), context.getIncludeRelationships(),
+                context.getRenditionFilterString(), context.isIncludePolicies(), context.isIncludeAcls(), null);
+
+        result = getObjectFactory().convertObject(objectData, context);
+
+        // put into cache
+        if (context.isCacheEnabled()) {
+            cache.put(result, context.getCacheKey());
+        }
+
+        // check result
+        if (!(result instanceof Document)) {
+            throw new IllegalArgumentException("Object is not a document!");
+        }
+
+        return (Document) result;
+    }
+
     public void removeObjectFromCache(ObjectId objectId) {
         if (objectId == null || objectId.getId() == null) {
             return;
@@ -600,7 +693,7 @@ public class SessionImpl implements Sess
     public ItemIterable<ObjectType> getTypeChildren(final String typeId, final boolean includePropertyDefinitions) {
         final RepositoryService repositoryService = getBinding().getRepositoryService();
 
-        return new CollectionIterable<ObjectType>(new AbstractPageFetcher<ObjectType>(this.getDefaultContext()
+        return new CollectionIterable<ObjectType>(new AbstractPageFetcher<ObjectType>(getDefaultContext()
                 .getMaxItemsPerPage()) {
 
             @Override
@@ -744,7 +837,7 @@ public class SessionImpl implements Sess
         }
 
         final DiscoveryService discoveryService = getBinding().getDiscoveryService();
-        final ObjectFactory of = this.getObjectFactory();
+        final ObjectFactory of = getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
 
         return new CollectionIterable<QueryResult>(new AbstractPageFetcher<QueryResult>(ctxt.getMaxItemsPerPage()) {
@@ -787,7 +880,7 @@ public class SessionImpl implements Sess
         }
 
         final DiscoveryService discoveryService = getBinding().getDiscoveryService();
-        final ObjectFactory of = this.getObjectFactory();
+        final ObjectFactory of = getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
         final StringBuilder statement = new StringBuilder("SELECT ");
 
@@ -856,12 +949,12 @@ public class SessionImpl implements Sess
     public void connect() {
         lock.writeLock().lock();
         try {
-            this.binding = CmisBindingHelper.createBinding(parameters, authenticationProvider, typeDefCache);
+            binding = CmisBindingHelper.createBinding(parameters, authenticationProvider, typeDefCache);
 
             /* get initial repository id from session parameter */
             String repositoryId = parameters.get(SessionParameter.REPOSITORY_ID);
             if (repositoryId == null) {
-                throw new IllegalStateException("Repository Id is not set!");
+                throw new IllegalStateException("Repository ID is not set!");
             }
 
             repositoryInfo = objectFactory.convertRepositoryInfo(getBinding().getRepositoryService().getRepositoryInfo(
@@ -961,7 +1054,7 @@ public class SessionImpl implements Sess
     public ObjectId createFolder(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
             List<Ace> addAces, List<Ace> removeAces) {
         if ((folderId == null) || (folderId.getId() == null)) {
-            throw new IllegalArgumentException("Folder Id must be set!");
+            throw new IllegalArgumentException("Folder ID must be set!");
         }
         if ((properties == null) || (properties.isEmpty())) {
             throw new IllegalArgumentException("Properties must not be empty!");
@@ -1035,30 +1128,30 @@ public class SessionImpl implements Sess
 
     public ObjectId createDocument(Map<String, ?> properties, ObjectId folderId, ContentStream contentStream,
             VersioningState versioningState) {
-        return this.createDocument(properties, folderId, contentStream, versioningState, null, null, null);
+        return createDocument(properties, folderId, contentStream, versioningState, null, null, null);
     }
 
     public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId,
             VersioningState versioningState) {
-        return this.createDocumentFromSource(source, properties, folderId, versioningState, null, null, null);
+        return createDocumentFromSource(source, properties, folderId, versioningState, null, null, null);
     }
 
     public ObjectId createFolder(Map<String, ?> properties, ObjectId folderId) {
-        return this.createFolder(properties, folderId, null, null, null);
+        return createFolder(properties, folderId, null, null, null);
     }
 
     public ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId) {
-        return this.createPolicy(properties, folderId, null, null, null);
+        return createPolicy(properties, folderId, null, null, null);
     }
 
     public ObjectId createItem(Map<String, ?> properties, ObjectId folderId) {
-        return this.createItem(properties, folderId, null, null, null);
+        return createItem(properties, folderId, null, null, null);
     }
 
     // --- relationships ---
 
     public ObjectId createRelationship(Map<String, ?> properties) {
-        return this.createRelationship(properties, null, null, null);
+        return createRelationship(properties, null, null, null);
     }
 
     public ItemIterable<Relationship> getRelationships(ObjectId objectId, final boolean includeSubRelationshipTypes,
@@ -1256,7 +1349,7 @@ public class SessionImpl implements Sess
         String[] ids = new String[policyIds.length];
         for (int i = 0; i < policyIds.length; i++) {
             if ((policyIds[i] == null) || (policyIds[i].getId() == null)) {
-                throw new IllegalArgumentException("A Policy Id is not set!");
+                throw new IllegalArgumentException("A Policy ID is not set!");
             }
 
             ids[i] = policyIds[i].getId();
@@ -1279,7 +1372,7 @@ public class SessionImpl implements Sess
         String[] ids = new String[policyIds.length];
         for (int i = 0; i < policyIds.length; i++) {
             if ((policyIds[i] == null) || (policyIds[i].getId() == null)) {
-                throw new IllegalArgumentException("A Policy Id is not set!");
+                throw new IllegalArgumentException("A Policy ID is not set!");
             }
 
             ids[i] = policyIds[i].getId();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/CmisBinding.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/CmisBinding.java?rev=1571019&r1=1571018&r2=1571019&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/CmisBinding.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/CmisBinding.java Sun Feb 23 14:36:37 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.commons.spi;
 
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
+
 /**
  * Entry point for all CMIS binding related operations. It provides access to
  * the service interface objects which are very similar to the CMIS 1.0 domain
@@ -39,6 +41,11 @@ public interface CmisBinding {
     String getSessionId();
 
     /**
+     * Returns the binding type.
+     */
+    BindingType getBindingType();
+
+    /**
      * Gets a Repository Service interface object.
      */
     RepositoryService getRepositoryService();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.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/versioning/VersioningSmokeTest.java?rev=1571019&r1=1571018&r2=1571019&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java Sun Feb 23 14:36:37 2014
@@ -213,6 +213,19 @@ public class VersioningSmokeTest extends
             f = createResult(FAILURE,
                     "The version that is flagged as latest version is not returned by getObjectOfLatestVersion()!");
             addResult(results, assertEquals(latestId, latestVersion.getId(), null, f));
+
+            // check with session.getLatestDocumentVersion()
+            Document latestVersion2 = session.getLatestDocumentVersion(versions.get(versions.size() - 1).getId(),
+                    SELECT_ALL_NO_CACHE_OC);
+
+            addResult(
+                    results,
+                    checkObject(session, latestVersion2, properties, "Latest version object check (2): "
+                            + latestVersion2.getId()));
+
+            f = createResult(FAILURE,
+                    "The version that is flagged as latest version is not returned by getObjectOfLatestVersion()!");
+            addResult(results, assertEquals(latestId, latestVersion2.getId(), null, f));
         }
 
         CmisTestResultImpl result = createResult(getWorst(results), message);