jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r792142 [23/35] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrab...
Date Wed, 08 Jul 2009 13:57:46 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java Wed Jul  8 13:57:13 2009
@@ -22,7 +22,13 @@
 import javax.jcr.PropertyType;
 import javax.jcr.query.Query;
 import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModel;
+
 import java.util.Calendar;
+import java.math.BigDecimal;
+
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * <code>NodeNameTest</code> checks if conversion of literals is correctly
@@ -35,7 +41,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         node1 = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
+        superuser.save();
     }
 
     protected void tearDown() throws Exception {
@@ -44,120 +50,210 @@
     }
 
     public void testStringLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(nodeName1);
-        Query q = createQuery(JCR_OPERATOR_EQUAL_TO, literal);
-        checkResult(q.execute(), new Node[]{node1});
+        Value literal = vf.createValue(nodeName1);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
+        checkQOM(qom, new Node[]{node1});
     }
 
     public void testStringLiteralInvalidName() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue("[" + nodeName1);
+        Value literal = vf.createValue("[" + nodeName1);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with STRING that cannot be converted to NAME must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = '" + literal.getString() + "'";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with STRING that cannot be converted to NAME must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testBinaryLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(
+        Value literal = vf.createValue(
                 nodeName1, PropertyType.BINARY);
-        Query q = createQuery(JCR_OPERATOR_EQUAL_TO, literal);
-        checkResult(q.execute(), new Node[]{node1});
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
+        checkQOM(qom, new Node[]{node1});
     }
 
     public void testDateLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(Calendar.getInstance());
