You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2009/04/27 14:52:19 UTC
svn commit: r768962 -
/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java
Author: mreutegg
Date: Mon Apr 27 12:52:19 2009
New Revision: 768962
URL: http://svn.apache.org/viewvc?rev=768962&view=rev
Log:
JCR-2076: JSR 283: Joins
- missing test class
Added:
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java (with props)
Added: 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=768962&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java Mon Apr 27 12:52:19 2009
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jsr283.query.qom;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+
+import org.apache.jackrabbit.spi.commons.query.jsr283.qom.JoinCondition;
+import org.apache.jackrabbit.spi.commons.query.jsr283.qom.QueryObjectModel;
+
+/**
+ * <code>ChildNodeJoinConditionTest</code> contains test cases that cover
+ * <code>ChildNodeJoinCondition</code>.
+ */
+public class ChildNodeJoinConditionTest extends AbstractJoinTest {
+
+ private Node n1;
+
+ private Node n2;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ n1 = testRootNode.addNode(nodeName1, testNodeType);
+ n2 = n1.addNode(nodeName2, testNodeType);
+ n2.addMixin(mixReferenceable);
+ testRootNode.save();
+ }
+
+ public void testInnerJoin() throws RepositoryException {
+ JoinCondition c = qomFactory.childNodeJoinCondition(LEFT, RIGHT);
+ QueryObjectModel qom = createQuery(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(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(JOIN_TYPE_LEFT_OUTER, c);
+ List result = new ArrayList();
+ result.add(new Node[]{n2, n1});
+ if (testRootNode.isNodeType(testNodeType)) {
+ result.add(new Node[]{n1, testRootNode});
+ } else {
+ result.add(new Node[]{n1, null});
+ }
+ checkResult(qom.execute(), (Node[][]) result.toArray(new Node[result.size()][]));
+ }
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/ChildNodeJoinConditionTest.java
------------------------------------------------------------------------------
svn:eol-style = native