jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r771710 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/
Date Tue, 05 May 2009 13:17:40 GMT
Author: reschke
Date: Tue May  5 13:17:40 2009
New Revision: 771710

URL: http://svn.apache.org/viewvc?rev=771710&view=rev
Log:
JCR-2085: remove dependency on SPI JoinType enum

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractJoinTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeJoinConditionTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/EquiJoinConditionTest.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/SelectorTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractJoinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractJoinTest.java?rev=771710&r1=771709&r2=771710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractJoinTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractJoinTest.java
Tue May  5 13:17:40 2009
@@ -24,8 +24,6 @@
 import javax.jcr.query.qom.JoinCondition;
 import javax.jcr.query.qom.QueryObjectModel;
 
-import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
-
 /**
  * <code>AbstractJoinTest</code> provides utility methods for join related
  * tests.
@@ -47,6 +45,11 @@
      */
     protected static final String[] SELECTOR_NAMES = new String[]{LEFT, RIGHT};
 
+    // Constants broken in JCR 2.0 PFD
+    // TODO remove when API is fixed
+    protected static String JCR_JOIN_TYPE_LEFT_OUTER = "{http://www.jcp.org/jcr/1.0}joinTypeLeftOuter";
+    protected static String JCR_JOIN_TYPE_RIGHT_OUTER = "{http://www.jcp.org/jcr/1.0}joinTypeRightOuter";
+    
     //--------------------------< utilities >-----------------------------------
 
     protected void checkResult(QueryResult result, Node[][] nodes)
@@ -54,20 +57,20 @@
         checkResult(result, SELECTOR_NAMES, nodes);
     }
 
