chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r832378 - in /incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub: client/CMISClient.java test/spec/GetTest.java
Date Tue, 03 Nov 2009 10:30:53 GMT
Author: dcaruana
Date: Tue Nov  3 10:30:45 2009
New Revision: 832378

URL: http://svn.apache.org/viewvc?rev=832378&view=rev
Log:
AtomPub TCK: add objectById test for rootFolderId

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/GetTest.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java?rev=832378&r1=832377&r2=832378&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java
Tue Nov  3 10:30:45 2009
@@ -77,7 +77,7 @@
     private ResourceLoader templates = new ResourceLoader("/org/apache/chemistry/tck/atompub/templates/");
 
     private Service cmisService = null;
-    private CMISCapabilities cmisCapabilities = null;
+    private CMISRepositoryInfo cmisRepositoryInfo = null;
 
 
     public CMISClient(Connection connection, String serviceUrl, TCKMessageWriter messageWriter)
{
@@ -111,15 +111,19 @@
         return cmisService;
     }
 
-    public CMISCapabilities getCapabilities() throws Exception {
-        if (cmisCapabilities == null) {
+    public CMISRepositoryInfo getRepositoryInfo() throws Exception {
+        if (cmisRepositoryInfo == null) {
+            // TODO: latestChangeLogToken can't be cached
             Service repo = getRepository();
             Workspace workspace = getWorkspace(repo);
-            CMISRepositoryInfo repoInfo = workspace.getExtension(CMISConstants.REPOSITORY_INFO);
-            Assert.assertNotNull(repoInfo);
-            cmisCapabilities = repoInfo.getCapabilities();
+            cmisRepositoryInfo = workspace.getExtension(CMISConstants.REPOSITORY_INFO);
+            Assert.assertNotNull(cmisRepositoryInfo);
         }
-        return cmisCapabilities;
+        return cmisRepositoryInfo;
+    }
+    
+    public CMISCapabilities getCapabilities() throws Exception {
+        return getRepositoryInfo().getCapabilities();
     }
 
     public Workspace getWorkspace() throws Exception {

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/GetTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/GetTest.java?rev=832378&r1=832377&r2=832378&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/GetTest.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/GetTest.java
Tue Nov  3 10:30:45 2009
@@ -24,6 +24,7 @@
 import org.apache.abdera.model.Entry;
 import org.apache.chemistry.abdera.ext.CMISConstants;
 import org.apache.chemistry.abdera.ext.CMISObject;
+import org.apache.chemistry.abdera.ext.CMISRepositoryInfo;
 import org.apache.chemistry.abdera.ext.CMISUriTemplate;
 import org.apache.chemistry.tck.atompub.TCKTest;
 import org.apache.chemistry.tck.atompub.http.GetRequest;
@@ -85,6 +86,26 @@
         Assert.assertEquals(objectId, documentByIdObject.getObjectId().getStringValue());
     }
 
+    public void testObjectByRootFolderId() throws Exception
+    {
+        CMISRepositoryInfo info = client.getRepositoryInfo();
+        String rootFolderId = info.getRootFolderId();
+        Assert.assertNotNull(rootFolderId);
+
+        // formulate get request via id
+        CMISUriTemplate objectByIdTemplate = client.getObjectByIdUriTemplate(client.getWorkspace());
+        Map<String, Object> variables = new HashMap<String, Object>();
+        variables.put("id", rootFolderId);
+        IRI rootFolderByIdRequest = objectByIdTemplate.generateUri(variables);
+        
+        // get folder
+        Entry rootFolderById = client.getEntry(rootFolderByIdRequest);
+        Assert.assertNotNull(rootFolderById);
+        CMISObject rootFolderObject = rootFolderById.getExtension(CMISConstants.OBJECT);
+        Assert.assertNotNull(rootFolderObject);
+        Assert.assertEquals(rootFolderId, rootFolderObject.getObjectId().getStringValue());
+    }
+    
     public void testObjectByPath() throws Exception
     {
         // construct folder



Mime
View raw message