Class AbstractQOMTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.apache.jackrabbit.test.JUnitTest
-
- org.apache.jackrabbit.test.AbstractJCRTest
-
- org.apache.jackrabbit.test.api.query.AbstractQueryTest
-
- 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
AbstractQOMTestis a base class for test cases on the JQOM.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceAbstractQOMTest.Callable
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.test.api.query.AbstractQueryTest
jcrContains, jcrDeref, jcrPath, jcrRoot, jcrScore, qf, qm, qsSQL, qsXPATH, 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, mixTitle, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntActivity, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testNodeTypeTestRoot, testPath, testRoot, testRootNode, workspaceName
-
-
Constructor Summary
Constructors Constructor Description AbstractQOMTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbindVariableValue(Query q, String var, Value value)Binds the givenvalueto the variable namedvar.protected voidcheckQOM(QueryObjectModel qom, String[] selectorNames, Node[][] nodes)Checks the query object model by executing it directly and matching the result against the givennodes.protected voidcheckQOM(QueryObjectModel qom, Node[] nodes)Checks the query object model by executing it directly and matching the result against the givennodes.protected voidcheckResult(QueryResult result, String[] selectorNames, Node[][] nodes)protected voidcheckResultOrder(QueryObjectModel qom, String[] selectorNames, Node[][] nodes)protected voidcheckResultOrder(QueryResult result, String[] selectorNames, Node[][] nodes)protected voidforQOMandSQL2(QueryObjectModel qom, AbstractQOMTest.Callable callable)Calls back thecallablefirst with theqomand then a JCR_SQL2 query created fromQuery.getStatement().protected static StringgetPath(Node node)Returns the path of thenodeor an empty string ifnodeisnull.-
Methods inherited from class org.apache.jackrabbit.test.api.query.AbstractQueryTest
checkResult, checkResult, checkResult, checkResult, createQuery, createQuery, createQuery, escapeIdentifierForSQL, evaluateResultOrder, execute, execute, executeSqlQuery, executeSqlQuery, executeXPathQuery, isSupportedLanguage, setUp, tearDown, toArray
-
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureLockingSupported, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getPrefix, getProperty, getProperty, getQualifiedName, getSize, isSupported, needsMixin, run
-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, runBare, runTest, setName, toString
-
-
-
-
Method Detail
-
bindVariableValue
protected void bindVariableValue(Query q, String var, Value value) throws RepositoryException
Binds the givenvalueto the variable namedvar.- Parameters:
q- the queryvar- name of variable in queryvalue- value to bind- Throws:
IllegalArgumentException- ifvaris 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 givennodes. Then the QOM is executed again usingQuery.getStatement()withQuery.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 givennodes. Then the QOM is executed again usingQuery.getStatement()withQuery.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 thenodeor an empty string ifnodeisnull.- Parameters:
node- a node ornull.- Returns:
- the path of the node or an empty string if
nodeisnull. - Throws:
RepositoryException- if an error occurs while reading from the repository.
-
forQOMandSQL2
protected void forQOMandSQL2(QueryObjectModel qom, AbstractQOMTest.Callable callable) throws RepositoryException
Calls back thecallablefirst with theqomand then a JCR_SQL2 query created fromQuery.getStatement().- Parameters:
qom- a query object model.callable- the callback.- Throws:
RepositoryException- if an error occurs.
-
-