You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/04/30 22:07:44 UTC

svn commit: r770428 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/

Author: jukka
Date: Thu Apr 30 20:07:43 2009
New Revision: 770428

URL: http://svn.apache.org/viewvc?rev=770428&view=rev
Log:
JCR-1104: JSR 283 support

Adjust many QOM tests in -core to JCR 2.0 PFD interfaces.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/BindVariableValueTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/LengthTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/QueryObjectModelFactoryTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SelectorTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/BindVariableValueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/BindVariableValueTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/BindVariableValueTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/BindVariableValueTest.java Thu Apr 30 20:07:43 2009
@@ -50,7 +50,7 @@
                 qomFactory.and(
                         qomFactory.childNode("s", testRoot),
                         qomFactory.comparison(
-                                qomFactory.propertyValue(propertyName1),
+                                qomFactory.propertyValue("s", propertyName1),
                                 JCR_OPERATOR_EQUAL_TO,
                                 qomFactory.bindVariable("v")
                         )

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeTest.java Thu Apr 30 20:07:43 2009
@@ -38,11 +38,6 @@
         Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
                 qomFactory.childNode("s", testRoot), null, null);
         checkResult(q.execute(), new Node[]{n});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.childNode(testRoot), null, null);
-        checkResult(q.execute(), new Node[]{n});
     }
 
     public void testChildNodes() throws RepositoryException {
@@ -54,11 +49,6 @@
         Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
                 qomFactory.childNode("s", testRoot), null, null);
         checkResult(q.execute(), new Node[]{n1, n2, n3});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.childNode(testRoot), null, null);
-        checkResult(q.execute(), new Node[]{n1, n2, n3});
     }
 
     public void testPathDoesNotExist() throws RepositoryException {
@@ -66,12 +56,6 @@
                 qomFactory.childNode("s", testRoot + "/" + nodeName1),
                 null, null);
         checkResult(q.execute(), new Node[]{});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.childNode(testRoot + "/" + nodeName1),
-                null, null);
-        checkResult(q.execute(), new Node[]{});
     }
 
     public void testChildNodesDoNotMatchSelector()
@@ -89,11 +73,6 @@
                 Query q = qomFactory.createQuery(qomFactory.selector(nt.getName(), "s"),
                         qomFactory.childNode("s", testRoot), null, null);
                 checkResult(q.execute(), new Node[]{});
-
-                // using default selector
-                q = qomFactory.createQuery(qomFactory.selector(nt.getName()),
-                        qomFactory.childNode(testRoot), null, null);
-                checkResult(q.execute(), new Node[]{});
                 return;
             }
         }
@@ -110,16 +89,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.childNode(testPath), null, null);
-            q.execute();
-            fail("ChildNode with relative path argument must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
     public void testSyntacticallyInvalidPath() throws RepositoryException {
@@ -132,17 +101,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.childNode(testRoot + "/" + nodeName1 + "["),
-                    null, null);
-            q.execute();
-            fail("ChildNode with syntactically invalid path argument must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
     public void testNotASelectorName() throws RepositoryException {
@@ -154,24 +112,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.childNode("x", testRoot), null, null);
-            q.execute();
-            fail("ChildNode with an invalid selector name must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
-    public void testDefaultSelector() throws RepositoryException {
-        Node n = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
-
-        Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                qomFactory.childNode(testRoot), null, null);
-        checkResult(q.execute(), new Node[]{n});
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeTest.java Thu Apr 30 20:07:43 2009
@@ -38,11 +38,6 @@
         Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
                 qomFactory.descendantNode("s", testRoot), null, null);
         checkResult(q.execute(), new Node[]{n});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.descendantNode(testRoot), null, null);
-        checkResult(q.execute(), new Node[]{n});
     }
 
     public void testDescendantNodes() throws RepositoryException {
@@ -54,11 +49,6 @@
         Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
                 qomFactory.descendantNode("s", testRoot), null, null);
         checkResult(q.execute(), new Node[]{n1, n2, n21});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.descendantNode(testRoot), null, null);
-        checkResult(q.execute(), new Node[]{n1, n2, n21});
     }
 
     public void testPathDoesNotExist() throws RepositoryException {
@@ -66,12 +56,6 @@
                 qomFactory.descendantNode("s", testRoot + "/" + nodeName1),
                 null, null);
         checkResult(q.execute(), new Node[]{});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.descendantNode(testRoot + "/" + nodeName1),
-                null, null);
-        checkResult(q.execute(), new Node[]{});
     }
 
     public void testDescendantNodesDoNotMatchSelector()
@@ -89,11 +73,6 @@
                 Query q = qomFactory.createQuery(qomFactory.selector(nt.getName(), "s"),
                         qomFactory.descendantNode("s", testRoot), null, null);
                 checkResult(q.execute(), new Node[]{});
-
-                // using default selector
-                q = qomFactory.createQuery(qomFactory.selector(nt.getName()),
-                        qomFactory.descendantNode(testRoot), null, null);
-                checkResult(q.execute(), new Node[]{});
                 return;
             }
         }
@@ -110,16 +89,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.descendantNode(testPath), null, null);
-            q.execute();
-            fail("DescendantNode with relative path argument must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
     public void testSyntacticallyInvalidPath() throws RepositoryException {
@@ -132,17 +101,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.descendantNode(testRoot + "/" + nodeName1 +
-                    "["), null, null);
-            q.execute();
-            fail("DescendantNode with syntactically invalid path argument must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
     public void testNotASelectorName() throws RepositoryException {
@@ -154,24 +112,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.descendantNode("x", testRoot), null, null);
-            q.execute();
-            fail("DescendantNode with an invalid selector name must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
-    public void testDefaultSelector() throws RepositoryException {
-        Node n = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
-
-        Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                qomFactory.descendantNode(testRoot), null, null);
-        checkResult(q.execute(), new Node[]{n});
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/LengthTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/LengthTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/LengthTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/LengthTest.java Thu Apr 30 20:07:43 2009
@@ -156,12 +156,12 @@
 
         Calendar length = Calendar.getInstance();
         length.setTimeInMillis(node.getProperty(propertyName1).getLength());
-        executeQuery(propertyName1, OPERATOR_EQUAL_TO, vf.createValue(length));
+        executeQuery(propertyName1, JCR_OPERATOR_EQUAL_TO, vf.createValue(length));
     }
 
     public void testLengthBooleanLiteral() throws RepositoryException {
         try {
-            executeQuery(propertyName1, OPERATOR_EQUAL_TO, vf.createValue(false));
+            executeQuery(propertyName1, JCR_OPERATOR_EQUAL_TO, vf.createValue(false));
             fail("Boolean literal cannot be converted to long");
         } catch (InvalidQueryException e) {
             // expected
@@ -170,7 +170,7 @@
 
     public void testLengthNameLiteral() throws RepositoryException {
         try {
-            executeQuery(propertyName1, OPERATOR_EQUAL_TO, vf.createValue(
+            executeQuery(propertyName1, JCR_OPERATOR_EQUAL_TO, vf.createValue(
                     propertyName1, PropertyType.NAME));
             fail("Name literal cannot be converted to long");
         } catch (InvalidQueryException e) {
@@ -180,7 +180,7 @@
 
     public void testLengthPathLiteral() throws RepositoryException {
         try {
-            executeQuery(propertyName1, OPERATOR_EQUAL_TO, vf.createValue(
+            executeQuery(propertyName1, JCR_OPERATOR_EQUAL_TO, vf.createValue(
                     node.getPath(), PropertyType.PATH));
             fail("Path literal cannot be converted to long");
         } catch (InvalidQueryException e) {
@@ -198,7 +198,7 @@
             throw new NotExecutableException("Cannot add mix:referenceable to node");
         }
         try {
-            executeQuery(propertyName1, OPERATOR_EQUAL_TO, vf.createValue(node));
+            executeQuery(propertyName1, JCR_OPERATOR_EQUAL_TO, vf.createValue(node));
             fail("Reference literal cannot be converted to long");
         } catch (InvalidQueryException e) {
             // expected
@@ -221,27 +221,27 @@
 
     private void checkOperators(String propertyName,
                                 long length) throws RepositoryException {
-        checkLength(propertyName, OPERATOR_EQUAL_TO, length, true);
-        checkLength(propertyName, OPERATOR_EQUAL_TO, length - 1, false);
+        checkLength(propertyName, JCR_OPERATOR_EQUAL_TO, length, true);
+        checkLength(propertyName, JCR_OPERATOR_EQUAL_TO, length - 1, false);
 
-        checkLength(propertyName, OPERATOR_GREATER_THAN, length - 1, true);
-        checkLength(propertyName, OPERATOR_GREATER_THAN, length, false);
+        checkLength(propertyName, JCR_OPERATOR_GREATER_THAN, length - 1, true);
+        checkLength(propertyName, JCR_OPERATOR_GREATER_THAN, length, false);
 
-        checkLength(propertyName, OPERATOR_GREATER_THAN_OR_EQUAL_TO, length, true);
-        checkLength(propertyName, OPERATOR_GREATER_THAN_OR_EQUAL_TO, length + 1, false);
+        checkLength(propertyName, JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, length, true);
+        checkLength(propertyName, JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, length + 1, false);
 
-        checkLength(propertyName, OPERATOR_LESS_THAN, length + 1, true);
-        checkLength(propertyName, OPERATOR_LESS_THAN, length, false);
+        checkLength(propertyName, JCR_OPERATOR_LESS_THAN, length + 1, true);
+        checkLength(propertyName, JCR_OPERATOR_LESS_THAN, length, false);
 
-        checkLength(propertyName, OPERATOR_LESS_THAN_OR_EQUAL_TO, length, true);
-        checkLength(propertyName, OPERATOR_LESS_THAN_OR_EQUAL_TO, length - 1, false);
+        checkLength(propertyName, JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, length, true);
+        checkLength(propertyName, JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, length - 1, false);
 
-        checkLength(propertyName, OPERATOR_NOT_EQUAL_TO, length - 1, true);
-        checkLength(propertyName, OPERATOR_NOT_EQUAL_TO, length, false);
+        checkLength(propertyName, JCR_OPERATOR_NOT_EQUAL_TO, length - 1, true);
+        checkLength(propertyName, JCR_OPERATOR_NOT_EQUAL_TO, length, false);
     }
 
     private void checkLength(String propertyName,
-                             int operator,
+                             String operator,
                              long length,
                              boolean matches) throws RepositoryException {
         Node[] result;
@@ -254,14 +254,14 @@
     }
 
     private QueryResult executeQuery(String propertyName,
-                                     int operator,
+                                     String operator,
                                      long length) throws RepositoryException {
         Value v = vf.createValue(length);
         return executeQuery(propertyName, operator, v);
     }
 
     private QueryResult executeQuery(String propertyName,
-                                     int operator,
+                                     String operator,
                                      Value length) throws RepositoryException {
         return qomFactory.createQuery(
                 qomFactory.selector(testNodeType, "s"),

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/QueryObjectModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/QueryObjectModelFactoryTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/QueryObjectModelFactoryTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/QueryObjectModelFactoryTest.java Thu Apr 30 20:07:43 2009
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.api.jsr283.query.qom;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.jcr.RepositoryException;
@@ -89,33 +88,33 @@
     /**
      * Set of all possible operators.
      */
-    private static final Set OPERATORS = new HashSet();
+    private static final Set<String> OPERATORS = new HashSet<String>();
 
     /**
      * Set of all possible join types.
      */
-    private static final Set JOIN_TYPES = new HashSet();
+    private static final Set<String> JOIN_TYPES = new HashSet<String>();
 
     static {
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO));
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN));
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO));
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN));
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO));
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_LIKE));
-        OPERATORS.add(new Integer(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO));
-
-        JOIN_TYPES.add(new Integer(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER));
-        JOIN_TYPES.add(new Integer(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER));
-        JOIN_TYPES.add(new Integer(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER));
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_LIKE);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO);
+
+        JOIN_TYPES.add(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER);
+        JOIN_TYPES.add(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER);
+        JOIN_TYPES.add(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER);
     }
 
     /**
      * Test case for {@link QueryObjectModelFactory#and(Constraint, Constraint)}
      */
     public void testAnd() throws RepositoryException {
-        PropertyExistence c1 = qomFactory.propertyExistence(propertyName1);
-        PropertyExistence c2 = qomFactory.propertyExistence(propertyName2);
+        PropertyExistence c1 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyExistence c2 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName2);
         And and = qomFactory.and(c1, c2);
         assertTrue("Not a PropertyExistence constraint",
                 and.getConstraint1() instanceof PropertyExistence);
