Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0603510D96 for ; Sun, 22 Dec 2013 18:26:15 +0000 (UTC) Received: (qmail 33823 invoked by uid 500); 22 Dec 2013 18:25:50 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 33779 invoked by uid 500); 22 Dec 2013 18:25:47 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 33769 invoked by uid 99); 22 Dec 2013 18:25:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Dec 2013 18:25:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Sun, 22 Dec 2013 18:25:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 90A9423888D7; Sun, 22 Dec 2013 18:25:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1553016 - in /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud: CRUDTestGroup.java PropertyFilterTest.java Date: Sun, 22 Dec 2013 18:25:21 -0000 To: commits@chemistry.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131222182521.90A9423888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmui Date: Sun Dec 22 18:25:21 2013 New Revision: 1553016 URL: http://svn.apache.org/r1553016 Log: TCK: added property filter test Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/PropertyFilterTest.java Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java?rev=1553016&r1=1553015&r2=1553016&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java Sun Dec 22 18:25:21 2013 @@ -41,6 +41,7 @@ public class CRUDTestGroup extends Abstr addTest(new NameCharsetTest()); addTest(new CreateAndDeleteRelationshipTest()); addTest(new CreateAndDeleteItemTest()); + addTest(new PropertyFilterTest()); addTest(new UpdateSmokeTest()); addTest(new BulkUpdatePropertiesTest()); addTest(new SetAndDeleteContentTest()); Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/PropertyFilterTest.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/PropertyFilterTest.java?rev=1553016&view=auto ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/PropertyFilterTest.java (added) +++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/PropertyFilterTest.java Sun Dec 22 18:25:21 2013 @@ -0,0 +1,172 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.chemistry.opencmis.tck.tests.crud; + +import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE; +import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.chemistry.opencmis.client.api.CmisObject; +import org.apache.chemistry.opencmis.client.api.Document; +import org.apache.chemistry.opencmis.client.api.Folder; +import org.apache.chemistry.opencmis.client.api.OperationContext; +import org.apache.chemistry.opencmis.client.api.Session; +import org.apache.chemistry.opencmis.client.util.OperationContextUtils; +import org.apache.chemistry.opencmis.commons.PropertyIds; +import org.apache.chemistry.opencmis.tck.CmisTestResult; +import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest; + +public class PropertyFilterTest extends AbstractSessionTest { + + private static final String CONTENT = "TCK test content."; + private static final String INVALID_PROPERTY = "cmis:tck:thisPropertyDoesNotExist"; + + @Override + public void init(Map parameters) { + super.init(parameters); + setName("Property Filter Test"); + setDescription("Tests different property filter combinations for documents and folders."); + } + + @Override + public void run(Session session) { + CmisTestResult f; + + // filter with MIME type + OperationContext testContext1 = OperationContextUtils.createMinimumOperationContext(); + Set testfilter1 = new HashSet(testContext1.getFilter()); + testfilter1.add(PropertyIds.CONTENT_STREAM_MIME_TYPE); + testContext1.setFilter(testfilter1); + + // filter with path + OperationContext testContext2 = OperationContextUtils.createMinimumOperationContext(); + Set testfilter2 = new HashSet(testContext2.getFilter()); + testfilter2.add(PropertyIds.PATH); + testContext2.setFilter(testfilter2); + + // filter with invalid property + OperationContext testContext3 = OperationContextUtils.createMinimumOperationContext(); + Set testfilter3 = new HashSet(testContext3.getFilter()); + testfilter3.add(INVALID_PROPERTY); + testContext3.setFilter(testfilter3); + + // create a test folder + Folder testFolder = createTestFolder(session); + + try { + Document doc = createDocument(session, testFolder, "doc", CONTENT); + + Document doc1 = (Document) session.getObject(doc, testContext1); + + // check document + f = createResult(FAILURE, "Document should have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + "!"); + addResult(assertNotNull(doc1.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(FAILURE, "Document should not have the property " + PropertyIds.PATH + "!"); + addResult(assertNull(doc1.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Document should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(doc1.getProperty(INVALID_PROPERTY), null, f)); + + Document doc2 = (Document) session.getObject(doc, testContext2); + + f = createResult(WARNING, "Document should not have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + + "!"); + addResult(assertNull(doc2.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(FAILURE, "Document should not have the property " + PropertyIds.PATH + "!"); + addResult(assertNull(doc2.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Document should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(doc2.getProperty(INVALID_PROPERTY), null, f)); + + Document doc3 = (Document) session.getObject(doc, testContext3); + + f = createResult(WARNING, "Document should not have the property" + PropertyIds.CONTENT_STREAM_MIME_TYPE + + "!"); + addResult(assertNull(doc3.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(FAILURE, "Document should not have the property" + PropertyIds.PATH + "!"); + addResult(assertNull(doc3.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Document should not have the property" + INVALID_PROPERTY + "!"); + addResult(assertNull(doc3.getProperty(INVALID_PROPERTY), null, f)); + + // check folder + Folder folder1 = (Folder) session.getObject(testFolder, testContext1); + + f = createResult(FAILURE, "Folder should not have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + + "!"); + addResult(assertNull(folder1.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(WARNING, "Folder should not have the property " + PropertyIds.PATH + "!"); + addResult(assertNull(folder1.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Folder should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(folder1.getProperty(INVALID_PROPERTY), null, f)); + + Folder folder2 = (Folder) session.getObject(testFolder, testContext2); + + f = createResult(FAILURE, "Folder should not have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + + "!"); + addResult(assertNull(folder2.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(FAILURE, "Folder should have the property " + PropertyIds.PATH + "!"); + addResult(assertNotNull(folder2.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Folder should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(folder2.getProperty(INVALID_PROPERTY), null, f)); + + Folder folder3 = (Folder) session.getObject(testFolder, testContext3); + + f = createResult(FAILURE, "Folder should not have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + + "!"); + addResult(assertNull(folder3.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(WARNING, "Folder should not have the property " + PropertyIds.PATH + "!"); + addResult(assertNull(folder3.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Folder should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(folder3.getProperty(INVALID_PROPERTY), null, f)); + + // check children + CmisObject obj1 = testFolder.getChildren(testContext1).iterator().next(); + + f = createResult(WARNING, "Child should have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + "!"); + addResult(assertNotNull(obj1.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(WARNING, "Child should not have the property " + PropertyIds.PATH + "!"); + addResult(assertNull(obj1.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Child should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(obj1.getProperty(INVALID_PROPERTY), null, f)); + + CmisObject obj2 = testFolder.getChildren(testContext2).iterator().next(); + + f = createResult(WARNING, "Child should not have the property " + PropertyIds.CONTENT_STREAM_MIME_TYPE + + "!"); + addResult(assertNull(obj2.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(WARNING, "Child should not have the property " + PropertyIds.PATH + "!"); + addResult(assertNull(obj2.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Child should not have the property " + INVALID_PROPERTY + "!"); + addResult(assertNull(obj2.getProperty(INVALID_PROPERTY), null, f)); + + CmisObject obj3 = testFolder.getChildren(testContext3).iterator().next(); + + f = createResult(WARNING, "Child should not have the property" + PropertyIds.CONTENT_STREAM_MIME_TYPE + "!"); + addResult(assertNull(obj3.getProperty(PropertyIds.CONTENT_STREAM_MIME_TYPE), null, f)); + f = createResult(WARNING, "Child should not have the property" + PropertyIds.PATH + "!"); + addResult(assertNull(obj3.getProperty(PropertyIds.PATH), null, f)); + f = createResult(FAILURE, "Child should not have the property" + INVALID_PROPERTY + "!"); + addResult(assertNull(obj3.getProperty(INVALID_PROPERTY), null, f)); + } finally { + // delete the test folder + deleteTestFolder(); + } + } +}