Author: jens
Date: Fri Mar 26 11:17:04 2010
New Revision: 927772

URL: http://svn.apache.org/viewvc?rev=927772&view=rev
Log:
Add tests for wrong base type during create 
Add test for naming restrictions

Modified:
    
incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java

Modified: 
incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
URL: 
http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java?rev=927772&r1=927771&r2=927772&view=diff
==============================================================================
--- 
incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
 (original)
+++ 
incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
 Fri Mar 26 11:17:04 2010
@@ -35,6 +35,7 @@ import org.apache.opencmis.commons.enums
 import org.apache.opencmis.commons.enums.UnfileObjects;
 import org.apache.opencmis.commons.enums.VersioningState;
 import org.apache.opencmis.commons.exceptions.CmisConstraintException;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.exceptions.CmisUpdateConflictException;
@@ -104,6 +105,26 @@ public class ObjectServiceTest extends A
     if (id != null)
       log.info("createDocument succeeded with created id: " + id);
     log.info("... testCreateObject() finished.");
+    
+    // test create a document with a folder type, should fail:
+    try {
+      PropertiesData props = 
createDocumentProperties("DocumentWithAFolderType", FOLDER_TYPE_ID);
+      id = fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, null, 
VersioningState.NONE,
+          null, null, null, null);
+      fail("Creating  document with a folder type should fail.");
+    } catch (Exception e) {
+      log.info("Creating  document with a folder type failed as expected.");
+    }
+    // test create a document with an illegal name, should fail:
+    try {
+      PropertiesData props = createDocumentProperties("abc ()", 
DOCUMENT_TYPE_ID);
+      id = fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, null, 
VersioningState.NONE,
+          null, null, null, null);
+      fail("Creating  document with an illegal should fail.");
+    } catch (Exception e) {
+      assertTrue(e instanceof CmisInvalidArgumentException);
+      log.info("Creating  document with an illegal name failed as expected.");
+    }
   }
 
 


Reply via email to