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 javax.jcr.query.qom.QueryObjectModelFactory |
qf
The query object model factory for
AbstractJCRTest.superuser . |
protected javax.jcr.query.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 javax.jcr.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, 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(javax.jcr.query.QueryResult result,
int hits)
Checks if the
result contains a number of
hits . |
protected void |
checkResult(javax.jcr.query.QueryResult result,
int hits,
int properties)
Checks if the
result contains a number of hits
and properties . |
protected void |
checkResult(javax.jcr.query.QueryResult result,
javax.jcr.Node[] expectedNodes)
Checks if the result set contains exactly the
nodes . |
protected void |
checkResult(javax.jcr.query.QueryResult result,
javax.jcr.Node[] requiredNodes,
javax.jcr.Node[] optionalNodes)
Checks if the result set contains exactly the
nodes . |
protected javax.jcr.query.Query |
createQuery(javax.jcr.Session session,
String statement,
String language)
Creates a
Query for the given statement in the requested
language, treating optional languages gracefully |
protected javax.jcr.query.Query |
createQuery(org.apache.jackrabbit.test.api.query.Statement statement)
Create a
Query for a given Statement . |
protected javax.jcr.query.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(javax.jcr.query.QueryResult queryResult,
String propName,
boolean descending)
Checks if the
QueryResult is ordered according order property in
direction of related argument. |
protected javax.jcr.query.QueryResult |
execute(org.apache.jackrabbit.test.api.query.Statement statement)
Creates and executes a
Query for the given Statement |
protected javax.jcr.query.QueryResult |
execute(String statement,
String language)
Creates and executes a
Query for a given Statement in a given
query language |
protected void |
executeSqlQuery(javax.jcr.Session session,
String sql,
javax.jcr.Node[] expectedNodes)
Executes the
sql query and checks the results against
the specified nodes . |
protected void |
executeSqlQuery(javax.jcr.Session session,
String sql,
javax.jcr.Node[] requiredNodes,
javax.jcr.Node[] optionalNodes)
Executes the
sql query and checks the results against
the specified nodes . |
protected void |
executeXPathQuery(javax.jcr.Session session,
String xpath,
javax.jcr.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 javax.jcr.Node[] |
toArray(javax.jcr.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 javax.jcr.query.qom.QueryObjectModelFactory qf
AbstractJCRTest.superuser
.protected javax.jcr.ValueFactory vf
protected javax.jcr.query.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 javax.jcr.query.Query createQuery(org.apache.jackrabbit.test.api.query.Statement statement) throws javax.jcr.RepositoryException, NotExecutableException
Query
for a given Statement
.statement
- the query should be created forjavax.jcr.RepositoryException
NotExecutableException
createQuery(String, String)
protected javax.jcr.query.Query createQuery(String statement, String language) throws javax.jcr.RepositoryException, NotExecutableException
Query
for the given statement in the requested
language, treating optional languages gracefullyjavax.jcr.RepositoryException
NotExecutableException
protected javax.jcr.query.Query createQuery(javax.jcr.Session session, String statement, String language) throws javax.jcr.RepositoryException, NotExecutableException
Query
for the given statement in the requested
language, treating optional languages gracefullyjavax.jcr.RepositoryException
NotExecutableException
protected javax.jcr.query.QueryResult execute(org.apache.jackrabbit.test.api.query.Statement statement) throws javax.jcr.RepositoryException, NotExecutableException
Query
for the given Statement
statement
- to executejavax.jcr.RepositoryException
NotExecutableException
execute(String, String)
protected javax.jcr.query.QueryResult execute(String statement, String language) throws javax.jcr.RepositoryException, NotExecutableException
Query
for a given Statement in a given
query languagestatement
- the query should be build forlanguage
- query language the stement is written injavax.jcr.RepositoryException
NotExecutableException
protected void checkResult(javax.jcr.query.QueryResult result, int hits) throws javax.jcr.RepositoryException
result
contains a number of
hits
.result
- the QueryResult
.hits
- the number of expected hits.javax.jcr.RepositoryException
- if an error occurs while iterating over the
result nodes.protected void checkResult(javax.jcr.query.QueryResult result, int hits, int properties) throws javax.jcr.RepositoryException
result
contains a number of hits
and properties
.result
- the QueryResult
.hits
- the number of expected hits.properties
- the number of expected properties.javax.jcr.RepositoryException
- if an error occurs while iterating over the
result nodes.protected void evaluateResultOrder(javax.jcr.query.QueryResult queryResult, String propName, boolean descending) throws javax.jcr.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 descendingjavax.jcr.RepositoryException
NotExecutableException
- in case of less than two results or all
results have same size of value in its
order-propertyprotected void executeXPathQuery(javax.jcr.Session session, String xpath, javax.jcr.Node[] expectedNodes) throws javax.jcr.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
javax.jcr.RepositoryException
protected void executeSqlQuery(javax.jcr.Session session, String sql, javax.jcr.Node[] expectedNodes) throws javax.jcr.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
javax.jcr.RepositoryException
protected void executeSqlQuery(javax.jcr.Session session, String sql, javax.jcr.Node[] requiredNodes, javax.jcr.Node[] optionalNodes) throws javax.jcr.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
javax.jcr.RepositoryException
protected void checkResult(javax.jcr.query.QueryResult result, javax.jcr.Node[] expectedNodes) throws javax.jcr.RepositoryException
nodes
.result
- the query result.expectedNodes
- the expected nodes.javax.jcr.RepositoryException
protected void checkResult(javax.jcr.query.QueryResult result, javax.jcr.Node[] requiredNodes, javax.jcr.Node[] optionalNodes) throws javax.jcr.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).javax.jcr.RepositoryException
protected javax.jcr.Node[] toArray(javax.jcr.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 javax.jcr.RepositoryException
language
- a query language.true
if language
is supported;
false
otherwise.javax.jcr.RepositoryException
- if an error occurs.Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.