chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1683344 - in /chemistry/opencmis/trunk: chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/...
Date Wed, 03 Jun 2015 14:22:07 GMT
Author: fmui
Date: Wed Jun  3 14:22:07 2015
New Revision: 1683344

URL: http://svn.apache.org/r1683344
Log:
fixed InMemory getTypeChildren()

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.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/server/InMemoryRepositoryServiceImpl.java?rev=1683344&r1=1683343&r2=1683344&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
Wed Jun  3 14:22:07 2015
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.in
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.ListIterator;
 
@@ -85,8 +86,17 @@ public class InMemoryRepositoryServiceIm
         } else {
             children = getTypeDescendants(context, repositoryId, typeId, BigInteger.valueOf(1),
inclPropDefs, null);
         }
+
+        if (skip >= children.size()) {
+            result.setHasMoreItems(false);
+            result.setNumItems(BigInteger.valueOf(children.size()));
+            result.setList(Collections.<TypeDefinition> emptyList());
+            return result;
+        }
+
         result.setNumItems(BigInteger.valueOf(children.size()));
         result.setHasMoreItems(children.size() > max - skip);
+
         List<TypeDefinition> childrenTypes = new ArrayList<TypeDefinition>();
         ListIterator<TypeDefinitionContainer> it = children.listIterator(skip);
         if (max < 0) {
@@ -143,9 +153,10 @@ public class InMemoryRepositoryServiceIm
         return result;
     }
 
-    public TypeDefinition createType(CallContext context, String repositoryId, TypeDefinition
type, ExtensionsData extension) {
+    public TypeDefinition createType(CallContext context, String repositoryId, TypeDefinition
type,
+            ExtensionsData extension) {
 
-        validator.createType(context, repositoryId, type, extension);        
+        validator.createType(context, repositoryId, type, extension);
         TypeManager typeManager = fStoreManager.getTypeManager(repositoryId);
         AbstractTypeDefinition newType = TypeValidator.completeType(type);
         TypeValidator.adjustTypeNamesAndId(newType);
@@ -154,8 +165,9 @@ public class InMemoryRepositoryServiceIm
         return newType;
     }
 
-    public TypeDefinition updateType(CallContext context, String repositoryId, TypeDefinition
type, ExtensionsData extension) {
-        validator.updateType(context, repositoryId, type, extension);        
+    public TypeDefinition updateType(CallContext context, String repositoryId, TypeDefinition
type,
+            ExtensionsData extension) {
+        validator.updateType(context, repositoryId, type, extension);
         String typeId = type.getId();
         TypeManager typeManager = fStoreManager.getTypeManager(repositoryId);
         if (null == typeManager) {
@@ -173,7 +185,7 @@ public class InMemoryRepositoryServiceIm
 
     public void deleteType(CallContext context, String repositoryId, String typeId, ExtensionsData
extension) {
 
-        validator.deleteType(context, repositoryId, typeId, extension);        
+        validator.deleteType(context, repositoryId, typeId, extension);
         TypeManager typeManager = fStoreManager.getTypeManager(repositoryId);
 
         ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.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/types/BaseTypesTest.java?rev=1683344&r1=1683343&r2=1683344&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java
Wed Jun  3 14:22:07 2015
@@ -183,11 +183,19 @@ public class BaseTypesTest extends Abstr
                         BigInteger.valueOf(6), null);
         if (typeDefinitionList == null) {
             addResult(createResult(FAILURE, "getTypeChildren() returned nothing!"));
-        } else if (typeDefinitionList.getList() != null && !typeDefinitionList.getList().isEmpty())
{
-            addResult(createResult(
-                    FAILURE,
-                    "A getTypeChildren() call on the base types must retrun an empty list
if skipCount is >= 6! The repository returned a list of "
-                            + typeDefinitionList.getList().size() + " elements."));
+        } else {
+            if (typeDefinitionList.getList() != null && !typeDefinitionList.getList().isEmpty())
{
+                addResult(createResult(
+                        FAILURE,
+                        "A getTypeChildren() call on the base types must retrun an empty
list if skipCount is >= 6! The repository returned a list of "
+                                + typeDefinitionList.getList().size() + " elements."));
+            }
+
+            if (Boolean.TRUE.equals(typeDefinitionList.hasMoreItems())) {
+                addResult(createResult(
+                        FAILURE,
+                        "A getTypeChildren() call on the base types must retrun an empty
list if skipCount is >= 6! The repository returned hasMoreItems == true."));
+            }
         }
 
         // test getTypeDescendants()



Mime
View raw message