-    protected QueryObjectModel createQuery(JoinType joinType,
+    protected QueryObjectModel createQuery(String joinType,
                                            JoinCondition condition)
             throws RepositoryException {
         return createQuery(joinType, condition, null, null);
     }
 
-    protected QueryObjectModel createQuery(JoinType joinType,
+    protected QueryObjectModel createQuery(String joinType,
                                            JoinCondition condition,
                                            Constraint left,
                                            Constraint right)
             throws RepositoryException {
         // only consider nodes under test root
         Constraint constraint;
-        if (JoinType.LEFT == joinType) {
+        if (JCR_JOIN_TYPE_LEFT_OUTER.equals(joinType)) {
             constraint = qomFactory.descendantNode(LEFT, testRoot);
         } else {
             constraint = qomFactory.descendantNode(RIGHT, testRoot);
@@ -79,10 +82,10 @@
         if (right != null) {
             constraint = qomFactory.and(constraint, right);
         }
-        Join join = joinType.join(
-                qomFactory,
+        Join join = qomFactory.join(
                 qomFactory.selector(testNodeType, LEFT),
                 qomFactory.selector(testNodeType, RIGHT),
+                joinType,
                 condition);
         return qomFactory.createQuery(join, constraint, null, null);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java?rev=771710&r1=771709&r2=771710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
Tue May  5 13:17:40 2009
@@ -83,7 +83,7 @@
         Set resultPaths = new HashSet();
         log.println("result:");
         for (RowIterator it = result.getRows(); it.hasNext();) {
-            Row r = (Row) it.nextRow();
+            Row r = it.nextRow();
             StringBuffer aggregatedPaths = new StringBuffer();
             for (int i = 0; i < selectorNames.length; i++) {
                 aggregatedPaths.append(getPath(r.getNode(selectorNames[i])));

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java?rev=771710&r1=771709&r2=771710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java
Tue May  5 13:17:40 2009
@@ -23,8 +23,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.query.qom.JoinCondition;
 import javax.jcr.query.qom.QueryObjectModel;
-
-import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 
 /**
  * <code>ChildNodeJoinConditionTest</code> contains test cases that cover
@@ -46,19 +45,19 @@
 
     public void testInnerJoin() throws RepositoryException {
         JoinCondition c = qomFactory.childNodeJoinCondition(LEFT, RIGHT);
-        QueryObjectModel qom = createQuery(JoinType.INNER, c);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
c);
         checkResult(qom.execute(), new Node[][]{{n2, n1}});
     }
 
     public void testRightOuterJoin() throws RepositoryException {
         JoinCondition c = qomFactory.childNodeJoinCondition(LEFT, RIGHT);
-        QueryObjectModel qom = createQuery(JoinType.RIGHT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER, c);
         checkResult(qom.execute(), new Node[][]{{n2, n1}, {null, n2}});
     }
 
     public void testLeftOuterJoin() throws RepositoryException {
         JoinCondition c = qomFactory.childNodeJoinCondition(LEFT, RIGHT);
-        QueryObjectModel qom = createQuery(JoinType.LEFT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
         List result = new ArrayList();
         result.add(new Node[]{n2, n1});
         if (testRootNode.isNodeType(testNodeType)) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeJoinConditionTest.java?rev=771710&r1=771709&r2=771710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeJoinConditionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/DescendantNodeJoinConditionTest.java
Tue May  5 13:17:40 2009
@@ -23,8 +23,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.query.qom.JoinCondition;
 import javax.jcr.query.qom.QueryObjectModel;
-
-import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 
 /**
  * <code>DescendantNodeJoinConditionTest</code> contains test cases that cover
@@ -46,19 +45,19 @@
 
     public void testInnerJoin() throws RepositoryException {
         JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
-        QueryObjectModel qom = createQuery(JoinType.INNER, c);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
c);
         checkResult(qom.execute(), new Node[][]{{n2, n1}});
     }
 
     public void testRightOuterJoin() throws RepositoryException {
         JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
-        QueryObjectModel qom = createQuery(JoinType.RIGHT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER, c);
         checkResult(qom.execute(), new Node[][]{{n2, n1}, {null, n2}});
     }
 
     public void testLeftOuterJoin() throws RepositoryException {
         JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
-        QueryObjectModel qom = createQuery(JoinType.LEFT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
         List result = new ArrayList();
         result.add(new Node[]{n2, n1});
         // for each ancestor-or-self of testRootNode check

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/EquiJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/EquiJoinConditionTest.java?rev=771710&r1=771709&r2=771710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/EquiJoinConditionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/EquiJoinConditionTest.java
Tue May  5 13:17:40 2009
@@ -20,8 +20,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.query.qom.JoinCondition;
 import javax.jcr.query.qom.QueryObjectModel;
-
-import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 
 /**
  * <code>EquiJoinConditionTest</code> contains test cases that cover
@@ -49,35 +48,35 @@
     public void testInnerJoin1() throws RepositoryException {
         JoinCondition c = qomFactory.equiJoinCondition(
                 LEFT, propertyName1, RIGHT, propertyName2);
-        QueryObjectModel qom = createQuery(JoinType.INNER, c);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
c);
         checkResult(qom.execute(), new Node[][]{{n1, n2}, {n2, n2}});
     }
 
     public void testInnerJoin2() throws RepositoryException {
         JoinCondition c = qomFactory.equiJoinCondition(
                 LEFT, propertyName2, RIGHT, propertyName1);
-        QueryObjectModel qom = createQuery(JoinType.INNER, c);
+        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
c);
         checkResult(qom.execute(), new Node[][]{{n2, n1}, {n2, n2}});
     }
 
     public void testRightOuterJoin1() throws RepositoryException {
         JoinCondition c = qomFactory.equiJoinCondition(
                 LEFT, propertyName1, RIGHT, propertyName2);
-        QueryObjectModel qom = createQuery(JoinType.RIGHT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER, c);
         checkResult(qom.execute(), new Node[][]{{null, n1}, {n1, n2}, {n2, n2}});
     }
 
     public void testRightOuterJoin2() throws RepositoryException {
         JoinCondition c = qomFactory.equiJoinCondition(
                 LEFT, propertyName2, RIGHT, propertyName1);
-        QueryObjectModel qom = createQuery(JoinType.RIGHT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER, c);
         checkResult(qom.execute(), new Node[][]{{n2, n1}, {n2, n2}});
     }
 
     public void testLeftOuterJoin1() throws RepositoryException {
         JoinCondition c = qomFactory.equiJoinCondition(
                 LEFT, propertyName1, RIGHT, propertyName2);
-        QueryObjectModel qom = createQuery(JoinType.LEFT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
         checkResult(qom.execute(), new Node[][]{{n1, n2}, {n2, n2}});
     }
 
@@ -85,7 +84,7 @@
     public void testLeftOuterJoin2() throws RepositoryException {
         JoinCondition c = qomFactory.equiJoinCondition(
                 LEFT, propertyName2, RIGHT, propertyName1);
-        QueryObjectModel qom = createQuery(JoinType.LEFT, c);
+        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
         checkResult(qom.execute(), new Node[][]{{n1, null}, {n2, n1}, {n2, n2}});
     }
 }

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=771710&r1=771709&r2=771710&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
Tue May  5 13:17:40 2009
@@ -21,8 +21,7 @@
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.qom.JoinCondition;
 import javax.jcr.query.qom.QueryObjectModel;
-
-import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 
 /**
  * <code>SameNodeJoinConditionTest</code> contains test cases that cover
@@ -43,23 +42,23 @@
     }
 
     public void testInnerJoin() throws RepositoryException {
-        QueryObjectModel qom = createQuery(JoinType.INNER, (String) null);
+        QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
(String) null);
         QueryResult result = qom.execute();
         checkResult(result, new Node[][]{{n1, n1}, {n2, n2}});
     }
 
     public void testInnerJoinWithPath() throws RepositoryException {
-        QueryObjectModel qom = createQuery(JoinType.INNER, nodeName2);
+        QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
nodeName2);
         QueryResult result = qom.execute();
         checkResult(result, new Node[][]{{n2, n1}});
     }
 
     public void testLeftOuterJoin() throws RepositoryException {
        QueryObjectModel qom = qomFactory.createQuery(
-               JoinType.LEFT.join(
-                       qomFactory,
+               qomFactory.join(
                        qomFactory.selector(testNodeType, LEFT),
                        qomFactory.selector(mixReferenceable, RIGHT),
+                       AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER,
                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
                qomFactory.descendantNode(LEFT, testRoot),
                null, null);
@@ -69,17 +68,17 @@
     }
 
     public void testLeftOuterJoinWithPath() throws RepositoryException {
-        QueryObjectModel qom = createQuery(JoinType.LEFT, nodeName2);
+        QueryObjectModel qom = createQomQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER,
nodeName2);
         QueryResult result = qom.execute();
         checkResult(result, new Node[][]{{n1, null}, {n2, n1}});
     }
 
     public void testRightOuterJoin() throws RepositoryException {
         QueryObjectModel qom = qomFactory.createQuery(
-                JoinType.RIGHT.join(
-                        qomFactory,
+                qomFactory.join(
                         qomFactory.selector(mixReferenceable, LEFT),
                         qomFactory.selector(testNodeType, RIGHT),
+                        AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER,
                         qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
                 qomFactory.descendantNode(RIGHT, testRoot),
                 null, null);
@@ -90,10 +89,10 @@
 
     public void testRightOuterJoinWithPath() throws RepositoryException {
         QueryObjectModel qom = qomFactory.createQuery(
-                JoinType.RIGHT.join(
-                        qomFactory,
+                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),
                 null, null);
@@ -104,7 +103,7 @@
 
     //-----------------------------< utilities >--------------------------------
 
-    private QueryObjectModel createQuery(JoinType joinType, String relPath)
+    private QueryObjectModel createQomQuery(String joinType, String relPath)
             throws RepositoryException {
         JoinCondition c;
         if (relPath != null) {

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=771710&r1=771709&r2=771710&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
Tue May  5 13:17:40 2009
@@ -22,8 +22,7 @@
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.Query;
-
-import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 
 /**
  * <code>SelectorTest</code>...
@@ -73,10 +72,10 @@
     public void testDuplicateNodeType() throws RepositoryException {
         try {
             Query q = qomFactory.createQuery(
-                    JoinType.INNER.join(
-                            qomFactory,
+                    qomFactory.join(
                             qomFactory.selector(testNodeType, "nt"),
                             qomFactory.selector(testNodeType, "nt"),
+                            QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
                             qomFactory.descendantNodeJoinCondition("nt", "nt")),
                     null, null, null);
             q.execute();



Mime
View raw message