Skip to content

Commit

Permalink
JCR-3408 Query tests should avoid casting to QueryManagerImpl
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1371132 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
stillalex committed Aug 9, 2012
1 parent 00aded8 commit a1ad759
Showing 1 changed file with 13 additions and 13 deletions.
Expand Up @@ -32,7 +32,7 @@
/**
* Tests queries with order by.
*/
public class OrderByTest extends AbstractIndexingTest {
public class OrderByTest extends AbstractQueryTest {

public void testOrderByScore() throws RepositoryException {
Node n1 = testRootNode.addNode("node1");
Expand All @@ -50,12 +50,12 @@ public void testOrderByScore() throws RepositoryException {

String sql = "SELECT value FROM nt:unstructured WHERE " +
"jcr:path LIKE '" + testRoot + "/%' ORDER BY jcr:score, value";
Query q = session.getWorkspace().getQueryManager().createQuery(sql, Query.SQL);
Query q = qm.createQuery(sql, Query.SQL);
QueryResult result = q.execute();
checkResult(result, 3);

String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by jcr:score(), @value";
q = session.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
q = qm.createQuery(xpath, Query.XPATH);
result = q.execute();
checkResult(result, 3);
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public void testOrderByUpperCase() throws RepositoryException {
testRootNode.save();

String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by fn:upper-case(@text)";
Query q = session.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
Query q = qm.createQuery(xpath, Query.XPATH);
QueryResult result = q.execute();
checkResult(result, new Node[]{n1, n2, n3});
}
Expand All @@ -121,7 +121,7 @@ public void testOrderByLowerCase() throws RepositoryException {
testRootNode.save();

String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by fn:lower-case(@text)";
Query q = session.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
Query q = qm.createQuery(xpath, Query.XPATH);
QueryResult result = q.execute();
checkResult(result, new Node[]{n1, n2, n3});
}
Expand Down Expand Up @@ -213,31 +213,31 @@ public void testChildAxisMixedTypes() throws RepositoryException {
//------------------------------< helper >----------------------------------

private Value getValue(String value) throws RepositoryException {
return session.getValueFactory().createValue(value);
return superuser.getValueFactory().createValue(value);
}

private Value getValue(long value) throws RepositoryException {
return session.getValueFactory().createValue(value);
return superuser.getValueFactory().createValue(value);
}

private Value getValue(double value) throws RepositoryException {
return session.getValueFactory().createValue(value);
return superuser.getValueFactory().createValue(value);
}

private Value getValue(boolean value) throws RepositoryException {
return session.getValueFactory().createValue(value);
return superuser.getValueFactory().createValue(value);
}

private Value getValue(Calendar value) throws RepositoryException {
return session.getValueFactory().createValue(value);
return superuser.getValueFactory().createValue(value);
}

private Value getNameValue(String value) throws RepositoryException {
return session.getValueFactory().createValue(value, PropertyType.NAME);
return superuser.getValueFactory().createValue(value, PropertyType.NAME);
}

private Value getPathValue(String value) throws RepositoryException {
return session.getValueFactory().createValue(value, PropertyType.PATH);
return superuser.getValueFactory().createValue(value, PropertyType.PATH);
}

/**
Expand All @@ -251,7 +251,7 @@ private void checkChildAxis(Value[] values) throws RepositoryException {
// child/prop is part of the test indexing configuration,
// this will use SimpleScoreDocComparator internally
checkChildAxis(values, "child", "property");
cleanUpTestRoot(session);
cleanUpTestRoot(superuser);
// c/p is not in the indexing configuration,
// this will use RelPathScoreDocComparator internally
checkChildAxis(values, "c", "p");
Expand Down

0 comments on commit a1ad759

Please sign in to comment.