org.opencms.xml.content
Class TestCmsXmlContentLinks

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.opencms.test.OpenCmsTestCase
              extended by org.opencms.xml.content.TestCmsXmlContentLinks
All Implemented Interfaces:
junit.framework.Test

public class TestCmsXmlContentLinks
extends OpenCmsTestCase

Tests the OpenCms XML contents with real VFS operations.


Nested Class Summary
 
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
TestCmsXmlContentLinks(String arg0)
          Default JUnit constructor.
 
Method Summary
static void assertLink(CmsLink expected, CmsLink result, boolean assertStructureId)
          Compares two link objects.
static CmsLink getHtmlLink(CmsObject cms, CmsXmlContent xmlcontent, String nodeName, String linkName)
          Returns the unique link for the given html node in the given xml content.
static CmsLink getVfsFileRefLink(CmsObject cms, CmsXmlContent xmlcontent, String nodeName)
          Returns the link for the given vfs file reference node in the given xml content.
protected static void initSchemas()
          Initializes all schema definitions.
static junit.framework.Test suite()
          Test suite for this test class.
 void testInvalidateFalse()
          Test the option to do not invalidate a broken link node.
 void testRelationType()
          Test the relation type configuration in xml content.
 void testRemoveNode()
          Test removing the node of a broken link.
 void testRemoveParent()
          Test removing the parent node of a broken link.
 void testUpdateId()
          Test updating the id of a moved resource in a broken link.
 void testUpdatePath()
          Test updating the path of a moved resource in a broken link.
 
Methods inherited from class org.opencms.test.OpenCmsTestCase
addTestDataPath, assertAce, assertAcl, assertAcl, assertContains, assertContainsNot, assertContent, assertDateContent, assertDateContentAfter, assertDateCreated, assertDateCreatedAfter, assertDateExpired, assertDateLastModified, assertDateLastModifiedAfter, assertDateReleased, assertEquals, assertEquals, assertEquals, assertFilter, assertFilter, assertFilter, assertFilter, assertFlags, assertHistory, assertHistoryForRestored, assertIsFolder, assertIsIdentical, assertIsNotIdentical, assertLock, assertLock, assertLock, assertModifiedInCurrentProject, assertPermissionString, assertProject, assertPropertyChanged, assertPropertyChanged, assertPropertydefinitionExist, assertPropertydefinitions, assertPropertyEqual, assertPropertyNew, assertPropertyNew, assertPropertyRemoved, assertPropertyRemoved, assertRelation, assertResourceId, assertResourceType, assertSiblingCount, assertSiblingCountIncremented, assertState, assertStructureId, assertType, assertUserCreated, assertUserLastModified, assertVersion, checkErrors, createStorage, deleteFile, echo, generateContent, generateContent, generateName, generateProperties, generateResources, generateSetupTestWrapper, generateUsers, getCmsObject, getConnectionName, getDatabaseProduct, getDbProduct, getPreCalculatedState, getReplacer, getSetupDataPath, getSetupDb, getTestDataPath, importData, importResources, importTestResource, initTestDataPath, removeDatabase, removeDatabase, removeOpenCms, removeStorage, resetMapping, restart, restartOpenCms, setMapping, setupDatabase, setupDatabase, setupOpenCms, setupOpenCms, setupOpenCms, setupOpenCms, setupOpenCms, storeResources, storeResources, switchStorage
 
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

TestCmsXmlContentLinks

public TestCmsXmlContentLinks(String arg0)
Default JUnit constructor.

Parameters:
arg0 - JUnit parameters
Method Detail

assertLink

public static void assertLink(CmsLink expected,
                              CmsLink result,
                              boolean assertStructureId)
Compares two link objects.

Parameters:
expected - the expected link object
result - the resulting link object
assertStructureId - if the structure id should be asserted or not

getHtmlLink

public static CmsLink getHtmlLink(CmsObject cms,
                                  CmsXmlContent xmlcontent,
                                  String nodeName,
                                  String linkName)
Returns the unique link for the given html node in the given xml content.

Parameters:
cms - the cms context
xmlcontent - the xml content
nodeName - the html node name
linkName - the name of the link
Returns:
the link object

getVfsFileRefLink

public static CmsLink getVfsFileRefLink(CmsObject cms,
                                        CmsXmlContent xmlcontent,
                                        String nodeName)
Returns the link for the given vfs file reference node in the given xml content.

Parameters:
cms - the cms context
xmlcontent - the xml content
nodeName - the vfs file reference node name
Returns:
the link object

suite

public static junit.framework.Test suite()
Test suite for this test class.

Returns:
the test suite

initSchemas

protected static void initSchemas()
                           throws IOException
Initializes all schema definitions.

Throws:
IOException - if something goes wrong

testRemoveNode

public void testRemoveNode()
                    throws Exception
Test removing the node of a broken link.

Throws:
Exception - in case something goes wrong

testRemoveParent

public void testRemoveParent()
                      throws Exception
Test removing the parent node of a broken link.

Throws:
Exception - in case something goes wrong

testUpdateId

public void testUpdateId()
                  throws Exception
Test updating the id of a moved resource in a broken link.

Throws:
Exception - in case something goes wrong

testUpdatePath

public void testUpdatePath()
                    throws Exception
Test updating the path of a moved resource in a broken link.

Throws:
Exception - in case something goes wrong

testRelationType

public void testRelationType()
                      throws Exception
Test the relation type configuration in xml content.

Throws:
Exception - in case something goes wrong

testInvalidateFalse

public void testInvalidateFalse()
                         throws Exception
Test the option to do not invalidate a broken link node.

Throws:
Exception - in case something goes wrong