jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r159361 - in incubator/jackrabbit/trunk: applications/test/ src/test/org/apache/jackrabbit/test/api/query/
Date Tue, 29 Mar 2005 10:11:18 GMT
Author: mreutegg
Date: Tue Mar 29 02:11:15 2005
New Revision: 159361

URL: http://svn.apache.org/viewcvs?view=rev&rev=159361
Log:
JCR-88: jcr:path is in QueryResult is only tested with SQL

Added:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/SQLJcrPathTest.java
      - copied, changed from r159360, incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/JcrPathTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/XPathJcrPathTest.java
  (with props)
Removed:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/JcrPathTest.java
Modified:
    incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/TestAll.java

Modified: incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties?view=diff&r1=159360&r2=159361
==============================================================================
--- incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties (original)
+++ incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties Tue Mar 29
02:11:15 2005
@@ -305,6 +305,9 @@
 # Test class: XPathSyntaxTest
 javax.jcr.tck.XPathSyntaxTest.testroot=/testdata/query
 
+# Test class: XPathJcrPathTest
+javax.jcr.tck.XPathJcrPathTest.testroot=/testdata
+
 # Test class: SQLQueryLevel1Test
 javax.jcr.tck.SQLQueryLevel1Test.testroot=/testdata/query
 
@@ -320,8 +323,8 @@
 # Test class: GetPropertyNamesTest
 javax.jcr.tck.GetPropertyNamesTest.testroot=/testdata
 
-# Test class: JcrPathTest
-javax.jcr.tck.JcrPathTest.testroot=/testdata
+# Test class: SQLJcrPathTest
+javax.jcr.tck.SQLJcrPathTest.testroot=/testdata
 
 # Test class: PredicatesTest
 javax.jcr.tck.PredicatesTest.testroot=/testdata

Copied: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/SQLJcrPathTest.java
(from r159360, incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/JcrPathTest.java)
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/SQLJcrPathTest.java?view=diff&rev=159361&p1=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/JcrPathTest.java&r1=159360&p2=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/SQLJcrPathTest.java&r2=159361
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/JcrPathTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/SQLJcrPathTest.java
Tue Mar 29 02:11:15 2005
@@ -33,7 +33,7 @@
  * @executeClass org.apache.jackrabbit.test.api.query.JcrPathTest
  * @keywords sql
  */
-public class JcrPathTest extends AbstractQueryTest {
+public class SQLJcrPathTest extends AbstractQueryTest {
 
     /** A read-only session */
     private Session session;

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/TestAll.java?view=diff&r1=159360&r2=159361
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/TestAll.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/TestAll.java
Tue Mar 29 02:11:15 2005
@@ -41,10 +41,12 @@
         suite.addTestSuite(SQLOrderByTest.class);
         suite.addTestSuite(SQLQueryLevel2Test.class);
         suite.addTestSuite(SQLJoinTest.class);
+        suite.addTestSuite(SQLJcrPathTest.class);
         suite.addTestSuite(XPathPosIndexTest.class);
         suite.addTestSuite(XPathDocOrderTest.class);
         suite.addTestSuite(XPathOrderByTest.class);
         suite.addTestSuite(XPathQueryLevel2Test.class);
+        suite.addTestSuite(XPathJcrPathTest.class);
 
         suite.addTestSuite(DerefQueryLevel1Test.class);
         suite.addTestSuite(ElementTest.class);
@@ -55,7 +57,6 @@
         suite.addTestSuite(GetStatementTest.class);
         suite.addTestSuite(GetSupportedQueryLanguagesTest.class);
 
-        suite.addTestSuite(JcrPathTest.class);
         suite.addTestSuite(GetPropertyNamesTest.class);
         suite.addTestSuite(PredicatesTest.class);
         suite.addTestSuite(SimpleSelectionTest.class);

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/XPathJcrPathTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/XPathJcrPathTest.java?view=auto&rev=159361
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/XPathJcrPathTest.java
(added)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/XPathJcrPathTest.java
Tue Mar 29 02:11:15 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed 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.jackrabbit.test.api.query;
+
+import org.apache.jackrabbit.test.NotExecutableException;
+
+import javax.jcr.Session;
+import javax.jcr.RepositoryException;
+import javax.jcr.Repository;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+
+/**
+ * Tests if the jcr:path property is returned at the correct position in the
+ * query result.
+ *
+ * @test
+ * @sources JcrPathTest.java
+ * @executeClass org.apache.jackrabbit.test.api.query.JcrPathTest
+ * @keywords level1
+ */
+public class XPathJcrPathTest extends AbstractQueryTest {
+
+    /** A read-only session */
+    private Session session;
+
+    /**
+     * Sets up the test cases
+     */
+    protected void setUp() throws Exception {
+        isReadOnly = true;
+        super.setUp();
+        session = helper.getReadOnlySession();
+        testRootNode = session.getRootNode().getNode(testPath);
+    }
+
+    /**
+     * Releases the session acquired in setUp().
+     */
+    protected void tearDown() throws Exception {
+        if (session != null) {
+            session.logout();
+        }
+        super.tearDown();
+    }
+
+    /**
+     * Verify that the jcr:path is the first property from the found property
+     * names, when explicitely declared in query statement.
+     *
+     * @throws NotExecutableException if the repository does not support the
+     *                                jcr:path property in the query result.
+     */
+    public void testJcrPath() throws RepositoryException, NotExecutableException {
+        String nodeTypeName = session.getRootNode().getPrimaryNodeType().getName();
+        String queryStatement = "//element(*, " + nodeTypeName + ")/@" + jcrPath;
+
+        // verify that jcr:path is supported
+        if (session.getRepository().getDescriptor(Repository.QUERY_JCRPATH) == null) {
+            throw new NotExecutableException(jcrPath + " not supported");
+        }
+
+        // execute the search query
+        Query query = session.getWorkspace().getQueryManager().createQuery(queryStatement,
Query.XPATH);
+        QueryResult result = query.execute();
+
+        String[] propNames = result.getPropertyNames();
+        if (propNames.length > 0) {
+            // jcr:path should be the first column
+            assertEquals(jcrPath + " should be the first property", jcrPath, propNames[0]);
+        }
+    }
+
+
+}

Propchange: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/XPathJcrPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message