+        Value literal = vf.createValue(Calendar.getInstance());
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with DATE must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS DATE)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with DATE must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testDoubleLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(Math.PI);
+        Value literal = vf.createValue(Math.PI);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with DOUBLE must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS DOUBLE)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with DOUBLE must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testDecimalLiteral() throws RepositoryException {
-        // TODO must throw InvalidQueryException
+        Value literal = vf.createValue(new BigDecimal(283));
+        try {
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
+            fail("NodeName comparison with DECIMAL must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS DECIMAL)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with DECIMAL must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testLongLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(283);
+        Value literal = vf.createValue(283);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with LONG must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = " + literal.getString();
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with LONG must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testBooleanLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(true);
+        Value literal = vf.createValue(true);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with BOOLEAN must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = " + literal.getString();
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with BOOLEAN must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testNameLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(
-                nodeName1, PropertyType.NAME);
-        Query q = createQuery(JCR_OPERATOR_EQUAL_TO, literal);
-        checkResult(q.execute(), new Node[]{node1});
+        Value literal = vf.createValue(nodeName1, PropertyType.NAME);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
+        checkQOM(qom, new Node[]{node1});
     }
 
     public void testPathLiteral() throws RepositoryException {
-        Value literal = superuser.getValueFactory().createValue(
-                nodeName1, PropertyType.PATH);
-        Query q = createQuery(JCR_OPERATOR_EQUAL_TO, literal);
-        checkResult(q.execute(), new Node[]{node1});
+        Value literal = vf.createValue(nodeName1, PropertyType.PATH);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
+        checkQOM(qom, new Node[]{node1});
 
-        literal = superuser.getValueFactory().createValue(
-                node1.getPath(), PropertyType.PATH);
+        literal = vf.createValue(node1.getPath(), PropertyType.PATH);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with absolute PATH must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS PATH)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with absolute PATH must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
 
-        literal = superuser.getValueFactory().createValue(
-                nodeName1 + "/" + nodeName1, PropertyType.PATH);
+        literal = vf.createValue(nodeName1 + "/" + nodeName1, PropertyType.PATH);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with PATH length >1 must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS PATH)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with PATH length >1 must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
-    public void testReferenceLiteral() throws RepositoryException {
-        if (!node1.isNodeType(mixReferenceable)) {
-            node1.addMixin(mixReferenceable);
-        }
-        node1.save();
-        Value literal = superuser.getValueFactory().createValue(node1);
+    public void testReferenceLiteral() throws RepositoryException,
+            NotExecutableException {
+        ensureMixinType(node1, mixReferenceable);
+        superuser.save();
+        Value literal = vf.createValue(node1);
         try {
-            createQuery(JCR_OPERATOR_EQUAL_TO, literal).execute();
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
             fail("NodeName comparison with REFERENCE must fail with InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS REFERENCE)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with REFERENCE must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
-    public void testWeakReferenceLiteral() throws RepositoryException {
-        // TODO: must throw InvalidQueryException
+    public void testWeakReferenceLiteral() throws RepositoryException,
+            NotExecutableException {
+        ensureMixinType(node1, mixReferenceable);
+        superuser.save();
+        Value literal = vf.createValue(node1, true);
+        try {
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
+            fail("NodeName comparison with WEAKREFERENCE must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS WEAKREFERENCE)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with absolute WEAKREFERENCE must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     /**
@@ -170,15 +266,33 @@
      * thrown.
      */
     public void testURILiteral() throws RepositoryException {
-        // TODO
+        Value literal = vf.createValue("./" + nodeName1, PropertyType.URI);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
+        checkQOM(qom, new Node[]{node1});
+
+        literal = vf.createValue("http://example.com", PropertyType.URI);
+        try {
+            createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
+            fail("NodeName comparison with URI that cannot be converted to NAME must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE NAME(s) = CAST('" + literal.getString() + "' AS URI)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("NAME() comparison with URI that cannot be converted to NAME must fail with InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testEqualTo() throws RepositoryException {
-        checkOperator(JCR_OPERATOR_EQUAL_TO, false, true, false);
+        checkOperator(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, false, true, false);
     }
 
     public void testNotEqualTo() throws RepositoryException {
-        checkOperator(JCR_OPERATOR_NOT_EQUAL_TO, true, false, true);
+        checkOperator(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO, true, false, true);
     }
 
     //------------------------------< helper >----------------------------------
@@ -197,9 +311,9 @@
                                             String operator,
                                             boolean matches)
             throws RepositoryException {
-        Value value = superuser.getValueFactory().createValue(literal);
-        Query q = createQuery(operator, value);
-        checkResult(q.execute(), matches ? new Node[]{node1} : new Node[0]);
+        Value value = vf.createValue(literal);
+        QueryObjectModel qom = createQuery(operator, value);
+        checkQOM(qom, matches ? new Node[]{node1} : new Node[0]);
     }
 
     private String createLexicographicallyGreater(String name) {
@@ -214,15 +328,16 @@
         return tmp.toString();
     }
 
-    private Query createQuery(String operator, Value literal) throws RepositoryException {
-        return qomFactory.createQuery(
-                qomFactory.selector(testNodeType, "s"),
-                qomFactory.and(
-                        qomFactory.childNode("s", testRoot),
-                        qomFactory.comparison(
-                                qomFactory.nodeName("s"),
+    private QueryObjectModel createQuery(String operator, Value literal)
+            throws RepositoryException {
+        return qf.createQuery(
+                qf.selector(testNodeType, "s"),
+                qf.and(
+                        qf.childNode("s", testRoot),
+                        qf.comparison(
+                                qf.nodeName("s"),
                                 operator,
-                                qomFactory.literal(literal)
+                                qf.literal(literal)
                         )
                 ), null, null);
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java Wed Jul  8 13:57:13 2009
@@ -18,7 +18,7 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Node;
-import javax.jcr.query.QueryResult;
+import javax.jcr.query.qom.QueryObjectModel;
 
 /**
  * <code>PropertyExistenceTest</code> performs a test with
@@ -31,22 +31,22 @@
         n1.setProperty(propertyName1, "abc");
         Node n2 = testRootNode.addNode(nodeName2, testNodeType);
         n2.setProperty(propertyName2, "abc");
-        testRootNode.save();
+        superuser.save();
 
-        QueryResult result = qomFactory.createQuery(
-                qomFactory.selector(testNodeType, "s"),
-                qomFactory.and(
-                        qomFactory.childNode("s", testRoot),
-                        qomFactory.propertyExistence("s", propertyName1)
-                ), null, null).execute();
-        checkResult(result, new Node[]{n1});
+        QueryObjectModel qom = qf.createQuery(
+                qf.selector(testNodeType, "s"),
+                qf.and(
+                        qf.childNode("s", testRoot),
+                        qf.propertyExistence("s", propertyName1)
+                ), null, null);
+        checkQOM(qom, new Node[]{n1});
 
-        result = qomFactory.createQuery(
-                qomFactory.selector(testNodeType, "s"),
-                qomFactory.and(
-                        qomFactory.childNode("s", testRoot),
-                        qomFactory.propertyExistence("s", propertyName2)
-                ), null, null).execute();
-        checkResult(result, new Node[]{n2});
+        qom = qf.createQuery(
+                qf.selector(testNodeType, "s"),
+                qf.and(
+                        qf.childNode("s", testRoot),
+                        qf.propertyExistence("s", propertyName2)
+                ), null, null);
+        checkQOM(qom, new Node[]{n2});
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java Wed Jul  8 13:57:13 2009
@@ -21,6 +21,7 @@
 import java.util.Set;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.Value;
 import javax.jcr.query.qom.And;
 import javax.jcr.query.qom.BindVariableValue;
 import javax.jcr.query.qom.ChildNode;
@@ -54,6 +55,7 @@
 import javax.jcr.query.qom.Source;
 import javax.jcr.query.qom.StaticOperand;
 import javax.jcr.query.qom.UpperCase;
+import javax.jcr.query.qom.Literal;
 
 /**
  * <code>QueryObjectModelFactoryTest</code> tests all methods on the
@@ -97,26 +99,26 @@
     private static final Set JOIN_TYPES = new HashSet();
 
     static {
-        OPERATORS.add(AbstractQOMTest.JCR_OPERATOR_EQUAL_TO);
+        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(AbstractQOMTest.JCR_OPERATOR_NOT_EQUAL_TO);
+        OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO);
 
         JOIN_TYPES.add(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER);
-        JOIN_TYPES.add(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER);
-        JOIN_TYPES.add(AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER);
+        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(SELECTOR_NAME1, propertyName1);
-        PropertyExistence c2 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName2);
-        And and = qomFactory.and(c1, c2);
+        PropertyExistence c1 = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyExistence c2 = qf.propertyExistence(SELECTOR_NAME1, propertyName2);
+        And and = qf.and(c1, c2);
         assertTrue("Not a PropertyExistence constraint",
                 and.getConstraint1() instanceof PropertyExistence);
         assertTrue("Not a PropertyExistence constraint",
@@ -127,8 +129,8 @@
      * Test case for {@link QueryObjectModelFactory#ascending(DynamicOperand)}
      */
     public void testOrderingAscending() throws RepositoryException {
-        PropertyValue op = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
-        Ordering asc = qomFactory.ascending(op);
+        PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Ordering asc = qf.ascending(op);
         assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_ASCENDING",
                 QueryObjectModelConstants.JCR_ORDER_ASCENDING, asc.getOrder());
         assertTrue("Not a PropertyValue operand", asc.getOperand() instanceof PropertyValue);
@@ -138,15 +140,15 @@
      * Test case for {@link QueryObjectModelFactory#bindVariable(String)}
      */
     public void testBindVariableValue() throws RepositoryException {
-        BindVariableValue bindVar = qomFactory.bindVariable(propertyName1);
+        BindVariableValue bindVar = qf.bindVariable(propertyName1);
         assertEquals("Wrong variable name", propertyName1, bindVar.getBindVariableName());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#childNode(String)}
+     * Test case for {@link QueryObjectModelFactory#childNode(String, String)}
      */
     public void testChildNode() throws RepositoryException {
-        ChildNode childNode = qomFactory.childNode(SELECTOR_NAME1, testRootNode.getPath());
+        ChildNode childNode = qf.childNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong path", testRootNode.getPath(), childNode.getParentPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, childNode.getSelectorName());
     }
@@ -155,7 +157,7 @@
      * Test case for {@link QueryObjectModelFactory#childNode(String, String)}
      */
     public void testChildNodeWithSelector() throws RepositoryException {
-        ChildNode childNode = qomFactory.childNode(SELECTOR_NAME1, testRootNode.getPath());
+        ChildNode childNode = qf.childNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong path", testRootNode.getPath(), childNode.getParentPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, childNode.getSelectorName());
     }
@@ -164,36 +166,36 @@
      * Test case for {@link QueryObjectModelFactory#childNodeJoinCondition(String, String)}
      */
     public void testChildNodeJoinCondition() throws RepositoryException {
-        ChildNodeJoinCondition cond = qomFactory.childNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2);
+        ChildNodeJoinCondition cond = qf.childNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2);
         assertEquals("Wrong selector name", cond.getChildSelectorName(), SELECTOR_NAME1);
         assertEquals("Wrong selector name", cond.getParentSelectorName(), SELECTOR_NAME2);
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#column(String)}
+     * Test case for {@link QueryObjectModelFactory#column(String, String, String)}
      */
     public void testColumn() throws RepositoryException {
-        Column col = qomFactory.column(SELECTOR_NAME1, propertyName1, null);
+        Column col = qf.column(SELECTOR_NAME1, propertyName1, propertyName1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, col.getSelectorName());
         assertEquals("Wrong property name", propertyName1, col.getPropertyName());
-        assertNull("Column name must be null", col.getColumnName());
+        assertEquals("Wrong column name", propertyName1, col.getColumnName());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#column(String)}
+     * Test case for {@link QueryObjectModelFactory#column(String, String, String)}
      */
     public void testColumnAllProperties() throws RepositoryException {
-        Column col = qomFactory.column(SELECTOR_NAME1, null, null);
+        Column col = qf.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());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#column(String, String)}
+     * Test case for {@link QueryObjectModelFactory#column(String, String, String)}
      */
     public void testColumnWithColumnName() throws RepositoryException {
-        Column col = qomFactory.column(SELECTOR_NAME1, propertyName1, COLUMN_NAME);
+        Column col = qf.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());
@@ -203,21 +205,21 @@
      * Test case for {@link QueryObjectModelFactory#column(String, String, String)}
      */
     public void testColumnWithSelector() throws RepositoryException {
-        Column col = qomFactory.column(SELECTOR_NAME1, propertyName1, COLUMN_NAME);
+        Column col = qf.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());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#comparison(DynamicOperand, int, StaticOperand)}
+     * Test case for {@link QueryObjectModelFactory#comparison(DynamicOperand, String, StaticOperand)}
      */
     public void testComparison() throws RepositoryException {
-        PropertyValue op1 = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
-        BindVariableValue op2 = qomFactory.bindVariable(VARIABLE_NAME);
+        PropertyValue op1 = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        BindVariableValue op2 = qf.bindVariable(VARIABLE_NAME);
         for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
             String operator = (String) it.next();
-            Comparison comp = qomFactory.comparison(op1, operator, op2);
+            Comparison comp = qf.comparison(op1, operator, op2);
             assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
             assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
             assertEquals("Wrong operator", operator.toString(), comp.getOperator());
@@ -225,8 +227,8 @@
     }
 
     public void testCreateQuery() throws RepositoryException {
-        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
-        QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
+        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        QueryObjectModel qom = qf.createQuery(selector, null, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertNull("Constraint must be null", qom.getConstraint());
         assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
@@ -234,9 +236,9 @@
     }
 
     public void testCreateQueryWithConstraint() throws RepositoryException {
-        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
-        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
-        QueryObjectModel qom = qomFactory.createQuery(
+        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        QueryObjectModel qom = qf.createQuery(
                 selector, propExist, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
@@ -245,11 +247,11 @@
     }
 
     public void testCreateQueryWithConstraintAndOrdering() throws RepositoryException {
-        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,
+        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Ordering ordering = qf.ascending(propValue);
+        QueryObjectModel qom = qf.createQuery(selector, propExist,
                 new Ordering[]{ordering}, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
@@ -258,12 +260,12 @@
     }
 
     public void testCreateQueryWithConstraintOrderingAndColumn() throws RepositoryException {
-        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(SELECTOR_NAME1, propertyName1, null);
-        QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
+        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Ordering ordering = qf.ascending(propValue);
+        Column column = qf.column(SELECTOR_NAME1, propertyName1, propertyName1);
+        QueryObjectModel qom = qf.createQuery(selector, propExist,
                 new Ordering[]{ordering}, new Column[]{column});
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
@@ -272,8 +274,8 @@
     }
 
     public void testCreateQueryFromSource() throws RepositoryException {
-        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
-        QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
+        Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        QueryObjectModel qom = qf.createQuery(selector, null, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertNull("Constraint must be null", qom.getConstraint());
         assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
@@ -281,9 +283,9 @@
     }
 
     public void testCreateQueryFromSourceWithConstraint() throws RepositoryException {
-        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
-        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
-        QueryObjectModel qom = qomFactory.createQuery(
+        Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        QueryObjectModel qom = qf.createQuery(
                 selector, propExist, null, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
@@ -292,11 +294,11 @@
     }
 
     public void testCreateQueryFromSourceWithConstraintAndOrdering() throws RepositoryException {
-        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,
+        Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Ordering ordering = qf.ascending(propValue);
+        QueryObjectModel qom = qf.createQuery(selector, propExist,
                 new Ordering[]{ordering}, null);
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
@@ -305,12 +307,12 @@
     }
 
     public void testCreateQueryFromSourceWithConstraintOrderingAndColumn() throws RepositoryException {
-        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(SELECTOR_NAME1, propertyName1, null);
-        QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
+        Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Ordering ordering = qf.ascending(propValue);
+        Column column = qf.column(SELECTOR_NAME1, propertyName1, propertyName1);
+        QueryObjectModel qom = qf.createQuery(selector, propExist,
                 new Ordering[]{ordering}, new Column[]{column});
         assertTrue("Not a selector source", qom.getSource() instanceof Selector);
         assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
@@ -319,10 +321,10 @@
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#descendantNode(String)}
+     * Test case for {@link QueryObjectModelFactory#descendantNode(String, String)}
      */
     public void testDescendantNode() throws RepositoryException {
-        DescendantNode descNode = qomFactory.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
+        DescendantNode descNode = qf.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong selector", SELECTOR_NAME1, descNode.getSelectorName());
         assertEquals("Wrong path", testRootNode.getPath(), descNode.getAncestorPath());
     }
@@ -331,7 +333,7 @@
      * Test case for {@link QueryObjectModelFactory#descendantNode(String, String)}
      */
     public void testDescendantNodeWithSelector() throws RepositoryException {
-        DescendantNode descNode = qomFactory.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
+        DescendantNode descNode = qf.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, descNode.getSelectorName());
         assertEquals("Wrong path", testRootNode.getPath(), descNode.getAncestorPath());
     }
@@ -340,7 +342,7 @@
      * Test case for {@link QueryObjectModelFactory#descendantNodeJoinCondition(String, String)}
      */
     public void testDescendantNodeJoinCondition() throws RepositoryException {
-        DescendantNodeJoinCondition cond = qomFactory.descendantNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2);
+        DescendantNodeJoinCondition cond = qf.descendantNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2);
         assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getDescendantSelectorName());
         assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getAncestorSelectorName());
     }
@@ -349,8 +351,8 @@
      * Test case for {@link QueryObjectModelFactory#descending(DynamicOperand)}
      */
     public void testOrderingDescending() throws RepositoryException {
-        PropertyValue op = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
-        Ordering desc = qomFactory.descending(op);
+        PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Ordering desc = qf.descending(op);
         assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_DESCENDING",
                 QueryObjectModelConstants.JCR_ORDER_DESCENDING, desc.getOrder());
         assertTrue("Not a PropertyValue operand", desc.getOperand() instanceof PropertyValue);
@@ -360,7 +362,7 @@
      * Test case for {@link QueryObjectModelFactory#equiJoinCondition(String, String, String, String)}
      */
     public void testEquiJoinCondition() throws RepositoryException {
-        EquiJoinCondition cond = qomFactory.equiJoinCondition(SELECTOR_NAME1, propertyName1, SELECTOR_NAME2, propertyName2);
+        EquiJoinCondition cond = qf.equiJoinCondition(SELECTOR_NAME1, propertyName1, SELECTOR_NAME2, propertyName2);
         assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name());
         assertEquals("Wrong property name", propertyName1, cond.getProperty1Name());
         assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name());
@@ -368,40 +370,34 @@
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String)}
+     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
      */
     public void testFullTextSearch() throws RepositoryException {
-        FullTextSearch ftSearch = qomFactory.fullTextSearch(SELECTOR_NAME1, propertyName1, FULLTEXT_SEARCH_EXPR);
+        FullTextSearch ftSearch = qf.fullTextSearch(SELECTOR_NAME1, propertyName1, FULLTEXT_SEARCH_EXPR);
         assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
         assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());
         // TODO is there some way to check the contents of a StaticOperand?
+        
+        // minimal test of getFullTextSearchExpression()
+        StaticOperand op = ftSearch.getFullTextSearchExpression();
+        assertNotNull(op);
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String)}
+     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
      */
     public void testFullTextSearchAllProperties() throws RepositoryException {
-        FullTextSearch ftSearch = qomFactory.fullTextSearch(SELECTOR_NAME1, null, FULLTEXT_SEARCH_EXPR);
+        FullTextSearch ftSearch = qf.fullTextSearch(SELECTOR_NAME1, null, FULLTEXT_SEARCH_EXPR);
         assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
         assertNull("Property name must be null", ftSearch.getPropertyName());
         // TODO is there some way to check the contents of a StaticOperand?
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
-     */
-    public void testFullTextSearchWithSelector() throws RepositoryException {
-        FullTextSearch ftSearch = qomFactory.fullTextSearch(SELECTOR_NAME1, propertyName1, FULLTEXT_SEARCH_EXPR);
-        assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
-        assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());
-        // TODO is there some way to check the contents of a StaticOperand?
-    }
-
-    /**
-     * Test case for {@link QueryObjectModelFactory#fullTextSearchScore()}
+     * Test case for {@link QueryObjectModelFactory#fullTextSearchScore(String)}
      */
     public void testFullTextSearchScore() throws RepositoryException {
-        FullTextSearchScore score = qomFactory.fullTextSearchScore(SELECTOR_NAME1);
+        FullTextSearchScore score = qf.fullTextSearchScore(SELECTOR_NAME1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, score.getSelectorName());
     }
 
@@ -409,23 +405,23 @@
      * Test case for {@link QueryObjectModelFactory#fullTextSearchScore(String)}
      */
     public void testFullTextSearchScoreWithSelector() throws RepositoryException {
-        FullTextSearchScore score = qomFactory.fullTextSearchScore(SELECTOR_NAME1);
+        FullTextSearchScore score = qf.fullTextSearchScore(SELECTOR_NAME1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, score.getSelectorName());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#join(Source, Source, int, JoinCondition)}
+     * Test case for {@link QueryObjectModelFactory#join(Source, Source, String, JoinCondition)}
      */
     public void testJoin() throws RepositoryException {
-        Selector s1 = qomFactory.selector(ntBase, SELECTOR_NAME1);
-        Selector s2 = qomFactory.selector(testNodeType, SELECTOR_NAME1);
-        JoinCondition cond = qomFactory.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
+        Selector s1 = qf.selector(ntBase, SELECTOR_NAME1);
+        Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1);
+        JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
         for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
             String joinType = (String) it.next();
-            Join join = qomFactory.join(s1, s2, joinType, cond);
+            Join join = qf.join(s1, s2, joinType, cond);
             assertTrue("Not a selector source", join.getLeft() instanceof Selector);
             assertTrue("Not a selector source", join.getRight() instanceof Selector);
-            assertEquals("Wrong join type", joinType.toString(), join.getJoinType());
+            assertEquals("Wrong join type", joinType, join.getJoinType());
             assertTrue("Not an EquiJoinCondition", join.getJoinCondition() instanceof EquiJoinCondition);
         }
     }
@@ -434,25 +430,35 @@
      * Test case for {@link QueryObjectModelFactory#length(PropertyValue)}
      */
     public void testLength() throws RepositoryException {
-        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
-        Length len = qomFactory.length(propValue);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        Length len = qf.length(propValue);
         assertNotNull("Property value must not be null", len.getPropertyValue());
     }
 
     /**
+     * Test case for {@link QueryObjectModelFactory#literal(Value)}
+     */
+    public void testLiteral() throws RepositoryException {
+        Value v = superuser.getValueFactory().createValue("test");
+        Literal literal = qf.literal(v);
+        assertEquals("Wrong literal value", v.getString(),
+                literal.getLiteralValue().getString());
+    }
+
+    /**
      * Test case for {@link QueryObjectModelFactory#lowerCase(DynamicOperand)}
      */
     public void testLowerCase() throws RepositoryException {
-        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
-        LowerCase lower = qomFactory.lowerCase(propValue);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        LowerCase lower = qf.lowerCase(propValue);
         assertTrue("Not a property value operand", lower.getOperand() instanceof PropertyValue);
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#nodeLocalName()}
+     * Test case for {@link QueryObjectModelFactory#nodeLocalName(String)}
      */
     public void testNodeLocalName() throws RepositoryException {
-        NodeLocalName localName = qomFactory.nodeLocalName(SELECTOR_NAME1);
+        NodeLocalName localName = qf.nodeLocalName(SELECTOR_NAME1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, localName.getSelectorName());
     }
 
@@ -460,15 +466,15 @@
      * Test case for {@link QueryObjectModelFactory#nodeLocalName(String)}
      */
     public void testNodeLocalNameWithSelector() throws RepositoryException {
-        NodeLocalName localName = qomFactory.nodeLocalName(SELECTOR_NAME1);
+        NodeLocalName localName = qf.nodeLocalName(SELECTOR_NAME1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, localName.getSelectorName());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#nodeName()}
+     * Test case for {@link QueryObjectModelFactory#nodeName(String)}
      */
     public void testNodeName() throws RepositoryException {
-        NodeName nodeName = qomFactory.nodeName(SELECTOR_NAME1);
+        NodeName nodeName = qf.nodeName(SELECTOR_NAME1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, nodeName.getSelectorName());
     }
 
@@ -476,7 +482,7 @@
      * Test case for {@link QueryObjectModelFactory#nodeName(String)}
      */
     public void testNodeNameWithSelector() throws RepositoryException {
-        NodeName nodeName = qomFactory.nodeName(SELECTOR_NAME1);
+        NodeName nodeName = qf.nodeName(SELECTOR_NAME1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, nodeName.getSelectorName());
     }
 
@@ -484,8 +490,8 @@
      * Test case for {@link QueryObjectModelFactory#not(Constraint)}
      */
     public void testNot() throws RepositoryException {
-        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
-        Not not = qomFactory.not(propExist);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        Not not = qf.not(propExist);
         assertTrue("Not a property existence constraint", not.getConstraint() instanceof PropertyExistence);
     }
 
@@ -493,9 +499,9 @@
      * Test case for {@link QueryObjectModelFactory#or(Constraint, Constraint)}
      */
     public void testOr() throws RepositoryException {
-        PropertyExistence c1 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
-        PropertyExistence c2 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName2);
-        Or or = qomFactory.or(c1, c2);
+        PropertyExistence c1 = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyExistence c2 = qf.propertyExistence(SELECTOR_NAME1, propertyName2);
+        Or or = qf.or(c1, c2);
         assertTrue("Not a PropertyExistence constraint",
                 or.getConstraint1() instanceof PropertyExistence);
         assertTrue("Not a PropertyExistence constraint",
@@ -503,10 +509,10 @@
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#propertyExistence(String)}
+     * Test case for {@link QueryObjectModelFactory#propertyExistence(String, String)}
      */
     public void testPropertyExistence() throws RepositoryException {
-        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
         assertEquals("Wrong selector", SELECTOR_NAME1, propExist.getSelectorName());
         assertEquals("Wrong property name", propertyName1, propExist.getPropertyName());
     }
@@ -515,16 +521,16 @@
      * Test case for {@link QueryObjectModelFactory#propertyExistence(String, String)}
      */
     public void testPropertyExistenceWithSelector() throws RepositoryException {
-        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
+        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, propExist.getSelectorName());
         assertEquals("Wrong property name", propertyName1, propExist.getPropertyName());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#propertyValue(String)}
+     * Test case for {@link QueryObjectModelFactory#propertyValue(String, String)}
      */
     public void testPropertyValue() throws RepositoryException {
-        PropertyValue propVal = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
+        PropertyValue propVal = qf.propertyValue(SELECTOR_NAME1, propertyName1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, propVal.getSelectorName());
         assertEquals("Wrong property name", propertyName1, propVal.getPropertyName());
     }
@@ -533,16 +539,16 @@
      * Test case for {@link QueryObjectModelFactory#propertyValue(String, String)}
      */
     public void testPropertyValueWithSelector() throws RepositoryException {
-        PropertyValue propVal = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
+        PropertyValue propVal = qf.propertyValue(SELECTOR_NAME1, propertyName1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, propVal.getSelectorName());
         assertEquals("Wrong property name", propertyName1, propVal.getPropertyName());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#sameNode(String)}
+     * Test case for {@link QueryObjectModelFactory#sameNode(String, String)}
      */
     public void testSameNode() throws RepositoryException {
-        SameNode sameNode = qomFactory.sameNode(SELECTOR_NAME1, testRootNode.getPath());
+        SameNode sameNode = qf.sameNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, sameNode.getSelectorName());
         assertEquals("Wrong path", testRootNode.getPath(), sameNode.getPath());
     }
@@ -551,16 +557,16 @@
      * Test case for {@link QueryObjectModelFactory#sameNode(String, String)}
      */
     public void testSameNodeWithSelector() throws RepositoryException {
-        SameNode sameNode = qomFactory.sameNode(SELECTOR_NAME1, testRootNode.getPath());
+        SameNode sameNode = qf.sameNode(SELECTOR_NAME1, testRootNode.getPath());
         assertEquals("Wrong selector name", SELECTOR_NAME1, sameNode.getSelectorName());
         assertEquals("Wrong path", testRootNode.getPath(), sameNode.getPath());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(String, String)}
+     * Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(String, String, String)}
      */
     public void testSameNodeJoinCondition() throws RepositoryException {
-        SameNodeJoinCondition cond = qomFactory.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, ".");
+        SameNodeJoinCondition cond = qf.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, ".");
         assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name());
         assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name());
         assertEquals("Wrong selector path", ".", cond.getSelector2Path());
@@ -570,17 +576,17 @@
      * Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(String, String, String)}
      */
     public void testSameNodeJoinConditionWithPath() throws RepositoryException {
-        SameNodeJoinCondition cond = qomFactory.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, nodeName1);
+        SameNodeJoinCondition cond = qf.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, nodeName1);
         assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name());
         assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name());
         assertEquals("Wrong path", nodeName1, cond.getSelector2Path());
     }
 
     /**
-     * Test case for {@link QueryObjectModelFactory#selector(String)}
+     * Test case for {@link QueryObjectModelFactory#selector(String, String)}
      */
     public void testSelector() throws RepositoryException {
-        Selector selector = qomFactory.selector(ntBase, SELECTOR_NAME1);
+        Selector selector = qf.selector(ntBase, SELECTOR_NAME1);
         assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
         assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
     }
@@ -589,7 +595,7 @@
      * Test case for {@link QueryObjectModelFactory#selector(String, String)}
      */
     public void testSelectorWithName() throws RepositoryException {
-        Selector selector = qomFactory.selector(ntBase, SELECTOR_NAME1);
+        Selector selector = qf.selector(ntBase, SELECTOR_NAME1);
         assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
         assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
     }
@@ -598,8 +604,8 @@
      * Test case for {@link QueryObjectModelFactory#upperCase(DynamicOperand)}
      */
     public void testUpperCase() throws RepositoryException {
-        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
-        UpperCase upper = qomFactory.upperCase(propValue);
+        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
+        UpperCase upper = qf.upperCase(propValue);
         assertTrue("Not a property value operand", upper.getOperand() instanceof PropertyValue);
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java Wed Jul  8 13:57:13 2009
@@ -18,7 +18,6 @@
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
-import javax.jcr.query.QueryResult;
 import javax.jcr.query.qom.JoinCondition;
 import javax.jcr.query.qom.QueryObjectModel;
 import javax.jcr.query.qom.QueryObjectModelConstants;
@@ -37,68 +36,62 @@
         super.setUp();
         n1 = testRootNode.addNode(nodeName1, testNodeType);
         n2 = n1.addNode(nodeName2, testNodeType);
-        n2.addMixin(mixReferenceable);
-        testRootNode.save();
+        ensureMixinType(n2, mixReferenceable);
+        superuser.save();
     }
 
     public void testInnerJoin() throws RepositoryException {
-        QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, (String) null);
-        QueryResult result = qom.execute();
-        checkResult(result, new Node[][]{{n1, n1}, {n2, n2}});
+        QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, null);
+        checkQOM(qom, new Node[][]{{n1, n1}, {n2, n2}});
     }
 
     public void testInnerJoinWithPath() throws RepositoryException {
         QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, nodeName2);
-        QueryResult result = qom.execute();
-        checkResult(result, new Node[][]{{n2, n1}});
+        checkQOM(qom, new Node[][]{{n2, n1}});
     }
 
     public void testLeftOuterJoin() throws RepositoryException {
-       QueryObjectModel qom = qomFactory.createQuery(
-               qomFactory.join(
-                       qomFactory.selector(testNodeType, LEFT),
-                       qomFactory.selector(mixReferenceable, RIGHT),
-                       AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER,
-                       qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
-               qomFactory.descendantNode(LEFT, testRoot),
+       QueryObjectModel qom = qf.createQuery(
+               qf.join(
+                       qf.selector(testNodeType, LEFT),
+                       qf.selector(mixReferenceable, RIGHT),
+                       QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER,
+                       qf.sameNodeJoinCondition(LEFT, RIGHT, ".")),
+               qf.descendantNode(LEFT, testRoot),
                null, null);
 
-        QueryResult result = qom.execute();
-        checkResult(result, new Node[][]{{n1, null}, {n2, n2}});
+        checkQOM(qom, new Node[][]{{n1, null}, {n2, n2}});
     }
 
     public void testLeftOuterJoinWithPath() throws RepositoryException {
-        QueryObjectModel qom = createQomQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, nodeName2);
-        QueryResult result = qom.execute();
-        checkResult(result, new Node[][]{{n1, null}, {n2, n1}});
+        QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, nodeName2);
+        checkQOM(qom, new Node[][]{{n1, null}, {n2, n1}});
     }
 
     public void testRightOuterJoin() throws RepositoryException {
-        QueryObjectModel qom = qomFactory.createQuery(
-                qomFactory.join(
-                        qomFactory.selector(mixReferenceable, LEFT),
-                        qomFactory.selector(testNodeType, RIGHT),
-                        AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER,
-                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
-                qomFactory.descendantNode(RIGHT, testRoot),
+        QueryObjectModel qom = qf.createQuery(
+                qf.join(
+                        qf.selector(mixReferenceable, LEFT),
+                        qf.selector(testNodeType, RIGHT),
+                        QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER,
+                        qf.sameNodeJoinCondition(LEFT, RIGHT, ".")),
+                qf.descendantNode(RIGHT, testRoot),
                 null, null);
 
-        QueryResult result = qom.execute();
-        checkResult(result, new Node[][]{{null, n1}, {n2, n2}});
+        checkQOM(qom, new Node[][]{{null, n1}, {n2, n2}});
     }
 
     public void testRightOuterJoinWithPath() throws RepositoryException {
-        QueryObjectModel qom = qomFactory.createQuery(
-                qomFactory.join(
-                        qomFactory.selector(mixReferenceable, LEFT),
-                        qomFactory.selector(testNodeType, RIGHT),
-                        AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER,
-                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)),
-                qomFactory.descendantNode(RIGHT, testRoot),
+        QueryObjectModel qom = qf.createQuery(
+                qf.join(
+                        qf.selector(mixReferenceable, LEFT),
+                        qf.selector(testNodeType, RIGHT),
+                        QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER,
+                        qf.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)),
+                qf.descendantNode(RIGHT, testRoot),
                 null, null);
 
-        QueryResult result = qom.execute();
-        checkResult(result, new Node[][]{{n2, n1}, {null, n2}});
+        checkQOM(qom, new Node[][]{{n2, n1}, {null, n2}});
     }
 
     //-----------------------------< utilities >--------------------------------
@@ -107,9 +100,9 @@
             throws RepositoryException {
         JoinCondition c;
         if (relPath != null) {
-            c = qomFactory.sameNodeJoinCondition(LEFT, RIGHT, relPath);
+            c = qf.sameNodeJoinCondition(LEFT, RIGHT, relPath);
         } else {
-            c = qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".");
+            c = qf.sameNodeJoinCondition(LEFT, RIGHT, ".");
         }
         return createQuery(joinType, c);
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java Wed Jul  8 13:57:13 2009
@@ -23,6 +23,7 @@
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.Query;
+import javax.jcr.query.qom.QueryObjectModel;
 
 import org.apache.jackrabbit.test.NotExecutableException;
 
@@ -33,24 +34,24 @@
 
     public void testSameNode() throws RepositoryException {
         Node n = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
+        superuser.save();
 
-        Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                qomFactory.sameNode("s", testRoot + "/" + nodeName1), null, null);
-        checkResult(q.execute(), new Node[]{n});
+        QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, "s"),
+                qf.sameNode("s", testRoot + "/" + nodeName1), null, null);
+        checkQOM(qom, new Node[]{n});
     }
 
     public void testPathDoesNotExist() throws RepositoryException {
-        Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                qomFactory.sameNode("s", testRoot + "/" + nodeName1),
+        QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, "s"),
+                qf.sameNode("s", testRoot + "/" + nodeName1),
                 null, null);
-        checkResult(q.execute(), new Node[]{});
+        checkQOM(qom, new Node[]{});
     }
 
     public void testChildNodesDoNotMatchSelector()
             throws RepositoryException, NotExecutableException {
         testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
+        superuser.save();
 
         NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
         NodeTypeIterator it = ntMgr.getPrimaryNodeTypes();
@@ -59,9 +60,9 @@
             NodeType nt = it.nextNodeType();
             if (!testNt.isNodeType(nt.getName())) {
                 // perform test
-                Query q = qomFactory.createQuery(qomFactory.selector(nt.getName(), "s"),
-                        qomFactory.sameNode("s", testRoot + "/" + nodeName1), null, null);
-                checkResult(q.execute(), new Node[]{});
+                QueryObjectModel qom = qf.createQuery(qf.selector(nt.getName(), "s"),
+                        qf.sameNode("s", testRoot + "/" + nodeName1), null, null);
+                checkQOM(qom, new Node[]{});
                 return;
             }
         }
@@ -71,36 +72,60 @@
 
     public void testRelativePath() throws RepositoryException {
         try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                    qomFactory.sameNode("s", testPath), null, null);
+            Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+                    qf.sameNode("s", testPath), null, null);
             q.execute();
             fail("SameNode with relative path argument must throw InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE ISSAMENODE(s, [" + testPath + "]";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("ISSAMENODE() with relative path argument must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testSyntacticallyInvalidPath() throws RepositoryException {
+        String invalidPath = testRoot + "/" + nodeName1 + "[";
         try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                    qomFactory.sameNode("s", testRoot + "/" + nodeName1 + "["),
+            Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+                    qf.sameNode("s", invalidPath),
                     null, null);
             q.execute();
             fail("SameNode with syntactically invalid path argument must throw InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE ISSAMENODE(s, [" + invalidPath + "]";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("ISSAMENODE() with syntactically invalid path argument must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testNotASelectorName() throws RepositoryException {
         try {
-            Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
-                    qomFactory.sameNode("x", testRoot), null, null);
+            Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+                    qf.sameNode("x", testRoot), null, null);
             q.execute();
             fail("SameNode with an invalid selector name must throw InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS s " +
+                    "WHERE ISSAMENODE(x, [" + testRoot + "]";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("ISSAMENODE with an invalid selector name must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
-
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java Wed Jul  8 13:57:13 2009
@@ -23,6 +23,7 @@
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.Query;
 import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModel;
 
 /**
  * <code>SelectorTest</code>...
@@ -32,24 +33,37 @@
     public void testSelector() throws RepositoryException {
         // make sure there's at least one node with this node type
         testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.save();
-        Query q = qomFactory.createQuery(
-                qomFactory.selector(testNodeType, "s"), null, null, null);
-        NodeIterator it = q.execute().getNodes();
-        while (it.hasNext()) {
-            assertTrue("Wrong node type", it.nextNode().isNodeType(testNodeType));
-        }
+        superuser.save();
+        QueryObjectModel qom = qf.createQuery(
+                qf.selector(testNodeType, "s"), null, null, null);
+        forQOMandSQL2(qom, new Callable() {
+            public Object call(Query query) throws RepositoryException {
+                NodeIterator it = query.execute().getNodes();
+                while (it.hasNext()) {
+                    assertTrue("Wrong node type", it.nextNode().isNodeType(testNodeType));
+                }
+                return null;
+            }
+        });
     }
 
     public void testSyntacticallyInvalidName() throws RepositoryException {
+        String invalidNodeType = testNodeType + "[";
         try {
-            Query q = qomFactory.createQuery(
-                    qomFactory.selector(testNodeType + "[", "s"), null, null, null);
+            Query q = qf.createQuery(qf.selector(invalidNodeType, "s"),
+                    null, null, null);
             q.execute();
             fail("Selector with syntactically invalid name must throw InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + invalidNodeType + "]";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("selectorName with syntactically invalid name must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testUnknownNodeType() throws RepositoryException {
@@ -63,26 +77,42 @@
                 break;
             }
         }
-        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());
+        try {
+            qf.createQuery(qf.selector(ntName, "s"), null, null, null).execute();
+            fail("Selector with unknown node type must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
+        try {
+            String stmt = "SELECT * FROM [" + ntName + "] AS nt";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("Selector with unknown node type must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
 
     public void testDuplicateNodeType() throws RepositoryException {
         try {
-            Query q = qomFactory.createQuery(
-                    qomFactory.join(
-                            qomFactory.selector(testNodeType, "nt"),
-                            qomFactory.selector(testNodeType, "nt"),
+            Query q = qf.createQuery(
+                    qf.join(
+                            qf.selector(testNodeType, "nt"),
+                            qf.selector(testNodeType, "nt"),
                             QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
-                            qomFactory.descendantNodeJoinCondition("nt", "nt")),
+                            qf.descendantNodeJoinCondition("nt", "nt")),
                     null, null, null);
             q.execute();
             fail("Selector with two identical selector names must throw InvalidQueryException");
         } catch (InvalidQueryException e) {
             // expected
         }
+        try {
+            String stmt = "SELECT * FROM [" + testNodeType + "] AS nt, [" +
+                    testNodeType + "] AS nt nt INNER JOIN nt ON ISDESCENDANTNODE(nt, nt)";
+            qm.createQuery(stmt, Query.JCR_SQL2).execute();
+            fail("selectorName with syntactically invalid name must throw InvalidQueryException");
+        } catch (InvalidQueryException e) {
+            // expected
+        }
     }
-
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/TestAll.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/TestAll.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/TestAll.java Wed Jul  8 13:57:13 2009
@@ -29,17 +29,26 @@
     public static Test suite() {
         TestSuite suite = new TestSuite("QOM tests");
 
+        suite.addTestSuite(AndConstraintTest.class);
         suite.addTestSuite(BindVariableValueTest.class);
         suite.addTestSuite(ChildNodeJoinConditionTest.class);
         suite.addTestSuite(ChildNodeTest.class);
+        suite.addTestSuite(ColumnTest.class);
         suite.addTestSuite(DescendantNodeJoinConditionTest.class);
         suite.addTestSuite(DescendantNodeTest.class);
         suite.addTestSuite(EquiJoinConditionTest.class);
+        suite.addTestSuite(FullTextSearchScoreTest.class);
+        suite.addTestSuite(GetQueryTest.class);
         suite.addTestSuite(LengthTest.class);
         suite.addTestSuite(NodeLocalNameTest.class);
         suite.addTestSuite(NodeNameTest.class);
+        suite.addTestSuite(NotConstraintTest.class);
+        suite.addTestSuite(OrConstraintTest.class);
+        suite.addTestSuite(OrderingTest.class);
         suite.addTestSuite(PropertyExistenceTest.class);
+        suite.addTestSuite(PropertyValueTest.class);
         suite.addTestSuite(QueryObjectModelFactoryTest.class);
+        suite.addTestSuite(RowTest.class);
         suite.addTestSuite(SameNodeJoinConditionTest.class); 
         suite.addTestSuite(SameNodeTest.class);
         suite.addTestSuite(SelectorTest.class);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java Wed Jul  8 13:57:13 2009
@@ -20,9 +20,9 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.ValueFactory;
-import javax.jcr.query.Query;
 import javax.jcr.query.qom.DynamicOperand;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModel;
 
 /**
  * <code>UpperLowerCaseTest</code> performs tests with upper- and lower-case
@@ -30,92 +30,94 @@
  */
 public class UpperLowerCaseTest extends AbstractQOMTest {
 
-    private ValueFactory vf;
-
     private Node node;
 
     protected void setUp() throws Exception {
         super.setUp();
-        vf = superuser.getValueFactory();
         node = testRootNode.addNode(nodeName1, testNodeType);
         node.setProperty(propertyName1, "abc");
         node.setProperty(propertyName2, "ABC");
-        testRootNode.save();
+        superuser.save();
     }
 
     protected void tearDown() throws Exception {
-        vf = null;
         node = null;
         super.tearDown();
     }
 
-    public void testFullTextSearchScore() throws RepositoryException {
-        // TODO
-    }
-
     public void testLength() throws RepositoryException {
-        // TODO
+        String lenStr = String.valueOf(node.getProperty(propertyName1).getLength());
+        // upper case
+        checkQueries(qf.length(qf.propertyValue("s", propertyName1)),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                new String[]{lenStr.toUpperCase()},
+                PropertyType.STRING,
+                new boolean[]{true});
+
+        // lower case
+        checkQueries(qf.length(qf.propertyValue("s", propertyName1)),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                new String[]{lenStr.toLowerCase()},
+                PropertyType.STRING,
+                new boolean[]{true});
     }
 
     public void testNodeLocalName() throws RepositoryException {
-        // TODO
+        String localName = getLocalName(node.getName());
+        // upper case
+        checkQueries(qf.nodeLocalName("s"),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                new String[]{localName.toLowerCase(), localName.toUpperCase()},
+                PropertyType.STRING,
+                new boolean[]{false, true});
+
+        // lower case
+        checkQueries(qf.nodeLocalName("s"),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                new String[]{localName.toLowerCase(), localName.toUpperCase()},
+                PropertyType.STRING,
+                new boolean[]{true, false});
     }
 
     public void testNodeName() throws RepositoryException {
-        node.setProperty(propertyName1, "abc", PropertyType.NAME);
-        node.setProperty(propertyName2, "ABC", PropertyType.NAME);
-        node.save();
-
         // upper case
-        checkQueries(qomFactory.propertyValue("s", propertyName1),
-                true, JCR_OPERATOR_EQUAL_TO,
-                new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
+        checkQueries(qf.nodeName("s"),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                new String[]{node.getName().toLowerCase(), node.getName().toUpperCase()},
                 PropertyType.NAME,
-                new boolean[]{false, false, false, false, true});
-
-        checkQueries(qomFactory.propertyValue("s", propertyName2),
-                true, JCR_OPERATOR_EQUAL_TO,
-                new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
-                PropertyType.NAME,
-                new boolean[]{false, false, false, false, true});
+                new boolean[]{false, true});
 
         // lower case
-        checkQueries(qomFactory.propertyValue("s", propertyName1),
-                false, JCR_OPERATOR_EQUAL_TO,
-                new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
+        checkQueries(qf.nodeName("s"),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
+                new String[]{node.getName().toLowerCase(), node.getName().toUpperCase()},
                 PropertyType.NAME,
-                new boolean[]{true, false, false, false, false});
-
-        checkQueries(qomFactory.propertyValue("s", propertyName2),
-                false, JCR_OPERATOR_EQUAL_TO,
-                new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
-                PropertyType.NAME,
-                new boolean[]{true, false, false, false, false});
+                new boolean[]{true, false});
     }
 
     public void testPropertyValue() throws RepositoryException {
         // upper case
-        checkQueries(qomFactory.propertyValue("s", propertyName1),
-                true, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.propertyValue("s", propertyName1),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{false, false, false, false, true});
 
-        checkQueries(qomFactory.propertyValue("s", propertyName2),
-                true, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.propertyValue("s", propertyName2),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{false, false, false, false, true});
 
         // lower case
-        checkQueries(qomFactory.propertyValue("s", propertyName1),
-                false, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.propertyValue("s", propertyName1),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{true, false, false, false, false});
 
-        checkQueries(qomFactory.propertyValue("s", propertyName2),
-                false, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.propertyValue("s", propertyName2),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{true, false, false, false, false});
@@ -123,8 +125,8 @@
 
     public void testUpperLowerCase() throws RepositoryException {
         // first upper case, then lower case again
-        checkQueries(qomFactory.upperCase(qomFactory.propertyValue("s", propertyName1)),
-                false, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.upperCase(qf.propertyValue("s", propertyName1)),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{true, false, false, false, false});
@@ -132,8 +134,8 @@
 
     public void testUpperCaseTwice() throws RepositoryException {
         // upper case twice
-        checkQueries(qomFactory.upperCase(qomFactory.propertyValue("s", propertyName1)),
-                true, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.upperCase(qf.propertyValue("s", propertyName1)),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{false, false, false, false, true});
@@ -141,8 +143,8 @@
 
     public void testLowerUpperCase() throws RepositoryException {
         // first lower case, then upper case again
-        checkQueries(qomFactory.lowerCase(qomFactory.propertyValue("s", propertyName1)),
-                true, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.lowerCase(qf.propertyValue("s", propertyName1)),
+                true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{false, false, false, false, true});
@@ -150,8 +152,8 @@
 
     public void testLowerCaseTwice() throws RepositoryException {
         // lower case twice
-        checkQueries(qomFactory.lowerCase(qomFactory.propertyValue("s", propertyName1)),
-                false, JCR_OPERATOR_EQUAL_TO,
+        checkQueries(qf.lowerCase(qf.propertyValue("s", propertyName1)),
+                false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                 new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
                 PropertyType.STRING,
                 new boolean[]{true, false, false, false, false});
@@ -166,28 +168,29 @@
                               int type,
                               boolean[] matches) throws RepositoryException {
         for (int i = 0; i < literals.length; i++) {
-            Query query = createQuery(operand, toUpper, operator, vf.createValue(literals[i], type));
-            checkResult(query.execute(), matches[i] ? new Node[]{node} : new Node[0]);
+            QueryObjectModel qom = createQuery(operand, toUpper, operator, vf.createValue(literals[i], type));
+            checkQOM(qom, matches[i] ? new Node[]{node} : new Node[0]);
         }
     }
     
-    private Query createQuery(DynamicOperand operand,
-                              boolean toUpper,
-                              String operator,
-                              Value literal) throws RepositoryException {
+    private QueryObjectModel createQuery(DynamicOperand operand,
+                                         boolean toUpper,
+                                         String operator,
+                                         Value literal)
+            throws RepositoryException {
         if (toUpper) {
-            operand = qomFactory.upperCase(operand);
+            operand = qf.upperCase(operand);
         } else {
-            operand = qomFactory.lowerCase(operand);
+            operand = qf.lowerCase(operand);
         }
-        return qomFactory.createQuery(
-                qomFactory.selector(testNodeType, "s"),
-                qomFactory.and(
-                        qomFactory.childNode("s", testRoot),
-                        qomFactory.comparison(
+        return qf.createQuery(
+                qf.selector(testNodeType, "s"),
+                qf.and(
+                        qf.childNode("s", testRoot),
+                        qf.comparison(
                                 operand,
                                 operator,
-                                qomFactory.literal(literal)
+                                qf.literal(literal)
                         )
                 ), null, null);
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/HoldEffectTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/HoldEffectTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/HoldEffectTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/HoldEffectTest.java Wed Jul  8 13:57:13 2009
@@ -44,7 +44,7 @@
         childP = testRootNode.setProperty(propertyName1, v);
         superuser.save();
 
-        otherS = helper.getSuperuserSession();
+        otherS = getHelper().getSuperuserSession();
     }
 
     protected void tearDown() throws Exception {



Mime
View raw message