|
||||||||||
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
public abstract class AbstractJCRTest
Abstract base class for all JCR test classes.
Field Summary | |
---|---|
static RepositoryHelper |
helper
Helper object to access repository transparently |
protected boolean |
isReadOnly
Flag that indicates if the current test is a read-only test, that is no content is written to the workspace by the test. |
protected String |
jcrBaseVersion
JCR Name jcr:baseVersion using the namespace resolver of the current session. |
protected String |
jcrCreated
JCR Name jcr:created using the namespace resolver of the current session. |
protected String |
jcrFrozenNode
JCR Name jcr:frozenNode using the namespace resolver of the current session. |
protected String |
jcrFrozenUuid
JCR Name jcr:frozenUuid using the namespace resolver of the current session. |
protected String |
jcrlockIsDeep
JCR Name jcr:lockIsDeep using the namespace resolver of the current session. |
protected String |
jcrLockOwner
JCR Name jcr:lockOwner using the namespace resolver of the current session. |
protected String |
jcrMergeFailed
JCR Name jcr:mergeFailed using the namespace resolver of the current session. |
protected String |
jcrMixinTypes
JCR Name jcr:mixinTypes using the namespace resolver of the current session. |
protected String |
jcrPredecessors
JCR Name jcr:predecessors using the namespace resolver of the current session. |
protected String |
jcrPrimaryType
JCR Name jcr:primaryType using the namespace resolver of the current session. |
protected String |
jcrRootVersion
JCR Name jcr:rootVersion using the namespace resolver of the current session. |
protected String |
jcrSuccessors
JCR Name jcr:successors using the namespace resolver of the current session. |
protected String |
jcrSystem
JCR Name jcr:system using the namespace resolver of the current session. |
protected String |
jcrUUID
JCR Name jcr:uuid using the namespace resolver of the current session. |
protected String |
jcrVersionHistory
JCR Name jcr:created using the namespace resolver of the current session. |
protected String |
mixLockable
JCR Name mix:lockable using the namespace resolver of the current session. |
protected String |
mixReferenceable
JCR Name mix:referenceable using the namespace resolver of the current session. |
protected String |
mixVersionable
JCR Name mix:versionable using the namespace resolver of the current session. |
protected String |
nodeName1
Name of a node that will be created during a test case. |
protected String |
nodeName2
Name of a node that will be created during a test case. |
protected String |
nodeName3
Name of a node that will be created during a test case. |
protected String |
nodeName4
Name of a node that will be created during a test case. |
static String |
NS_JCR_URI
Namespace URI for jcr prefix. |
static String |
NS_MIX_URI
Namespace URI for mix prefix. |
static String |
NS_NT_URI
Namespace URI for nt prefix. |
static String |
NS_SV_URI
Namespace URI for sv prefix |
protected String |
ntBase
JCR Name nt:base using the namespace resolver of the current session. |
protected String |
ntFrozenNode
JCR Name nt:frozenNode using the namespace resolver of the current session. |
protected String |
ntQuery
JCR Name nt:query using the namespace resolver of the current session. |
protected String |
ntVersion
JCR Name nt:version using the namespace resolver of the current session. |
protected String |
ntVersionHistory
JCR Name nt:versionHistory using the namespace resolver of the current session. |
protected String |
ntVersionLabels
JCR Name nt:versionHistory using the namespace resolver of the current session. |
protected String |
propertyName1
Name of a property that will be used during a test case. |
protected String |
propertyName2
Name of a property that will be used during a test case. |
protected Session |
superuser
The superuser session for the default workspace |
protected String |
testNodeType
The node type name for newly created nodes. |
protected String |
testNodeTypeNoChildren
A node type that does not allow any child nodes, such as nt:base. |
protected String |
testPath
Relative path to the test root node. |
protected String |
testRoot
Absolute path to the test root node. |
protected Node |
testRootNode
The root Node for testing |
protected String |
workspaceName
Name of a workspace to use instead of the default workspace. |
Fields inherited from class org.apache.jackrabbit.test.JUnitTest |
---|
log |
Constructor Summary | |
---|---|
AbstractJCRTest()
|
Method Summary | |
---|---|
protected void |
cleanUp()
|
protected Node |
cleanUpTestRoot(Session s)
Reverts any pending changes made by s and deletes any nodes
under testRoot . |
protected String |
createRandomString(int numChars)
Creates a String with a random sequence of characters
using 'a' - 'z'. |
protected void |
ensureCanSetProperty(Node node,
String propertyName,
int propertyType,
boolean isMultiple)
Checks that the repository can set the property to the required type, otherwise aborts with NotExecutableException . |
protected void |
ensureCanSetProperty(Node node,
String propertyName,
Value value)
Checks that the repository can set the property to the required type, otherwise aborts with NotExecutableException . |
protected void |
ensureCanSetProperty(Node node,
String propertyName,
Value[] values)
Checks that the repository can set the property to the required type, otherwise aborts with NotExecutableException . |
protected void |
ensureMultipleWorkspacesSupported()
Checks that the repository supports multiple workspace, otherwise aborts with NotExecutableException . |
protected String |
getNonExistingWorkspaceName(Session session)
Returns the name of a workspace that is not accessible from session . |
String |
getProperty(String propName)
Returns the value of the configuration property with propName . |
protected long |
getSize(RangeIterator it)
Returns the size of the RangeIterator it . |
protected boolean |
isSupported(String descriptorKey)
Returns true if this repository support a certain optional
feature; otherwise false is returned. |
protected boolean |
needsMixin(Node node,
String mixin)
Checks whether the node already has the specified mixin node type |
void |
run(junit.framework.TestResult testResult)
Runs the test cases of this test class and reports the results to testResult . |
protected void |
setUp()
|
protected void |
tearDown()
|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static RepositoryHelper helper
public static final String NS_JCR_URI
public static final String NS_NT_URI
public static final String NS_MIX_URI
public static final String NS_SV_URI
protected String jcrPrimaryType
protected String jcrMixinTypes
protected String jcrPredecessors
protected String jcrSuccessors
protected String jcrCreated
protected String jcrVersionHistory
protected String jcrFrozenNode
protected String jcrFrozenUuid
protected String jcrRootVersion
protected String jcrBaseVersion
protected String jcrUUID
protected String jcrLockOwner
protected String jcrlockIsDeep
protected String jcrMergeFailed
protected String jcrSystem
protected String ntBase
protected String ntVersion
protected String ntVersionHistory
protected String ntVersionLabels
protected String ntFrozenNode
protected String mixReferenceable
protected String mixVersionable
protected String mixLockable
protected String ntQuery
protected String testPath
protected String testRoot
protected String testNodeType
protected String testNodeTypeNoChildren
protected String nodeName1
protected String nodeName2
protected String nodeName3
protected String nodeName4
protected String propertyName1
protected String propertyName2
protected String workspaceName
protected Session superuser
protected boolean isReadOnly
protected Node testRootNode
Node
for testing
Constructor Detail |
---|
public AbstractJCRTest()
Method Detail |
---|
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected void cleanUp() throws Exception
Exception
protected void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
public void run(junit.framework.TestResult testResult)
testResult
. In contrast to the default implementation of
TestCase.run()
this method will suppress tests errors with
a NotExecutableException
. That is, test cases that throw this
exception will still result as successful.
run
in interface junit.framework.Test
run
in class junit.framework.TestCase
testResult
- the test result.public String getProperty(String propName) throws RepositoryException
propName
.
The sequence how configuration properties are read is the follwoing:
javax.jcr.tck.<testClassName>.<testCaseName>.<propName>
javax.jcr.tck.<testClassName>.<propName>
javax.jcr.tck.<packageName>.<propName>
javax.jcr.tck.<propName>
<testClassName>
is the name of the test class without package prefix.<testMethodName>
is the name of the test method<packageName>
is the name of the package of the test class.
Example: packageName for org.apache.jackrabbit.test.api.BooleanPropertyTest
: api
propName
- the propName of the configration property.
null
if the property
does not exist.
RepositoryException
- if an error occurs while reading from
the configuration.protected long getSize(RangeIterator it)
RangeIterator
it
.
Note, that the RangeIterator
might get consumed, because
RangeIterator.getSize()
might return -1 (information unavailable).
it
- a RangeIterator
.
protected String getNonExistingWorkspaceName(Session session) throws RepositoryException
session
.
session
- the session.
RepositoryException
- if an error occurs.protected String createRandomString(int numChars)
String
with a random sequence of characters
using 'a' - 'z'.
numChars
- number of characters.
protected boolean isSupported(String descriptorKey) throws RepositoryException
true
if this repository support a certain optional
feature; otherwise false
is returned. If there is no
such descriptorKey
present in the repository, this method
also returns false.
descriptorKey
- the descriptor key.
true
if the option is supported.
RepositoryException
- if an error occurs.protected void ensureMultipleWorkspacesSupported() throws RepositoryException, NotExecutableException
NotExecutableException
.
NotExecutableException
- when the repository only supports a single
workspace
RepositoryException
protected void ensureCanSetProperty(Node node, String propertyName, int propertyType, boolean isMultiple) throws NotExecutableException, RepositoryException
NotExecutableException
.
NotExecutableException
- when setting the property to the required
type is not supported
RepositoryException
protected void ensureCanSetProperty(Node node, String propertyName, Value value) throws NotExecutableException, RepositoryException
NotExecutableException
.
NotExecutableException
- when setting the property to the required
type is not supported
RepositoryException
protected void ensureCanSetProperty(Node node, String propertyName, Value[] values) throws NotExecutableException, RepositoryException
NotExecutableException
.
NotExecutableException
- when setting the property to the required
type is not supported
RepositoryException
protected boolean needsMixin(Node node, String mixin) throws RepositoryException
RepositoryException
protected Node cleanUpTestRoot(Session s) throws RepositoryException
s
and deletes any nodes
under testRoot
. If there is no node at testRoot
then
the necessary nodes are created.
s
- the session to clean up.
Node
that represents the test root.
RepositoryException
- if an error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |