|
||||||||
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.opencms.test.OpenCmsTestCase
public class OpenCmsTestCase
Extends the JUnit standard with methods to handle an OpenCms database test instance.
The required configuration files are located in the
${test.data.path}/WEB-INF
folder structure.
To run this test you might have to change the database connection
values in the provided ${test.data.path}/WEB-INF/config/opencms.properties
file.
Nested Class Summary | |
---|---|
protected static class |
OpenCmsTestCase.ConnectionData
Class to bundle the connection information. |
Field Summary | |
---|---|
static int |
ARTICLE_TYPEID
test article type id constant. |
static String |
DB_MYSQL
Key for tests on MySql database. |
static String |
DB_ORACLE
Key for tests on Oracle database. |
protected static OpenCmsTestCase.ConnectionData |
m_additionalConnection
Additional connection data. |
static CmsParameterConfiguration |
m_configuration
The OpenCms/database configuration. |
OpenCmsTestResourceStorage |
m_currentResourceStrorage
The current resource storage. |
protected static OpenCmsTestCase.ConnectionData |
m_defaultConnection
The user connection data. |
static String |
m_defaultTablespace
Name of the default tablespace (oracle only). |
static String |
m_indexTablespace
Name of the index tablespace (oracle only). |
static HashMap<String,OpenCmsTestResourceStorage> |
m_resourceStorages
The internal storages. |
protected static OpenCmsTestCase.ConnectionData |
m_setupConnection
The setup connection data. |
static String |
m_tempTablespace
Name of the temporary tablespace (oracle only). |
Constructor Summary | |
---|---|
OpenCmsTestCase(String arg0)
Default JUnit constructor. |
|
OpenCmsTestCase(String arg0,
boolean initialize)
JUnit constructor. |
Method Summary | |
---|---|
protected static void |
addTestDataPath(String dataPath)
Adds an additional path to the list of test data configuration files. |
void |
assertAce(CmsObject cms,
String resourceName,
CmsAccessControlEntry ace)
Compares an access control entry of a resource with a given access control entry. |
void |
assertAcl(CmsObject cms,
String resourceName,
CmsUUID principal,
CmsPermissionSet permission)
Compares an access control list of a resource with a given access control permission. |
void |
assertAcl(CmsObject cms,
String modifiedResource,
String resourceName,
CmsUUID principal,
CmsPermissionSet permission)
Compares an access control list of a resource with a given access control permission. |
void |
assertContains(String content,
String pattern)
Tests if a pattern can be found in a content string. |
void |
assertContainsNot(String content,
String pattern)
Tests if a pattern cannot be found in a content string. |
void |
assertContent(CmsObject cms,
String resourceName,
byte[] content)
Compares the current content of a (file) resource with a given content. |
void |
assertDateContent(CmsObject cms,
String resourceName,
long dateContent)
Tests if the current content date of a resource is equals to the given date. |
void |
assertDateContentAfter(CmsObject cms,
String resourceName,
long dateContent)
Tests if the the current date content of a resource is later than the given date. |
void |
assertDateCreated(CmsObject cms,
String resourceName,
long dateCreated)
Compares the current date created of a resource with a given date. |
void |
assertDateCreatedAfter(CmsObject cms,
String resourceName,
long dateCreated)
Tests if the the creation date of a resource is later then a given date. |
void |
assertDateExpired(CmsObject cms,
String resourceName,
long dateExpired)
Compares the current expiration date of a resource with a given date. |
void |
assertDateLastModified(CmsObject cms,
String resourceName,
long dateLastModified)
Compares the current date last modified of a resource with a given date. |
void |
assertDateLastModifiedAfter(CmsObject cms,
String resourceName,
long dateLastModified)
Tests if the the current date last modified of a resource is later than the given date. |
void |
assertDateReleased(CmsObject cms,
String resourceName,
long dateReleased)
Compares the current release date of a resource with a given date. |
void |
assertEquals(CmsException e1,
CmsException e2)
Tests if the given exceptions are equal (or both null). |
void |
assertEquals(CmsPublishJobBase j1,
CmsPublishJobBase j2,
boolean comparePublishLists,
boolean compareTime)
Tests if the given jobs are internally equal. |
void |
assertEquals(Document d1,
Document d2)
Tests if the given xml document objects are equals (or both null). |
void |
assertFilter(CmsObject cms,
CmsResource resource,
OpenCmsTestResourceFilter filter)
Compares a given resource to its stored version containing the state before a CmsObject method was called. |
void |
assertFilter(CmsObject cms,
OpenCmsTestResourceStorageEntry storedResource,
CmsResource res,
OpenCmsTestResourceFilter filter)
Compares a stored Cms resource with another Cms resource instance using a specified filter. |
void |
assertFilter(CmsObject cms,
String resourceName,
OpenCmsTestResourceFilter filter)
Compares a resource to its stored version containing the state before a CmsObject method was called. |
void |
assertFilter(CmsObject cms,
String resourceName1,
String resourceName2,
OpenCmsTestResourceFilter filter)
Compares a resource to another given resource using a specified filter. |
void |
assertFlags(CmsObject cms,
String resourceName,
int flag)
Tests whether a resource has currently a specified flag set. |
void |
assertHistory(CmsObject cms,
String resourcename,
int versionCount)
Checks if the given resource has the correct history count, also check if all entries in the history can be read. |
void |
assertHistoryForRestored(CmsObject cms,
String resourcename,
int versionCount)
Checks if the given resource has the correct history count, also check if all entries in the history can be read. |
void |
assertIsFolder(CmsObject cms,
String resourceName)
Ensures that the given resource is a folder. |
void |
assertIsIdentical(Object o1,
Object o2)
Tests if the specified object is identical with another object. |
void |
assertIsNotIdentical(Object o1,
Object o2)
Tests if the specified object is not identical with another object. |
void |
assertLock(CmsObject cms,
String resourceName)
Validates if a specified resource is somehow locked to the current user. |
void |
assertLock(CmsObject cms,
String resourceName,
CmsLockType lockType)
Validates if a specified resource has a lock of a given type for the current user. |
void |
assertLock(CmsObject cms,
String resourceName,
CmsLockType lockType,
CmsUser user)
Validates if a specified resource has a lock of a given type and is locked for a principal. |
void |
assertModifiedInCurrentProject(CmsObject cms,
String resourceName,
boolean shouldHaveRedFlag)
Validates the project status of a resource, i.e. |
void |
assertPermissionString(CmsObject cms,
String resourceName,
I_CmsPrincipal principal,
String permissionString)
Asserts the given permission string with the access control entry for the given resource and principal. |
void |
assertProject(CmsObject cms,
String resourceName,
CmsProject project)
Compares the current project of a resource with a given CmsProject. |
void |
assertPropertyChanged(CmsObject cms,
String resourceName,
CmsProperty property)
Compares the current properties of a resource with the stored values and a given, changed property. |
void |
assertPropertyChanged(CmsObject cms,
String resourceName,
List<CmsProperty> excludeList)
Compares the current properties of a resource with the stored values and a list of changed property. |
void |
assertPropertydefinitionExist(CmsObject cms,
CmsPropertyDefinition propertyDefinition)
Tests if a properetydefintion does exist. |
void |
assertPropertydefinitions(CmsObject cms,
List<CmsPropertyDefinition> propertyDefintions,
CmsPropertyDefinition exclude)
Tests the list the propertydefinitions are identical to a given list except one exlclude propertydefintion. |
void |
assertPropertyEqual(CmsObject cms,
String resourceName)
Compares the current properties of a resource with the stored values. |
void |
assertPropertyNew(CmsObject cms,
String resourceName,
CmsProperty property)
Compares the current properties of a resource with the stored values and a given, new property. |
void |
assertPropertyNew(CmsObject cms,
String resourceName,
List excludeList)
Compares the current properties of a resource with the stored values and a list of new property. |
void |
assertPropertyRemoved(CmsObject cms,
String resourceName,
CmsProperty property)
Compares the current properties of a resource with the stored values and a given, deleted property. |
void |
assertPropertyRemoved(CmsObject cms,
String resourceName,
List excludeList)
Compares the current properties of a resource with the stored values and a list of deleted properties. |
void |
assertRelation(CmsRelation expected,
CmsRelation actual)
Asserts the equality of the two given relations. |
void |
assertResourceId(CmsObject cms,
String resourceName,
CmsUUID resourceId)
Compares the current resource id of a resource with a given id. |
void |
assertResourceType(CmsObject cms,
String resourceName,
int resourceType)
Ensures that the given resource is of a certain type. |
void |
assertSiblingCount(CmsObject cms,
String resourceName,
int count)
Validates if the current sibling count of a resource matches the given number. |
void |
assertSiblingCountIncremented(CmsObject cms,
String resourceName,
int increment)
Validates if the current sibling count of a resource has been incremented compared to it's previous sibling count. |
void |
assertState(CmsObject cms,
String resourceName,
CmsResourceState state)
Compares the current state of a resource with a given state. |
void |
assertStructureId(CmsObject cms,
String resourceName,
CmsUUID structureId)
Compares the current structure id of a resource with a given id. |
void |
assertType(CmsObject cms,
String resourceName,
int type)
Compares the current type of a resource with a given type. |
void |
assertUserCreated(CmsObject cms,
String resourceName,
CmsUser user)
Compares the user who created a resource with a given user. |
void |
assertUserLastModified(CmsObject cms,
String resourceName,
CmsUser user)
Compares the current user last modified of a resource with a given user. |
void |
assertVersion(CmsObject cms,
String resourceName,
int version)
Tests if the current version of a resource is equals to the given version number. |
protected static void |
checkErrors(org.opencms.setup.CmsSetupDb setupDb)
Check the setup DB for errors that might have occurred. |
void |
createStorage(String name)
Creates a new storage object. |
protected void |
deleteFile(String absolutePath)
Deletes the given file from the rfs. |
protected void |
echo(String message)
Writes a message to the current output stream. |
static int |
generateContent(CmsObject cms,
String vfsFolder,
int numberOfFiles,
double fileTypeDistribution)
Generates a sub tree of folders with files. |
static int |
generateContent(CmsObject cms,
String vfsFolder,
int maxWidth,
int maxDepth,
int maxProps,
double propertyDistribution,
int maxNumberOfFiles,
double fileTypeDistribution)
Generates a sub tree of folders with files. |
static String |
generateName(int maxLen)
Generate a new random name. |
static List<CmsProperty> |
generateProperties(CmsObject cms,
int maxProps,
int propValueLength,
double propertyDistribution)
Generates random properties. |
static int |
generateResources(CmsObject cms,
String rfsName,
String vfsFolder,
int n,
int type,
int maxProps,
double propertyDistribution)
Generates n new resources in a given folder. |
static junit.framework.Test |
generateSetupTestWrapper(Class<? extends junit.framework.Test> testClass,
String importFolder,
String targetFolder)
Generates a wrapper for a test class which handles setting up the OpenCms instance. |
static void |
generateUsers(CmsObject cms,
String groupName,
int n)
Generates n new users for a given group. |
protected CmsObject |
getCmsObject()
Returns an initialized CmsObject with admin user permissions, running in the "/sites/default" site root. |
String |
getConnectionName()
Should return the additional connection name. |
String |
getDatabaseProduct()
Returns the name of the database product. |
static String |
getDbProduct()
Returns the currently used database/configuration. |
CmsResourceState |
getPreCalculatedState(String resourceName)
Gets an precalculate resource state from the storage. |
protected static Map<String,String> |
getReplacer(OpenCmsTestCase.ConnectionData connectionData)
Returns an initialized replacer map. |
protected static String |
getSetupDataPath()
Returns the path to the data files used by the setup wizard. |
protected static org.opencms.setup.CmsSetupDb |
getSetupDb(OpenCmsTestCase.ConnectionData connection)
Returns an initialized DB setup object. |
protected static String |
getTestDataPath(String filename)
Returns the path to a file in the test data configuration, or null if the given file can not be found. |
static void |
importData(String importFolder,
String targetFolder)
Does a database import from the given RFS folder to the given VFS folder. |
protected static void |
importResources(CmsObject cms,
String importFile,
String targetPath)
Imports a resource into the Cms. |
protected static CmsResource |
importTestResource(CmsObject cms,
String rfsPath,
String vfsPath,
int type,
List<CmsProperty> properties)
Imports a resource from the RFS test directories to the VFS. |
static void |
initTestDataPath()
Initializes the path to the test data configuration files using the default path. |
protected static void |
removeDatabase()
Removes the OpenCms database test instance. |
protected static void |
removeDatabase(OpenCmsTestCase.ConnectionData setupConnection,
OpenCmsTestCase.ConnectionData defaultConnection,
boolean handleErrors)
Removes the OpenCms database test instance. |
static void |
removeOpenCms()
Removes the initialized OpenCms database and all temporary files created during the test run. |
protected void |
removeStorage(String name)
Removes and deletes a storage object. |
void |
resetMapping()
Resets the mapping for resourcenames. |
protected void |
restart()
Restarts the cms. |
static void |
restartOpenCms()
Restarts the OpenCms shell. |
void |
setMapping(String source,
String target)
Sets the mapping for resourcenames. |
protected static void |
setupDatabase()
Creates a new OpenCms test database including the tables. |
protected static void |
setupDatabase(OpenCmsTestCase.ConnectionData setupConnection,
OpenCmsTestCase.ConnectionData defaultConnection,
boolean handleErrors)
Creates a new OpenCms test database including the tables. |
static CmsObject |
setupOpenCms(String importFolder,
String targetFolder)
Sets up a complete OpenCms instance with configuration from the config-ori folder, creating the usual projects, and importing a default database. |
static CmsObject |
setupOpenCms(String importFolder,
String targetFolder,
boolean publish)
Sets up a complete OpenCms instance with configuration from the config-ori folder, creating the usual projects, and importing a default database. |
static CmsObject |
setupOpenCms(String importFolder,
String targetFolder,
String specialConfigFolder)
Sets up a complete OpenCms instance with configuration from the config-ori folder, creating the usual projects, and importing a default database. |
static CmsObject |
setupOpenCms(String importFolder,
String targetFolder,
String configFolder,
boolean publish)
Sets up a complete OpenCms instance, creating the usual projects, and importing a default database. |
static CmsObject |
setupOpenCms(String importFolder,
String targetFolder,
String configFolder,
String specialConfigFolder,
boolean publish)
Sets up a complete OpenCms instance, creating the usual projects, and importing a default database. |
void |
storeResources(CmsObject cms,
String resourceName)
Stores the state (e.g. |
void |
storeResources(CmsObject cms,
String resourceName,
boolean storeSubresources)
Stores the state (e.g. |
void |
switchStorage(String name)
Switches the internal resource storage. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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 final int ARTICLE_TYPEID
public static final String DB_MYSQL
public static final String DB_ORACLE
public static CmsParameterConfiguration m_configuration
public static String m_defaultTablespace
public static String m_indexTablespace
public static HashMap<String,OpenCmsTestResourceStorage> m_resourceStorages
public static String m_tempTablespace
protected static OpenCmsTestCase.ConnectionData m_additionalConnection
protected static OpenCmsTestCase.ConnectionData m_defaultConnection
protected static OpenCmsTestCase.ConnectionData m_setupConnection
public OpenCmsTestResourceStorage m_currentResourceStrorage
Constructor Detail |
---|
public OpenCmsTestCase(String arg0)
arg0
- JUnit parameterspublic OpenCmsTestCase(String arg0, boolean initialize)
arg0
- JUnit parametersinitialize
- indicates if the configuration will be initializedMethod Detail |
---|
public static int generateContent(CmsObject cms, String vfsFolder, int numberOfFiles, double fileTypeDistribution) throws Exception
cms
- the cms contextvfsFolder
- name of the foldernumberOfFiles
- the number of files to generatefileTypeDistribution
- a percentage: x% binary files and (1-x)% text files
Exception
- if something goes wrongpublic static int generateContent(CmsObject cms, String vfsFolder, int maxWidth, int maxDepth, int maxProps, double propertyDistribution, int maxNumberOfFiles, double fileTypeDistribution) throws Exception
cms
- the cms contextvfsFolder
- where to create the subtreemaxWidth
- an upper bound for the number of subfolder a folder should havemaxDepth
- an upper bound for depth of the genearted subtreemaxProps
- upper bound for number of properties to create for each resourcepropertyDistribution
- a percentage: x% shared props and (1-x)% individuals propsmaxNumberOfFiles
- upper bound for the number of files in each folderfileTypeDistribution
- a percentage: x% binary files and (1-x)% text files
Exception
- if something goes wrongpublic static String generateName(int maxLen)
maxLen
- upper bound for the length of the name
public static List<CmsProperty> generateProperties(CmsObject cms, int maxProps, int propValueLength, double propertyDistribution) throws CmsException
cms
- the cms contextmaxProps
- upper bound for number of properties to create for each resourcepropValueLength
- upper bound for the number of char for the valuespropertyDistribution
- a percentage: x% shared props and (1-x)% individuals props
CmsProperty
objects
CmsException
- if something goes wrongpublic static int generateResources(CmsObject cms, String rfsName, String vfsFolder, int n, int type, int maxProps, double propertyDistribution) throws Exception
cms
- the cms contextrfsName
- the rfs file for the contentvfsFolder
- the folder to create the resources inn
- number of resources to generatetype
- the type of the resourcemaxProps
- upper bound for number of properties to create for each resourcepropertyDistribution
- a percentage: x% shared props and (1-x)% individuals props
Exception
- if something goes wrongpublic static junit.framework.Test generateSetupTestWrapper(Class<? extends junit.framework.Test> testClass, String importFolder, String targetFolder)
testClass
- the test class to wrapimportFolder
- the RFS folder with the test data to importtargetFolder
- the VFS target folder for the test data
public static void generateUsers(CmsObject cms, String groupName, int n) throws CmsException
cms
- the cms contextgroupName
- the group name, group will be creating if group does not existsn
- number of users to generate
CmsException
- if something goes wrongpublic static String getDbProduct()
public static void importData(String importFolder, String targetFolder)
importFolder
- the RFS folder to import fromtargetFolder
- the VFS folder to import intopublic static void initTestDataPath()
public static void removeOpenCms()
public static void restartOpenCms()
public static CmsObject setupOpenCms(String importFolder, String targetFolder)
importFolder
- the folder to import in the "real" FStargetFolder
- the target folder of the import in the VFS
public static CmsObject setupOpenCms(String importFolder, String targetFolder, boolean publish)
importFolder
- the folder to import in the "real" FStargetFolder
- the target folder of the import in the VFSpublish
- flag to signalize if the publish script should be called
public static CmsObject setupOpenCms(String importFolder, String targetFolder, String specialConfigFolder)
importFolder
- the folder to import in the "real" FStargetFolder
- the target folder of the import in the VFSspecialConfigFolder
- the folder that contains the special configuration files for this setup
public static CmsObject setupOpenCms(String importFolder, String targetFolder, String configFolder, boolean publish)
importFolder
- the folder to import in the "real" FStargetFolder
- the target folder of the import in the VFSconfigFolder
- the folder to copy the configuration filespublish
- publish only if set
public static CmsObject setupOpenCms(String importFolder, String targetFolder, String configFolder, String specialConfigFolder, boolean publish)
importFolder
- the folder to import in the "real" FStargetFolder
- the target folder of the import in the VFSconfigFolder
- the folder to copy the standard configuration files fromspecialConfigFolder
- the folder that contains the special configuration fiiles for this setuppublish
- publish only if set
protected static void addTestDataPath(String dataPath)
dataPath
- the path to addprotected static void checkErrors(org.opencms.setup.CmsSetupDb setupDb)
setupDb
- the setup DB object to checkprotected static Map<String,String> getReplacer(OpenCmsTestCase.ConnectionData connectionData)
connectionData
- the connection data to derive the replacer information
protected static String getSetupDataPath()
Whenever possible use this path to ensure that the files used for testing are actually the same as for the setup.
protected static org.opencms.setup.CmsSetupDb getSetupDb(OpenCmsTestCase.ConnectionData connection)
connection
- the connection data
protected static String getTestDataPath(String filename)
null
if the given file can not be found.This methods searches the given file in all configured test data paths. It returns the file found first.
filename
- the file name to look up
protected static void importResources(CmsObject cms, String importFile, String targetPath) throws CmsException
cms
- an initialized CmsObjectimportFile
- the name (absolute Path) of the import resource (zip or folder)targetPath
- the name (absolute Path) of the target folder in the VFS
CmsException
- if something goes wrongprotected static CmsResource importTestResource(CmsObject cms, String rfsPath, String vfsPath, int type, List<CmsProperty> properties) throws Exception
The imported resource will be automatically unlocked.
cms
- the current users OpenCms contextrfsPath
- the RTF path of the resource to import, must be a path accessibly by the current class loadervfsPath
- the VFS path for the imported resourcetype
- the type for the imported resourceproperties
- the properties for the imported resource
Exception
- if the import failsprotected static void removeDatabase()
protected static void removeDatabase(OpenCmsTestCase.ConnectionData setupConnection, OpenCmsTestCase.ConnectionData defaultConnection, boolean handleErrors)
setupConnection
- the setup connectiondefaultConnection
- the default connectionhandleErrors
- flag to indicate if errors should be handled/checkedprotected static void setupDatabase()
Any existing instance of the test database is forcefully removed first.
protected static void setupDatabase(OpenCmsTestCase.ConnectionData setupConnection, OpenCmsTestCase.ConnectionData defaultConnection, boolean handleErrors)
setupConnection
- the setup connectiondefaultConnection
- the default connectionhandleErrors
- flag to indicate if errors should be handled/checkedpublic void assertAce(CmsObject cms, String resourceName, CmsAccessControlEntry ace)
cms
- the CmsObjectresourceName
- the name of the resource to compareace
- the access control entry to compare or null if to compare with the stored valuespublic void assertAcl(CmsObject cms, String resourceName, CmsUUID principal, CmsPermissionSet permission)
cms
- the CmsObjectresourceName
- the name of the resource to compareprincipal
- the principal of the permission set or null if to compare with the stored valuespermission
- the permission set to comparepublic void assertAcl(CmsObject cms, String modifiedResource, String resourceName, CmsUUID principal, CmsPermissionSet permission)
cms
- the CmsObjectmodifiedResource
- the name of the which had its permissions changedresourceName
- the name of the resource to compareprincipal
- the principal of the permission set or null if to compare with the stored valuespermission
- the permission set to comparepublic void assertContains(String content, String pattern)
Fails if the pattern is not found.
content
- the content stringpattern
- the pattern to search forpublic void assertContainsNot(String content, String pattern)
Fails if the pattern is found.
content
- the content stringpattern
- the pattern to search forpublic void assertContent(CmsObject cms, String resourceName, byte[] content)
cms
- the CmsObjectresourceName
- the name of the resource to comparecontent
- the content to comparepublic void assertDateContent(CmsObject cms, String resourceName, long dateContent)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateContent
- the content datepublic void assertDateContentAfter(CmsObject cms, String resourceName, long dateContent)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateContent
- the content datepublic void assertDateCreated(CmsObject cms, String resourceName, long dateCreated)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateCreated
- the creation datepublic void assertDateCreatedAfter(CmsObject cms, String resourceName, long dateCreated)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateCreated
- the creation datepublic void assertDateExpired(CmsObject cms, String resourceName, long dateExpired)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateExpired
- the expiration datepublic void assertDateLastModified(CmsObject cms, String resourceName, long dateLastModified)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateLastModified
- the last modification datepublic void assertDateLastModifiedAfter(CmsObject cms, String resourceName, long dateLastModified)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateLastModified
- the last modification datepublic void assertDateReleased(CmsObject cms, String resourceName, long dateReleased)
cms
- the CmsObjectresourceName
- the name of the resource to comparedateReleased
- the release datepublic void assertEquals(CmsException e1, CmsException e2)
e1
- first exception to comparee2
- second exception to comparepublic void assertEquals(CmsPublishJobBase j1, CmsPublishJobBase j2, boolean comparePublishLists, boolean compareTime)
(May have different wrapper classes)
j1
- first job to comparej2
- second job to comparecomparePublishLists
- if the publish lists should be compared, toocompareTime
- if the timestamps should be compared, toopublic void assertEquals(Document d1, Document d2)
d1
- first document to compared2
- second document to comparepublic void assertFilter(CmsObject cms, CmsResource resource, OpenCmsTestResourceFilter filter)
cms
- the CmsObjectresource
- the resource to comparefilter
- the filter contianing the flags defining which attributes to comparepublic void assertFilter(CmsObject cms, OpenCmsTestResourceStorageEntry storedResource, CmsResource res, OpenCmsTestResourceFilter filter)
cms
- the current user's Cms objectstoredResource
- a stored Cms resource representing the state before an operationres
- a Cms resource representing the state after an operationfilter
- a filter to compare both resourcespublic void assertFilter(CmsObject cms, String resourceName, OpenCmsTestResourceFilter filter) throws CmsException
cms
- the CmsObjectresourceName
- the name of the resource to comparefilter
- the filter contianing the flags defining which attributes to compare
CmsException
- if something goes wrongpublic void assertFilter(CmsObject cms, String resourceName1, String resourceName2, OpenCmsTestResourceFilter filter)
cms
- the current user's Cms objectresourceName1
- resource #1resourceName2
- resource #2filter
- the filter contianing the flags defining which attributes to comparepublic void assertFlags(CmsObject cms, String resourceName, int flag)
cms
- the CmsObjectresourceName
- the name of the resource to compareflag
- a flag to checkpublic void assertHistory(CmsObject cms, String resourcename, int versionCount) throws Exception
cms
- the current user OpenCms contextresourcename
- the name of the resource to check the history forversionCount
- the expected version number of the resource
Exception
- if the test failspublic void assertHistoryForRestored(CmsObject cms, String resourcename, int versionCount) throws Exception
Use this method only for resources that has been restored.
cms
- the current user OpenCms contextresourcename
- the name of the resource to check the history forversionCount
- the expected version number of the resource
Exception
- if the test failspublic void assertIsFolder(CmsObject cms, String resourceName)
cms
- the CmsObjectresourceName
- the name of the resource to check for a folderpublic void assertIsIdentical(Object o1, Object o2)
o1
- an objecto2
- another objectpublic void assertIsNotIdentical(Object o1, Object o2)
o1
- an objecto2
- another objectpublic void assertLock(CmsObject cms, String resourceName)
cms
- the current user's Cms objectresourceName
- the name of the resource to validatepublic void assertLock(CmsObject cms, String resourceName, CmsLockType lockType)
cms
- the current user's Cms objectresourceName
- the name of the resource to validatelockType
- the type of the lockCmsLockType
public void assertLock(CmsObject cms, String resourceName, CmsLockType lockType, CmsUser user)
cms
- the current user's Cms objectresourceName
- the name of the resource to validatelockType
- the type of the lockuser
- the user to check the lock withCmsLockType
public void assertModifiedInCurrentProject(CmsObject cms, String resourceName, boolean shouldHaveRedFlag)
cms
- the current user's Cms objectresourceName
- the name of the resource to validateshouldHaveRedFlag
- true, if the resource should currently have a red flagpublic void assertPermissionString(CmsObject cms, String resourceName, I_CmsPrincipal principal, String permissionString) throws CmsException
cms
- the cms objectresourceName
- the resource nameprincipal
- the principalpermissionString
- the permission string to compare
CmsException
- if something goes wrongpublic void assertProject(CmsObject cms, String resourceName, CmsProject project)
cms
- the CmsObjectresourceName
- the name of the resource to compareproject
- the projectpublic void assertPropertyChanged(CmsObject cms, String resourceName, CmsProperty property)
cms
- the CmsObjectresourceName
- the name of the resource to compareproperty
- the changed propertypublic void assertPropertyChanged(CmsObject cms, String resourceName, List<CmsProperty> excludeList)
cms
- an initialized CmsObjectresourceName
- the name of the resource to compareexcludeList
- a list of CmsProperties to excludepublic void assertPropertydefinitionExist(CmsObject cms, CmsPropertyDefinition propertyDefinition)
cms
- the CmsObjectpropertyDefinition
- the propertsdefinitionpublic void assertPropertydefinitions(CmsObject cms, List<CmsPropertyDefinition> propertyDefintions, CmsPropertyDefinition exclude)
cms
- the CmsObjectpropertyDefintions
- the list of propertydefintionsexclude
- the exclude propertydefinitionpublic void assertPropertyEqual(CmsObject cms, String resourceName)
cms
- the CmsObjectresourceName
- the name of the resource to comparepublic void assertPropertyNew(CmsObject cms, String resourceName, CmsProperty property)
cms
- the CmsObjectresourceName
- the name of the resource to compareproperty
- the changed propertypublic void assertPropertyNew(CmsObject cms, String resourceName, List excludeList)
cms
- an initialized CmsObjectresourceName
- the name of the resource to compareexcludeList
- a list of CmsProperties to excludepublic void assertPropertyRemoved(CmsObject cms, String resourceName, CmsProperty property)
cms
- the CmsObjectresourceName
- the name of the resource to compareproperty
- the deleted propertypublic void assertPropertyRemoved(CmsObject cms, String resourceName, List excludeList)
cms
- an initialized CmsObjectresourceName
- the name of the resource to compareexcludeList
- a list of CmsProperties to excludepublic void assertRelation(CmsRelation expected, CmsRelation actual)
expected
- the expected relationactual
- the actual resultpublic void assertResourceId(CmsObject cms, String resourceName, CmsUUID resourceId)
cms
- the CmsObjectresourceName
- the name of the resource to compareresourceId
- the idpublic void assertResourceType(CmsObject cms, String resourceName, int resourceType)
cms
- the CmsObjectresourceName
- the name of the resource to checkresourceType
- the resource type to check forpublic void assertSiblingCount(CmsObject cms, String resourceName, int count)
cms
- the current user's Cms objectresourceName
- the name of the resource to comparecount
- the number of additional siblingspublic void assertSiblingCountIncremented(CmsObject cms, String resourceName, int increment)
cms
- the current user's Cms objectresourceName
- the name of the resource to compareincrement
- the number of additional siblings compared to the original statepublic void assertState(CmsObject cms, String resourceName, CmsResourceState state)
cms
- the CmsObjectresourceName
- the name of the resource to comparestate
- the statepublic void assertStructureId(CmsObject cms, String resourceName, CmsUUID structureId)
cms
- the CmsObjectresourceName
- the name of the resource to comparestructureId
- the idpublic void assertType(CmsObject cms, String resourceName, int type)
cms
- the CmsObjectresourceName
- the name of the resource to comparetype
- the typepublic void assertUserCreated(CmsObject cms, String resourceName, CmsUser user)
cms
- the CmsObjectresourceName
- the name of the resource to compareuser
- the last modification userpublic void assertUserLastModified(CmsObject cms, String resourceName, CmsUser user)
cms
- the CmsObjectresourceName
- the name of the resource to compareuser
- the last modification userpublic void assertVersion(CmsObject cms, String resourceName, int version)
cms
- the CmsObjectresourceName
- the name of the resource to compareversion
- the version number to checkpublic void createStorage(String name)
name
- the name of the storagepublic String getConnectionName()
public String getDatabaseProduct()
public CmsResourceState getPreCalculatedState(String resourceName) throws Exception
resourceName
- the name of the resource to get the state
Exception
- in case something goes wrongpublic void resetMapping()
public void setMapping(String source, String target)
source
- the source resource nametarget
- the target resource namepublic void storeResources(CmsObject cms, String resourceName)
If the resourceName is the name of a folder in the vfs, all subresoruces are stored as well.
cms
- an initialized CmsObjectresourceName
- the name of the resource in the vfspublic void storeResources(CmsObject cms, String resourceName, boolean storeSubresources)
If the resourceName is the name of a folder in the vfs and storeSubresources is true, all subresoruces are stored as well.
cms
- an initialized CmsObjectresourceName
- the name of the resource in the vfsstoreSubresources
- indicates to store subresources of folderspublic void switchStorage(String name) throws CmsException
name
- the name of the storage
CmsException
- if the storage was not foundprotected void deleteFile(String absolutePath)
absolutePath
- the absolute path of the fileprotected void echo(String message)
message
- the message to writeprotected CmsObject getCmsObject() throws CmsException
CmsException
- in case of OpenCms access errorsprotected void removeStorage(String name)
name
- the name of the storageprotected void restart()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |