Class AbstractJCRTest

    • Field Detail

      • jcrPrimaryType

        protected String jcrPrimaryType
        JCR Name jcr:primaryType using the namespace resolver of the current session.
      • jcrMixinTypes

        protected String jcrMixinTypes
        JCR Name jcr:mixinTypes using the namespace resolver of the current session.
      • jcrPredecessors

        protected String jcrPredecessors
        JCR Name jcr:predecessors using the namespace resolver of the current session.
      • jcrSuccessors

        protected String jcrSuccessors
        JCR Name jcr:successors using the namespace resolver of the current session.
      • jcrCreated

        protected String jcrCreated
        JCR Name jcr:created using the namespace resolver of the current session.
      • jcrVersionHistory

        protected String jcrVersionHistory
        JCR Name jcr:created using the namespace resolver of the current session.
      • jcrCopiedFrom

        protected String jcrCopiedFrom
        JCR Name jcr:copiedFrom using the namespace resolver of the current session.
      • jcrFrozenNode

        protected String jcrFrozenNode
        JCR Name jcr:frozenNode using the namespace resolver of the current session.
      • jcrFrozenUuid

        protected String jcrFrozenUuid
        JCR Name jcr:frozenUuid using the namespace resolver of the current session.
      • jcrRootVersion

        protected String jcrRootVersion
        JCR Name jcr:rootVersion using the namespace resolver of the current session.
      • jcrIsCheckedOut

        protected String jcrIsCheckedOut
        JCR Name jcr:isCheckedOut using the namespace resolver of the current session.
      • jcrBaseVersion

        protected String jcrBaseVersion
        JCR Name jcr:baseVersion using the namespace resolver of the current session.
      • jcrUUID

        protected String jcrUUID
        JCR Name jcr:uuid using the namespace resolver of the current session.
      • jcrLockOwner

        protected String jcrLockOwner
        JCR Name jcr:lockOwner using the namespace resolver of the current session.
      • jcrlockIsDeep

        protected String jcrlockIsDeep
        JCR Name jcr:lockIsDeep using the namespace resolver of the current session.
      • jcrMergeFailed

        protected String jcrMergeFailed
        JCR Name jcr:mergeFailed using the namespace resolver of the current session.
      • jcrSystem

        protected String jcrSystem
        JCR Name jcr:system using the namespace resolver of the current session.
      • ntBase

        protected String ntBase
        JCR Name nt:base using the namespace resolver of the current session.
      • ntUnstructured

        protected String ntUnstructured
        JCR Name nt:unstructured using the namespace resolver of the current session.
      • ntVersion

        protected String ntVersion
        JCR Name nt:version using the namespace resolver of the current session.
      • ntVersionHistory

        protected String ntVersionHistory
        JCR Name nt:versionHistory using the namespace resolver of the current session.
      • ntVersionLabels

        protected String ntVersionLabels
        JCR Name nt:versionHistory using the namespace resolver of the current session.
      • ntFrozenNode

        protected String ntFrozenNode
        JCR Name nt:frozenNode using the namespace resolver of the current session.
      • mixReferenceable

        protected String mixReferenceable
        JCR Name mix:referenceable using the namespace resolver of the current session.
      • mixVersionable

        protected String mixVersionable
        JCR Name mix:versionable using the namespace resolver of the current session.
      • mixSimpleVersionable

        protected String mixSimpleVersionable
        JCR Name mix:simpleVersionable using the namespace resolver of the current session.
      • mixLockable

        protected String mixLockable
        JCR Name mix:lockable using the namespace resolver of the current session.
      • mixTitle

        protected String mixTitle
        JCR Name mix:title using the namespace resolver of the current session.
      • mixShareable

        protected String mixShareable
        JCR Name mix:shareable using the namespace resolver of the current session.
      • ntQuery

        protected String ntQuery
        JCR Name nt:query using the namespace resolver of the current session.
      • ntActivity

        protected String ntActivity
        JCR Name nt:activity using the namespace resolver of the current session.
      • testPath

        protected String testPath
        Relative path to the test root node.
      • testRoot

        protected String testRoot
        Absolute path to the test root node.
      • testNodeType

        protected String testNodeType
        The node type name for newly created nodes.
      • testNodeTypeTestRoot

        protected String testNodeTypeTestRoot
        The node type name for the test root node.
      • testNodeTypeNoChildren

        protected String testNodeTypeNoChildren
        A node type that does not allow any child nodes, such as nt:base.
      • nodeName1

        protected String nodeName1
        Name of a node that will be created during a test case.
      • nodeName2

        protected String nodeName2
        Name of a node that will be created during a test case.
      • nodeName3

        protected String nodeName3
        Name of a node that will be created during a test case.
      • nodeName4

        protected String nodeName4
        Name of a node that will be created during a test case.
      • propertyName1

        protected String propertyName1
        Name of a property that will be used during a test case.
      • propertyName2

        protected String propertyName2
        Name of a property that will be used during a test case.
      • workspaceName

        protected String workspaceName
        Name of a workspace to use instead of the default workspace.
      • superuser

        protected Session superuser
        The superuser session for the default workspace
      • isReadOnly

        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.
      • testRootNode

        protected Node testRootNode
        The root Node for testing
    • Constructor Detail

      • AbstractJCRTest

        public AbstractJCRTest()
    • Method Detail

      • run

        public void run​(junit.framework.TestResult testResult)
        Runs the test cases of this test class and reports the results to 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.
        Specified by:
        run in interface junit.framework.Test
        Overrides:
        run in class junit.framework.TestCase
        Parameters:
        testResult - the test result.
      • getHelper

        protected RepositoryHelper getHelper()
        Returns:
        the repository helper instance that is associated with this test.
      • getProperty

        public String getProperty​(String propName)
                           throws RepositoryException
        Returns the value of the configuration property with propName. The sequence how configuration properties are read is the follwoing:
        1. javax.jcr.tck.<testClassName>.<testCaseName>.<propName>
        2. javax.jcr.tck.<testClassName>.<propName>
        3. javax.jcr.tck.<packageName>.<propName>
        4. javax.jcr.tck.<propName>
        Where:
        • <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
        Parameters:
        propName - the propName of the configration property.
        Returns:
        the value of the property or null if the property does not exist.
        Throws:
        RepositoryException - if an error occurs while reading from the configuration.
      • getProperty

        public String getProperty​(String name,
                                  String defaultValue)
                           throws RepositoryException
        Returns the value of the configuration property with specified name. If the property does not exist defaultValue is returned.

        Configuration properties are defined in the file: repositoryStubImpl.properties.

        Parameters:
        name - the name of the property to retrieve.
        defaultValue - the default value if the property does not exist.
        Returns:
        the value of the property or defaultValue if non existent.
        Throws:
        RepositoryException - if the configuration file cannot be found.
      • getJcrValue

        public Value getJcrValue​(Session s,
                                 String valueProp,
                                 String typeProp,
                                 String defaultValue)
                          throws RepositoryException
        Create a JCR value based on the configuration.
        Parameters:
        s -
        valueProp - Name of the config property that contains the property value.
        typeProp - Name of the config property that contains the property type. If the config parameter is missing, PropertyType.STRING is used to create the JCR value.
        defaultValue - Default value to be used if the config does not define the value property.
        Returns:
        JCR value to be used for a test.
        Throws:
        RepositoryException
      • getSize

        protected long getSize​(RangeIterator it)
        Returns the size of the RangeIterator it. Note, that the RangeIterator might get consumed, because RangeIterator.getSize() might return -1 (information unavailable).
        Parameters:
        it - a RangeIterator.
        Returns:
        the size of the iterator (number of elements).
      • getLocalName

        protected static String getLocalName​(String jcrName)
        Returns the local name for the given jcrName.
        Parameters:
        jcrName - the name.
        Returns:
        the local name part.
      • getPrefix

        protected static String getPrefix​(String jcrName)
        Returns the prefix for the given jcrName.
        Parameters:
        jcrName - the name.
        Returns:
        the prefix part (empty string when not prefixed)
      • getNonExistingWorkspaceName

        protected String getNonExistingWorkspaceName​(Session session)
                                              throws RepositoryException
        Returns the name of a workspace that is not accessible from session.
        Parameters:
        session - the session.
        Returns:
        name of a non existing workspace.
        Throws:
        RepositoryException - if an error occurs.
      • createRandomString

        protected String createRandomString​(int numChars)
        Creates a String with a random sequence of characters using 'a' - 'z'.
        Parameters:
        numChars - number of characters.
        Returns:
        the generated String.
      • isSupported

        protected boolean isSupported​(String descriptorKey)
                               throws RepositoryException
        Returns 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.
        Parameters:
        descriptorKey - the descriptor key.
        Returns:
        true if the option is supported.
        Throws:
        RepositoryException - if an error occurs.
      • cleanUpTestRoot

        protected Node cleanUpTestRoot​(Session s)
                                throws RepositoryException
        Reverts any pending changes made by s and deletes any nodes under testRoot. If there is no node at testRoot then the necessary nodes are created.
        Parameters:
        s - the session to clean up.
        Returns:
        the Node that represents the test root.
        Throws:
        RepositoryException - if an error occurs.