chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1412238 - /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Date Wed, 21 Nov 2012 19:28:41 GMT
Author: fmui
Date: Wed Nov 21 19:28:40 2012
New Revision: 1412238

URL: http://svn.apache.org/viewvc?rev=1412238&view=rev
Log:
CMIS-606: TCK: check allowable actions before getting the parents of an object

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=1412238&r1=1412237&r2=1412238&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 Nov 21 19:28:40 2012
@@ -1664,25 +1664,33 @@ public abstract class AbstractSessionTes
 
             if (child instanceof FileableCmisObject) {
                 FileableCmisObject fileableChild = (FileableCmisObject) child;
-                List<Folder> parents = fileableChild.getParents();
 
-                f = createResult(FAILURE, "Child has no parents! Id: " + child.getId());
-                addResult(results, assertIsTrue(parents.size() > 0, null, f));
+                Set<Action> actions = fileableChild.getAllowableActions().getAllowableActions();
+                boolean hasObjectParentsAction = actions.contains(Action.CAN_GET_OBJECT_PARENTS);
+                boolean hasFolderParentAction = actions.contains(Action.CAN_GET_FOLDER_PARENT);
 
-                boolean foundParent = false;
-                for (Folder parent : parents) {
-                    if (parent == null) {
-                        f = createResult(FAILURE, "One of childs parents is null! Id: " +
child.getId());
+                if (hasObjectParentsAction || hasFolderParentAction) {
+                    List<Folder> parents = fileableChild.getParents();
+
+                    f = createResult(FAILURE, "Child has no parents! Id: " + child.getId());
+                    addResult(results, assertIsTrue(parents.size() > 0, null, f));
+
+                    boolean foundParent = false;
+                    for (Folder parent : parents) {
+                        if (parent == null) {
+                            f = createResult(FAILURE, "One of childs parents is null! Id:
" + child.getId());
+                            addResult(results, assertIsTrue(parents.size() > 0, null,
f));
+                        } else if (folder.getId().equals(parent.getId())) {
+                            foundParent = true;
+                            break;
+                        }
+                    }
+
+                    if (!foundParent) {
+                        f = createResult(FAILURE, "Folder is not found in childs parents!
Id: " + child.getId());
                         addResult(results, assertIsTrue(parents.size() > 0, null, f));
-                    } else if (folder.getId().equals(parent.getId())) {
-                        foundParent = true;
-                        break;
                     }
-                }
 
-                if (!foundParent) {
-                    f = createResult(FAILURE, "Folder is not found in childs parents! Id:
" + child.getId());
-                    addResult(results, assertIsTrue(parents.size() > 0, null, f));
                 }
 
                 // get object by id and compare
@@ -1711,11 +1719,11 @@ public abstract class AbstractSessionTes
                 }
             }
 
-            f = createResult(FAILURE, "Child has no CAN_GET_OBJECT_PARENTS allowable action!
Id: " + child.getId());
+            f = createResult(WARNING, "Child has no CAN_GET_OBJECT_PARENTS allowable action!
Id: " + child.getId());
             addResult(results, assertAllowableAction(child, Action.CAN_GET_OBJECT_PARENTS,
null, f));
 
             if (child instanceof Folder) {
-                f = createResult(FAILURE, "Child has no CAN_GET_FOLDER_PARENT allowable action!
Id: " + child.getId());
+                f = createResult(WARNING, "Child has no CAN_GET_FOLDER_PARENT allowable action!
Id: " + child.getId());
                 addResult(results, assertAllowableAction(child, Action.CAN_GET_FOLDER_PARENT,
null, f));
             }
         }



Mime
View raw message