chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1509723 [2/3] - in /chemistry/opencmis/branches/inmemory-refactoring/src: main/java/org/apache/chemistry/opencmis/inmemory/ main/java/org/apache/chemistry/opencmis/inmemory/server/ main/java/org/apache/chemistry/opencmis/inmemory/storedobj...
Date Fri, 02 Aug 2013 14:16:06 GMT
Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java Fri Aug  2 14:16:05 2013
@@ -24,20 +24,216 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.FolderTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.ItemTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableDocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableFolderTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableItemTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutablePolicyTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutablePropertyDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableRelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableSecondaryTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PolicyTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.SecondaryTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.ItemTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.SecondaryTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeMutabilityImpl;
+import org.apache.chemistry.opencmis.server.support.TypeDefinitionFactory;
 
 public class DocumentTypeCreationHelper {
+    
+    public static class InMemoryDocumentType extends DocumentTypeDefinitionImpl {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
+            DocumentTypeCreationHelper.addPropertyDefinition(propertyDefinition);
+            super.addPropertyDefinition(propertyDefinition);
+        }        
+
+        @Override
+        public void setId(String id) {
+            super.setId(id);
+            super.setLocalName(id);
+            super.setQueryName(DocumentTypeCreationHelper.getQueryName(id));
+        }
+    }
+
+    public static class InMemoryFolderType extends FolderTypeDefinitionImpl {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
+            DocumentTypeCreationHelper.addPropertyDefinition(propertyDefinition);
+            super.addPropertyDefinition(propertyDefinition);
+        }        
+
+        @Override
+        public void setId(String id) {
+            super.setId(id);
+            super.setLocalName(id);
+            super.setQueryName(DocumentTypeCreationHelper.getQueryName(id));
+        }
+    }
+
+    public static class InMemoryRelationshipType extends RelationshipTypeDefinitionImpl {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
+            DocumentTypeCreationHelper.addPropertyDefinition(propertyDefinition);
+            super.addPropertyDefinition(propertyDefinition);
+        }        
+
+        @Override
+        public void setId(String id) {
+            super.setId(id);
+            super.setLocalName(id);
+            super.setQueryName(DocumentTypeCreationHelper.getQueryName(id));
+        }
+    }
+    
+    public static class InMemoryPolicyType extends PolicyTypeDefinitionImpl {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
+            DocumentTypeCreationHelper.addPropertyDefinition(propertyDefinition);
+            super.addPropertyDefinition(propertyDefinition);
+        }        
+
+        @Override
+        public void setId(String id) {
+            super.setId(id);
+            super.setLocalName(id);
+            super.setQueryName(DocumentTypeCreationHelper.getQueryName(id));
+        }
+    }
+
+    public static class InMemoryItemType extends ItemTypeDefinitionImpl {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
+            DocumentTypeCreationHelper.addPropertyDefinition(propertyDefinition);
+            super.addPropertyDefinition(propertyDefinition);
+        }        
+
+        @Override
+        public void setId(String id) {
+            super.setId(id);
+            super.setLocalName(id);
+            super.setQueryName(id);
+        }
+    }
+
+    public static class InMemorySecondaryType extends SecondaryTypeDefinitionImpl {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
+            DocumentTypeCreationHelper.addPropertyDefinition(propertyDefinition);
+            super.addPropertyDefinition(propertyDefinition);
+        }        
+
+        @Override
+        public void setId(String id) {
+            super.setId(id);
+            super.setLocalName(id);
+            super.setQueryName(id);
+        }
+    }
 
     private static final List<TypeDefinition> defaultTypes = createCmisDefaultTypes();
