org.apache.jackrabbit.test.api.query.qom
Class AbstractQOMTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.jackrabbit.test.JUnitTest
              extended by org.apache.jackrabbit.test.AbstractJCRTest
                  extended by org.apache.jackrabbit.test.api.query.AbstractQueryTest
                      extended by org.apache.jackrabbit.test.api.query.qom.AbstractQOMTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractJoinTest, AndConstraintTest, BindVariableValueTest, ChildNodeTest, ColumnTest, DescendantNodeTest, FullTextSearchScoreTest, GetQueryTest, LengthTest, NodeLocalNameTest, NodeNameTest, NotConstraintTest, OrConstraintTest, PropertyExistenceTest, PropertyValueTest, QueryObjectModelFactoryTest, RowTest, SameNodeTest, SelectorTest, UpperLowerCaseTest

public abstract class AbstractQOMTest
extends AbstractQueryTest

AbstractQOMTest is a base class for test cases on the JQOM.


Nested Class Summary
protected static interface AbstractQOMTest.Callable
           
 
Field Summary
 
Fields inherited from class org.apache.jackrabbit.test.api.query.AbstractQueryTest
jcrContains, jcrDeref, jcrPath, jcrRoot, jcrScore, qf, qm, vf, xpathRoot
 
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
isReadOnly, jcrBaseVersion, jcrCopiedFrom, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrIsCheckedOut, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixShareable, mixSimpleVersionable, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testPath, testRoot, testRootNode, workspaceName
 
Fields inherited from class org.apache.jackrabbit.test.JUnitTest
log, logger
 
Constructor Summary
AbstractQOMTest()
           
 
Method Summary
protected  void bindVariableValue(Query q, String var, Value value)
          Binds the given value to the variable named var.
protected  void checkQOM(QueryObjectModel qom, Node[] nodes)
          Checks the query object model by executing it directly and matching the result against the given nodes.
protected  void checkQOM(QueryObjectModel qom, String[] selectorNames, Node[][] nodes)
          Checks the query object model by executing it directly and matching the result against the given nodes.
protected  void checkResult(QueryResult result, String[] selectorNames, Node[][] nodes)
           
protected  void checkResultOrder(QueryObjectModel qom, String[] selectorNames, Node[][] nodes)
           
protected  void checkResultOrder(QueryResult result, String[] selectorNames, Node[][] nodes)
           
protected  void forQOMandSQL2(QueryObjectModel qom, AbstractQOMTest.Callable callable)
          Calls back the callable first with the qom and then a JCR_SQL2 query created from Query.getStatement().
protected static String getPath(Node node)
          Returns the path of the node or an empty string if node is null.
 
Methods inherited from class org.apache.jackrabbit.test.api.query.AbstractQueryTest
checkResult, checkResult, checkResult, createQuery, createQuery, createQuery, escapeIdentifierForSQL, evaluateResultOrder, execute, execute, executeSqlQuery, executeXPathQuery, isSupportedLanguage, setUp, tearDown, toArray
 
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getProperty, getProperty, getSize, isSupported, needsMixin, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractQOMTest

public AbstractQOMTest()
Method Detail

bindVariableValue

protected void bindVariableValue(Query q,
                                 String var,
                                 Value value)
                          throws RepositoryException
Binds the given value to the variable named var.

Parameters:
q - the query
var - name of variable in query
value - value to bind
Throws:
IllegalArgumentException - if var is not a valid variable in this query.
RepositoryException - if an error occurs.

checkResultOrder

protected void checkResultOrder(QueryObjectModel qom,
                                String[] selectorNames,
                                Node[][] nodes)
                         throws RepositoryException
Throws:
RepositoryException

checkResultOrder

protected void checkResultOrder(QueryResult result,
                                String[] selectorNames,
                                Node[][] nodes)
                         throws RepositoryException
Throws:
RepositoryException

checkQOM

protected void checkQOM(QueryObjectModel qom,
                        Node[] nodes)
                 throws RepositoryException
Checks the query object model by executing it directly and matching the result against the given nodes. Then the QOM is executed again using Query.getStatement() with Query.JCR_SQL2.

Parameters:
qom - the query object model to check.
nodes - the result nodes.
Throws:
RepositoryException - if an error occurs while executing the query.

checkQOM

protected void checkQOM(QueryObjectModel qom,
                        String[] selectorNames,
                        Node[][] nodes)
                 throws RepositoryException
Checks the query object model by executing it directly and matching the result against the given nodes. Then the QOM is executed again using Query.getStatement() with Query.JCR_SQL2.

Parameters:
qom - the query object model to check.
selectorNames - the selector names of the qom.
nodes - the result nodes.
Throws:
RepositoryException - if an error occurs while executing the query.

checkResult

protected void checkResult(QueryResult result,
                           String[] selectorNames,
                           Node[][] nodes)
                    throws RepositoryException
Throws:
RepositoryException

getPath

protected static String getPath(Node node)
                         throws RepositoryException
Returns the path of the node or an empty string if node is null.

Parameters:
node - a node or null.
Returns:
the path of the node or an empty string if node is null.
Throws:
RepositoryException - if an error occurs while reading from the repository.

forQOMandSQL2

protected void forQOMandSQL2(QueryObjectModel qom,
                             AbstractQOMTest.Callable callable)
                      throws RepositoryException
Calls back the callable first with the qom and then a JCR_SQL2 query created from Query.getStatement().

Parameters:
qom - a query object model.
callable - the callback.
Throws:
RepositoryException - if an error occurs.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.