org.opencms.ade.configuration
Class TestLiveConfig

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.opencms.test.OpenCmsTestCase
              extended by org.opencms.ade.configuration.TestLiveConfig
All Implemented Interfaces:
junit.framework.Test

public class TestLiveConfig
extends OpenCmsTestCase

Tests for the ADE configuration mechanism which read the configuration data from multiple files in the VFS.


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
TestLiveConfig(String name)
          Test constructor.
 
Method Summary
protected  void checkResourceTypes(CmsObject cms, String path, String attr, String... expected)
          Helper method to compare attributes of configured resource types with a list of expected values.
protected  void delete(CmsResource res)
          Helper method for deleting a resource.
protected  String getAttribute(CmsResourceTypeConfig typeConfig, String attr)
          Gets an attribute from a resource type configuration object.
protected
<X> List<X>
list(X... elems)
          Helper method for creating a list of given elements.
protected  CmsObject onlineCms()
          Helper method for creating a CMS context in the Online Project.
protected  void publish()
          Helper method for publishing the current project.
protected  void restoreFiles()
          Helper method to re-create the original test data in the VFS.
protected  CmsObject rootCms()
          Helper method for getting a CMS object in the root site.
static junit.framework.Test suite()
          Returns the test suite.
 void testDeleted()
          Tests deletion of configuration files.
 void testDetailPage1()
          Tests finding detail pages.
 void testFormatters()
          Tests formatter configuration.
 void testLevel1Configuration()
          Tests the configuration in top-level sitemaps.
 void testLevel2Configuration()
          Tests the configuration in level 2 subsitemaps.
 void testModuleConfig1()
          Tests that newly created module configurations are reflected in the configuration objects.
 void testMove1()
          Tests that when moving a configuration file, the configuration will be correct.
 void testMoveDetailPages()
          Tests that when detail pages are moved, the configuration will still return the correct URIs.
 void testNoConfiguration()
          Tests that the configuration is empty at paths where no configuration is defined.
 void testPublish()
          Tests that publishing a changed configuration file updates the online configuration object.
 void testPublishDeleted()
          Tests that publishing a deleted configuration file changes the online configuration.
 void testSaveDetailPages()
          Tests the saving of detail pages.
 
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

TestLiveConfig

public TestLiveConfig(String name)
Test constructor.

Parameters:
name - the name of the test
Method Detail

suite

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

Returns:
the test suite

testDeleted

public void testDeleted()
                 throws Exception
Tests deletion of configuration files.

Throws:
Exception

testDetailPage1

public void testDetailPage1()
                     throws Exception
Tests finding detail pages.

Throws:
Exception

testFormatters

public void testFormatters()
                    throws Exception
Tests formatter configuration.

Throws:
Exception

testLevel1Configuration

public void testLevel1Configuration()
                             throws Exception
Tests the configuration in top-level sitemaps.

Throws:
Exception

testLevel2Configuration

public void testLevel2Configuration()
                             throws Exception
Tests the configuration in level 2 subsitemaps.

Throws:
Exception

testModuleConfig1

public void testModuleConfig1()
                       throws Exception
Tests that newly created module configurations are reflected in the configuration objects.

Throws:
Exception

testMove1

public void testMove1()
               throws Exception
Tests that when moving a configuration file, the configuration will be correct.

Throws:
Exception

testMoveDetailPages

public void testMoveDetailPages()
                         throws Exception
Tests that when detail pages are moved, the configuration will still return the correct URIs.

Throws:
Exception

testNoConfiguration

public void testNoConfiguration()
                         throws Exception
Tests that the configuration is empty at paths where no configuration is defined.

Throws:
Exception

testPublish

public void testPublish()
                 throws Exception
Tests that publishing a changed configuration file updates the online configuration object.

Throws:
Exception

testPublishDeleted

public void testPublishDeleted()
                        throws Exception
Tests that publishing a deleted configuration file changes the online configuration.

Throws:
Exception

testSaveDetailPages

public void testSaveDetailPages()
                         throws Exception
Tests the saving of detail pages.

Throws:
Exception

checkResourceTypes

protected void checkResourceTypes(CmsObject cms,
                                  String path,
                                  String attr,
                                  String... expected)
Helper method to compare attributes of configured resource types with a list of expected values.

Parameters:
cms - the CMS context
path - the path used to access the configuration
attr - the attribute which should be retrieved from the configured resource types
expected -

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

getAttribute

protected String getAttribute(CmsResourceTypeConfig typeConfig,
                              String attr)
Gets an attribute from a resource type configuration object.

Parameters:
typeConfig - the type configuration object
attr - the attribute name
Returns:
the attribute from the resource type configuration object

list

protected <X> List<X> list(X... elems)
Helper method for creating a list of given elements.

Parameters:
elems - the elements
Returns:
a list containing the elements

onlineCms

protected CmsObject onlineCms()
                       throws Exception
Helper method for creating a CMS context in the Online Project.

Returns:
the CMS context
Throws:
Exception

publish

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

Throws:
Exception

restoreFiles

protected void restoreFiles()
                     throws Exception
Helper method to re-create the original test data in the VFS.

Throws:
Exception

rootCms

protected CmsObject rootCms()
                     throws CmsException
Helper method for getting a CMS object in the root site.

Returns:
a CMS context in the root site
Throws:
CmsException