+    private static TypeDefinitionFactory typeFactory;
+    private static MutableDocumentTypeDefinition cmisTypeDoc;
+    private static MutableFolderTypeDefinition cmisTypeFolder;
+    private static MutableRelationshipTypeDefinition cmisTypeRel;
+    private static MutablePolicyTypeDefinition cmisTypePolicy;
+    private static MutableItemTypeDefinition cmisTypeItem;
+    private static MutableSecondaryTypeDefinition cmisTypeSecondary;
+    
+    public static DocumentTypeDefinition getCmisDocumentType() {
+        return cmisTypeDoc;
+    }
+    
+    public static FolderTypeDefinition getCmisFolderType() {
+        return cmisTypeFolder;
+    }
+    
+    public static RelationshipTypeDefinition getCmisRelationshipType() {
+        return cmisTypeRel;
+    }
+
+    public static PolicyTypeDefinition getCmisPolicyType() {
+        return cmisTypePolicy;
+    }
+    
+    public static ItemTypeDefinition getCmisItemType() {
+        return cmisTypeItem;
+    }
+    
+    public static SecondaryTypeDefinition getCmisSecondaryType() {
+        return cmisTypeSecondary;
+    }
+    
+    private static void initType(MutableTypeDefinition type, TypeDefinition parentTypeDefinition) {
+        type.setBaseTypeId(parentTypeDefinition.getBaseTypeId());
+        type.setParentTypeId(parentTypeDefinition.getId());
+        type.setIsControllableAcl(parentTypeDefinition.isControllableAcl());
+        type.setIsControllablePolicy(parentTypeDefinition.isControllablePolicy());
+        type.setIsCreatable(parentTypeDefinition.isCreatable());
+        type.setDescription(null);
+        type.setDisplayName(null);
+        type.setIsFileable(parentTypeDefinition.isFileable());
+        type.setIsFulltextIndexed(parentTypeDefinition.isFulltextIndexed());
+        type.setIsIncludedInSupertypeQuery(parentTypeDefinition.isIncludedInSupertypeQuery());
+        type.setLocalName(null);
+        type.setLocalNamespace(parentTypeDefinition.getLocalNamespace());
+        type.setIsQueryable(parentTypeDefinition.isQueryable());
+        type.setQueryName(null);
+        type.setId(null);
+        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
+     */
+    public static MutableDocumentTypeDefinition createDocumentTypeDefinitionWithoutBaseProperties(DocumentTypeDefinition parentTypeDefinition)
+            throws InstantiationException, IllegalAccessException {
+        MutableDocumentTypeDefinition documentType = new InMemoryDocumentType();
+        initType(documentType, parentTypeDefinition);
+
+        documentType.setIsVersionable(parentTypeDefinition.isVersionable());
+        documentType.setContentStreamAllowed(parentTypeDefinition.getContentStreamAllowed());
+        return documentType;
+    }
 
     private DocumentTypeCreationHelper() {
     }
@@ -51,33 +247,114 @@ public class DocumentTypeCreationHelper 
     public static final List<TypeDefinition> getDefaultTypes() {
         return defaultTypes;
     }
+    
+    private static void addPropertyDefinition(PropertyDefinition<?> propertyDefinition)  {
+        if (propertyDefinition.getId().equals(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
+            MutablePropertyDefinition<?> propDef = (MutablePropertyDefinition<?>) propertyDefinition;
+            propDef.setUpdatability(Updatability.READWRITE);
+        }        
+    }
 
+    private static String getQueryName(String id) {
+        if (null == id)
+            return null;
+        
+        StringBuffer sb = new StringBuffer(id);
+        for (int i=0; i<sb.length(); i++) {
+            char c = sb.charAt(i);
+            if (c == '.' || c == ' ') {
+                sb.setCharAt(i, '_');
+            }
+        }
+        return sb.toString();
+    }
+    
+    public static void setDefaultTypeCapabilities(MutableTypeDefinition cmisType) {
+        cmisType.setIsCreatable(true);
+        cmisType.setIsFileable(true);
+        cmisType.setIsFulltextIndexed(false);
+    }
+    
+    static TypeMutabilityImpl getBaseTypeMutability() {
+        TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
+        typeMutability.setCanCreate(true);
+        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(false);
+        return typeMutability;
+    }
+    
     private static List<TypeDefinition> createCmisDefaultTypes() {
+        TypeDefinitionFactory typeFactory = getTypeDefinitionFactory();
+        
         List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
 
         // create root types:
-        TypeDefinition cmisType = InMemoryDocumentTypeDefinition.getRootDocumentType();
-        typesList.add(cmisType);
-
-        cmisType = InMemoryFolderTypeDefinition.getRootFolderType();
-        typesList.add(cmisType);
-
-        cmisType = InMemoryRelationshipTypeDefinition.getRootRelationshipType();
-        typesList.add(cmisType);
-        
-        cmisType = InMemoryPolicyTypeDefinition.getRootPolicyType();
-        typesList.add(cmisType);
-
-        // CMIS 1.1
-        cmisType = InMemoryItemTypeDefinition.getRootItemType();
-        typesList.add(cmisType);
-        
-        cmisType = InMemorySecondaryTypeDefinition.getRootSecondaryType();
-        typesList.add(cmisType);
+        try {
+            cmisTypeDoc = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, null);
+            setDefaultTypeCapabilities(cmisTypeDoc);
+            cmisTypeDoc.setTypeMutability(getBaseTypeMutability());
+            cmisTypeDoc.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
+            cmisTypeDoc.setIsVersionable(false);
+            typesList.add(cmisTypeDoc);
+
+            cmisTypeFolder = typeFactory.createFolderTypeDefinition(CmisVersion.CMIS_1_1, null);
+            setDefaultTypeCapabilities(cmisTypeFolder);
+            cmisTypeFolder.setTypeMutability(getBaseTypeMutability());
+            typesList.add(cmisTypeFolder);
+            
+            cmisTypeRel = typeFactory.createRelationshipTypeDefinition(CmisVersion.CMIS_1_1, null);
+            setDefaultTypeCapabilities(cmisTypeRel);
+            cmisTypeRel.setTypeMutability(getBaseTypeMutability());
+            cmisTypeRel.setIsFileable(false);
+            typesList.add(cmisTypeRel);
+
+            cmisTypePolicy = typeFactory.createPolicyTypeDefinition(CmisVersion.CMIS_1_1, null);
+            setDefaultTypeCapabilities(cmisTypePolicy);
+            cmisTypePolicy.setTypeMutability(getBaseTypeMutability());
+            cmisTypePolicy.setIsFileable(false);
+            typesList.add(cmisTypePolicy);
+            
+            cmisTypeItem = typeFactory.createItemTypeDefinition(CmisVersion.CMIS_1_1, null);
+            setDefaultTypeCapabilities(cmisTypeItem);
+            cmisTypeItem.setTypeMutability(getBaseTypeMutability());
+            cmisTypeItem.setIsFileable(true);
+            typesList.add(cmisTypeItem);
+            
+            cmisTypeSecondary = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, null);
+            setDefaultTypeCapabilities(cmisTypeSecondary);
+            cmisTypeSecondary.setTypeMutability(getBaseTypeMutability());
+            cmisTypeSecondary.setIsFileable(false);
+            typesList.add(cmisTypeSecondary);            
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error when creating base types. ", e);
+        }
 
         return typesList;
     }
 
