chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1646490 - /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Date Thu, 18 Dec 2014 16:46:15 GMT
Author: fmui
Date: Thu Dec 18 16:46:14 2014
New Revision: 1646490

URL: http://svn.apache.org/r1646490
Log:
CMIS-857: TCK: check if types are creatable and skip test if they are not

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java

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=1646490&r1=1646489&r2=1646490&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
Thu Dec 18 16:46:14 2014
@@ -285,6 +285,22 @@ public abstract class AbstractSessionTes
             throw new IllegalArgumentException("Object Type Id is not set!");
         }
 
+        // check type
+        ObjectType type;
+        try {
+            type = session.getTypeDefinition(objectTypeId);
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(UNEXPECTED_EXCEPTION,
+                    "Folder type '" + objectTypeId + "' is not available: " + e.getMessage(),
e, true));
+            return null;
+        }
+
+        if (Boolean.FALSE.equals(type.isCreatable())) {
+            addResult(createResult(SKIPPED, "Folder type '" + objectTypeId + "' is not creatable!",
true));
+            return null;
+        }
+
+        // create
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
@@ -404,6 +420,22 @@ public abstract class AbstractSessionTes
             content = "";
         }
 
+        // check type
+        ObjectType type;
+        try {
+            type = session.getTypeDefinition(objectTypeId);
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(UNEXPECTED_EXCEPTION,
+                    "Document type '" + objectTypeId + "' is not available: " + e.getMessage(),
e, true));
+            return null;
+        }
+
+        if (Boolean.FALSE.equals(type.isCreatable())) {
+            addResult(createResult(SKIPPED, "Document type '" + objectTypeId + "' is not
creatable!", true));
+            return null;
+        }
+
+        // create
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
@@ -412,7 +444,7 @@ public abstract class AbstractSessionTes
             properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, Arrays.asList(secondaryTypeIds));
         }
 
-        TypeDefinition type = session.getTypeDefinition(objectTypeId);
+        type = session.getTypeDefinition(objectTypeId);
         if (!(type instanceof DocumentTypeDefinition)) {
             addResult(createResult(FAILURE, "Type is not a document type! Type: " + objectTypeId,
true));
             return null;
@@ -522,6 +554,22 @@ public abstract class AbstractSessionTes
             throw new IllegalArgumentException("Object Type Id is not set!");
         }
 
+        // check type
+        ObjectType type;
+        try {
+            type = session.getTypeDefinition(objectTypeId);
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(UNEXPECTED_EXCEPTION, "Relationship type '" + objectTypeId
+ "' is not available: "
+                    + e.getMessage(), e, true));
+            return null;
+        }
+
+        if (Boolean.FALSE.equals(type.isCreatable())) {
+            addResult(createResult(SKIPPED, "Relationship type '" + objectTypeId + "' is
not creatable!", true));
+            return null;
+        }
+
+        // create
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
@@ -573,6 +621,22 @@ public abstract class AbstractSessionTes
             throw new IllegalArgumentException("Object Type Id is not set!");
         }
 
+        // check type
+        ObjectType type;
+        try {
+            type = session.getTypeDefinition(objectTypeId);
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(UNEXPECTED_EXCEPTION,
+                    "Item type '" + objectTypeId + "' is not available: " + e.getMessage(),
e, true));
+            return null;
+        }
+
+        if (Boolean.FALSE.equals(type.isCreatable())) {
+            addResult(createResult(SKIPPED, "Item type '" + objectTypeId + "' is not creatable!",
true));
+            return null;
+        }
+
+        // create
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);



Mime
View raw message