org.exoplatform.commons.testing.jcr
Class AbstractJCRTestCase

java.lang.Object
  extended by org.exoplatform.commons.testing.AbstractExoContainerTestCase
      extended by org.exoplatform.commons.testing.jcr.AbstractJCRTestCase

public abstract class AbstractJCRTestCase
extends AbstractExoContainerTestCase

Version:
$Revision$
Author:
Patrice Lamarque

Constructor Summary
AbstractJCRTestCase()
           
 
Method Summary
protected  javax.jcr.Node addFile(String path)
          Add a file at a given path.
protected  javax.jcr.Node addNode(String path)
          Add a new node to a given path.
protected  javax.jcr.Node addNode(String path, String nodetype)
          Add a new node to a given path.
protected  void assertBinaryPropertyNotEmpty(javax.jcr.Node node, String property)
          Asserts a property value is not empty
protected  void assertNodeExists(String path)
          Asserts a node exists at the given path
protected  void assertNodeNotExists(String path)
          Asserts a node does not exists at the given path
protected  void assertPropertyEquals(boolean expected, javax.jcr.Node node, String property)
           
protected  void assertPropertyEquals(String expected, javax.jcr.Node node, String property)
           
protected  void assertPropertyExists(javax.jcr.Node node, String property)
          Asserts a node has a property
 void beforeContainerStart()
           
protected  void deleteNode(String path)
          removes a node at a given path
protected  javax.jcr.Node getNode(String path)
          Load a node from path
protected  String getRepository()
          Get the repository for the current test
protected  javax.jcr.Session getSession()
          Get a session on the test workspace
protected  String getWorkspace()
          Get the workspace available for test data
 void initTempDir()
           
 void setUp()
           
 
Methods inherited from class org.exoplatform.commons.testing.AbstractExoContainerTestCase
afterContainerStart, getComponent, registerComponent, replaceComponent, startContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJCRTestCase

public AbstractJCRTestCase()
Method Detail

setUp

public void setUp()

beforeContainerStart

public void beforeContainerStart()
Overrides:
beforeContainerStart in class AbstractExoContainerTestCase

initTempDir

public void initTempDir()

getWorkspace

protected String getWorkspace()
                       throws javax.jcr.RepositoryException,
                              org.exoplatform.services.jcr.config.RepositoryConfigurationException
Get the workspace available for test data

Returns:
workspace name
Throws:
org.exoplatform.services.jcr.config.RepositoryConfigurationException
javax.jcr.RepositoryException

getRepository

protected String getRepository()
                        throws javax.jcr.RepositoryException,
                               org.exoplatform.services.jcr.config.RepositoryConfigurationException
Get the repository for the current test

Returns:
repository name
Throws:
org.exoplatform.services.jcr.config.RepositoryConfigurationException
javax.jcr.RepositoryException

assertNodeExists

protected void assertNodeExists(String path)
Asserts a node exists at the given path

Parameters:
path - path relative to root of test workspace

assertNodeNotExists

protected void assertNodeNotExists(String path)
Asserts a node does not exists at the given path

Parameters:
path - relative path to root of test workspace

getNode

protected javax.jcr.Node getNode(String path)
Load a node from path

Parameters:
path -
Returns:

getSession

protected javax.jcr.Session getSession()
                                throws javax.jcr.RepositoryException,
                                       org.exoplatform.services.jcr.config.RepositoryConfigurationException
Get a session on the test workspace

Returns:
a new system session
Throws:
org.exoplatform.services.jcr.config.RepositoryConfigurationException
Exception
javax.jcr.RepositoryException

addNode

protected javax.jcr.Node addNode(String path)
Add a new node to a given path. intermediary are created if needed.

Parameters:
path - relative path to root
Returns:
the newly added node

addNode

protected javax.jcr.Node addNode(String path,
                                 String nodetype)
Add a new node to a given path. intermediary are created if needed.

Parameters:
path - relative path to root
nodetype - nodetype for the last node to create
Returns:
the newly added node

addFile

protected javax.jcr.Node addFile(String path)
Add a file at a given path. An nt:file is added at 'path' with a sample text/plain jcr:content for the string "stuff"

Parameters:
path - relative path to root
Returns:
the node for the newly added file

deleteNode

protected void deleteNode(String path)
removes a node at a given path

Parameters:
path - relative path from root

assertPropertyExists

protected void assertPropertyExists(javax.jcr.Node node,
                                    String property)
Asserts a node has a property

Parameters:
node - note to assert
property - propertyName

assertBinaryPropertyNotEmpty

protected void assertBinaryPropertyNotEmpty(javax.jcr.Node node,
                                            String property)
Asserts a property value is not empty

Parameters:
node -
property -

assertPropertyEquals

protected void assertPropertyEquals(String expected,
                                    javax.jcr.Node node,
                                    String property)

assertPropertyEquals

protected void assertPropertyEquals(boolean expected,
                                    javax.jcr.Node node,
                                    String property)


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.