org.apache.sling.commons.testing.jcr
Class RepositoryTestBase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.sling.commons.testing.jcr.RepositoryTestBase
All Implemented Interfaces:
junit.framework.Test

public class RepositoryTestBase
extends junit.framework.TestCase

Base class for tests which need a Repository. Uses static variables to initialize it only once per test run.


Field Summary
protected  javax.jcr.Session session
           
protected  javax.jcr.Node testRoot
           
 
Constructor Summary
RepositoryTestBase()
           
 
Method Summary
protected  org.apache.sling.jcr.api.SlingRepository getRepository()
          Return a Repository - first call initializes it, and a JVM shutdown hook is registered to stop it
protected  javax.jcr.Session getSession()
          Return a JCR Session, initialized on demand
protected  javax.jcr.Node getTestRootNode()
          Return a test root node, created on demand, with a unique path
protected  void tearDown()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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

testRoot

protected javax.jcr.Node testRoot

session

protected javax.jcr.Session session
Constructor Detail

RepositoryTestBase

public RepositoryTestBase()
Method Detail

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

getSession

protected javax.jcr.Session getSession()
                                throws javax.jcr.RepositoryException,
                                       javax.naming.NamingException
Return a JCR Session, initialized on demand

Throws:
javax.jcr.RepositoryException
javax.naming.NamingException

getTestRootNode

protected javax.jcr.Node getTestRootNode()
                                  throws javax.jcr.RepositoryException,
                                         javax.naming.NamingException
Return a test root node, created on demand, with a unique path

Throws:
javax.jcr.RepositoryException
javax.naming.NamingException

getRepository

protected org.apache.sling.jcr.api.SlingRepository getRepository()
                                                          throws javax.jcr.RepositoryException,
                                                                 javax.naming.NamingException
Return a Repository - first call initializes it, and a JVM shutdown hook is registered to stop it

Throws:
javax.jcr.RepositoryException
javax.naming.NamingException


Copyright © 2007-2009. All Rights Reserved.