org.opencms.db
Class TestUrlNameMapping

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.opencms.test.OpenCmsTestCase
              extended by org.opencms.db.TestUrlNameMapping
All Implemented Interfaces:
junit.framework.Test

public class TestUrlNameMapping
extends OpenCmsTestCase

Tests the URL name mapping facilities of OpenCms.

Since:
8.0.0

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
TestUrlNameMapping(String arg0)
          Test constructor.
 
Method Summary
protected  String addMapping(String name, CmsResource res)
          Helper method for adding a resource mapping.
 CmsResource createFile()
          Creates a new file and returns it.
protected  void delete(CmsResource res)
          Helper method for deleting a resource.
 CmsObject getOnlineCmsObject()
          Helper method for getting a CMS context set to the Online project.
protected  void publish()
          Helper method for publishing the current project.
static junit.framework.Test suite()
          Returns the test suite.
 void testDeleteChanged()
          Tests that when a not-new resource is deleted and published, its URL name mappings are also deleted.
 void testDeleteNew()
          Tests that when a new resource is deleted, its URL name mapping is also deleted.
 void testMultipleIdMapping()
          Tests mapping the same URL name to multiple ids.
 void testMultipleNameMapping()
          Tests mapping multiple names to the same resource.
 void testOverwrite()
          Tests that an URL name that has not been published will be overwritten by a new URL name.
 void testPublish()
          Tests publishing the URL name mappings of a resource.
 void testSimpleMapping()
          Tests adding a single url name in the Offline project.
 void testUndo()
          Tests that when the changes of a resource are undone, its unpublished URL name mapping will be removed.
protected  void touch(CmsResource res)
          Changes a resource's "last modified" time to the current time.
 
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

TestUrlNameMapping

public TestUrlNameMapping(String arg0)
Test constructor.

Parameters:
arg0 -
Method Detail

suite

public static junit.framework.Test suite()
Returns the test suite.

Returns:
the test suite

createFile

public CmsResource createFile()
                       throws Exception
Creates a new file and returns it.

Returns:
the new file
Throws:
Exception - if something goes wrong

getOnlineCmsObject

public CmsObject getOnlineCmsObject()
                             throws Exception
Helper method for getting a CMS context set to the Online project.

Returns:
a CmsObject with the project set to the Online project
Throws:
Exception - if something goes wrong

testDeleteChanged

public void testDeleteChanged()
                       throws Exception
Tests that when a not-new resource is deleted and published, its URL name mappings are also deleted.

Throws:
Exception - if something goes wrong

testDeleteNew

public void testDeleteNew()
                   throws Exception
Tests that when a new resource is deleted, its URL name mapping is also deleted.

Throws:
Exception - if something goes wrong

testMultipleIdMapping

public void testMultipleIdMapping()
                           throws Exception
Tests mapping the same URL name to multiple ids.

Throws:
Exception - if something goes wrong

testMultipleNameMapping

public void testMultipleNameMapping()
                             throws Exception
Tests mapping multiple names to the same resource.

Throws:
Exception - if something goes wrong

testOverwrite

public void testOverwrite()
                   throws Exception
Tests that an URL name that has not been published will be overwritten by a new URL name.

Throws:
Exception - if something goes wrong

testPublish

public void testPublish()
                 throws Exception
Tests publishing the URL name mappings of a resource.

Throws:
Exception - if something goes wrong

testSimpleMapping

public void testSimpleMapping()
                       throws Exception
Tests adding a single url name in the Offline project.

Throws:
Exception - if something goes wrong

testUndo

public void testUndo()
              throws Exception
Tests that when the changes of a resource are undone, its unpublished URL name mapping will be removed.

Throws:
Exception - if something goes wrong

addMapping

protected String addMapping(String name,
                            CmsResource res)
                     throws Exception
Helper method for adding a resource mapping.

Parameters:
name - the mapping name to be used
res - the resource to which the
Returns:
the URL name which has actually been mapped
Throws:
Exception

delete

protected void delete(CmsResource res)
               throws Exception
Helper method for deleting a resource.

Parameters:
res - the resource to delete
Throws:
Exception - if something goes wrong

publish

protected void publish()
                throws Exception
Helper method for publishing the current project.

Throws:
Exception

touch

protected void touch(CmsResource res)
              throws Exception
Changes a resource's "last modified" time to the current time.

Parameters:
res - the resource which should be touched
Throws:
Exception - if something goes wrong