public abstract class AbstractQueryTest extends AbstractJCRTest
Modifier and Type | Field and Description |
---|---|
protected String |
jcrContains
Resolved Name for jcr:contains
|
protected String |
jcrDeref
Resolved Name for jcr:deref
|
protected String |
jcrPath
Resolved Name for jcr:path
|
protected String |
jcrRoot
Resolved Name for jcr:root
|
protected String |
jcrScore
Resolved Name for jcr:score
|
protected QueryObjectModelFactory |
qf
The query object model factory for
AbstractJCRTest.superuser . |
protected QueryManager |
qm
The query manager for
AbstractJCRTest.superuser |
protected String |
qsSQL
The identifier for the "SQL" query syntax
|
protected String |
qsXPATH
The identifier for the "XPATH" query syntax
|
protected ValueFactory |
vf
The value factory for creating literals for the query object model.
|
protected String |
xpathRoot
The string /${jcrRoot}${testRoot} with all components of the test path
properly escaped for XPath.
|
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 and Description |
---|
AbstractQueryTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkResult(QueryResult result,
int hits)
Checks if the
result contains a number of
hits . |
protected void |
checkResult(QueryResult result,
int hits,
int properties)
Checks if the
result contains a number of hits
and properties . |
protected void |
checkResult(QueryResult result,
Node[] expectedNodes)
Checks if the result set contains exactly the
nodes . |
protected void |
checkResult(QueryResult result,
Node[] requiredNodes,
Node[] optionalNodes)
Checks if the result set contains exactly the
nodes . |
protected Query |
createQuery(Session session,
String statement,
String language)
Creates a
Query for the given statement in the requested
language, treating optional languages gracefully |
protected Query |
createQuery(org.apache.jackrabbit.test.api.query.Statement statement)
Create a
Query for a given Statement . |
protected Query |
createQuery(String statement,
String language)
Creates a
Query for the given statement in the requested
language, treating optional languages gracefully |
protected String |
escapeIdentifierForSQL(String identifier)
Escape an identifier suitable for the SQL parser
|
protected void |
evaluateResultOrder(QueryResult queryResult,
String propName,
boolean descending)
Checks if the
QueryResult is ordered according order property in
direction of related argument. |
protected QueryResult |
execute(org.apache.jackrabbit.test.api.query.Statement statement)
Creates and executes a
Query for the given Statement |
protected QueryResult |
execute(String statement,
String language)
Creates and executes a
Query for a given Statement in a given
query language |
protected void |
executeSqlQuery(Session session,
String sql,
Node[] expectedNodes)
Executes the
sql query and checks the results against
the specified nodes . |
protected void |
executeSqlQuery(Session session,
String sql,
Node[] requiredNodes,
Node[] optionalNodes)
Executes the
sql query and checks the results against
the specified nodes . |
protected void |
executeXPathQuery(Session session,
String xpath,
Node[] expectedNodes)
Executes the
xpath query and checks the results against
the specified nodes . |
protected boolean |
isSupportedLanguage(String language) |
protected void |
setUp()
Set-up the configuration values used for the test.
|
protected void |
tearDown() |
protected Node[] |
toArray(NodeIterator it)
Returns the nodes in
it as an array of Nodes. |
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureLockingSupported, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getPrefix, getProperty, getProperty, getQualifiedName, getSize, isSupported, needsMixin, run
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
protected String jcrScore
protected String jcrPath
protected String jcrRoot
protected String jcrContains
protected String jcrDeref
protected String xpathRoot
protected QueryObjectModelFactory qf
AbstractJCRTest.superuser
.protected ValueFactory vf
protected QueryManager qm
AbstractJCRTest.superuser
protected String qsXPATH
protected String qsSQL
protected void setUp() throws Exception
setUp
in class AbstractJCRTest
Exception
protected void tearDown() throws Exception
tearDown
in class AbstractJCRTest
Exception
protected Query createQuery(org.apache.jackrabbit.test.api.query.Statement statement) throws RepositoryException, NotExecutableException
Query
for a given Statement
.statement
- the query should be created forRepositoryException
NotExecutableException
createQuery(String, String)
protected Query createQuery(String statement, String language) throws RepositoryException, NotExecutableException
Query
for the given statement in the requested
language, treating optional languages gracefullyprotected Query createQuery(Session session, String statement, String language) throws RepositoryException, NotExecutableException
Query
for the given statement in the requested
language, treating optional languages gracefullyprotected QueryResult execute(org.apache.jackrabbit.test.api.query.Statement statement) throws RepositoryException, NotExecutableException
Query
for the given Statement
statement
- to executeRepositoryException
NotExecutableException
execute(String, String)
protected QueryResult execute(String statement, String language) throws RepositoryException, NotExecutableException
Query
for a given Statement in a given
query languagestatement
- the query should be build forlanguage
- query language the stement is written inRepositoryException
NotExecutableException
protected void checkResult(QueryResult result, int hits) throws RepositoryException
result
contains a number of
hits
.result
- the QueryResult
.hits
- the number of expected hits.RepositoryException
- if an error occurs while iterating over the
result nodes.protected void checkResult(QueryResult result, int hits, int properties) throws RepositoryException
result
contains a number of hits
and properties
.result
- the QueryResult
.hits
- the number of expected hits.properties
- the number of expected properties.RepositoryException
- if an error occurs while iterating over the
result nodes.protected void evaluateResultOrder(QueryResult queryResult, String propName, boolean descending) throws RepositoryException, NotExecutableException
QueryResult
is ordered according order property in
direction of related argument.queryResult
- to be testedpropName
- Name of the porperty to order bydescending
- if true
order has to be descendingRepositoryException
NotExecutableException
- in case of less than two results or all
results have same size of value in its
order-propertyprotected void executeXPathQuery(Session session, String xpath, Node[] expectedNodes) throws RepositoryException, NotExecutableException
xpath
query and checks the results against
the specified nodes
.session
- the session to use for the query.xpath
- the xpath query.expectedNodes
- the expected nodes.NotExecutableException
RepositoryException
protected void executeSqlQuery(Session session, String sql, Node[] expectedNodes) throws RepositoryException, NotExecutableException
sql
query and checks the results against
the specified nodes
.session
- the session to use for the query.sql
- the sql query.expectedNodes
- the expected nodes.NotExecutableException
RepositoryException
protected void executeSqlQuery(Session session, String sql, Node[] requiredNodes, Node[] optionalNodes) throws RepositoryException, NotExecutableException
sql
query and checks the results against
the specified nodes
.session
- the session to use for the query.sql
- the sql query.requiredNodes
- the nodes that need to be in the result set
(null if no node is required).optionalNodes
- the nodes that may be in the result set
(null if no node is optional).NotExecutableException
RepositoryException
protected void checkResult(QueryResult result, Node[] expectedNodes) throws RepositoryException
nodes
.result
- the query result.expectedNodes
- the expected nodes.RepositoryException
protected void checkResult(QueryResult result, Node[] requiredNodes, Node[] optionalNodes) throws RepositoryException
nodes
.result
- the query result.requiredNodes
- the nodes that need to be in the result set
(null if no node is required).optionalNodes
- the nodes that may be in the result set
(null if no node is optional).RepositoryException
protected Node[] toArray(NodeIterator it)
it
as an array of Nodes.it
- the NodeIterator.protected String escapeIdentifierForSQL(String identifier)
TODO: currently only handles dash character
protected boolean isSupportedLanguage(String language) throws RepositoryException
language
- a query language.true
if language
is supported;
false
otherwise.RepositoryException
- if an error occurs.Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.