+    public static TypeDefinitionFactory getTypeDefinitionFactory() {
+        if (null == typeFactory) {
+            typeFactory = TypeDefinitionFactory.newInstance();
+            typeFactory.setDefaultControllableAcl(true);
+            typeFactory.setDefaultControllablePolicy(true);
+            typeFactory.setDefaultNamespace("http://apache.org");
+            //        typeFactory.setDefaultIsFulltextIndexed(false);
+            typeFactory.setDefaultQueryable(true);
+            TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
+            typeMutability.setCanCreate(true);
+            typeMutability.setCanUpdate(true);
+            typeMutability.setCanDelete(true);
+            typeFactory.setDefaultTypeMutability(typeMutability);
+            typeFactory.setDocumentTypeDefinitionClass(InMemoryDocumentType.class);
+            typeFactory.setFolderTypeDefinitionClass(InMemoryFolderType.class);
+            typeFactory.setRelationshipTypeDefinitionClass(InMemoryRelationshipType.class);
+            typeFactory.setPolicyTypeDefinitionClass(InMemoryPolicyType.class);
+            typeFactory.setItemTypeDefinitionClass(InMemoryItemType.class);
+            typeFactory.setSecondaryTypeDefinitionClass(InMemorySecondaryType.class);
+        }
+        return typeFactory;
+    }
+
     /**
      * create root types and a collection of sample types
      *

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Fri Aug  2 14:16:05 2013
@@ -541,24 +541,29 @@ public final class PropertyCreationHelpe
     }
 
     private static AbstractPropertyData<?> getEmptyValue(PropertyDefinition<?> propDef) {
+        AbstractPropertyData<?> emptyValue;
         if (propDef.getPropertyType().equals(PropertyType.BOOLEAN))
-            return new PropertyBooleanImpl(propDef.getId(), (Boolean) null);
+            emptyValue =  new PropertyBooleanImpl(propDef.getId(), (Boolean) null);
         else if (propDef.getPropertyType().equals(PropertyType.DATETIME))
-            return new PropertyDateTimeImpl(propDef.getId(), (GregorianCalendar) null);
+            emptyValue =  new PropertyDateTimeImpl(propDef.getId(), (GregorianCalendar) null);
         else if (propDef.getPropertyType().equals(PropertyType.DECIMAL))
-            return new PropertyDecimalImpl(propDef.getId(), (BigDecimal) null);
+            emptyValue =  new PropertyDecimalImpl(propDef.getId(), (BigDecimal) null);
         else if (propDef.getPropertyType().equals(PropertyType.HTML))
-            return new PropertyHtmlImpl(propDef.getId(), (String) null);
+            emptyValue =  new PropertyHtmlImpl(propDef.getId(), (String) null);
         else if (propDef.getPropertyType().equals(PropertyType.ID))
-            return new PropertyIdImpl(propDef.getId(), (String) null);
+            emptyValue =  new PropertyIdImpl(propDef.getId(), (String) null);
         else if (propDef.getPropertyType().equals(PropertyType.INTEGER))
-            return new PropertyIntegerImpl(propDef.getId(), (BigInteger) null);
+            emptyValue =  new PropertyIntegerImpl(propDef.getId(), (BigInteger) null);
         else if (propDef.getPropertyType().equals(PropertyType.STRING))
-            return new PropertyStringImpl(propDef.getId(), (String) null);
+            emptyValue =  new PropertyStringImpl(propDef.getId(), (String) null);
         else if (propDef.getPropertyType().equals(PropertyType.URI))
-            return new PropertyUriImpl(propDef.getId(), (String) null);
+            emptyValue =  new PropertyUriImpl(propDef.getId(), (String) null);
         else
-            return null;
+            emptyValue =  null;
+        emptyValue.setDisplayName(propDef.getDisplayName());
+        emptyValue.setQueryName(propDef.getQueryName());
+        emptyValue.setLocalName(propDef.getLocalName());
+        return emptyValue;
     }
 
     private static AbstractPropertyData<?> clonePropertyData(PropertyData<?> prop) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/webapp/WEB-INF/classes/repository.properties?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/webapp/WEB-INF/classes/repository.properties (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/webapp/WEB-INF/classes/repository.properties Fri Aug  2 14:16:05 2013
@@ -25,6 +25,8 @@ InMemoryServer.User=dummyuser
 InMemoryServer.Password=dummysecret
 InMemoryServer.TypesCreatorClass=org.apache.chemistry.opencmis.inmemory.types.DefaultTypeSystemCreator
 InMemoryServer.TypeDefinitionsFile=types.xml
+InMemoryServer.Class=org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl
+# InMemoryServer.Class=org.apache.chemistry.opencmis.inmemory.storedobj.dbimpl.StoreManagerImpl
 
 # InMemoryServer.MemoryThreshold=10485760
 # InMemoryServer.TempDir=/path/to/your/tmp
@@ -33,6 +35,7 @@ InMemoryServer.EncryptTempFiles=true
 
 # settings for init repository with data
   # enable or disable
+# RepositoryFiller.Enable=false
 RepositoryFiller.Enable=true
   # Type id of documents that are created
 RepositoryFiller.DocumentTypeId=ComplexType

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java Fri Aug  2 14:16:05 2013
@@ -21,7 +21,6 @@ package org.apache.chemistry.opencmis.in
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
@@ -38,13 +37,12 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumBasicPermissions;
 import org.apache.chemistry.opencmis.inmemory.ObjectServiceTest.ObjectTestTypeSystemCreator;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.InMemoryAce;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AclServiceTest extends AbstractServiceTest {
 
@@ -52,8 +50,8 @@ public class AclServiceTest extends Abst
     private ObjectCreator fCreator;
     private static final String DOCUMENT_NAME = "DocumentWithAcl";
     private static final String FOLDER_NAME = "FolderWithAcl";
-    private static final String DOCUMENT_TYPE_ID = InMemoryDocumentTypeDefinition.getRootDocumentType().getId();
-    private static final String FOLDER_TYPE_ID = InMemoryFolderTypeDefinition.getRootFolderType().getId();
+    private static final String DOCUMENT_TYPE_ID = DocumentTypeCreationHelper.getCmisDocumentType().getId();
+    private static final String FOLDER_TYPE_ID = DocumentTypeCreationHelper.getCmisFolderType().getId();
     private static final String USER = "user";
     private static final String ALICE = "alice";
     private static final String BOB = "bob";

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java Fri Aug  2 14:16:05 2013
@@ -79,11 +79,11 @@ public class FolderTest extends TestCase
         assertEquals(f1, fTest);
         fTest = fStore.getObjectByPath("/Folder 1/Folder 1.1", USER);
         assertEquals(f11, fTest);
-        List<Fileable> subFolders = fStore.getChildren(fRoot, -1, -1, "user").getChildren();
+        List<Fileable> subFolders = fStore.getChildren(fRoot, -1, -1, "user", false).getChildren();
         assertEquals(4, subFolders.size());
-        subFolders = fStore.getChildren(f2, -1, -1, "user").getChildren();
+        subFolders = fStore.getChildren(f2, -1, -1, "user", false).getChildren();
         assertEquals(0, subFolders.size());
-        subFolders = fStore.getChildren(f1, -1, -1, "user").getChildren();
+        subFolders = fStore.getChildren(f1, -1, -1, "user", false).getChildren();
         assertEquals(1, subFolders.size());
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java Fri Aug  2 14:16:05 2013
@@ -40,18 +40,18 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MultiFilingTest extends AbstractServiceTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(MultiFilingTest.class);
     private static final String DOCUMENT_TYPE_ID = UnitTestTypeSystemCreator.COMPLEX_TYPE;
-    private static final String FOLDER_TYPE_ID = InMemoryFolderTypeDefinition.getRootFolderType().getId();
+    private static final String FOLDER_TYPE_ID = DocumentTypeCreationHelper.getCmisFolderType().getId();
     private static final String UNFILED_DOC_NAME = "Unfiled document";
     private static final String RENAMED_DOC_NAME = "My Renamed Document";
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java Fri Aug  2 14:16:05 2013
@@ -36,13 +36,13 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
+import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
 import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Jens
@@ -205,8 +205,8 @@ public class NavigationServiceTest exten
     public void testGetPaging() {
         log.info("starting testGetPaging() ...");
         // create a folder
-        String folderId = super.createFolder("PagingFolder", fRootFolderId, InMemoryFolderTypeDefinition
-                .getRootFolderType().getId());
+        String folderId = super.createFolder("PagingFolder", fRootFolderId, DocumentTypeCreationHelper
+                .getCmisFolderType().getId());
         
         // create some documents
         for (int i=0; i<10; i++) {
@@ -275,8 +275,8 @@ public class NavigationServiceTest exten
         for (int i = 0; i < NUM_ROOT_FOLDERS; i++) {
             List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
             properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Folder " + i));
-            properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, InMemoryFolderTypeDefinition
-                    .getRootFolderType().getId()));
+            properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, DocumentTypeCreationHelper
+                    .getCmisFolderType().getId()));
             Properties props = fFactory.createPropertiesData(properties);
             String id = fObjSvc.createFolder(fRepositoryId, props, fRootFolderId, null, null, null, null);
             if (i == 3) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Fri Aug  2 14:16:05 2013
@@ -50,9 +50,17 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.RenditionData;
+import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableDocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableFolderTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableItemTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutablePolicyTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableRelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableSecondaryTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
@@ -64,6 +72,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
@@ -71,13 +80,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.ContentStreamDataImpl;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.DocumentImpl;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryItemTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryRelationshipTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemorySecondaryTypeDefinition;
+import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
+import org.apache.chemistry.opencmis.server.support.TypeDefinitionFactory;
 import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
 import org.junit.After;
 import org.junit.Before;
@@ -115,9 +120,9 @@ public class ObjectServiceTest extends A
     public static final String TEST_DOCUMENT_MY_SUB_INT_PROP_ID = "MyInheritedIntProp";
     public static final String TEST_ITEM_TYPE_ID = "MyItemType";
     public static final String ITEM_STRING_PROP = "ItemStringProp";
-    private static final String DOCUMENT_TYPE_ID = InMemoryDocumentTypeDefinition.getRootDocumentType().getId();
+    private static final String DOCUMENT_TYPE_ID = DocumentTypeCreationHelper.getCmisDocumentType().getId();
     private static final String DOCUMENT_ID = "Document_1";
-    private static final String FOLDER_TYPE_ID = InMemoryFolderTypeDefinition.getRootFolderType().getId();
+    private static final String FOLDER_TYPE_ID = DocumentTypeCreationHelper.getCmisFolderType().getId();
     private static final String FOLDER_ID = "Folder_1";
     private static final String MY_CUSTOM_NAME = "My Custom Document";
     private static final int MAX_SIZE = 100;
@@ -614,9 +619,9 @@ public class ObjectServiceTest extends A
                 ObjectGenerator.CONTENT_KIND.LoremIpsumText);
         String rootFolderId = createFolder();
         // Set the type id for all created documents:
-        gen.setDocumentTypeId(InMemoryDocumentTypeDefinition.getRootDocumentType().getId());
+        gen.setDocumentTypeId(DocumentTypeCreationHelper.getCmisDocumentType().getId());
         // Set the type id for all created folders:
-        gen.setFolderTypeId(InMemoryFolderTypeDefinition.getRootFolderType().getId());
+        gen.setFolderTypeId(DocumentTypeCreationHelper.getCmisFolderType().getId());
         gen.setNumberOfDocumentsToCreatePerFolder(2); // create two documents in
         // each folder
         gen.createFolderHierachy(1, 1, rootFolderId);
@@ -1511,12 +1516,12 @@ public class ObjectServiceTest extends A
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
                 ObjectGenerator.CONTENT_KIND.LoremIpsumText);
         // Set the type id for all created documents:
-        gen.setDocumentTypeId(InMemoryDocumentTypeDefinition.getRootDocumentType().getId());
+        gen.setDocumentTypeId(DocumentTypeCreationHelper.getCmisDocumentType().getId());
         // Set the type id for all created folders:
         gen.setNumberOfDocumentsToCreatePerFolder(1); // create one document in
         // each folder
         gen.createFolderHierachy(3, 2, rootFolderId);
-        gen.setFolderTypeId(InMemoryFolderTypeDefinition.getRootFolderType().getId());
+        gen.setFolderTypeId(DocumentTypeCreationHelper.getCmisFolderType().getId());
         gen.dumpFolder(fRootFolderId, propertyFilter);
         Holder<String> holder = new Holder<String>();
         String sourceIdToMove = gen.getFolderId(rootFolderId, 2, 1);
@@ -1678,6 +1683,8 @@ public class ObjectServiceTest extends A
 
     public static class ObjectTestTypeSystemCreator implements TypeCreator {
 
+        static final TypeDefinitionFactory typeFactory =  DocumentTypeCreationHelper.getTypeDefinitionFactory();
+
         /**
          * create root types and a sample type for folder and document
          *
@@ -1686,188 +1693,213 @@ public class ObjectServiceTest extends A
         @Override
 		public List<TypeDefinition> createTypesList() {
             List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
-            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(TEST_DOCUMENT_TYPE_ID,
-                    "My Document Type", InMemoryDocumentTypeDefinition.getRootDocumentType());
+ 
+            try {
+                MutableDocumentTypeDefinition cmisDocumentType;        
+                cmisDocumentType = typeFactory.createChildDocumentTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), null);
+                cmisDocumentType.setId(TEST_DOCUMENT_TYPE_ID);
+                cmisDocumentType.setDisplayName("My Document Type");
+                cmisDocumentType.setDescription("InMemory test type definition " + TEST_DOCUMENT_TYPE_ID);
+    
+                MutableFolderTypeDefinition cmisFolderType;        
+                cmisFolderType = typeFactory.createFolderTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisFolderType().getId());
+                cmisFolderType.setId(TEST_FOLDER_TYPE_ID);
+                cmisFolderType.setDisplayName("My Folder Type");
+                cmisFolderType.setDescription("InMemory test type definition " + TEST_FOLDER_TYPE_ID);
+                // create a simple string property type and
+                // attach the property definition to the type definition for
+                // document and folder type
+                Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+                PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
+                        TEST_DOCUMENT_STRING_PROP_ID, "Sample Doc String Property", Updatability.READWRITE);
+                propertyDefinitions.put(prop.getId(), prop);
+                cmisDocumentType.addPropertyDefinition(prop);
+    
+                propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+                prop = PropertyCreationHelper.createStringDefinition(TEST_FOLDER_STRING_PROP_ID,
+                        "Sample Folder String Property", Updatability.READWRITE);
+                propertyDefinitions.put(prop.getId(), prop);
+                cmisFolderType.addPropertyDefinition(prop);
+    
+                DocumentTypeDefinition customDocType = createCustomTypeWithStringIntProperty();
+                TypeDefinition noContentType = createCustomTypeNoContent();
+                TypeDefinition mustHaveContentType = createCustomTypeMustHaveContent();
+                TypeDefinition relType = createRelationshipType();
+                TypeDefinition relTypeRestricted = createRelationshipTypeRestricted();
+                TypeDefinition verType = createVersionableType();
+                TypeDefinition polType = createPolicyType();
+                
+                // add type to types collection
+                typesList.add(cmisDocumentType);
+                typesList.add(cmisFolderType);
+                typesList.add(customDocType);
+                typesList.add(noContentType);
+                typesList.add(mustHaveContentType);
+                typesList.add(createCustomInheritedType(customDocType));
+                typesList.add(createDocumentTypeWithDefault());
+                typesList.add(createFolderTypeWithDefault());
+                typesList.add(createItemType());
+                typesList.add(createSecondaryType());
+                typesList.add(relType);
+                typesList.add(relTypeRestricted);
+                typesList.add(verType);
+                typesList.add(polType);
+                return typesList;
+            } catch (Exception e) {
+                throw new CmisRuntimeException("Failed to create types.", e);
+            }
+        }
 
-            InMemoryFolderTypeDefinition cmisFolderType = new InMemoryFolderTypeDefinition(TEST_FOLDER_TYPE_ID,
-                    "My Folder Type", InMemoryFolderTypeDefinition.getRootFolderType());
-            // create a simple string property type and
-            // attach the property definition to the type definition for
-            // document and folder type
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
-                    TEST_DOCUMENT_STRING_PROP_ID, "Sample Doc String Property", Updatability.READWRITE);
-            propertyDefinitions.put(prop.getId(), prop);
-            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
-
-            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            prop = PropertyCreationHelper.createStringDefinition(TEST_FOLDER_STRING_PROP_ID,
-                    "Sample Folder String Property", Updatability.READWRITE);
-            propertyDefinitions.put(prop.getId(), prop);
-            cmisFolderType.addCustomPropertyDefinitions(propertyDefinitions);
-
-            InMemoryDocumentTypeDefinition customDocType = createCustomTypeWithStringIntProperty();
-            InMemoryDocumentTypeDefinition noContentType = createCustomTypeNoContent();
-            InMemoryDocumentTypeDefinition mustHaveContentType = createCustomTypeMustHaveContent();
-            InMemoryRelationshipTypeDefinition relType = createRelationshipType();
-            InMemoryRelationshipTypeDefinition relTypeRestricted = createRelationshipTypeRestricted();
-            InMemoryDocumentTypeDefinition verType = createVersionableType();
-            InMemoryPolicyTypeDefinition polType = createPolicyType();
-            
-            // add type to types collection
-            typesList.add(cmisDocumentType);
-            typesList.add(cmisFolderType);
-            typesList.add(customDocType);
-            typesList.add(noContentType);
-            typesList.add(mustHaveContentType);
-            typesList.add(createCustomInheritedType(customDocType));
-            typesList.add(createDocumentTypeWithDefault());
-            typesList.add(createFolderTypeWithDefault());
-            typesList.add(createItemType());
-            typesList.add(createSecondaryType());
-            typesList.add(relType);
-            typesList.add(relTypeRestricted);
-            typesList.add(verType);
-            typesList.add(polType);
-            return typesList;
-        }
-
-        private static InMemoryDocumentTypeDefinition createCustomTypeWithStringIntProperty() {
-            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
-                    TEST_CUSTOM_DOCUMENT_TYPE_ID, "My Custom Document Type", InMemoryDocumentTypeDefinition
-                            .getRootDocumentType());
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+        private static DocumentTypeDefinition createCustomTypeWithStringIntProperty() throws InstantiationException, IllegalAccessException {
+            MutableDocumentTypeDefinition cmisDocumentType;        
+            cmisDocumentType = typeFactory.createChildDocumentTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), null);
+            cmisDocumentType.setId(TEST_CUSTOM_DOCUMENT_TYPE_ID);
+            cmisDocumentType.setDisplayName("My Custom Document Type");
+            cmisDocumentType.setDescription("InMemory test type definition " + TEST_CUSTOM_DOCUMENT_TYPE_ID);
+ 
             PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
                     TEST_DOCUMENT_MY_STRING_PROP_ID, "My String Property", Updatability.READWRITE);
             prop.setIsRequired(false);
             prop.setMaxLength(BigInteger.valueOf(20)); // max len to 20
-            propertyDefinitions.put(prop.getId(), prop);
+            cmisDocumentType.addPropertyDefinition(prop);
 
             PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                     TEST_DOCUMENT_MY_INT_PROP_ID, "My Integer Property", Updatability.READWRITE);
             prop2.setIsRequired(true);
             prop2.setMinValue(BigInteger.valueOf(-10000));
             prop2.setMaxValue(BigInteger.valueOf(10000));
-            propertyDefinitions.put(prop2.getId(), prop2);
-            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
+            cmisDocumentType.addPropertyDefinition(prop2);
             return cmisDocumentType;
         }
 
-        private static InMemoryDocumentTypeDefinition createCustomInheritedType(InMemoryDocumentTypeDefinition baseType) {
-            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
-                    TEST_INHERITED_CUSTOM_DOCUMENT_TYPE_ID, "My Custom Document Type", baseType);
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+        private static TypeDefinition createCustomInheritedType(DocumentTypeDefinition baseType)  throws InstantiationException, IllegalAccessException {
+            MutableDocumentTypeDefinition cmisDocumentType;        
+            cmisDocumentType = typeFactory.createChildDocumentTypeDefinition(baseType, null);
+            cmisDocumentType.setId(TEST_INHERITED_CUSTOM_DOCUMENT_TYPE_ID);
+            cmisDocumentType.setDisplayName("My Custom Document Type");
+            cmisDocumentType.setDescription("InMemory test type definition " + TEST_INHERITED_CUSTOM_DOCUMENT_TYPE_ID);
+           
             PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
                     TEST_DOCUMENT_MY_SUB_STRING_PROP_ID, "Subtype String Property", Updatability.READWRITE);
             prop.setIsRequired(false);
-            propertyDefinitions.put(prop.getId(), prop);
+            cmisDocumentType.addPropertyDefinition(prop);
 
             PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                     TEST_DOCUMENT_MY_SUB_INT_PROP_ID, "Subtype", Updatability.READWRITE);
             prop2.setIsRequired(true);
-            propertyDefinitions.put(prop2.getId(), prop2);
-            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
+            cmisDocumentType.addPropertyDefinition(prop2);
             return cmisDocumentType;
         }
 
-        private static InMemoryDocumentTypeDefinition createDocumentTypeWithDefault() {
-            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
-                    TEST_DOC_TYPE_WITH_DEFAULTS_ID, "Document Type With default values", InMemoryDocumentTypeDefinition
-                    .getRootDocumentType());
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+        private static TypeDefinition createDocumentTypeWithDefault()  throws InstantiationException, IllegalAccessException {
+            MutableDocumentTypeDefinition cmisDocumentType;        
+            cmisDocumentType = typeFactory.createChildDocumentTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), null);
+            cmisDocumentType.setId(TEST_DOC_TYPE_WITH_DEFAULTS_ID);
+            cmisDocumentType.setDisplayName("Document Type With default values");
+            cmisDocumentType.setDescription("InMemory test type definition " + TEST_DOC_TYPE_WITH_DEFAULTS_ID);
+
             PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringMultiDefinition(
                     TEST_DOCUMENT_MY_MULTI_STRING_PROP_ID, "Test Multi String Property", Updatability.READWRITE);
             prop.setIsRequired(false);
             List<String> defValS = new ArrayList<String>() {{ add("Apache"); add("CMIS"); }};
             prop.setDefaultValue(defValS);
-            propertyDefinitions.put(prop.getId(), prop);
+            cmisDocumentType.addPropertyDefinition(prop);
 
             PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                     TEST_DOCUMENT_MY_INT_PROP_ID, "Test Integer Property", Updatability.READWRITE);
             prop2.setIsRequired(false);
             List<BigInteger> defVal = new ArrayList<BigInteger>() {{ add(BigInteger.valueOf(100)); }};
             prop2.setDefaultValue(defVal);
-            propertyDefinitions.put(prop2.getId(), prop2);
+            cmisDocumentType.addPropertyDefinition(prop2);
 
             PropertyIntegerDefinitionImpl prop3 = PropertyCreationHelper.createIntegerDefinition(
                     TEST_DOCUMENT_MY_INT_PROP_ID_MANDATORY_DEFAULT, "Test Integer Property Mandatory default", Updatability.READWRITE);
             prop3.setIsRequired(true);
             List<BigInteger> defVal2 = new ArrayList<BigInteger>() {{ add(BigInteger.valueOf(100)); }};
             prop3.setDefaultValue(defVal2);
-            propertyDefinitions.put(prop3.getId(), prop3);
-
-            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
+            cmisDocumentType.addPropertyDefinition(prop3);
 
             return cmisDocumentType;
         }
 
-        private static InMemoryDocumentTypeDefinition createCustomTypeNoContent() {
-            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
-                    TEST_CUSTOM_NO_CONTENT_TYPE_ID, "No Content Document Type", InMemoryDocumentTypeDefinition
-                            .getRootDocumentType());
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
+        private static TypeDefinition createCustomTypeNoContent()  throws InstantiationException, IllegalAccessException {
+            MutableDocumentTypeDefinition cmisDocumentType;        
+            cmisDocumentType = typeFactory.createChildDocumentTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), null);
+            cmisDocumentType.setId(TEST_CUSTOM_NO_CONTENT_TYPE_ID);
+            cmisDocumentType.setDisplayName("No Content Document Type");
+            cmisDocumentType.setDescription("InMemory test type definition " + TEST_CUSTOM_NO_CONTENT_TYPE_ID);
             cmisDocumentType.setContentStreamAllowed(ContentStreamAllowed.NOTALLOWED);
             return cmisDocumentType;
         }
         
-        private static InMemoryDocumentTypeDefinition createCustomTypeMustHaveContent() {
-            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
-                    TEST_CUSTOM_MUST_CONTENT_TYPE_ID, "Must Have Content Document Type", InMemoryDocumentTypeDefinition
-                            .getRootDocumentType());
+        private static TypeDefinition createCustomTypeMustHaveContent()  throws InstantiationException, IllegalAccessException {
+            MutableDocumentTypeDefinition cmisDocumentType;        
+            cmisDocumentType = typeFactory.createChildDocumentTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), null);
+            cmisDocumentType.setId(TEST_CUSTOM_MUST_CONTENT_TYPE_ID);
+            cmisDocumentType.setDisplayName("Must Have Content Document Type");
+            cmisDocumentType.setDescription("InMemory test type definition " + TEST_CUSTOM_MUST_CONTENT_TYPE_ID);
+            cmisDocumentType.setContentStreamAllowed(ContentStreamAllowed.NOTALLOWED);
             cmisDocumentType.setContentStreamAllowed(ContentStreamAllowed.REQUIRED);
             return cmisDocumentType;
         }
         
-        private static InMemoryFolderTypeDefinition createFolderTypeWithDefault() {
-            InMemoryFolderTypeDefinition cmisFolderType = new InMemoryFolderTypeDefinition(
-                    TEST_FOLDER_TYPE_WITH_DEFAULTS_ID, "Folder Type With default values", InMemoryFolderTypeDefinition.
-                    getRootFolderType());
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+        private static TypeDefinition createFolderTypeWithDefault()  throws InstantiationException, IllegalAccessException {
+            MutableFolderTypeDefinition cmisFolderType;        
+            cmisFolderType = typeFactory.createFolderTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisFolderType().getId());
+            cmisFolderType.setId(TEST_FOLDER_TYPE_WITH_DEFAULTS_ID);
+            cmisFolderType.setDisplayName("Folder Type With default values");
+            cmisFolderType.setDescription("InMemory test type definition " + TEST_FOLDER_TYPE_WITH_DEFAULTS_ID);
+
             PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringMultiDefinition(
                     TEST_FOLDER_MY_MULTI_STRING_PROP_ID, "Test Multi String Property", Updatability.READWRITE);
             prop.setIsRequired(false);
             List<String> defValS = new ArrayList<String>() {{ add("Apache"); add("CMIS"); }};
             prop.setDefaultValue(defValS);
-            propertyDefinitions.put(prop.getId(), prop);
+            cmisFolderType.addPropertyDefinition(prop);
 
             PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                     TEST_FOLDER_MY_INT_PROP_ID, "Test Integer Property", Updatability.READWRITE);
             prop2.setIsRequired(false);
             List<BigInteger> defVal = new ArrayList<BigInteger>() {{ add(BigInteger.valueOf(100)); }};
             prop2.setDefaultValue(defVal);
-            propertyDefinitions.put(prop2.getId(), prop2);
+            cmisFolderType.addPropertyDefinition(prop2);
 
             PropertyIntegerDefinitionImpl prop3 = PropertyCreationHelper.createIntegerDefinition(
                     TEST_FOLDER_MY_INT_PROP_ID_MANDATORY_DEFAULT, "Test Integer Property Mandatory default", Updatability.READWRITE);
             prop3.setIsRequired(true);
             List<BigInteger> defVal2 = new ArrayList<BigInteger>() {{ add(BigInteger.valueOf(100)); }};
             prop3.setDefaultValue(defVal2);
-            propertyDefinitions.put(prop3.getId(), prop3);
-
-            cmisFolderType.addCustomPropertyDefinitions(propertyDefinitions);
+            cmisFolderType.addPropertyDefinition(prop3);
 
             return cmisFolderType;
         }
         
-        private InMemoryRelationshipTypeDefinition createRelationshipType() {
-            InMemoryRelationshipTypeDefinition cmisRelType = new InMemoryRelationshipTypeDefinition(
-                    TEST_RELATION_TYPE_ID, "MyRelationshipType");
+        private TypeDefinition createRelationshipType()  throws InstantiationException, IllegalAccessException {
+            MutableRelationshipTypeDefinition cmisRelType;        
+            cmisRelType = typeFactory.createRelationshipTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisRelationshipType().getId());
+            cmisRelType.setId(TEST_RELATION_TYPE_ID);
+            cmisRelType.setDisplayName("MyRelationshipType");
+            cmisRelType.setDescription("InMemory test type definition " + TEST_RELATION_TYPE_ID);
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisRelType);
+            cmisRelType.setIsFileable(false);
+
             // create a single String property definition
 
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
             PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(REL_STRING_PROP,
                     "CrossReferenceType", Updatability.READWRITE);
-            propertyDefinitions.put(prop1.getId(), prop1);
-            cmisRelType.addCustomPropertyDefinitions(propertyDefinitions);
+            cmisRelType.addPropertyDefinition(prop1);
             
             return cmisRelType;            
         }
 
-        private InMemoryRelationshipTypeDefinition createRelationshipTypeRestricted() {
-            InMemoryRelationshipTypeDefinition cmisRelType = new InMemoryRelationshipTypeDefinition(
-                    TEST_RESTRICTED_RELATION_TYPE_ID, "RestrictedRelationshipType");
+        private TypeDefinition createRelationshipTypeRestricted()  throws InstantiationException, IllegalAccessException {
+            MutableRelationshipTypeDefinition cmisRelType;        
+            cmisRelType = typeFactory.createRelationshipTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisRelationshipType().getId());
+            cmisRelType.setId(TEST_RESTRICTED_RELATION_TYPE_ID);
+            cmisRelType.setDisplayName("RestrictedRelationshipType");
+            cmisRelType.setDescription("InMemory test type definition " + TEST_RESTRICTED_RELATION_TYPE_ID);
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisRelType);
+            cmisRelType.setIsFileable(false);
 
             List<String> allowedTypeIds = Collections.singletonList(TEST_CUSTOM_DOCUMENT_TYPE_ID);
             cmisRelType.setAllowedSourceTypes(allowedTypeIds);
@@ -1875,75 +1907,77 @@ public class ObjectServiceTest extends A
             return cmisRelType;            
         }
 
-       private static InMemoryItemTypeDefinition createItemType() {
+       private static TypeDefinition createItemType()  throws InstantiationException, IllegalAccessException {
             //CMIS 1.1 create an item item type
-
-            InMemoryItemTypeDefinition cmisItemType = new InMemoryItemTypeDefinition(TEST_ITEM_TYPE_ID, "MyItemType");
-            // create a single String property definition
-
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(ITEM_STRING_PROP,
-                    "Item String Property", Updatability.READWRITE);
-            propertyDefinitions.put(prop1.getId(), prop1);
-            cmisItemType.addCustomPropertyDefinitions(propertyDefinitions);
-            // add type to types collection
-            return cmisItemType;            
+           MutableItemTypeDefinition cmisItemType;        
+           cmisItemType = typeFactory.createItemTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisItemType().getId()); // ??? DocumentTypeCreationHelper.getCmisItemType());
+           cmisItemType.setId(TEST_ITEM_TYPE_ID);
+           cmisItemType.setDisplayName("MyItemType");
+           cmisItemType.setDescription("Builtin InMemory type definition " + TEST_ITEM_TYPE_ID);
+           DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisItemType);
+
+           // create a single String property definition
+           PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(ITEM_STRING_PROP,
+                   "Item String Property", Updatability.READWRITE);
+           cmisItemType.addPropertyDefinition(prop1);
+           // add type to types collection
+           return cmisItemType;            
         }
         
-        private static InMemorySecondaryTypeDefinition createSecondaryType() {
+        private static TypeDefinition createSecondaryType()  throws InstantiationException, IllegalAccessException {
             //CMIS 1.1 create an item item type
+            MutableSecondaryTypeDefinition cmisSecondaryType;        
+            cmisSecondaryType = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisSecondaryType().getId());
+            cmisSecondaryType.setId(TEST_SECONDARY_TYPE_ID);
+            cmisSecondaryType.setDisplayName("MySecondaryType");
+            cmisSecondaryType.setDescription("InMemory test type definition " + TEST_SECONDARY_TYPE_ID);
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
+            cmisSecondaryType.setIsFileable(false);
 
-            InMemorySecondaryTypeDefinition cmisSecondaryType = new InMemorySecondaryTypeDefinition(TEST_SECONDARY_TYPE_ID, 
-                    "MySecondaryType");
             // create a single String property definition
 
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
             PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(SECONDARY_STRING_PROP,
                     "Secondary String Property", Updatability.READWRITE);
-            propertyDefinitions.put(prop1.getId(), prop1);
+            cmisSecondaryType.addPropertyDefinition(prop1);
+
             PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(SECONDARY_INTEGER_PROP,
                     "Secondary Integer Property", Updatability.READWRITE);
             prop2.setIsRequired(true);
-            propertyDefinitions.put(prop2.getId(), prop2);
-            cmisSecondaryType.addCustomPropertyDefinitions(propertyDefinitions);
-
+            cmisSecondaryType.addPropertyDefinition(prop2);
+ 
             return cmisSecondaryType;            
         }
         
-        private static InMemoryDocumentTypeDefinition createVersionableType() {
+        private static TypeDefinition createVersionableType()  throws InstantiationException, IllegalAccessException {
             // create a complex type with properties
-            InMemoryDocumentTypeDefinition verType = new InMemoryDocumentTypeDefinition(
-                    TEST_VERSION_DOCUMENT_TYPE_ID, "VersionedType", InMemoryDocumentTypeDefinition.getRootDocumentType());
-
-            // create a String property definition
+            MutableDocumentTypeDefinition verType;        
+            verType = typeFactory.createChildDocumentTypeDefinition(DocumentTypeCreationHelper.getCmisDocumentType(), null);
+            verType.setId(TEST_VERSION_DOCUMENT_TYPE_ID);
+            verType.setDisplayName("VersionedType");
+            verType.setDescription("InMemory test type definition " + TEST_VERSION_DOCUMENT_TYPE_ID);
 
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+            verType.setIsVersionable(true); // make it a versionable type;
 
+            // create a String property definition
             PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(TEST_VER_PROPERTY_ID,
                     "Sample String Property", Updatability.WHENCHECKEDOUT);
-            propertyDefinitions.put(prop1.getId(), prop1);
-
-            verType.addCustomPropertyDefinitions(propertyDefinitions);
-            verType.setIsVersionable(true); // make it a versionable type;
+            verType.addPropertyDefinition(prop1);
             return verType;
         }
         
-        private static InMemoryPolicyTypeDefinition createPolicyType() {
-            
-            InMemoryPolicyTypeDefinition polType = new InMemoryPolicyTypeDefinition(
-                    TEST_POLICY_TYPE_ID, "Audit Policy", InMemoryPolicyTypeDefinition.getRootPolicyType());
-
+        private static TypeDefinition createPolicyType()  throws InstantiationException, IllegalAccessException {
+            MutablePolicyTypeDefinition polType;        
+            polType = typeFactory.createPolicyTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisPolicyType().getId());
+            polType.setId(TEST_POLICY_TYPE_ID);
+            polType.setDisplayName("Audit Policy");
+            polType.setDescription("InMemory type definition " + TEST_POLICY_TYPE_ID);
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(polType);
+            polType.setIsFileable(false);
+           
             // create a String property definition
-
-            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
             PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(TEST_POLICY_PROPERTY_ID,
                     "Audit Kind Property", Updatability.READWRITE);
-            propertyDefinitions.put(prop1.getId(), prop1);
-
-            polType.addCustomPropertyDefinitions(propertyDefinitions);
+            polType.addPropertyDefinition(prop1);
             return polType;            
         }
     }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceMutabilityTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceMutabilityTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceMutabilityTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceMutabilityTest.java Fri Aug  2 14:16:05 2013
@@ -32,28 +32,25 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableDocumentTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.apache.chemistry.opencmis.inmemory.server.InMemoryObjectServiceImpl;
-import org.apache.chemistry.opencmis.inmemory.server.InMemoryRepositoryServiceImpl;
 import org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceFactoryImpl;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
+import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Temporary test class until CMIS 1.1 bindings are completed. Until then
@@ -84,7 +81,6 @@ public class RepositoryServiceMutability
         
         InMemoryServiceFactoryImpl factory = new InMemoryServiceFactoryImpl();
         factory.init(parameters);
-        StoreManager storeManager = factory.getStoreManger();
     }
 
     @Override
@@ -158,7 +154,7 @@ public class RepositoryServiceMutability
         String repositoryId = getRepositoryId();
         
         // test illegal type id
-        InMemoryDocumentTypeDefinition typeDefRef = createTypeForAddingAtRuntime();
+        MutableDocumentTypeDefinition typeDefRef = createTypeForAddingAtRuntime();
         typeDefRef.setId(typeDefRef.getId() + "!!!");
         TypeDefinition typeDefNew = fRepSvc.createType(repositoryId, typeDefRef, null);
         assertEquals(TYPE_ID_MUTABILITY + "___", typeDefNew.getId());
@@ -214,7 +210,7 @@ public class RepositoryServiceMutability
         String repositoryId = getRepositoryId();
         
         // test null property id
-        InMemoryDocumentTypeDefinition typeDef = createTypeForAddingAtRuntime();
+        DocumentTypeDefinition typeDef = createTypeForAddingAtRuntime();
         PropertyStringDefinitionImpl pd = getPropertyDefinitionImpl(typeDef);
         pd.setId(null);
         checkAddingType(repositoryId, typeDef, CmisInvalidArgumentException.class);
@@ -341,31 +337,34 @@ public class RepositoryServiceMutability
     }
 
     private PropertyStringDefinitionImpl getPropertyDefinitionImpl(TypeDefinition typeDef) {
-        @SuppressWarnings("unchecked")
         PropertyStringDefinitionImpl pd = (PropertyStringDefinitionImpl) typeDef.getPropertyDefinitions().get(PROPERTY_ID_TITLE);
         return pd;
     }
     
-    private InMemoryDocumentTypeDefinition createTypeForAddingAtRuntime() {
-        
-        InMemoryDocumentTypeDefinition cmisLaterType = new InMemoryDocumentTypeDefinition(TYPE_ID_MUTABILITY,
-                "Type with two properties", InMemoryDocumentTypeDefinition.getRootDocumentType());
-
-        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
-        PropertyIntegerDefinitionImpl prop1 = PropertyCreationHelper.createIntegerDefinition(PROPERTY_ID_NUMBER,
-                "Sample Int Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop1.getId(), prop1);
+    private MutableDocumentTypeDefinition createTypeForAddingAtRuntime() {
+        try {
+            MutableDocumentTypeDefinition cmisLaterType;
+            cmisLaterType = DocumentTypeCreationHelper.createDocumentTypeDefinitionWithoutBaseProperties(DocumentTypeCreationHelper.getCmisDocumentType());
+            cmisLaterType.setId(TYPE_ID_MUTABILITY);
+            cmisLaterType.setDisplayName("Type with two properties");
+            cmisLaterType.setDescription("Builtin InMemory type definition " + TYPE_ID_MUTABILITY);
+
+
+            PropertyIntegerDefinitionImpl prop1 = PropertyCreationHelper.createIntegerDefinition(PROPERTY_ID_NUMBER,
+                    "Sample Int Property", Updatability.READWRITE);
+            cmisLaterType.addPropertyDefinition(prop1);
+
+            PropertyStringDefinitionImpl prop2 = PropertyCreationHelper.createStringDefinition(PROPERTY_ID_TITLE,
+                    "Sample String Property", Updatability.READWRITE);
+            cmisLaterType.addPropertyDefinition(prop2);
 
-        PropertyStringDefinitionImpl prop2 = PropertyCreationHelper.createStringDefinition(PROPERTY_ID_TITLE,
-                "Sample String Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop2.getId(), prop2);
-        
-        cmisLaterType.addCustomPropertyDefinitions(propertyDefinitions);
-        
-        return cmisLaterType;
+            return cmisLaterType;
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error when creating built-in InMemory types.", e);
+        }
     }
 
+
     String createDoc(String name, String folderId, String typeId) {
         ContentStream contentStream = null;
         List<String> policies = null;

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java Fri Aug  2 14:16:05 2013
@@ -166,7 +166,7 @@ public class RepositoryServiceTest exten
             log.info("  Base type is: " + typeDef.getBaseTypeId());
             Map<String, PropertyDefinition<?>> propDefs = typeDef.getPropertyDefinitions();
             log.info("  Property definitions (must be null): " + propDefs);
-            assertNull(propDefs);
+            assertTrue(propDefs.isEmpty());
         }
 
         log.info("... testGetTypesWihtoutPropDefs() finished.");
@@ -301,7 +301,7 @@ public class RepositoryServiceTest exten
         children = fRepSvc.getTypeChildren(repositoryId, typeId, null, maxItems, null, null);
 
         for (TypeDefinition type : children.getList()) {
-            assertNull(type.getPropertyDefinitions());
+            assertTrue(type.getPropertyDefinitions().isEmpty());
         }
 
         log.info("... testGetTypeChildrenNoProperties() finished.");



Mime
View raw message