You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dc...@apache.org on 2010/02/26 18:35:37 UTC

svn commit: r916768 - in /incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec: RepositoryServiceTest.java TypeDefinitionTest.java

Author: dcaruana
Date: Fri Feb 26 17:35:36 2010
New Revision: 916768

URL: http://svn.apache.org/viewvc?rev=916768&view=rev
Log:
Fix CMIS-132: TCK: Test that the URI template has all variables as stated in the spec
- added tests for each of the four URI templates
- query uri template only tested if query capability supported

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RepositoryServiceTest.java
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/TypeDefinitionTest.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RepositoryServiceTest.java?rev=916768&r1=916767&r2=916768&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RepositoryServiceTest.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RepositoryServiceTest.java Fri Feb 26 17:35:36 2010
@@ -19,6 +19,9 @@
 
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Service;
+import org.apache.chemistry.abdera.ext.CMISCapabilities;
+import org.apache.chemistry.abdera.ext.CMISUriTemplate;
+import org.apache.chemistry.tck.atompub.TCKSkipCapabilityException;
 import org.apache.chemistry.tck.atompub.TCKTest;
 import org.apache.chemistry.tck.atompub.http.GetRequest;
 import org.junit.Assert;
@@ -39,4 +42,51 @@
         client.executeRequest(new GetRequest(rootHREF.toString()), 200);
     }
 
+    public void testObjectByIdURITemplate() throws Exception {
+        CMISUriTemplate uriTemplate = client.getObjectByIdUriTemplate(client.getWorkspace());
+        assertNotNull(uriTemplate);
+        String template = uriTemplate.getTemplate();
+        assertNotNull(template);
+        assertTemplateVariables(template, new String[] { "id", "filter", "includeAllowableActions",
+                "includePolicyIds", "includeRelationships", "includeACL", "renditionFilter" });
+    }
+
+    public void testObjectByPathURITemplate() throws Exception {
+        CMISUriTemplate uriTemplate = client.getObjectByPathUriTemplate(client.getWorkspace());
+        assertNotNull(uriTemplate);
+        String template = uriTemplate.getTemplate();
+        assertNotNull(template);
+        assertTemplateVariables(template, new String[] { "path", "filter", "includeAllowableActions",
+                "includePolicyIds", "includeRelationships", "includeACL", "renditionFilter" });
+    }
+
+    public void testTypeByIdURITemplate() throws Exception {
+        CMISUriTemplate uriTemplate = client.getTypeByIdUriTemplate(client.getWorkspace());
+        assertNotNull(uriTemplate);
+        String template = uriTemplate.getTemplate();
+        assertNotNull(template);
+        assertTemplateVariables(template, new String[] { "id" });
+    }
+
+    public void testQueryURITemplate() throws Exception {
+        CMISCapabilities capabilities = client.getCapabilities();
+        String capability = capabilities.getQuery();
+        assertNotNull(capability);
+        if (capability.equals("none"))
+            throw new TCKSkipCapabilityException("query", "metadataonly or fulltextonly or bothseparate or bothcombined", capability);
+
+        CMISUriTemplate uriTemplate = client.getQueryUriTemplate(client.getWorkspace());
+        assertNotNull(uriTemplate);
+        String template = uriTemplate.getTemplate();
+        assertNotNull(template);
+        assertTemplateVariables(template, new String[] { "q", "searchAllVersions", "maxItems", "skipCount",
+                "includeAllowableActions", "includeRelationships"});
+    }
+
+    private void assertTemplateVariables(String template, String[] variables) {
+        for (String variable : variables)
+        {
+            assertTrue("template " + template + " contains variable " + variable, template.contains("{" + variable + "}"));
+        }
+    }
 }

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/TypeDefinitionTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/TypeDefinitionTest.java?rev=916768&r1=916767&r2=916768&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/TypeDefinitionTest.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/TypeDefinitionTest.java Fri Feb 26 17:35:36 2010
@@ -94,4 +94,6 @@
             // TODO: test correct type for entry & properties of type
         }
     }
+    
+    // TODO: test for getTypeById uri template
 }