chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r917995 - in /incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry: abdera/ext/CMISTypeDefinition.java tck/atompub/test/spec/TypeDefinitionTest.java
Date Tue, 02 Mar 2010 12:27:45 GMT
Author: dcaruana
Date: Tue Mar  2 12:27:45 2010
New Revision: 917995

URL: http://svn.apache.org/viewvc?rev=917995&view=rev
Log:
Add getByTypeId URI template test to TCK.

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.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/abdera/ext/CMISTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java?rev=917995&r1=917994&r2=917995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java
Tue Mar  2 12:27:45 2010
@@ -44,6 +44,13 @@
     }
 
     /**
+     * @return the type identifier
+     */
+    public String getId() {
+        return getFirstChild(CMISConstants.TYPE_ID).getText();
+    }
+    
+    /**
      * Determines whether objects of this type are controllable by ACLs.
      * 
      * @return <code>true</code> if objects of this type are controllable by

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=917995&r1=917994&r2=917995&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
Tue Mar  2 12:27:45 2010
@@ -25,6 +25,9 @@
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Link;
 import org.apache.chemistry.abdera.ext.CMISConstants;
+import org.apache.chemistry.abdera.ext.CMISObject;
+import org.apache.chemistry.abdera.ext.CMISTypeDefinition;
+import org.apache.chemistry.abdera.ext.CMISUriTemplate;
 import org.apache.chemistry.tck.atompub.TCKTest;
 import org.junit.Assert;
 
@@ -86,14 +89,32 @@
         Link childrenLink = client.getChildrenLink(testFolder);
         Feed children = client.getFeed(childrenLink.getHref());
         for (Entry entry : children.getEntries()) {
+            CMISObject entryObject = entry.getExtension(CMISConstants.OBJECT);
+            Assert.assertNotNull(entryObject);
             // get type definition
             Link typeLink = entry.getLink(CMISConstants.REL_DESCRIBED_BY);
             Assert.assertNotNull(typeLink);
             Entry type = client.getEntry(typeLink.getHref());
             Assert.assertNotNull(type);
-            // TODO: test correct type for entry & properties of type
+            CMISTypeDefinition entryType = type.getExtension(CMISConstants.TYPE_DEFINITION);
+            Assert.assertNotNull(entryType);
+            assertEquals(entryObject.getObjectTypeId().getStringValue(), entryType.getId());
         }
     }
     
-    // TODO: test for getTypeById uri template
+    public void testGetTypeDefinitionById() throws Exception {
+        // construct uri for cmis:document type
+        CMISUriTemplate typeByIdTemplate = client.getTypeByIdUriTemplate(client.getWorkspace());
+        Map<String, Object> variables = new HashMap<String, Object>();
+        variables.put("id", "cmis:document");
+        IRI typeByIdRequest = typeByIdTemplate.generateUri(variables);
+        
+        // get type definition
+        Entry typeById = client.getEntry(typeByIdRequest);
+        Assert.assertNotNull(typeById);
+        CMISTypeDefinition typeDef = typeById.getExtension(CMISConstants.TYPE_DEFINITION);
+        Assert.assertNotNull(typeDef);
+        Assert.assertEquals("cmis:document", typeDef.getId());
+    }
+    
 }



Mime
View raw message