You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dp...@apache.org on 2010/03/19 11:03:30 UTC

svn commit: r925156 - in /incubator/chemistry/trunk/chemistry: chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleRepository.java chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java

Author: dpfister
Date: Fri Mar 19 10:03:29 2010
New Revision: 925156

URL: http://svn.apache.org/viewvc?rev=925156&view=rev
Log:
CMIS-168 BasicTestCase should check repository capability before executing a test
- Make root folder name an instance member
- SimpleRepository actually *does* support getFolderTree()

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleRepository.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleRepository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleRepository.java?rev=925156&r1=925155&r2=925156&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleRepository.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleRepository.java Fri Mar 19 10:03:29 2010
@@ -193,7 +193,7 @@ public class SimpleRepository extends Ba
     }
 
     public boolean hasGetFolderTree() {
-        return false;
+        return true;
     }
 
     public boolean isContentStreamUpdatableAnytime() {

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=925156&r1=925155&r2=925156&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java Fri Mar 19 10:03:29 2010
@@ -73,14 +73,14 @@ import org.apache.commons.io.IOUtils;
  */
 public abstract class BasicTestCase extends TestCase {
 
-    public static final String ROOT_FOLDER_NAME = ""; // not in spec
-
     public Repository repository;
 
     public Connection conn;
 
     public SPI spi;
 
+    public String rootFolderName = ""; // not in spec
+
     public String expectedRepositoryId = "test";
 
     public String expectedRepositoryName = "test";
@@ -96,6 +96,8 @@ public abstract class BasicTestCase exte
 
     public boolean expectedCapabilityHasGetDescendants = true;
 
+    public boolean expectedCapabilityHasGetFolderTree = true;
+
     public boolean expectedCapabilityHasMultifiling = false;
 
     public CapabilityQuery expectedCapabilityQuery = CapabilityQuery.BOTH_COMBINED;
@@ -175,7 +177,7 @@ public abstract class BasicTestCase exte
         assertTrue(cap.isContentStreamUpdatableAnytime());
         assertEquals(expectedCapabilityHasGetDescendants,
                 cap.hasGetDescendants());
-        assertFalse(cap.hasGetFolderTree());
+        assertEquals(expectedCapabilityHasGetFolderTree, cap.hasGetFolderTree());
         assertEquals(expectedCapabilityHasMultifiling, cap.hasMultifiling());
         assertFalse(cap.isPWCSearchable());
         assertFalse(cap.isPWCUpdatable());
@@ -195,7 +197,7 @@ public abstract class BasicTestCase exte
         assertNotNull(rootType);
         assertEquals(expectedRootTypeId, rootType.getId());
         assertEquals(expectedRootTypeId, root.getTypeId());
-        assertEquals(ROOT_FOLDER_NAME, root.getName());
+        assertEquals(rootFolderName, root.getName());
         assertNull(root.getParent());
         Map<String, Property> props = root.getProperties();
         assertNotNull(props);
@@ -367,7 +369,7 @@ public abstract class BasicTestCase exte
 
     public void testGetObjectByPath() {
         Folder root = conn.getRootFolder();
-        assertEquals(ROOT_FOLDER_NAME, root.getName());
+        assertEquals(rootFolderName, root.getName());
         assertNotNull(spi.getObjectByPath("/", null));
         assertNotNull(spi.getObjectByPath("/folder 1", null));
         assertNotNull(spi.getObjectByPath("/folder 1/doc 1", null));
@@ -444,6 +446,11 @@ public abstract class BasicTestCase exte
     }
 
     public void testGetFolderTree() {
+        // check whether repository supports this feature
+        RepositoryInfo info = repository.getInfo();
+        if (!info.getCapabilities().hasGetFolderTree()) {
+            return;
+        }
         Folder root = conn.getRootFolder();
         Tree<ObjectEntry> desc = spi.getFolderTree(root, 4, null);
         assertEquals(2, desc.size());
@@ -464,6 +471,11 @@ public abstract class BasicTestCase exte
     }
 
     public void testGetDescendants() {
+        // check whether repository supports this feature
+        RepositoryInfo info = repository.getInfo();
+        if (!info.getCapabilities().hasGetDescendants()) {
+            return;
+        }
         Folder root = conn.getRootFolder();
         Tree<ObjectEntry> desc = spi.getDescendants(root, 4, null, null);
         assertEquals(6, desc.size());
@@ -484,6 +496,12 @@ public abstract class BasicTestCase exte
     }
 
     public void testTrees() throws Exception {
+        // check whether repository supports this feature
+        RepositoryInfo info = repository.getInfo();
+        if (!info.getCapabilities().hasGetDescendants()) {
+            return;
+        }
+
         Tree<ObjectEntry> desc;
 
         Folder root = conn.getRootFolder();