jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r381593 - in /incubator/jackrabbit/trunk/jackrabbit/src: main/java/org/apache/jackrabbit/core/query/QueryImpl.java test/java/org/apache/jackrabbit/test/api/query/SaveTest.java
Date Tue, 28 Feb 2006 08:37:17 GMT
Author: mreutegg
Date: Tue Feb 28 00:37:15 2006
New Revision: 381593

URL: http://svn.apache.org/viewcvs?rev=381593&view=rev
Log:
JCR-156: Review test cases and cross check with 1.0 specification
- SaveTest does not check if same name siblings are allowed

Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/SaveTest.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java?rev=381593&r1=381592&r2=381593&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
Tue Feb 28 00:37:15 2006
@@ -178,12 +178,7 @@
             if (!p.isAbsolute()) {
                 throw new RepositoryException(absPath + " is not an absolute path");
             }
-            if (session.itemExists(absPath)) {
-                throw new ItemExistsException(absPath);
-            }
-            if (!session.itemExists(p.getAncestor(1).toJCRPath(resolver))) {
-                throw new PathNotFoundException(p.getAncestor(1).toJCRPath(resolver));
-            }
+
             String relPath = p.toJCRPath(resolver).substring(1);
             Node queryNode = session.getRootNode().addNode(relPath,
                     QName.NT_QUERY.toJCRName(resolver));

Modified: incubator/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/SaveTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/SaveTest.java?rev=381593&r1=381592&r2=381593&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/SaveTest.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/SaveTest.java
Tue Feb 28 00:37:15 2006
@@ -66,19 +66,27 @@
 
     /**
      * Tests if an {@link javax.jcr.ItemExistsException} is thrown when a query
-     * is stored on an existing node.
+     * is stored on an existing node and same name siblings are not allowed.
      */
     public void testItemExistsException() throws RepositoryException {
         Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
-        query.storeAsNode(testRoot + "/" + nodeName1);
+        Node qNode = query.storeAsNode(testRoot + "/" + nodeName1);
 
         // create another one
         query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
         try {
             query.storeAsNode(testRoot + "/" + nodeName1);
-            fail("Query.storeAsNode() did not throw ItemExistsException");
+            if (!qNode.getDefinition().allowsSameNameSiblings()) {
+                // must throw if same name siblings are not allowed
+                fail("Query.storeAsNode() did not throw ItemExistsException");
+            }
         } catch (ItemExistsException e) {
-            // expected behaviour
+            if (qNode.getDefinition().allowsSameNameSiblings()) {
+                fail("Query.storeAsNode() must not throw ItemExistsException " +
+                        "when same name siblings are allowed");
+            } else {
+                // expected behaviour
+            }
         }
     }
 



Mime
View raw message