|
||||||||
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
org.opencms.file.TestLinkRewriter
public class TestLinkRewriter
Test class for the CmsLinkRewriter class.
Nested Class Summary | |
---|---|
class |
TestLinkRewriter.ExpectErrorLogHandler
A log handler which detects whether an error message containing a given string is written to the log. |
Nested classes/interfaces inherited from class org.opencms.test.OpenCmsTestCase |
---|
OpenCmsTestCase.ConnectionData |
Field Summary |
---|
Fields inherited from class org.opencms.test.OpenCmsTestCase |
---|
ARTICLE_TYPEID, DB_MYSQL, DB_ORACLE, m_additionalConnection, m_configuration, m_currentResourceStrorage, m_defaultConnection, m_defaultTablespace, m_indexTablespace, m_resourceStorages, m_setupConnection, m_tempTablespace |
Constructor Summary | |
---|---|
TestLinkRewriter(String name)
Creates a new test suite instance. |
Method Summary | |
---|---|
void |
assertSetEquals(Set expected,
Set actual)
Helper method to compare sets by sorting them and converting them to strings first. |
String |
canonicalize(String path)
Converts a path to a canonical form. |
void |
copyAndAdjust(String target)
Copies the /system/base folder to a given path and adjusts the links for that path. |
void |
createFolder(String path)
Creates a folder at a given path. |
void |
delete(String directory)
Helper method for deleting a directory. |
Set<String> |
getBaseLinks(String root)
Gets the set of relation strings which a given folder should have if it had been copied from /system/base and had its links adjusted afterwards. |
List<CmsRelation> |
getLinksBetween(String firstFolder,
String secondFolder)
Gets a list of relations from resources in one subtree to resources in another. |
Set<String> |
getMultiBaseLinks(String root)
Returns the links for the multibase adjustment test, relocated to a given root path. |
String |
getRelationCode(CmsRelation relation)
Converts a single relation to a string of the form TYPE:SOURCE:TARGET. |
Set<String> |
getRelationSet(Collection<CmsRelation> relations)
Helper method to convert a collection of relations to a set of strings. |
protected Set<String> |
links(String source,
String target)
Gets the string representations of relations between two subtrees. |
static junit.framework.Test |
suite()
Returns the test suite. |
void |
testAdjustWithMissingFile()
Tests that the link rewriting process can handle missing files in the target folder structure. |
void |
testCopy()
Tests whether the link rewriting works in the system folder. |
void |
testCopyToSite()
Tests whether the link rewriting works in the current site. |
void |
testEncodingConversion()
Tests whether the encoding is converted correctly when rewriting links. |
void |
testFailIfTargetIsSubdirectory()
Tests that the link rewriting fails if one of two folder arguments is a subfolder of the other. |
void |
testMultiCopy()
Tests relation adjustments for multiple source files. |
void |
testNotAbort()
Tests that an error when rewriting a file will not throw an exception, but will be written to the log. |
void |
testVerifySetup()
Test to verify that the files under /system/base have been created correctly by the test setup (not really necessary, just to make sure that e.g. |
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 |
Constructor Detail |
---|
public TestLinkRewriter(String name)
name
- Method Detail |
---|
public static junit.framework.Test suite()
public void assertSetEquals(Set expected, Set actual)
expected
- the expected valueactual
- the actual value to checkpublic String canonicalize(String path)
path
- the path to convert
public void copyAndAdjust(String target) throws CmsException
target
- the target path
CmsException
- if something goes wrongpublic void createFolder(String path) throws CmsException
path
- the path of the folder
CmsException
- if something goes wrongpublic void delete(String directory) throws CmsException
directory
- the directory to remove
CmsException
- if something goes wrongpublic Set<String> getBaseLinks(String root)
root
- the target folder
public List<CmsRelation> getLinksBetween(String firstFolder, String secondFolder) throws CmsException
firstFolder
- the root folder of the first subtreesecondFolder
- the root folder of the second subtree
CmsException
- if something goes wrongpublic Set<String> getMultiBaseLinks(String root)
root
- the new root path
public String getRelationCode(CmsRelation relation)
relation
- the relation
public Set<String> getRelationSet(Collection<CmsRelation> relations)
relations
- the relations
public void testAdjustWithMissingFile() throws Exception
Exception
public void testCopy() throws Exception
Exception
public void testCopyToSite() throws Exception
Exception
public void testEncodingConversion() throws Exception
Exception
public void testFailIfTargetIsSubdirectory() throws Exception
Exception
public void testMultiCopy() throws CmsException
CmsException
public void testNotAbort() throws Exception
Exception
public void testVerifySetup() throws Exception
Exception
protected Set<String> links(String source, String target) throws CmsException
source
- the root of the first subtreetarget
- the root of the second subtree
CmsException
- if something goes wrong
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |