Return-Path: Delivered-To: apmail-incubator-chemistry-commits-archive@minotaur.apache.org Received: (qmail 85947 invoked from network); 19 Mar 2010 10:03:53 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Mar 2010 10:03:53 -0000 Received: (qmail 46957 invoked by uid 500); 19 Mar 2010 10:03:53 -0000 Delivered-To: apmail-incubator-chemistry-commits-archive@incubator.apache.org Received: (qmail 46894 invoked by uid 500); 19 Mar 2010 10:03:52 -0000 Mailing-List: contact chemistry-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: chemistry-dev@incubator.apache.org Delivered-To: mailing list chemistry-commits@incubator.apache.org Received: (qmail 46886 invoked by uid 99); 19 Mar 2010 10:03:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Mar 2010 10:03:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Mar 2010 10:03:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 27A7923888E4; Fri, 19 Mar 2010 10:03:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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 Date: Fri, 19 Mar 2010 10:03:30 -0000 To: chemistry-commits@incubator.apache.org From: dpfister@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100319100330.27A7923888E4@eris.apache.org> 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 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 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 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 desc; Folder root = conn.getRootFolder();