chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1490161 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemi...
Date Thu, 06 Jun 2013 06:00:02 GMT
Author: fmui
Date: Thu Jun  6 06:00:02 2013
New Revision: 1490161

URL: http://svn.apache.org/r1490161
Log:
TCK: added more tests

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
  (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryForObject.java
  (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryTestGroup.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1490161&r1=1490160&r2=1490161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
Thu Jun  6 06:00:02 2013
@@ -1177,6 +1177,9 @@ public final class JSONConverter {
             }
 
             String propId = (propertyMode == PropertyMode.QUERY ? property.getQueryName()
: property.getId());
+            if (propId == null) {
+                throw new CmisRuntimeException("No query name or alias for property '" +
property.getId() + "'!");
+            }
             result.put(propId, convert(property, propDef, succinct));
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java?rev=1490161&r1=1490160&r2=1490161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
Thu Jun  6 06:00:02 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.fit.tck;
 
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -91,8 +92,13 @@ public abstract class AbstractTckIT exte
         for (CmisTestGroup group : getGroups()) {
             for (CmisTest test : group.getTests()) {
                 for (CmisTestResult result : test.getResults()) {
-                    assertTrue(result.getStatus() != CmisTestResultStatus.FAILURE);
-                    assertTrue(result.getStatus() != CmisTestResultStatus.UNEXPECTED_EXCEPTION);
+                    assertNotNull("The test '" + test.getName() + "' returned an invalid
result.", result);
+                    assertTrue("The test '" + test.getName() + "' returned a failure: " +
result.getMessage(),
+                            result.getStatus() != CmisTestResultStatus.FAILURE);
+                    assertTrue(
+                            "The test '" + test.getName() + "' returned at an unexcepted
exception: "
+                                    + result.getMessage(),
+                            result.getStatus() != CmisTestResultStatus.UNEXPECTED_EXCEPTION);
                 }
             }
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.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/impl/AbstractSessionTest.java?rev=1490161&r1=1490160&r2=1490161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Thu Jun  6 06:00:02 2013
@@ -1117,6 +1117,24 @@ public abstract class AbstractSessionTes
                 addResult(results, checkRenditions(session, object, "Rendition check"));
             }
 
+            // check allowed child object type ids
+            if (object instanceof Folder) {
+                List<String> otids = object.getPropertyValue(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS);
+                if (otids != null) {
+                    for (String otid : otids) {
+                        try {
+                            session.getTypeDefinition(otid);
+                        } catch (CmisBaseException e) {
+                            addResult(
+                                    results,
+                                    createResult(FAILURE,
+                                            "The cmis:allowedChildObjectTypeIds property
contains the type id '" + otid
+                                                    + "' but the type doesn't exists. Folder
id: " + object.getId()));
+                        }
+                    }
+                }
+            }
+
             // check path
             if (object instanceof FileableCmisObject) {
                 List<String> paths = ((FileableCmisObject) object).getPaths();

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=1490161&r1=1490160&r2=1490161&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
Thu Jun  6 06:00:02 2013
@@ -47,5 +47,6 @@ public class CRUDTestGroup extends Abstr
         addTest(new CopyTest());
         addTest(new MoveTest());
         addTest(new DeleteTreeTest());
+        addTest(new OperationContextTest());
     }
 }

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.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/OperationContextTest.java?rev=1490161&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
Thu Jun  6 06:00:02 2013
@@ -0,0 +1,218 @@
+/*
+ * 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 java.math.BigInteger;
+import java.util.HashSet;
+import java.util.List;
+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.Property;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.ObjectInFolderData;
+import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
+import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+import org.apache.chemistry.opencmis.tck.CmisTestResultStatus;
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+
+public class OperationContextTest extends AbstractSessionTest {
+
+    private static final String CONTENT = "TCK test content.";
+
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Operation Context");
+        setDescription("Creates a document, retrieves a minimal set of details, checks it,
and finally deletes the document.");
+    }
+
+    @Override
+    public void run(Session session) {
+
+        // create a test folder
+        Folder testFolder = createTestFolder(session);
+
+        try {
+            // create a test document
+            Document document = createDocument(session, testFolder, "testdoc.txt", CONTENT);
+
+            // high-level API tests
+            runHighLevelApiTests(session, testFolder, document);
+
+            // low-level API tests
+            runLowLevelApiTests(session, testFolder, document);
+
+            // clean up
+            document.delete(true);
+        } finally {
+            // delete the test folder
+            deleteTestFolder();
+        }
+    }
+
+    /**
+     * Checks for not requested properties, Allowable Actions, ACLs, renditions,
+     * relationships, and policies.
+     */
+    public void runHighLevelApiTests(Session session, Folder testFolder, Document testDocument)
{
+        CmisTestResult f;
+
+        // only select some base properties
+        Set<String> properties = new HashSet<String>();
+        properties.add("cmis:objectId");
+        properties.add("cmis:baseTypeId");
+        properties.add("cmis:objectTypeId");
+
+        OperationContext context = session.createOperationContext();
+        context.setCacheEnabled(false);
+        context.setFilter(properties);
+        context.setIncludeAcls(false);
+        context.setIncludeAllowableActions(false);
+        context.setIncludePathSegments(false);
+        context.setIncludePolicies(false);
+        context.setIncludeRelationships(IncludeRelationships.NONE);
+        context.setLoadSecondaryTypeProperties(false);
+        context.setRenditionFilterString("cmis:none");
+
+        // get the object with the OperationContext
+        Document doc1 = (Document) session.getObject(testDocument, context);
+
+        // check properties
+        for (Property<?> prop : doc1.getProperties()) {
+            if (!properties.contains(prop.getDefinition().getQueryName())) {
+                addResult(createResult(CmisTestResultStatus.WARNING,
+                        "getObject() delivered the property '" + prop.getId()
+                                + "', although it has not been requested."));
+            }
+        }
+
+        // check other details
+        f = createResult(CmisTestResultStatus.WARNING,
+                "getObject() delivered ACLs, although they have not been requested.");
+        addResult(assertNull(doc1.getAcl(), null, f));
+
+        f = createResult(CmisTestResultStatus.WARNING,
+                "getObject() delivered Allowable Actions, although they have not been requested.");
+        addResult(assertNull(doc1.getAllowableActions(), null, f));
+
+        f = createResult(CmisTestResultStatus.WARNING,
+                "getObject() delivered policies, although they have not been requested.");
+        addResult(assertIsTrue(doc1.getPolicies() == null || doc1.getPolicies().isEmpty(),
null, f));
+
+        f = createResult(CmisTestResultStatus.WARNING,
+                "getObject() delivered relationships, although they have not been requested.");
+        addResult(assertIsTrue(doc1.getRelationships() == null || doc1.getRelationships().isEmpty(),
null, f));
+
+        f = createResult(CmisTestResultStatus.WARNING,
+                "getObject() delivered renditions, although they have not been requested.");
+        addResult(assertIsTrue(doc1.getRenditions() == null || doc1.getRenditions().isEmpty(),
null, f));
+
+        // get the test folder children with the OperationContext
+        for (CmisObject child : testFolder.getChildren(context)) {
+            if (child.getId().equals(testDocument.getId())) {
+                // check properties
+                for (Property<?> prop : child.getProperties()) {
+                    if (!properties.contains(prop.getDefinition().getQueryName())) {
+                        addResult(createResult(CmisTestResultStatus.WARNING, "getChildren()
delivered the property '"
+                                + prop.getId() + "', although it has not been requested."));
+                    }
+                }
+
+                // check other details
+                f = createResult(CmisTestResultStatus.INFO, "getChildren() delivered ACLs,
which is not required.");
+                addResult(assertNull(child.getAcl(), null, f));
+
+                f = createResult(CmisTestResultStatus.WARNING,
+                        "getChildren() delivered Allowable Actions, although they have not
been requested.");
+                addResult(assertNull(child.getAllowableActions(), null, f));
+
+                f = createResult(CmisTestResultStatus.INFO, "getChildren() delivered policies,
which is not required.");
+                addResult(assertIsTrue(child.getPolicies() == null || child.getPolicies().isEmpty(),
null, f));
+
+                f = createResult(CmisTestResultStatus.WARNING,
+                        "getChildren() delivered relationships, although they have not been
requested.");
+                addResult(assertIsTrue(child.getRelationships() == null || child.getRelationships().isEmpty(),
null, f));
+
+                f = createResult(CmisTestResultStatus.WARNING,
+                        "getChildren() delivered renditions, although they have not been
requested.");
+                addResult(assertIsTrue(child.getRenditions() == null || child.getRenditions().isEmpty(),
null, f));
+
+                break;
+            }
+        }
+    }
+
+    /**
+     * Checks for change events and path segments.
+     */
+    public void runLowLevelApiTests(Session session, Folder testFolder, Document testDocument)
{
+        CmisTestResult f;
+
+        String repositoryId = session.getRepositoryInfo().getId();
+        String filter = "cmis:objectId,cmis:baseTypeId,cmis:objectTypeId";
+
+        // get the object
+        ObjectData doc1 = session
+                .getBinding()
+                .getObjectService()
+                .getObject(repositoryId, testDocument.getId(), filter, Boolean.FALSE, IncludeRelationships.NONE,
+                        "cmis:none", Boolean.FALSE, Boolean.FALSE, null);
+
+        // check for change events
+        f = createResult(CmisTestResultStatus.WARNING,
+                "getObject() delivered a change event, which doesn't make sense.");
+        addResult(assertNull(doc1.getChangeEventInfo(), null, f));
+
+        // get the test folder children
+        ObjectInFolderList children = session
+                .getBinding()
+                .getNavigationService()
+                .getChildren(repositoryId, testFolder.getId(), filter, null, Boolean.FALSE,
IncludeRelationships.NONE,
+                        "cmis:none", Boolean.FALSE, null, BigInteger.ZERO, null);
+
+        // check for path segments
+        for (ObjectInFolderData child : children.getObjects()) {
+            f = createResult(CmisTestResultStatus.WARNING,
+                    "getChildren() delivered a path segment, although it hasn't been requested.");
+            addResult(assertNull(child.getPathSegment(), null, f));
+        }
+
+        // get the document parent
+        List<ObjectParentData> parents = session
+                .getBinding()
+                .getNavigationService()
+                .getObjectParents(repositoryId, testDocument.getId(), filter, Boolean.FALSE,
IncludeRelationships.NONE,
+                        "cmis:none", Boolean.FALSE, null);
+
+        // check for relative path segments
+        for (ObjectParentData parent : parents) {
+            f = createResult(CmisTestResultStatus.WARNING,
+                    "getObjectParents() delivered a relative path segment, although it hasn't
been requested.");
+            addResult(assertNull(parent.getRelativePathSegment(), null, f));
+        }
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryForObject.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/query/QueryForObject.java?rev=1490161&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryForObject.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryForObject.java
Thu Jun  6 06:00:02 2013
@@ -0,0 +1,142 @@
+/*
+ * 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.query;
+
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.client.api.QueryResult;
+import org.apache.chemistry.opencmis.client.api.QueryStatement;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+
+public class QueryForObject extends AbstractQueryTest {
+
+    private static final String CONTENT = "TCK test content.";
+
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Query For Object Test");
+        setDescription("Creates a folder and a document, queries them by object id, and deletes
both.");
+    }
+
+    @Override
+    public void run(Session session) {
+        if (supportsQuery(session) && !isFulltextOnly(session)) {
+            // create a test folder
+            Folder testFolder = createTestFolder(session);
+
+            try {
+                // create a test document
+                Document document = createDocument(session, testFolder, "testdoc.txt", CONTENT);
+
+                // find the folder
+                runFolderQuery(session, testFolder);
+
+                // find the document
+                runDocumentQuery(session, document);
+
+                // clean up
+                document.delete(true);
+            } finally {
+                // delete the test folder
+                deleteTestFolder();
+            }
+
+        } else {
+            addResult(createResult(SKIPPED, "Metadata query not supported. Test Skipped!"));
+        }
+    }
+
+    public void runFolderQuery(Session session, Folder testFolder) {
+        if (!Boolean.TRUE.equals(testFolder.getType().isQueryable())) {
+            addResult(createResult(SKIPPED, "Folder type '" + testFolder.getType().getId()
+                    + "' is not queryable. Folder query test skipped!"));
+            return;
+        }
+
+        CmisTestResult f;
+
+        QueryStatement[] statements = new QueryStatement[] {
+                session.createQueryStatement("SELECT * FROM ? WHERE ? = ?"),
+                session.createQueryStatement("SELECT * FROM ? WHERE ? IN (?)") };
+
+        for (QueryStatement statement : statements) {
+            statement.setType(1, testFolder.getType());
+            statement.setProperty(2, testFolder.getType().getPropertyDefinitions().get(PropertyIds.OBJECT_ID));
+            statement.setString(3, testFolder.getId());
+
+            addResult(createInfoResult("Folder query: " + statement.toQueryString()));
+
+            int count = 0;
+            for (QueryResult qr : statement.query(false)) {
+                count++;
+
+                String objectId = qr.getPropertyValueByQueryName("cmis:objectId");
+
+                f = createResult(FAILURE, "Folder query returned unexpected object. Id: "
+ objectId);
+                addResult(assertEquals(testFolder.getId(), objectId, null, f));
+            }
+
+            f = createResult(FAILURE, "Folder query should return exactly one hit, but returned
" + count + ".");
+            addResult(assertEquals(1, count, null, f));
+        }
+    }
+
+    public void runDocumentQuery(Session session, Document testDocument) {
+        if (!Boolean.TRUE.equals(testDocument.getType().isQueryable())) {
+            addResult(createResult(SKIPPED, "Document type '" + testDocument.getType().getId()
+                    + "' is not queryable. Document query test skipped!"));
+            return;
+        }
+
+        CmisTestResult f;
+
+        QueryStatement[] statements = new QueryStatement[] {
+                session.createQueryStatement("SELECT * FROM ? WHERE ? = ?"),
+                session.createQueryStatement("SELECT * FROM ? WHERE ? IN (?)") };
+
+        for (QueryStatement statement : statements) {
+            statement.setType(1, testDocument.getType());
+            statement.setProperty(2, testDocument.getType().getPropertyDefinitions().get(PropertyIds.OBJECT_ID));
+            statement.setString(3, testDocument.getId());
+
+            addResult(createInfoResult("Document query: " + statement.toQueryString()));
+
+            int count = 0;
+            for (QueryResult qr : statement.query(false)) {
+                count++;
+
+                String objectId = qr.getPropertyValueByQueryName("cmis:objectId");
+
+                f = createResult(FAILURE, "Document query returned unexpected object. Id:
" + objectId);
+                addResult(assertEquals(testDocument.getId(), objectId, null, f));
+            }
+
+            f = createResult(FAILURE, "Document query should return exactly one hit, but
returned " + count + ".");
+            addResult(assertEquals(1, count, null, f));
+        }
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryForObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryTestGroup.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/query/QueryTestGroup.java?rev=1490161&r1=1490160&r2=1490161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryTestGroup.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/query/QueryTestGroup.java
Thu Jun  6 06:00:02 2013
@@ -35,6 +35,7 @@ public class QueryTestGroup extends Abst
 
         addTest(new QuerySmokeTest());
         addTest(new QueryRootFolderTest());
+        addTest(new QueryForObject());
         addTest(new QueryLikeTest());
         addTest(new ContentChangesSmokeTest());
     }



Mime
View raw message