Return-Path: Delivered-To: apmail-incubator-chemistry-commits-archive@minotaur.apache.org Received: (qmail 77491 invoked from network); 2 Mar 2010 12:28:12 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Mar 2010 12:28:12 -0000 Received: (qmail 50978 invoked by uid 500); 2 Mar 2010 12:28:09 -0000 Delivered-To: apmail-incubator-chemistry-commits-archive@incubator.apache.org Received: (qmail 50952 invoked by uid 500); 2 Mar 2010 12:28:09 -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 50939 invoked by uid 99); 2 Mar 2010 12:28:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Mar 2010 12:28:09 +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; Tue, 02 Mar 2010 12:28:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 07AAA238898B; Tue, 2 Mar 2010 12:27:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: chemistry-commits@incubator.apache.org From: dcaruana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100302122746.07AAA238898B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 true 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 variables = new HashMap(); + 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()); + } + }