Class OrderByLongTest
- 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.OrderByLongTest
-
- All Implemented Interfaces:
junit.framework.Test
public class OrderByLongTest extends AbstractQueryTest
Test cases for order by queries on long properties.testroot
path to node that accepts child nodes of typenodetype
nodetype
name of a node typenodename1
name of a child node of typenodetype
nodename2
name of a child node of typenodetype
nodename3
name of a child node of typenodetype
nodename4
name of a child node of typenodetype
propertyname1
name of a single value long property.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
checkSQL
Iftrue
this repository supports sql queries-
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 OrderByLongTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkOrder(String[] nodeNames)
Runs queries on the workspace and checks if the ordering is according to thenodeNames
.protected void
checkResultOrder(QueryResult result, String[] nodeNames)
Checks if the node ordering inresult
is according tonodeNames
.protected DynamicOperand
createOrderingOperand()
protected QueryObjectModel
createQOM(boolean ascending)
protected String
createSQL()
protected String
createXPath()
protected void
populate(double[] values)
Populates the workspace with child nodes undertestroot
with each node has a double value set in property with namepropertyname1
.protected void
populate(long[] values)
Populates the workspace with child nodes undertestroot
with each node has a long value set in property with namepropertyname1
.protected void
populate(String[] values)
Populates the workspace with child nodes undertestroot
with each node has a String value set in property with namepropertyname1
.protected void
populate(String[] values, int type)
Populates the workspace with child nodes undertestroot
with each node has a value set in property with namepropertyname1
.protected void
populate(BigDecimal[] values)
Populates the workspace with child nodes undertestroot
with each node has a decimal value set in property with namepropertyname1
.protected void
populate(Calendar[] values)
Populates the workspace with child nodes undertestroot
with each node has a calendar value set in property with namepropertyname1
.protected void
setUp()
Set-up the configuration values used for the test.void
testIntegerOrder()
Tests order by queries with long properties.-
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, 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
-
testIntegerOrder
public void testIntegerOrder() throws Exception
Tests order by queries with long properties.- Throws:
Exception
-
setUp
protected void setUp() throws Exception
Description copied from class:AbstractQueryTest
Set-up the configuration values used for the test. Per default retrieves a session, configures testRoot, and nodetype and checks if the query language for the current language is available.- Overrides:
setUp
in classAbstractQueryTest
- Throws:
Exception
-
populate
protected void populate(String[] values) throws RepositoryException
Populates the workspace with child nodes undertestroot
with each node has a String value set in property with namepropertyname1
.- Parameters:
values
- the String values.- Throws:
RepositoryException
-
populate
protected void populate(String[] values, int type) throws RepositoryException
Populates the workspace with child nodes undertestroot
with each node has a value set in property with namepropertyname1
. The actual value is created by using the sessions value factory and the giventype
.- Parameters:
values
- the String values.type
- a JCR property type.- Throws:
RepositoryException
-
populate
protected void populate(Calendar[] values) throws RepositoryException
Populates the workspace with child nodes undertestroot
with each node has a calendar value set in property with namepropertyname1
.- Parameters:
values
- the calendar values.- Throws:
RepositoryException
-
populate
protected void populate(long[] values) throws RepositoryException
Populates the workspace with child nodes undertestroot
with each node has a long value set in property with namepropertyname1
.- Parameters:
values
- the long values.- Throws:
RepositoryException
-
populate
protected void populate(double[] values) throws RepositoryException
Populates the workspace with child nodes undertestroot
with each node has a double value set in property with namepropertyname1
.- Parameters:
values
- the double values.- Throws:
RepositoryException
-
populate
protected void populate(BigDecimal[] values) throws RepositoryException
Populates the workspace with child nodes undertestroot
with each node has a decimal value set in property with namepropertyname1
.- Parameters:
values
- the decimal values.- Throws:
RepositoryException
-
checkOrder
protected void checkOrder(String[] nodeNames) throws RepositoryException
Runs queries on the workspace and checks if the ordering is according to thenodeNames
.- Parameters:
nodeNames
- the sequence of node names required in the result set.- Throws:
RepositoryException
-
checkResultOrder
protected void checkResultOrder(QueryResult result, String[] nodeNames) throws RepositoryException
Checks if the node ordering inresult
is according tonodeNames
.- Parameters:
result
- the query result.nodeNames
- the node names.- Throws:
RepositoryException
-
createQOM
protected QueryObjectModel createQOM(boolean ascending) throws RepositoryException
- Returns:
- a basic QOM to test order by queries.
- Throws:
RepositoryException
- if an error occurs.
-
createOrderingOperand
protected DynamicOperand createOrderingOperand() throws RepositoryException
- Returns:
- a dynamic operand that is used in the QOM created by
createQOM(boolean)
. - Throws:
RepositoryException
- if an error occurs.
-
createSQL
protected String createSQL()
- Returns:
- a basic SQL statement to test order by queries. Returns
null
if SQL is not supported.
-
createXPath
protected String createXPath() throws RepositoryException
- Returns:
- a basic XPath statement to test order by queries. Returns
null
is XPath is not supported. - Throws:
RepositoryException
- if an error occurs.
-
-