Author: fmui
Date: Wed Apr 29 13:15:47 2015
New Revision: 1676741

URL: http://svn.apache.org/r1676741
Log:
correct secondary type definition in TypeDefinitionFactory (+ TCK test and 
InMemory repository adjustments)

Modified:
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
    
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.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-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
 Wed Apr 29 13:15:47 2015
@@ -462,7 +462,7 @@ public class ThresholdOutputStream exten
     /**
      * InputStream for in-memory data.
      */
-    private class InternalBufferInputStream extends ThresholdInputStream {
+    private final class InternalBufferInputStream extends ThresholdInputStream 
{
 
         private int pos = 0;
         private int mark = -1;
@@ -582,7 +582,7 @@ public class ThresholdOutputStream exten
      * 
      * Call {@link #close()} to delete the temp file.
      */
-    private class InternalTempFileInputStream extends ThresholdInputStream {
+    private final class InternalTempFileInputStream extends 
ThresholdInputStream {
 
         private final Cipher cipher;
         private BufferedInputStream stream;

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.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/types/DefaultTypeSystemCreator.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
 Wed Apr 29 13:15:47 2015
@@ -61,6 +61,7 @@ public class DefaultTypeSystemCreator im
     /*
      * In the public interface of this class we return the singleton containing
      * the required types for testing.
+     * 
      * @see 
org.apache.chemistry.opencmis.inmemory.TypeCreator#createTypesList()
      */
     @Override
@@ -356,6 +357,7 @@ public class DefaultTypeSystemCreator im
             cmisSecondaryType.setDisplayName("MySecondaryType");
             
cmisSecondaryType.setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + 
SECONDARY_TYPE_ID);
             
DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
+            cmisSecondaryType.setIsCreatable(false);
             cmisSecondaryType.setIsFileable(false);
 
             // create a single String property definition
@@ -411,8 +413,6 @@ public class DefaultTypeSystemCreator im
                     + "ignored and replaced by random bytes");
             typesList.add(cmisTypeFake);
 
-            
-
             return typesList;
         } catch (Exception e) {
             throw new CmisRuntimeException("Error when creating built-in 
InMemory types.", e);

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.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/types/DocumentTypeCreationHelper.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
 Wed Apr 29 13:15:47 2015
@@ -221,7 +221,7 @@ public final class DocumentTypeCreationH
         type.setTypeMutability(parentTypeDefinition.getTypeMutability());
     }
 
-    /*  
+    /*
      * Creates a new mutable document type definition, which is a child of the
      * provided type definition. Property definitions are not added which is
      * useful for creating additional types at runtime
@@ -326,6 +326,7 @@ public final class DocumentTypeCreationH
             setDefaultTypeCapabilities(cmisTypeSecondary);
             cmisTypeSecondary.setTypeMutability(getBaseTypeMutability());
             cmisTypeSecondary.setIsFileable(false);
+            cmisTypeSecondary.setIsCreatable(false);
             typesList.add(cmisTypeSecondary);
         } catch (Exception e) {
             throw new CmisRuntimeException("Error when creating base types. ", 
e);

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.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/ObjectServiceTest.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
 Wed Apr 29 13:15:47 2015
@@ -2043,6 +2043,7 @@ public class ObjectServiceTest extends A
             cmisSecondaryType.setDisplayName("MySecondaryType");
             cmisSecondaryType.setDescription("InMemory test type definition " 
+ TEST_SECONDARY_TYPE_ID);
             
DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
+            cmisSecondaryType.setIsCreatable(false);
             cmisSecondaryType.setIsFileable(false);
 
             // create a single String property definition

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.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/UnitTestTypeSystemCreator.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
 Wed Apr 29 13:15:47 2015
@@ -374,6 +374,7 @@ public class UnitTestTypeSystemCreator i
             cmisSecondaryType.setDisplayName("MySecondaryType");
             cmisSecondaryType.setDescription("Builtin InMemory type definition 
" + SECONDARY_TYPE);
             
DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
+            cmisSecondaryType.setIsCreatable(false);
             cmisSecondaryType.setIsFileable(false);
 
             // create a single String property definition
@@ -392,7 +393,9 @@ public class UnitTestTypeSystemCreator i
             cmisSecondaryType2.setDisplayName("MySecondaryType-2");
             cmisSecondaryType2.setDescription("Builtin InMemory type 
definition " + SECONDARY_TYPE_2);
             
DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType2);
-
+            cmisSecondaryType2.setIsCreatable(false);
+            cmisSecondaryType2.setIsFileable(false);
+            
             // add type to types collectio
             typesList.add(cmisDocTypeTopLevel);
             typesList.add(cmisDocTypeLevel1);

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
 Wed Apr 29 13:15:47 2015
@@ -551,9 +551,9 @@ public final class TypeDefinitionFactory
         MutableSecondaryTypeDefinition secondaryType = 
createSecondaryTypeDefinitionObject();
         secondaryType.setBaseTypeId(BaseTypeId.CMIS_SECONDARY);
         secondaryType.setParentTypeId(parentId);
-        secondaryType.setIsControllableAcl(defaultControllableAcl);
-        secondaryType.setIsControllablePolicy(defaultControllablePolicy);
-        secondaryType.setIsCreatable(true);
+        secondaryType.setIsControllableAcl(false);
+        secondaryType.setIsControllablePolicy(false);
+        secondaryType.setIsCreatable(false);
         secondaryType.setDescription("Secondary");
         secondaryType.setDisplayName("Secondary");
         secondaryType.setIsFileable(false);

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.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/impl/AbstractSessionTest.java?rev=1676741&r1=1676740&r2=1676741&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
 Wed Apr 29 13:15:47 2015
@@ -2268,10 +2268,10 @@ public abstract class AbstractSessionTes
         addResult(results, assertNotNull(type, null, f));
 
         if (type != null) {
-            f = createResult(FAILURE, "Type id is not set!");
+            f = createResult(FAILURE, "Type ID is not set!");
             addResult(results, assertStringNotEmpty(type.getId(), null, f));
 
-            f = createResult(FAILURE, "Base type id is not set!");
+            f = createResult(FAILURE, "Base type ID is not set!");
             addResult(results, assertNotNull(type.getBaseTypeId(), null, f));
 
             f = createResult(FAILURE, "Local name is not set!");
@@ -2288,6 +2288,9 @@ public abstract class AbstractSessionTes
                 if (type.getBaseTypeId().value().equals(type.getId())) {
                     f = createResult(FAILURE, "Base type has parent type!");
                     addResult(results, 
assertStringNullOrEmpty(type.getParentTypeId(), null, f));
+
+                    f = createResult(FAILURE, "Query name of base type is 
wrong!");
+                    addResult(results, assertEquals(type.getId(), 
type.getQueryName(), null, f));
                 } else {
                     f = createResult(FAILURE, "Parent type is not set!");
                     addResult(results, 
assertStringNotEmpty(type.getParentTypeId(), null, f));
@@ -2385,6 +2388,26 @@ public abstract class AbstractSessionTes
                 }
             } else if (BaseTypeId.CMIS_POLICY.equals(type.getBaseTypeId())) {
                 // nothing to do
+            } else if (BaseTypeId.CMIS_SECONDARY.equals(type.getBaseTypeId())) 
{
+                if (type.isCreatable() != null) {
+                    f = createResult(FAILURE, "Secondary types must not be 
creatable!");
+                    addResult(results, assertIsFalse(type.isCreatable(), null, 
f));
+                }
+
+                if (type.isFileable() != null) {
+                    f = createResult(FAILURE, "Secondary types must not be 
fileable!");
+                    addResult(results, assertIsFalse(type.isFileable(), null, 
f));
+                }
+
+                if (type.isControllableAcl() != null) {
+                    f = createResult(FAILURE, "The controllable ACL flag must 
be false for secondary types!");
+                    addResult(results, assertIsFalse(type.isControllableAcl(), 
null, f));
+                }
+
+                if (type.isControllablePolicy() != null) {
+                    f = createResult(FAILURE, "The controllable policy flag 
must be false for secondary types!");
+                    addResult(results, 
assertIsFalse(type.isControllablePolicy(), null, f));
+                }
             }
 
             // check properties

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=1676741&r1=1676740&r2=1676741&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 Apr 29 13:15:47 2015
@@ -68,11 +68,11 @@ public class BaseTypesTest extends Abstr
             String typeId = typeDef.getId();
 
             if (typeId == null || !cmisTypes.contains(typeId)) {
-                addResult(createResult(FAILURE, "Base type has an invalid id: 
" + typeId));
+                addResult(createResult(FAILURE, "Base type has an invalid ID: 
" + typeId));
             }
 
             if (typeDef.getPropertyDefinitions() != null && 
!typeDef.getPropertyDefinitions().isEmpty()) {
-                addResult(createResult(WARNING, "Property type definitions 
were not requested but delivered. Type id: "
+                addResult(createResult(WARNING, "Property type definitions 
were not requested but delivered. Type ID: "
                         + typeId));
             }
         }
@@ -80,7 +80,8 @@ public class BaseTypesTest extends Abstr
         // document
         try {
             TypeDefinition documentType = 
session.getTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value());
-            addResult(checkTypeDefinition(session, documentType, "Document 
type spec compliance."));
+            addResult(checkTypeDefinition(session, documentType,
+                    "Document type spec compliance: " + documentType.getId()));
 
             failure = createResult(FAILURE, "Document type has the wrong base 
type: " + documentType.getBaseTypeId());
             addResult(assertEquals(BaseTypeId.CMIS_DOCUMENT, 
documentType.getBaseTypeId(), null, failure));
@@ -92,7 +93,7 @@ public class BaseTypesTest extends Abstr
         try {
             TypeDefinition folderType = 
session.getTypeDefinition(BaseTypeId.CMIS_FOLDER.value());
 
-            addResult(checkTypeDefinition(session, folderType, "Folder type 
spec compliance."));
+            addResult(checkTypeDefinition(session, folderType, "Folder type 
spec compliance: " + folderType.getId()));
 
             failure = createResult(FAILURE, "Folder type has the wrong base 
type: " + folderType.getBaseTypeId());
             addResult(assertEquals(BaseTypeId.CMIS_FOLDER, 
folderType.getBaseTypeId(), null, failure));
@@ -103,7 +104,8 @@ public class BaseTypesTest extends Abstr
         // relationship
         try {
             TypeDefinition relationshipType = 
session.getTypeDefinition(BaseTypeId.CMIS_RELATIONSHIP.value());
-            addResult(checkTypeDefinition(session, relationshipType, 
"Relationship type spec compliance."));
+            addResult(checkTypeDefinition(session, relationshipType, 
"Relationship type spec compliance: "
+                    + relationshipType.getId()));
 
             failure = createResult(FAILURE,
                     "Relationship type has the wrong base type: " + 
relationshipType.getBaseTypeId());
@@ -115,7 +117,7 @@ public class BaseTypesTest extends Abstr
         // policy
         try {
             TypeDefinition policyType = 
session.getTypeDefinition(BaseTypeId.CMIS_POLICY.value());
-            addResult(checkTypeDefinition(session, policyType, "Policy type 
spec compliance."));
+            addResult(checkTypeDefinition(session, policyType, "Policy type 
spec compliance: " + policyType.getId()));
 
             failure = createResult(FAILURE, "Policy type has the wrong base 
type: " + policyType.getBaseTypeId());
             addResult(assertEquals(BaseTypeId.CMIS_POLICY, 
policyType.getBaseTypeId(), null, failure));
@@ -130,7 +132,7 @@ public class BaseTypesTest extends Abstr
             // item
             try {
                 TypeDefinition itemType = 
session.getTypeDefinition(BaseTypeId.CMIS_ITEM.value());
-                addResult(checkTypeDefinition(session, itemType, "Item type 
spec compliance."));
+                addResult(checkTypeDefinition(session, itemType, "Item type 
spec compliance: " + itemType.getId()));
 
                 failure = createResult(FAILURE, "Item type has the wrong base 
type: " + itemType.getBaseTypeId());
                 addResult(assertEquals(BaseTypeId.CMIS_ITEM, 
itemType.getBaseTypeId(), null, failure));
@@ -143,7 +145,8 @@ public class BaseTypesTest extends Abstr
             // secondary type
             try {
                 TypeDefinition secondaryType = 
session.getTypeDefinition(BaseTypeId.CMIS_SECONDARY.value());
-                addResult(checkTypeDefinition(session, secondaryType, 
"Secondary type spec compliance."));
+                addResult(checkTypeDefinition(session, secondaryType, 
"Secondary type spec compliance: "
+                        + secondaryType.getId()));
 
                 failure = createResult(FAILURE,
                         "Secondary type has the wrong base type: " + 
secondaryType.getBaseTypeId());


Reply via email to