|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.jackrabbit.test.JUnitTest
org.apache.jackrabbit.test.AbstractJCRTest
org.apache.jackrabbit.test.api.query.AbstractQueryTest
public abstract class AbstractQueryTest
Abstract base class for query test cases.
Field Summary | |
---|---|
protected java.lang.String |
jcrContains
Resolved Name for jcr:contains |
protected java.lang.String |
jcrDeref
Resolved Name for jcr:deref |
protected java.lang.String |
jcrPath
Resolved Name for jcr:path |
protected java.lang.String |
jcrRoot
Resolved Name for jcr:root |
protected java.lang.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 javax.jcr.ValueFactory |
vf
The value factory for creating literals for the query object model. |
protected java.lang.String |
xpathRoot
The string /${jcrRoot}${testRoot} with all components of the test path properly escaped for XPath. |
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 |
Constructor Summary | |
---|---|
AbstractQueryTest()
|
Method Summary | |
---|---|
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[] nodes)
Checks if the result set contains exactly the nodes . |
protected javax.jcr.query.Query |
createQuery(javax.jcr.Session session,
java.lang.String statement,
java.lang.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(java.lang.String statement,
java.lang.String language)
Creates a Query for the given statement in the requested
language, treating optional languages gracefully |
protected java.lang.String |
escapeIdentifierForSQL(java.lang.String identifier)
Escape an identifier suitable for the SQL parser |
protected void |
evaluateResultOrder(javax.jcr.query.QueryResult queryResult,
java.lang.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(java.lang.String statement,
java.lang.String language)
Creates and executes a Query for a given Statement in a given
query language |
protected void |
executeSqlQuery(javax.jcr.Session session,
java.lang.String sql,
javax.jcr.Node[] nodes)
Executes the sql query and checks the results against
the specified nodes . |
protected void |
executeXPathQuery(javax.jcr.Session session,
java.lang.String xpath,
javax.jcr.Node[] nodes)
Executes the xpath query and checks the results against
the specified nodes . |
protected boolean |
isSupportedLanguage(java.lang.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. |
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, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String jcrScore
protected java.lang.String jcrPath
protected java.lang.String jcrRoot
protected java.lang.String jcrContains
protected java.lang.String jcrDeref
protected java.lang.String xpathRoot
protected javax.jcr.query.qom.QueryObjectModelFactory qf
AbstractJCRTest.superuser
.
protected javax.jcr.ValueFactory vf
protected javax.jcr.query.QueryManager qm
AbstractJCRTest.superuser
Constructor Detail |
---|
public AbstractQueryTest()
Method Detail |
---|
protected void setUp() throws java.lang.Exception
setUp
in class AbstractJCRTest
java.lang.Exception
protected void tearDown() throws java.lang.Exception
tearDown
in class AbstractJCRTest
java.lang.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 for
javax.jcr.RepositoryException
NotExecutableException
createQuery(String, String)
protected javax.jcr.query.Query createQuery(java.lang.String statement, java.lang.String language) throws javax.jcr.RepositoryException, NotExecutableException
Query
for the given statement in the requested
language, treating optional languages gracefully
javax.jcr.RepositoryException
NotExecutableException
protected javax.jcr.query.Query createQuery(javax.jcr.Session session, java.lang.String statement, java.lang.String language) throws javax.jcr.RepositoryException, NotExecutableException
Query
for the given statement in the requested
language, treating optional languages gracefully
javax.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 execute
javax.jcr.RepositoryException
NotExecutableException
execute(String, String)
protected javax.jcr.query.QueryResult execute(java.lang.String statement, java.lang.String language) throws javax.jcr.RepositoryException, NotExecutableException
Query
for a given Statement in a given
query language
statement
- the query should be build forlanguage
- query language the stement is written in
javax.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, java.lang.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 descending
javax.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, java.lang.String xpath, javax.jcr.Node[] nodes) 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.nodes
- the expected result nodes.
NotExecutableException
javax.jcr.RepositoryException
protected void executeSqlQuery(javax.jcr.Session session, java.lang.String sql, javax.jcr.Node[] nodes) 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.nodes
- the expected result nodes.
NotExecutableException
javax.jcr.RepositoryException
protected void checkResult(javax.jcr.query.QueryResult result, javax.jcr.Node[] nodes) throws javax.jcr.RepositoryException
nodes
.
result
- the query result.nodes
- the expected nodes in the result set.
javax.jcr.RepositoryException
protected javax.jcr.Node[] toArray(javax.jcr.NodeIterator it)
it
as an array of Nodes.
it
- the NodeIterator.
protected java.lang.String escapeIdentifierForSQL(java.lang.String identifier)
protected boolean isSupportedLanguage(java.lang.String language) throws javax.jcr.RepositoryException
language
- a query language.
true
if language
is supported;
false
otherwise.
javax.jcr.RepositoryException
- if an error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |