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/06/10 15:36:31 UTC
svn commit: r783359 -
/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/
Author: mreutegg
Date: Wed Jun 10 13:36:30 2009
New Revision: 783359
URL: http://svn.apache.org/viewvc?rev=783359&view=rev
Log:
JCR-2085: test case (TCK) maintenance for JCR 2.0
- less verbose code
Modified:
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractJoinTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/BindVariableValueTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/EquiJoinConditionTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/LengthTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeLocalNameTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/RowTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractJoinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractJoinTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractJoinTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractJoinTest.java Wed Jun 10 13:36:30 2009
@@ -67,22 +67,22 @@
// only consider nodes under test root
Constraint constraint;
if (QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER.equals(joinType)) {
- constraint = qomFactory.descendantNode(LEFT, testRoot);
+ constraint = qf.descendantNode(LEFT, testRoot);
} else {
- constraint = qomFactory.descendantNode(RIGHT, testRoot);
+ constraint = qf.descendantNode(RIGHT, testRoot);
}
if (left != null) {
- constraint = qomFactory.and(constraint, left);
+ constraint = qf.and(constraint, left);
}
if (right != null) {
- constraint = qomFactory.and(constraint, right);
+ constraint = qf.and(constraint, right);
}
- Join join = qomFactory.join(
- qomFactory.selector(testNodeType, LEFT),
- qomFactory.selector(testNodeType, RIGHT),
+ Join join = qf.join(
+ qf.selector(testNodeType, LEFT),
+ qf.selector(testNodeType, RIGHT),
joinType,
condition);
- return qomFactory.createQuery(join, constraint, null, null);
+ return qf.createQuery(join, constraint, null, null);
}
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java Wed Jun 10 13:36:30 2009
@@ -37,12 +37,12 @@
*/
public class AbstractQOMTest extends AbstractQueryTest {
- protected QueryObjectModelFactory qomFactory;
+ protected QueryObjectModelFactory qf;
protected void setUp() throws Exception {
super.setUp();
QueryManager qm = superuser.getWorkspace().getQueryManager();
- qomFactory = qm.getQOMFactory();
+ qf = qm.getQOMFactory();
}
/**
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/BindVariableValueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/BindVariableValueTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/BindVariableValueTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/BindVariableValueTest.java Wed Jun 10 13:36:30 2009
@@ -47,14 +47,14 @@
protected void setUp() throws Exception {
super.setUp();
vf = superuser.getValueFactory();
- query = qomFactory.createQuery(
- qomFactory.selector(testNodeType, "s"),
- qomFactory.and(
- qomFactory.childNode("s", testRoot),
- qomFactory.comparison(
- qomFactory.propertyValue("s", propertyName1),
+ query = qf.createQuery(
+ qf.selector(testNodeType, "s"),
+ qf.and(
+ qf.childNode("s", testRoot),
+ qf.comparison(
+ qf.propertyValue("s", propertyName1),
QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
- qomFactory.bindVariable("v")
+ qf.bindVariable("v")
)
), null, null);
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java Wed Jun 10 13:36:30 2009
@@ -44,19 +44,19 @@
}
public void testInnerJoin() throws RepositoryException {
- JoinCondition c = qomFactory.childNodeJoinCondition(LEFT, RIGHT);
+ JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
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);
+ JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.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);
+ JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
List result = new ArrayList();
result.add(new Node[]{n2, n1});
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeTest.java Wed Jun 10 13:36:30 2009
@@ -35,8 +35,8 @@
Node n = testRootNode.addNode(nodeName1, testNodeType);
testRootNode.save();
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.childNode("s", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.childNode("s", testRoot), null, null);
checkResult(q.execute(), new Node[]{n});
}
@@ -46,14 +46,14 @@
Node n3 = testRootNode.addNode(nodeName3, testNodeType);
testRootNode.save();
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.childNode("s", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.childNode("s", testRoot), null, null);
checkResult(q.execute(), new Node[]{n1, n2, n3});
}
public void testPathDoesNotExist() throws RepositoryException {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.childNode("s", testRoot + "/" + nodeName1),
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.childNode("s", testRoot + "/" + nodeName1),
null, null);
checkResult(q.execute(), new Node[]{});
}
@@ -70,8 +70,8 @@
NodeType nt = it.nextNodeType();
if (!testNt.isNodeType(nt.getName())) {
// perform test
- Query q = qomFactory.createQuery(qomFactory.selector(nt.getName(), "s"),
- qomFactory.childNode("s", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(nt.getName(), "s"),
+ qf.childNode("s", testRoot), null, null);
checkResult(q.execute(), new Node[]{});
return;
}
@@ -82,8 +82,8 @@
public void testRelativePath() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.childNode("s", testPath), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.childNode("s", testPath), null, null);
q.execute();
fail("ChildNode with relative path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
@@ -93,8 +93,8 @@
public void testSyntacticallyInvalidPath() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.childNode("s", testRoot + "/" + nodeName1 + "["),
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.childNode("s", testRoot + "/" + nodeName1 + "["),
null, null);
q.execute();
fail("ChildNode with syntactically invalid path argument must throw InvalidQueryException");
@@ -105,8 +105,8 @@
public void testNotASelectorName() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.childNode("x", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.childNode("x", testRoot), null, null);
q.execute();
fail("ChildNode with an invalid selector name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java Wed Jun 10 13:36:30 2009
@@ -56,11 +56,11 @@
* named "selectorName.propertyName".
*/
public void testExpandColumnsForNodeType() throws RepositoryException {
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.selector(testNodeType, SELECTOR_1),
+ QueryObjectModel qom = qf.createQuery(
+ qf.selector(testNodeType, SELECTOR_1),
null,
null,
- new Column[]{qomFactory.column(SELECTOR_1, null, null)});
+ new Column[]{qf.column(SELECTOR_1, null, null)});
QueryResult result = qom.execute();
List names = new ArrayList(Arrays.asList(result.getColumnNames()));
NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
@@ -86,11 +86,11 @@
* the column in the tabular results.
*/
public void testColumnNames() throws RepositoryException {
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.selector(testNodeType, SELECTOR_1),
+ QueryObjectModel qom = qf.createQuery(
+ qf.selector(testNodeType, SELECTOR_1),
null,
null,
- new Column[]{qomFactory.column(SELECTOR_1, propertyName1, propertyName1)});
+ new Column[]{qf.column(SELECTOR_1, propertyName1, propertyName1)});
QueryResult result = qom.execute();
List names = new ArrayList(Arrays.asList(result.getColumnNames()));
assertTrue("Missing column: " + propertyName1, names.remove(propertyName1));
@@ -106,18 +106,18 @@
String columnName1 = SELECTOR_1 + "." + propertyName1;
String columnName2 = SELECTOR_2 + "." + propertyName1;
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.join(
- qomFactory.selector(testNodeType, SELECTOR_1),
- qomFactory.selector(testNodeType, SELECTOR_2),
+ QueryObjectModel qom = qf.createQuery(
+ qf.join(
+ qf.selector(testNodeType, SELECTOR_1),
+ qf.selector(testNodeType, SELECTOR_2),
QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
- qomFactory.equiJoinCondition(SELECTOR_1, propertyName1, SELECTOR_2, propertyName1)
+ qf.equiJoinCondition(SELECTOR_1, propertyName1, SELECTOR_2, propertyName1)
),
- qomFactory.descendantNode(SELECTOR_1, testRoot),
+ qf.descendantNode(SELECTOR_1, testRoot),
null,
new Column[]{
- qomFactory.column(SELECTOR_1, propertyName1, columnName1),
- qomFactory.column(SELECTOR_2, propertyName1, columnName2)
+ qf.column(SELECTOR_1, propertyName1, columnName1),
+ qf.column(SELECTOR_2, propertyName1, columnName2)
}
);
RowIterator rows = qom.execute().getRows();
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java Wed Jun 10 13:36:30 2009
@@ -44,19 +44,19 @@
}
public void testInnerJoin() throws RepositoryException {
- JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
+ JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
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);
+ JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.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);
+ JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
List result = new ArrayList();
result.add(new Node[]{n2, n1});
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeTest.java Wed Jun 10 13:36:30 2009
@@ -35,8 +35,8 @@
Node n = testRootNode.addNode(nodeName1, testNodeType);
testRootNode.save();
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.descendantNode("s", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.descendantNode("s", testRoot), null, null);
checkResult(q.execute(), new Node[]{n});
}
@@ -46,14 +46,14 @@
Node n21 = n2.addNode(nodeName1, testNodeType);
testRootNode.save();
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.descendantNode("s", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.descendantNode("s", testRoot), null, null);
checkResult(q.execute(), new Node[]{n1, n2, n21});
}
public void testPathDoesNotExist() throws RepositoryException {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.descendantNode("s", testRoot + "/" + nodeName1),
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.descendantNode("s", testRoot + "/" + nodeName1),
null, null);
checkResult(q.execute(), new Node[]{});
}
@@ -70,8 +70,8 @@
NodeType nt = it.nextNodeType();
if (!testNt.isNodeType(nt.getName())) {
// perform test
- Query q = qomFactory.createQuery(qomFactory.selector(nt.getName(), "s"),
- qomFactory.descendantNode("s", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(nt.getName(), "s"),
+ qf.descendantNode("s", testRoot), null, null);
checkResult(q.execute(), new Node[]{});
return;
}
@@ -82,8 +82,8 @@
public void testRelativePath() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.descendantNode("s", testPath), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.descendantNode("s", testPath), null, null);
q.execute();
fail("DescendantNode with relative path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
@@ -93,8 +93,8 @@
public void testSyntacticallyInvalidPath() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.descendantNode("s", testRoot + "/" + nodeName1 +
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.descendantNode("s", testRoot + "/" + nodeName1 +
"["), null, null);
q.execute();
fail("DescendantNode with syntactically invalid path argument must throw InvalidQueryException");
@@ -105,8 +105,8 @@
public void testNotASelectorName() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.descendantNode("x", testRoot), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.descendantNode("x", testRoot), null, null);
q.execute();
fail("DescendantNode with an invalid selector name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/EquiJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/EquiJoinConditionTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/EquiJoinConditionTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/EquiJoinConditionTest.java Wed Jun 10 13:36:30 2009
@@ -46,35 +46,35 @@
}
public void testInnerJoin1() throws RepositoryException {
- JoinCondition c = qomFactory.equiJoinCondition(
+ JoinCondition c = qf.equiJoinCondition(
LEFT, propertyName1, RIGHT, propertyName2);
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(
+ JoinCondition c = qf.equiJoinCondition(
LEFT, propertyName2, RIGHT, propertyName1);
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(
+ JoinCondition c = qf.equiJoinCondition(
LEFT, propertyName1, RIGHT, propertyName2);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.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(
+ JoinCondition c = qf.equiJoinCondition(
LEFT, propertyName2, RIGHT, propertyName1);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, c);
checkResult(qom.execute(), new Node[][]{{n2, n1}, {n2, n2}});
}
public void testLeftOuterJoin1() throws RepositoryException {
- JoinCondition c = qomFactory.equiJoinCondition(
+ JoinCondition c = qf.equiJoinCondition(
LEFT, propertyName1, RIGHT, propertyName2);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
checkResult(qom.execute(), new Node[][]{{n1, n2}, {n2, n2}});
@@ -82,7 +82,7 @@
public void testLeftOuterJoin2() throws RepositoryException {
- JoinCondition c = qomFactory.equiJoinCondition(
+ JoinCondition c = qf.equiJoinCondition(
LEFT, propertyName2, RIGHT, propertyName1);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
checkResult(qom.execute(), new Node[][]{{n1, null}, {n2, n1}, {n2, n2}});
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/LengthTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/LengthTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/LengthTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/LengthTest.java Wed Jun 10 13:36:30 2009
@@ -265,16 +265,16 @@
private QueryResult executeQuery(String propertyName,
String operator,
Value length) throws RepositoryException {
- return qomFactory.createQuery(
- qomFactory.selector(testNodeType, "s"),
- qomFactory.and(
- qomFactory.childNode("s", testRoot),
- qomFactory.comparison(
- qomFactory.length(
- qomFactory.propertyValue(
+ return qf.createQuery(
+ qf.selector(testNodeType, "s"),
+ qf.and(
+ qf.childNode("s", testRoot),
+ qf.comparison(
+ qf.length(
+ qf.propertyValue(
"s", propertyName)),
operator,
- qomFactory.literal(length))
+ qf.literal(length))
), null, null).execute();
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeLocalNameTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeLocalNameTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeLocalNameTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeLocalNameTest.java Wed Jun 10 13:36:30 2009
@@ -205,14 +205,14 @@
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.nodeLocalName("s"),
+ return qf.createQuery(
+ qf.selector(testNodeType, "s"),
+ qf.and(
+ qf.childNode("s", testRoot),
+ qf.comparison(
+ qf.nodeLocalName("s"),
operator,
- qomFactory.literal(literal)
+ qf.literal(literal)
)
), null, null);
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/NodeNameTest.java Wed Jun 10 13:36:30 2009
@@ -217,14 +217,14 @@
}
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"),
+ 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/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/PropertyExistenceTest.java Wed Jun 10 13:36:30 2009
@@ -33,19 +33,19 @@
n2.setProperty(propertyName2, "abc");
testRootNode.save();
- QueryResult result = qomFactory.createQuery(
- qomFactory.selector(testNodeType, "s"),
- qomFactory.and(
- qomFactory.childNode("s", testRoot),
- qomFactory.propertyExistence("s", propertyName1)
+ QueryResult result = qf.createQuery(
+ qf.selector(testNodeType, "s"),
+ qf.and(
+ qf.childNode("s", testRoot),
+ qf.propertyExistence("s", propertyName1)
), null, null).execute();
checkResult(result, new Node[]{n1});
- result = qomFactory.createQuery(
- qomFactory.selector(testNodeType, "s"),
- qomFactory.and(
- qomFactory.childNode("s", testRoot),
- qomFactory.propertyExistence("s", propertyName2)
+ result = qf.createQuery(
+ qf.selector(testNodeType, "s"),
+ qf.and(
+ qf.childNode("s", testRoot),
+ qf.propertyExistence("s", propertyName2)
), null, null).execute();
checkResult(result, new Node[]{n2});
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java Wed Jun 10 13:36:30 2009
@@ -114,9 +114,9 @@
* 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 +127,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,7 +138,7 @@
* 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());
}
@@ -146,7 +146,7 @@
* Test case for {@link QueryObjectModelFactory#childNode(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 +155,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,7 +164,7 @@
* 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);
}
@@ -173,7 +173,7 @@
* Test case for {@link QueryObjectModelFactory#column(String)}
*/
public void testColumn() throws RepositoryException {
- Column col = qomFactory.column(SELECTOR_NAME1, propertyName1, null);
+ Column col = qf.column(SELECTOR_NAME1, propertyName1, null);
assertEquals("Wrong selector name", SELECTOR_NAME1, col.getSelectorName());
assertEquals("Wrong property name", propertyName1, col.getPropertyName());
assertNull("Column name must be null", col.getColumnName());
@@ -183,7 +183,7 @@
* Test case for {@link QueryObjectModelFactory#column(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());
@@ -193,7 +193,7 @@
* Test case for {@link QueryObjectModelFactory#column(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,7 +203,7 @@
* 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());
@@ -213,11 +213,11 @@
* Test case for {@link QueryObjectModelFactory#comparison(DynamicOperand, int, 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 +225,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 +234,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 +245,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 +258,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, null);
+ 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 +272,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 +281,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 +292,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 +305,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, null);
+ 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);
@@ -322,7 +322,7 @@
* Test case for {@link QueryObjectModelFactory#descendantNode(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 +331,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 +340,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 +349,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 +360,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());
@@ -371,7 +371,7 @@
* Test case for {@link QueryObjectModelFactory#fullTextSearch(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?
@@ -381,7 +381,7 @@
* Test case for {@link QueryObjectModelFactory#fullTextSearch(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?
@@ -391,7 +391,7 @@
* Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
*/
public void testFullTextSearchWithSelector() 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?
@@ -401,7 +401,7 @@
* Test case for {@link QueryObjectModelFactory#fullTextSearchScore()}
*/
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,7 +409,7 @@
* 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());
}
@@ -417,12 +417,12 @@
* Test case for {@link QueryObjectModelFactory#join(Source, Source, int, 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());
@@ -434,8 +434,8 @@
* 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());
}
@@ -443,8 +443,8 @@
* 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);
}
@@ -452,7 +452,7 @@
* Test case for {@link QueryObjectModelFactory#nodeLocalName()}
*/
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,7 +460,7 @@
* 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());
}
@@ -468,7 +468,7 @@
* Test case for {@link QueryObjectModelFactory#nodeName()}
*/
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 +476,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 +484,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 +493,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",
@@ -506,7 +506,7 @@
* Test case for {@link QueryObjectModelFactory#propertyExistence(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,7 +515,7 @@
* 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());
}
@@ -524,7 +524,7 @@
* Test case for {@link QueryObjectModelFactory#propertyValue(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,7 +533,7 @@
* 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());
}
@@ -542,7 +542,7 @@
* Test case for {@link QueryObjectModelFactory#sameNode(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,7 +551,7 @@
* 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());
}
@@ -560,7 +560,7 @@
* Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(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,7 +570,7 @@
* 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());
@@ -580,7 +580,7 @@
* Test case for {@link QueryObjectModelFactory#selector(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 +589,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 +598,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/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/RowTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/RowTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/RowTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/RowTest.java Wed Jun 10 13:36:30 2009
@@ -89,11 +89,11 @@
}
private Row getRow() throws RepositoryException {
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.selector(testNodeType, SELECTOR_NAME),
- qomFactory.descendantNode(SELECTOR_NAME, testRoot),
+ QueryObjectModel qom = qf.createQuery(
+ qf.selector(testNodeType, SELECTOR_NAME),
+ qf.descendantNode(SELECTOR_NAME, testRoot),
null,
- new Column[]{qomFactory.column(SELECTOR_NAME, propertyName1, propertyName1)});
+ new Column[]{qf.column(SELECTOR_NAME, propertyName1, propertyName1)});
RowIterator rows = qom.execute().getRows();
assertTrue("empty result", rows.hasNext());
Row r = rows.nextRow();
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeJoinConditionTest.java Wed Jun 10 13:36:30 2009
@@ -54,13 +54,13 @@
}
public void testLeftOuterJoin() throws RepositoryException {
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.join(
- qomFactory.selector(testNodeType, LEFT),
- qomFactory.selector(mixReferenceable, RIGHT),
+ QueryObjectModel qom = qf.createQuery(
+ qf.join(
+ qf.selector(testNodeType, LEFT),
+ qf.selector(mixReferenceable, RIGHT),
QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER,
- qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
- qomFactory.descendantNode(LEFT, testRoot),
+ qf.sameNodeJoinCondition(LEFT, RIGHT, ".")),
+ qf.descendantNode(LEFT, testRoot),
null, null);
QueryResult result = qom.execute();
@@ -74,13 +74,13 @@
}
public void testRightOuterJoin() throws RepositoryException {
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.join(
- qomFactory.selector(mixReferenceable, LEFT),
- qomFactory.selector(testNodeType, RIGHT),
+ QueryObjectModel qom = qf.createQuery(
+ qf.join(
+ qf.selector(mixReferenceable, LEFT),
+ qf.selector(testNodeType, RIGHT),
QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER,
- qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
- qomFactory.descendantNode(RIGHT, testRoot),
+ qf.sameNodeJoinCondition(LEFT, RIGHT, ".")),
+ qf.descendantNode(RIGHT, testRoot),
null, null);
QueryResult result = qom.execute();
@@ -88,13 +88,13 @@
}
public void testRightOuterJoinWithPath() throws RepositoryException {
- QueryObjectModel qom = qomFactory.createQuery(
- qomFactory.join(
- qomFactory.selector(mixReferenceable, LEFT),
- qomFactory.selector(testNodeType, RIGHT),
+ QueryObjectModel qom = qf.createQuery(
+ qf.join(
+ qf.selector(mixReferenceable, LEFT),
+ qf.selector(testNodeType, RIGHT),
QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER,
- qomFactory.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)),
- qomFactory.descendantNode(RIGHT, testRoot),
+ qf.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)),
+ qf.descendantNode(RIGHT, testRoot),
null, null);
QueryResult result = qom.execute();
@@ -107,9 +107,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/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SameNodeTest.java Wed Jun 10 13:36:30 2009
@@ -35,14 +35,14 @@
Node n = testRootNode.addNode(nodeName1, testNodeType);
testRootNode.save();
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.sameNode("s", testRoot + "/" + nodeName1), null, null);
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.sameNode("s", testRoot + "/" + nodeName1), null, null);
checkResult(q.execute(), new Node[]{n});
}
public void testPathDoesNotExist() throws RepositoryException {
- Query q = qomFactory.createQuery(qomFactory.selector(testNodeType, "s"),
- qomFactory.sameNode("s", testRoot + "/" + nodeName1),
+ Query q = qf.createQuery(qf.selector(testNodeType, "s"),
+ qf.sameNode("s", testRoot + "/" + nodeName1),
null, null);
checkResult(q.execute(), new Node[]{});
}
@@ -59,8 +59,8 @@
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);
+ Query q = qf.createQuery(qf.selector(nt.getName(), "s"),
+ qf.sameNode("s", testRoot + "/" + nodeName1), null, null);
checkResult(q.execute(), new Node[]{});
return;
}
@@ -71,8 +71,8 @@
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) {
@@ -82,8 +82,8 @@
public void testSyntacticallyInvalidPath() throws RepositoryException {
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", testRoot + "/" + nodeName1 + "["),
null, null);
q.execute();
fail("SameNode with syntactically invalid path argument must throw InvalidQueryException");
@@ -94,8 +94,8 @@
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) {
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/SelectorTest.java Wed Jun 10 13:36:30 2009
@@ -33,8 +33,8 @@
// 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);
+ Query q = qf.createQuery(
+ qf.selector(testNodeType, "s"), null, null, null);
NodeIterator it = q.execute().getNodes();
while (it.hasNext()) {
assertTrue("Wrong node type", it.nextNode().isNodeType(testNodeType));
@@ -43,8 +43,8 @@
public void testSyntacticallyInvalidName() throws RepositoryException {
try {
- Query q = qomFactory.createQuery(
- qomFactory.selector(testNodeType + "[", "s"), null, null, null);
+ Query q = qf.createQuery(
+ qf.selector(testNodeType + "[", "s"), null, null, null);
q.execute();
fail("Selector with syntactically invalid name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
@@ -63,7 +63,7 @@
break;
}
}
- Query q = qomFactory.createQuery(qomFactory.selector(ntName, "s"),
+ Query q = qf.createQuery(qf.selector(ntName, "s"),
null, null, null);
assertFalse("Selector must not select nodes for unknown node type",
q.execute().getNodes().hasNext());
@@ -71,12 +71,12 @@
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");
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java?rev=783359&r1=783358&r2=783359&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/UpperLowerCaseTest.java Wed Jun 10 13:36:30 2009
@@ -68,26 +68,26 @@
node.save();
// upper case
- checkQueries(qomFactory.propertyValue("s", propertyName1),
+ checkQueries(qf.propertyValue("s", propertyName1),
true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.NAME,
new boolean[]{false, false, false, false, true});
- checkQueries(qomFactory.propertyValue("s", propertyName2),
+ checkQueries(qf.propertyValue("s", propertyName2),
true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.NAME,
new boolean[]{false, false, false, false, true});
// lower case
- checkQueries(qomFactory.propertyValue("s", propertyName1),
+ checkQueries(qf.propertyValue("s", propertyName1),
false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.NAME,
new boolean[]{true, false, false, false, false});
- checkQueries(qomFactory.propertyValue("s", propertyName2),
+ checkQueries(qf.propertyValue("s", propertyName2),
false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.NAME,
@@ -96,26 +96,26 @@
public void testPropertyValue() throws RepositoryException {
// upper case
- checkQueries(qomFactory.propertyValue("s", propertyName1),
+ 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),
+ 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),
+ 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),
+ checkQueries(qf.propertyValue("s", propertyName2),
false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.STRING,
@@ -124,7 +124,7 @@
public void testUpperLowerCase() throws RepositoryException {
// first upper case, then lower case again
- checkQueries(qomFactory.upperCase(qomFactory.propertyValue("s", propertyName1)),
+ checkQueries(qf.upperCase(qf.propertyValue("s", propertyName1)),
false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.STRING,
@@ -133,7 +133,7 @@
public void testUpperCaseTwice() throws RepositoryException {
// upper case twice
- checkQueries(qomFactory.upperCase(qomFactory.propertyValue("s", propertyName1)),
+ checkQueries(qf.upperCase(qf.propertyValue("s", propertyName1)),
true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.STRING,
@@ -142,7 +142,7 @@
public void testLowerUpperCase() throws RepositoryException {
// first lower case, then upper case again
- checkQueries(qomFactory.lowerCase(qomFactory.propertyValue("s", propertyName1)),
+ checkQueries(qf.lowerCase(qf.propertyValue("s", propertyName1)),
true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.STRING,
@@ -151,7 +151,7 @@
public void testLowerCaseTwice() throws RepositoryException {
// lower case twice
- checkQueries(qomFactory.lowerCase(qomFactory.propertyValue("s", propertyName1)),
+ checkQueries(qf.lowerCase(qf.propertyValue("s", propertyName1)),
false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
new String[]{"abc", "Abc", "aBc", "abC", "ABC"},
PropertyType.STRING,
@@ -177,18 +177,18 @@
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);
}