Package org.apache.jackrabbit.test
Class RepositoryHelper
- java.lang.Object
-
- org.apache.jackrabbit.test.RepositoryHelper
-
-
Constructor Summary
Constructors Constructor Description RepositoryHelper()
Creates a repository helper with configuration fromrepositoryStubImpl.properties
file.RepositoryHelper(Map config)
Creates a repository helper with additional configuration parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Principal
getKnownPrincipal(Session session)
Returns aPrincipal
identifying a known user.String
getProperty(String name)
Returns the value of the configuration property with specifiedname
.Credentials
getReadOnlyCredentials()
Returns the read-only credentials created from the username and password specified in the configuration properties.Session
getReadOnlySession()
Returns aSession
of the default workspace with read only access to the workspace.Session
getReadOnlySession(String workspaceName)
Returns aSession
of the workspace with nameworkspaceName
with read only access to the workspace.Credentials
getReadWriteCredentials()
Returns the read-write credentials created from the username and password specified in the configuration properties.Session
getReadWriteSession()
Returns aSession
of the default workspace with read and write access to the workspace.Session
getReadWriteSession(String workspaceName)
Returns aSession
of the workspace with nameworkspaceName
with read and write access to the workspace.Repository
getRepository()
Returns the repository instance to test.Credentials
getSuperuserCredentials()
Returns the superuser credentials created from the username and password specified in the configuration properties.Session
getSuperuserSession()
Returns a superuserSession
of the default workspace.Session
getSuperuserSession(String workspaceName)
Returns a superuserSession
of the workspace with nameworkspaceName
.Principal
getUnknownPrincipal(Session session)
Returns aPrincipal
identifiying an unknown user.
-
-
-
Constructor Detail
-
RepositoryHelper
public RepositoryHelper()
Creates a repository helper with configuration fromrepositoryStubImpl.properties
file.
-
RepositoryHelper
public RepositoryHelper(Map config)
Creates a repository helper with additional configuration parameters.- Parameters:
config
- configuration which overlays the values from the property file.
-
-
Method Detail
-
getRepository
public Repository getRepository() throws RepositoryException
Returns the repository instance to test.- Returns:
- the repository instance to test.
- Throws:
RepositoryException
- if the repository could not be obtained.
-
getSuperuserSession
public Session getSuperuserSession() throws RepositoryException
Returns a superuserSession
of the default workspace. The returnedSession
has read and write access to the whole workspace.- Returns:
- a superuser
Session
. - Throws:
RepositoryException
- if login to the repository failed.
-
getSuperuserSession
public Session getSuperuserSession(String workspaceName) throws RepositoryException
Returns a superuserSession
of the workspace with nameworkspaceName
. The returnedSession
has read and write access to the whole workspace.- Returns:
- a superuser
Session
. - Throws:
RepositoryException
- if login to the repository failed.
-
getReadWriteSession
public Session getReadWriteSession() throws RepositoryException
Returns aSession
of the default workspace with read and write access to the workspace.- Returns:
- a
Session
with read and write access. - Throws:
RepositoryException
- if login to the repository failed.
-
getReadWriteSession
public Session getReadWriteSession(String workspaceName) throws RepositoryException
Returns aSession
of the workspace with nameworkspaceName
with read and write access to the workspace.- Returns:
- a
Session
with read and write access. - Throws:
RepositoryException
- if login to the repository failed.
-
getReadOnlySession
public Session getReadOnlySession() throws RepositoryException
Returns aSession
of the default workspace with read only access to the workspace.- Returns:
- a
Session
with read only. - Throws:
RepositoryException
- if login to the repository failed.
-
getReadOnlySession
public Session getReadOnlySession(String workspaceName) throws RepositoryException
Returns aSession
of the workspace with nameworkspaceName
with read only access to the workspace.- Returns:
- a
Session
with read only access. - Throws:
RepositoryException
- if login to the repository failed.
-
getProperty
public String getProperty(String name) throws RepositoryException
Returns the value of the configuration property with specifiedname
. If the property does not existnull
is returned.Configuration properties are defined in the file:
repositoryStubImpl.properties
.- Parameters:
name
- the name of the property to retrieve.- Returns:
- the value of the property or
null
if non existent. - Throws:
RepositoryException
- if the configuration file cannot be found.
-
getReadOnlyCredentials
public Credentials getReadOnlyCredentials()
Returns the read-only credentials created from the username and password specified in the configuration properties. Configuration properties are defined in the file:repositoryStubImpl.properties
.- Returns:
- read-only
Credentials
-
getReadWriteCredentials
public Credentials getReadWriteCredentials()
Returns the read-write credentials created from the username and password specified in the configuration properties. Configuration properties are defined in the file:repositoryStubImpl.properties
.- Returns:
- read-write
Credentials
-
getSuperuserCredentials
public Credentials getSuperuserCredentials()
Returns the superuser credentials created from the username and password specified in the configuration properties. Configuration properties are defined in the file:repositoryStubImpl.properties
.- Returns:
- superuser
Credentials
-
getKnownPrincipal
public Principal getKnownPrincipal(Session session) throws RepositoryException
Returns aPrincipal
identifying a known user.- Parameters:
session
-- Throws:
RepositoryException
-
getUnknownPrincipal
public Principal getUnknownPrincipal(Session session) throws NotExecutableException, RepositoryException
Returns aPrincipal
identifiying an unknown user.- Parameters:
session
-- Throws:
NotExecutableException
RepositoryException
-
-