@@ -127,7 +126,7 @@
      * Test case for {@link QueryObjectModelFactory#ascending(DynamicOperand)}
      */
     public void testOrderingAscending() throws RepositoryException {
-        PropertyValue op = qomFactory.propertyValue(propertyName1);
+        PropertyValue op = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Ordering asc = qomFactory.ascending(op);
         assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_ASCENDING",
                 QueryObjectModelConstants.JCR_ORDER_ASCENDING, asc.getOrder());
@@ -146,8 +145,8 @@
      * Test case for {@link QueryObjectModelFactory#childNode(String)}
      */
     public void testChildNode() throws RepositoryException {
-        ChildNode childNode = qomFactory.childNode(testRootNode.getPath());
-        assertEquals("Wrong path", testRootNode.getPath(), childNode.getPath());
+        ChildNode childNode = qomFactory.childNode(SELECTOR_NAME1, testRootNode.getPath());
+        assertEquals("Wrong path", testRootNode.getPath(), childNode.getParentPath());
         assertNull("Selector must be null", childNode.getSelectorName());
     }
 
@@ -156,7 +155,7 @@
      */
     public void testChildNodeWithSelector() throws RepositoryException {
         ChildNode childNode = qomFactory.childNode(SELECTOR_NAME1, testRootNode.getPath());
-        assertEquals("Wrong path", testRootNode.getPath(), childNode.getPath());
+        assertEquals("Wrong path", testRootNode.getPath(), childNode.getParentPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, childNode.getSelectorName());
     }
 
@@ -173,8 +172,8 @@
      * Test case for {@link QueryObjectModelFactory#column(String)}
      */
     public void testColumn() throws RepositoryException {
-        Column col = qomFactory.column(propertyName1);
-        assertNull("Selector must be null", col.getSelectorName());
+        Column col = qomFactory.column(SELECTOR_NAME1, propertyName1, null);
+        assertEquals("Wrong selector name", SELECTOR_NAME1, col.getSelectorName());
         assertEquals("Wrong property name", propertyName1, col.getPropertyName());
         assertEquals("Wrong column name", propertyName1, col.getColumnName());
     }
@@ -183,8 +182,8 @@
      * Test case for {@link QueryObjectModelFactory#column(String)}
      */
     public void testColumnAllProperties() throws RepositoryException {
-        Column col = qomFactory.column(null);
-        assertNull("Selector must be null", col.getSelectorName());
+        Column col = qomFactory.column(SELECTOR_NAME1, null, null);
+        assertEquals("Wrong selector name", SELECTOR_NAME1, col.getSelectorName());
         assertNull("Property name must be null", col.getPropertyName());
         assertNull("Column name must be null", col.getColumnName());
     }
@@ -193,8 +192,8 @@
      * Test case for {@link QueryObjectModelFactory#column(String, String)}
      */
     public void testColumnWithColumnName() throws RepositoryException {
-        Column col = qomFactory.column(propertyName1, COLUMN_NAME);
-        assertNull("Selector must be null", col.getSelectorName());
+        Column col = qomFactory.column(SELECTOR_NAME1, propertyName1, COLUMN_NAME);
+        assertEquals("Wrong selector name", SELECTOR_NAME1, col.getSelectorName());
         assertEquals("Wrong property name", propertyName1, col.getPropertyName());
         assertEquals("Wrong column name", COLUMN_NAME, col.getColumnName());
     }
@@ -213,10 +212,9 @@
      * Test case for {@link QueryObjectModelFactory#comparison(DynamicOperand, int, StaticOperand)}
      */
     public void testComparison() throws RepositoryException {
-        PropertyValue op1 = qomFactory.propertyValue(propertyName1);
+        PropertyValue op1 = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         BindVariableValue op2 = qomFactory.bindVariable(VARIABLE_NAME);
-        for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
-            int operator = ((Integer) it.next()).intValue();
+        for (String operator : OPERATORS) {
             Comparison comp = qomFactory.comparison(op1, operator, op2);
             assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
             assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
@@ -225,7 +223,7 @@
     }
 
     public void testCreateQuery() throws RepositoryException {
-        Selector selector = qomFactory.selector(testNodeType);
+        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
         QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertNull("Constraint must be null", qom.getConstraint());
@@ -234,8 +232,8 @@
     }
 
     public void testCreateQueryWithConstraint() throws RepositoryException {
-        Selector selector = qomFactory.selector(testNodeType);
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
+        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
         QueryObjectModel qom = qomFactory.createQuery(
                 selector, propExist, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
@@ -245,9 +243,9 @@
     }
 
     public void testCreateQueryWithConstraintAndOrdering() throws RepositoryException {
-        Selector selector = qomFactory.selector(testNodeType);
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Ordering ordering = qomFactory.ascending(propValue);
         QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                 new Ordering[]{ordering}, null);
@@ -258,11 +256,11 @@
     }
 
     public void testCreateQueryWithConstraintOrderingAndColumn() throws RepositoryException {
-        Selector selector = qomFactory.selector(testNodeType);
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Ordering ordering = qomFactory.ascending(propValue);
-        Column column = qomFactory.column(propertyName1);
+        Column column = qomFactory.column(SELECTOR_NAME1, propertyName1, null);
         QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                 new Ordering[]{ordering}, new Column[]{column});
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
@@ -272,7 +270,7 @@
     }
 
     public void testCreateQueryFromSource() throws RepositoryException {
-        Source selector = qomFactory.selector(testNodeType);
+        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
         QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertNull("Constraint must be null", qom.getConstraint());
@@ -281,8 +279,8 @@
     }
 
     public void testCreateQueryFromSourceWithConstraint() throws RepositoryException {
-        Source selector = qomFactory.selector(testNodeType);
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
+        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
         QueryObjectModel qom = qomFactory.createQuery(
                 selector, propExist, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
@@ -292,9 +290,9 @@
     }
 
     public void testCreateQueryFromSourceWithConstraintAndOrdering() throws RepositoryException {
-        Source selector = qomFactory.selector(testNodeType);
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Ordering ordering = qomFactory.ascending(propValue);
         QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                 new Ordering[]{ordering}, null);
@@ -305,11 +303,11 @@
     }
 
     public void testCreateQueryFromSourceWithConstraintOrderingAndColumn() throws RepositoryException {
-        Source selector = qomFactory.selector(testNodeType);
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Ordering ordering = qomFactory.ascending(propValue);
-        Column column = qomFactory.column(propertyName1);
+        Column column = qomFactory.column(SELECTOR_NAME1, propertyName1, null);
         QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                 new Ordering[]{ordering}, new Column[]{column});
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
@@ -322,9 +320,9 @@
      * Test case for {@link QueryObjectModelFactory#descendantNode(String)}
      */
     public void testDescendantNode() throws RepositoryException {
-        DescendantNode descNode = qomFactory.descendantNode(testRootNode.getPath());
+        DescendantNode descNode = qomFactory.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
         assertNull("Selector must be null", descNode.getSelectorName());
-        assertEquals("Wrong path", testRootNode.getPath(), descNode.getPath());
+        assertEquals("Wrong path", testRootNode.getPath(), descNode.getAncestorPath());
     }
 
     /**
@@ -333,7 +331,7 @@
     public void testDescendantNodeWithSelector() throws RepositoryException {
         DescendantNode descNode = qomFactory.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, descNode.getSelectorName());
-        assertEquals("Wrong path", testRootNode.getPath(), descNode.getPath());
+        assertEquals("Wrong path", testRootNode.getPath(), descNode.getAncestorPath());
     }
 
     /**
@@ -349,10 +347,10 @@
      * Test case for {@link QueryObjectModelFactory#descending(DynamicOperand)}
      */
     public void testOrderingDescending() throws RepositoryException {
-        PropertyValue op = qomFactory.propertyValue(propertyName1);
+        PropertyValue op = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Ordering desc = qomFactory.descending(op);
         assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_DESCENDING",
-                QueryObjectModelConstants.ORDER_DESCENDING, desc.getOrder());
+                QueryObjectModelConstants.JCR_ORDER_DESCENDING, desc.getOrder());
         assertTrue("Not a PropertyValue operand", desc.getOperand() instanceof PropertyValue);
     }
 
@@ -371,7 +369,7 @@
      * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String)}
      */
     public void testFullTextSearch() throws RepositoryException {
-        FullTextSearch ftSearch = qomFactory.fullTextSearch(propertyName1, FULLTEXT_SEARCH_EXPR);
+        FullTextSearch ftSearch = qomFactory.fullTextSearch(SELECTOR_NAME1, propertyName1, FULLTEXT_SEARCH_EXPR);
         assertNull("Selector must be null", ftSearch.getSelectorName());
         assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());
         assertEquals("Wrong fulltext search expression", FULLTEXT_SEARCH_EXPR, ftSearch.getFullTextSearchExpression());
@@ -381,7 +379,7 @@
      * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String)}
      */
     public void testFullTextSearchAllProperties() throws RepositoryException {
-        FullTextSearch ftSearch = qomFactory.fullTextSearch(null, FULLTEXT_SEARCH_EXPR);
+        FullTextSearch ftSearch = qomFactory.fullTextSearch(SELECTOR_NAME1, null, FULLTEXT_SEARCH_EXPR);
         assertNull("Selector must be null", ftSearch.getSelectorName());
         assertNull("Property name must be null", ftSearch.getPropertyName());
         assertEquals("Wrong fulltext search expression", FULLTEXT_SEARCH_EXPR, ftSearch.getFullTextSearchExpression());
@@ -401,7 +399,7 @@
      * Test case for {@link QueryObjectModelFactory#fullTextSearchScore()}
      */
     public void testFullTextSearchScore() throws RepositoryException {
-        FullTextSearchScore score = qomFactory.fullTextSearchScore();
+        FullTextSearchScore score = qomFactory.fullTextSearchScore(SELECTOR_NAME1);
         assertNull("Selector must be null", score.getSelectorName());
     }
 
@@ -417,11 +415,10 @@
      * Test case for {@link QueryObjectModelFactory#join(Source, Source, int, JoinCondition)}
      */
     public void testJoin() throws RepositoryException {
-        Selector s1 = qomFactory.selector(ntBase);
-        Selector s2 = qomFactory.selector(testNodeType);
+        Selector s1 = qomFactory.selector(ntBase, SELECTOR_NAME1);
+        Selector s2 = qomFactory.selector(testNodeType, SELECTOR_NAME1);
         JoinCondition cond = qomFactory.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
-        for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
-            int joinType = ((Integer) it.next()).intValue();
+        for (String joinType : JOIN_TYPES) {
             Join join = qomFactory.join(s1, s2, joinType, cond);
             assertTrue("Not a selector source", join.getLeft() instanceof Selector);
             assertTrue("Not a selector source", join.getRight() instanceof Selector);
@@ -434,7 +431,7 @@
      * Test case for {@link QueryObjectModelFactory#length(PropertyValue)}
      */
     public void testLength() throws RepositoryException {
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         Length len = qomFactory.length(propValue);
         assertNotNull("Property value must not be null", len.getPropertyValue());
     }
@@ -443,7 +440,7 @@
      * Test case for {@link QueryObjectModelFactory#lowerCase(DynamicOperand)}
      */
     public void testLowerCase() throws RepositoryException {
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         LowerCase lower = qomFactory.lowerCase(propValue);
         assertTrue("Not a property value operand", lower.getOperand() instanceof PropertyValue);
     }
@@ -452,7 +449,7 @@
      * Test case for {@link QueryObjectModelFactory#nodeLocalName()}
      */
     public void testNodeLocalName() throws RepositoryException {
-        NodeLocalName localName = qomFactory.nodeLocalName();
+        NodeLocalName localName = qomFactory.nodeLocalName(SELECTOR_NAME1);
         assertNull("Selector name must be null", localName.getSelectorName());
     }
 
@@ -468,7 +465,7 @@
      * Test case for {@link QueryObjectModelFactory#nodeName()}
      */
     public void testNodeName() throws RepositoryException {
-        NodeName nodeName = qomFactory.nodeName();
+        NodeName nodeName = qomFactory.nodeName(SELECTOR_NAME1);
         assertNull("Selector name must be null", nodeName.getSelectorName());
     }
 
@@ -484,7 +481,7 @@
      * Test case for {@link QueryObjectModelFactory#not(Constraint)}
      */
     public void testNot() throws RepositoryException {
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
         Not not = qomFactory.not(propExist);
         assertTrue("Not a property existence constraint", not.getConstraint() instanceof PropertyExistence);
     }
@@ -493,8 +490,8 @@
      * Test case for {@link QueryObjectModelFactory#or(Constraint, Constraint)}
      */
     public void testOr() throws RepositoryException {
-        PropertyExistence c1 = qomFactory.propertyExistence(propertyName1);
-        PropertyExistence c2 = qomFactory.propertyExistence(propertyName2);
+        PropertyExistence c1 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyExistence c2 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName2);
         Or or = qomFactory.or(c1, c2);
         assertTrue("Not a PropertyExistence constraint",
                 or.getConstraint1() instanceof PropertyExistence);
@@ -506,7 +503,7 @@
      * Test case for {@link QueryObjectModelFactory#propertyExistence(String)}
      */
     public void testPropertyExistence() throws RepositoryException {
-        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
+        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
         assertNull("Selector name must be null", propExist.getSelectorName());
         assertEquals("Wrong property name", propertyName1, propExist.getPropertyName());
     }
@@ -524,7 +521,7 @@
      * Test case for {@link QueryObjectModelFactory#propertyValue(String)}
      */
     public void testPropertyValue() throws RepositoryException {
-        PropertyValue propVal = qomFactory.propertyValue(propertyName1);
+        PropertyValue propVal = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         assertNull("Selector name must be null", propVal.getSelectorName());
         assertEquals("Wrong property name", propertyName1, propVal.getPropertyName());
     }
@@ -542,7 +539,7 @@
      * Test case for {@link QueryObjectModelFactory#sameNode(String)}
      */
     public void testSameNode() throws RepositoryException {
-        SameNode sameNode = qomFactory.sameNode(testRootNode.getPath());
+        SameNode sameNode = qomFactory.sameNode(SELECTOR_NAME1, testRootNode.getPath());
         assertNull("Selector name must be null", sameNode.getSelectorName());
         assertEquals("Wrong path", testRootNode.getPath(), sameNode.getPath());
     }
@@ -560,7 +557,7 @@
      * Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(String, String)}
      */
     public void testSameNodeJoinCondition() throws RepositoryException {
-        SameNodeJoinCondition cond = qomFactory.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2);
+        SameNodeJoinCondition cond = qomFactory.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, ".");
         assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name());
         assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name());
         assertNull("Path must be null", cond.getSelector2Path());
@@ -580,9 +577,9 @@
      * Test case for {@link QueryObjectModelFactory#selector(String)}
      */
     public void testSelector() throws RepositoryException {
-        Selector selector = qomFactory.selector(ntBase);
+        Selector selector = qomFactory.selector(ntBase, SELECTOR_NAME1);
         assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
-        assertEquals("Wrong selector name", ntBase, selector.getSelectorName());
+        assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
     }
 
     /**
@@ -598,7 +595,7 @@
      * Test case for {@link QueryObjectModelFactory#upperCase(DynamicOperand)}
      */
     public void testUpperCase() throws RepositoryException {
-        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
+        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
         UpperCase upper = qomFactory.upperCase(propValue);
         assertTrue("Not a property value operand", upper.getOperand() instanceof PropertyValue);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java Thu Apr 30 20:07:43 2009
@@ -58,7 +58,7 @@
                         qomFactory.selector(testNodeType, LEFT),
                         qomFactory.selector(mixReferenceable, RIGHT),
                         JCR_JOIN_TYPE_LEFT_OUTER,
-                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT)
+                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")
                 ),
                qomFactory.descendantNode(LEFT, testRoot),
                null, null);
@@ -79,7 +79,7 @@
                          qomFactory.selector(mixReferenceable, LEFT),
                          qomFactory.selector(testNodeType, RIGHT),
                          JCR_JOIN_TYPE_RIGHT_OUTER,
-                         qomFactory.sameNodeJoinCondition(LEFT, RIGHT)
+                         qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")
                  ),
                 qomFactory.descendantNode(RIGHT, testRoot),
                 null, null);
@@ -111,7 +111,7 @@
         if (relPath != null) {
             c = qomFactory.sameNodeJoinCondition(LEFT, RIGHT, relPath);
         } else {
-            c = qomFactory.sameNodeJoinCondition(LEFT, RIGHT);
+            c = qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".");
         }
         return createQuery(joinType, c);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeTest.java Thu Apr 30 20:07:43 2009
@@ -16,15 +16,15 @@
  */
 package org.apache.jackrabbit.api.jsr283.query.qom;
 
-import org.apache.jackrabbit.test.NotExecutableException;
-
-import javax.jcr.RepositoryException;
 import javax.jcr.Node;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NodeType;
-import javax.jcr.query.Query;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.Query;
+
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * <code>SameNodeTest</code>...
@@ -38,11 +38,6 @@
         Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
                 qomFactory.sameNode("s", testRoot + "/" + nodeName1), null, null);
         checkResult(q.execute(), new Node[]{n});
-
-        // using default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.sameNode(testRoot + "/" + nodeName1), null, null);
-        checkResult(q.execute(), new Node[]{n});
     }
 
     public void testPathDoesNotExist() throws RepositoryException {
@@ -50,12 +45,6 @@
                 qomFactory.sameNode("s", testRoot + "/" + nodeName1),
                 null, null);
         checkResult(q.execute(), new Node[]{});
-
-        // default selector
-        q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                qomFactory.sameNode(testRoot + "/" + nodeName1),
-                null, null);
-        checkResult(q.execute(), new Node[]{});
     }
 
     public void testChildNodesDoNotMatchSelector()
@@ -73,11 +62,6 @@
                 Query q = qomFactory.createQuery(qomFactory.selector(nt.getName(), "s"),
                         qomFactory.sameNode("s", testRoot + "/" + nodeName1), null, null);
                 checkResult(q.execute(), new Node[]{});
-
-                // using default selector
-                q = qomFactory.createQuery(qomFactory.selector(nt.getName()),
-                        qomFactory.sameNode(testRoot + "/" + nodeName1), null, null);
-                checkResult(q.execute(), new Node[]{});
                 return;
             }
         }
@@ -94,16 +78,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.sameNode(testPath), null, null);
-            q.execute();
-            fail("SameNode with relative path argument must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
     public void testSyntacticallyInvalidPath() throws RepositoryException {
@@ -116,17 +90,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.sameNode(testRoot + "/" + nodeName1 + "["),
-                    null, null);
-            q.execute();
-            fail("SameNode with syntactically invalid path argument must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
     public void testNotASelectorName() throws RepositoryException {
@@ -138,24 +101,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using default selector
-        try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType),
-                    qomFactory.sameNode("x", testRoot), null, null);
-            q.execute();
-            fail("SameNode with an invalid selector name must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
 
-    public void testDefaultSelector() throws RepositoryException {
-        Node n = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
-
-        Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                qomFactory.sameNode(testRoot + "/" + nodeName1), null, null);
-        checkResult(q.execute(), new Node[]{n});
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SelectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SelectorTest.java?rev=770428&r1=770427&r2=770428&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SelectorTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SelectorTest.java Thu Apr 30 20:07:43 2009
@@ -16,12 +16,12 @@
  */
 package org.apache.jackrabbit.api.jsr283.query.qom;
 
-import javax.jcr.RepositoryException;
 import javax.jcr.NodeIterator;
-import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.query.Query;
+import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.Query;
 
 /**
  * <code>SelectorTest</code>...
@@ -33,7 +33,7 @@
         testRootNode.addNode(nodeName1, testNodeType);
         testRootNode.save();
         Query q = qomFactory.createQuery(
-                qomFactory.selector(testNodeType), null, null, null);
+                qomFactory.selector(testNodeType, "s"), null, null, null);
         NodeIterator it = q.execute().getNodes();
         while (it.hasNext()) {
             assertTrue("Wrong node type", it.nextNode().isNodeType(testNodeType));
@@ -43,7 +43,7 @@
     public void testSyntacticallyInvalidName() throws RepositoryException {
         try {
             Query q = qomFactory.createQuery(
-                    qomFactory.selector(testNodeType + "["), null, null, null);
+                    qomFactory.selector(testNodeType + "[", "s"), null, null, null);
             q.execute();
             fail("Selector with syntactically invalid name must throw InvalidQueryException");
         } catch (InvalidQueryException e) {
@@ -62,7 +62,7 @@
                 break;
             }
         }
-        Query q = qomFactory.createQuery(qomFactory.selector(ntName),
+        Query q = qomFactory.createQuery(qomFactory.selector(ntName, "s"),
                 null, null, null);
         assertFalse("Selector must not select nodes for unknown node type",
                 q.execute().getNodes().hasNext());
@@ -74,7 +74,7 @@
                     qomFactory.join(
                             qomFactory.selector(testNodeType, "nt"),
                             qomFactory.selector(testNodeType, "nt"),
-                            JOIN_TYPE_INNER,
+                            JCR_JOIN_TYPE_INNER,
                             qomFactory.descendantNodeJoinCondition("nt", "nt")),
                     null, null, null);
             q.execute();
@@ -82,21 +82,6 @@
         } catch (InvalidQueryException e) {
             // expected
         }
-
-        // using one argument selector method
-        try {
-            Query q = qomFactory.createQuery(
-                    qomFactory.join(
-                            qomFactory.selector(testNodeType),
-                            qomFactory.selector(testNodeType),
-                            JOIN_TYPE_INNER,
-                            qomFactory.descendantNodeJoinCondition(
-                                    testNodeType, testNodeType)),
-                    null, null, null);
-            q.execute();
-            fail("Selector with two identical selector names must throw InvalidQueryException");
-        } catch (InvalidQueryException e) {
-            // expected
-        }
     }
+
 }