org.opencms.ade.configuration
Class TestConfig

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.TestConfig
All Implemented Interfaces:
junit.framework.Test

public class TestConfig
extends OpenCmsTestCase

Lightweight tests for the ADE configuration mechanism which mostly do not read the configuration data from the VFS.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.opencms.test.OpenCmsTestCase
OpenCmsTestCase.ConnectionData
 
Field Summary
protected static List<CmsDetailPageInfo> NO_DETAILPAGES
          Empty detail page list.
protected static List<CmsModelPageConfig> NO_MODEL_PAGES
          Empty model page list.
protected static List<CmsPropertyConfig> NO_PROPERTIES
          Empty property definition list.
protected static List<CmsResourceTypeConfig> NO_TYPES
          Empty resource type list.
 
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
TestConfig(String arg0)
          Test constructor.
 
Method Summary
protected  void assertPathEquals(String path1, String path2)
          Helper method for comparing paths which ignores leading/trailing slashes.
protected  CmsPropertyConfig createDisabledPropertyConfig(String name)
          Helper method for creating a disabled property configuration.
 void createFolder(String rootPath, boolean deep)
          Helper method for creating a folder.
protected  CmsPropertyConfig createPropertyConfig(String name, String description)
          Helper method for creating a property configuration object.
protected  CmsXmlContentProperty createXmlContentProperty(String name, String description)
          Helper method for creating an XML content property with only a name and description.
protected  void dumpTree()
          Helper method for dumping the whole VFS tree to the console.
protected  void dumpTree(CmsObject cms, CmsResource res, int indentation)
          Helper method for dumping a VFS tree to the console.
protected  CmsUUID getId(String rootPath)
          Helper method for getting the structure id of a file given by root path.
protected
<X> List<X>
list(X... elems)
          Helper method for creating a list of elements.
protected  CmsObject rootCms()
          Helper method for getting a CMS context in the root site
protected
<X> Set<X>
set(X... elems)
          Helper method for creating a set of elements.
static junit.framework.Test suite()
          Returns the test suite.
 void testCreatable()
          Tests the 'creatable' check of the CmsResourceTypeConfig class.
 void testCreateContentsLocally()
          Tests the option to create contents locally.
 void testCreateContentsLocally2()
          Another test for the option to create contents locally.
 void testCreateContentsLocally3()
          Another test for the option to create contents locally.
 void testCreateContentsLocally4()
          Tests the creation of local contents when no folder name has been defined anywhere.
 void testCreateElements()
          Tests the creation of new contents by the CmsResourceTypeConfig class.
 void testDefaultFolderName()
          Tests the generation of the default content folder name.
 void testDefaultFolderName2()
          Another test for the the generation of the content folder name.
 void testDetailPages2()
          Tests inheritance of detail page configurations.
 void testDiscardInheritedModelPages()
          Tests the 'Disable all' option for model pages.
 void testDiscardInheritedProperties()
          Tests the 'Disable all' option for properties
 void testDiscardInheritedTypes()
          Tests the 'Disable all' option for resource types.
 void testInheritedFolderName1()
          Tests inheritance of folder names for resource types.
 void testInheritedFolderName2()
          Tests inheritance of folder names for resource types.
 void testInheritNamePattern()
          Tests inheritance of name patterns for resource types.
 void testInheritProperties()
          Tests inheritance of property definitions.
 void testInheritResourceTypes1()
          Tests inheritance of resource types.
 void testModelPages1()
          Tests inheritance of model pages.
 void testModelPages2()
          Tests inheritance of model pages.
 void testOverrideResourceType()
          Tests overriding of resource types.
 void testParseConfiguration()
          Tests the configuration parser.
 void testParseModuleConfiguration()
          Tests the parsing of module configurations.
 void testRemoveResourceType()
          Test for disabling single resource types.
 void testReorderResourceTypes()
          Test for reordering resource types.
 void testResolveFolderName1()
          Tests folder name generation.
 void testResourceTypeConfigObjectsNotSame()
          Tests that for each configuration file there are distinct resource type configuration objects.
 void testXsdFormatters1()
          Tests accessing the XSD formatter configuration.
protected  void writeIndentation(int indent)
          Helper method for writing a number of spaces.
 
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
 

Field Detail

NO_DETAILPAGES

protected static final List<CmsDetailPageInfo> NO_DETAILPAGES
Empty detail page list.


NO_MODEL_PAGES

protected static final List<CmsModelPageConfig> NO_MODEL_PAGES
Empty model page list.


NO_PROPERTIES

protected static final List<CmsPropertyConfig> NO_PROPERTIES
Empty property definition list.


NO_TYPES

protected static final List<CmsResourceTypeConfig> NO_TYPES
Empty resource type list.

Constructor Detail

TestConfig

public TestConfig(String arg0)
Test constructor.

Parameters:
arg0 -
Method Detail

suite

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

Returns:
the test suite

createFolder

public void createFolder(String rootPath,
                         boolean deep)
                  throws CmsException
Helper method for creating a folder.

Parameters:
rootPath - the root path of the folder
deep - if true, creates all parent folders
Throws:
CmsException - if something goes wrong

testCreatable

public void testCreatable()
                   throws Exception
Tests the 'creatable' check of the CmsResourceTypeConfig class.

Throws:
Exception

testCreateContentsLocally

public void testCreateContentsLocally()
                               throws Exception
Tests the option to create contents locally.

Throws:
Exception

testCreateContentsLocally2

public void testCreateContentsLocally2()
                                throws Exception
Another test for the option to create contents locally.

Throws:
Exception

testCreateContentsLocally3

public void testCreateContentsLocally3()
                                throws Exception
Another test for the option to create contents locally.

Throws:
Exception

testCreateContentsLocally4

public void testCreateContentsLocally4()
                                throws Exception
Tests the creation of local contents when no folder name has been defined anywhere.

Throws:
Exception

testCreateElements

public void testCreateElements()
                        throws Exception
Tests the creation of new contents by the CmsResourceTypeConfig class.

Throws:
Exception

testDefaultFolderName

public void testDefaultFolderName()
                           throws Exception
Tests the generation of the default content folder name.

Throws:
Exception

testDefaultFolderName2

public void testDefaultFolderName2()
                            throws Exception
Another test for the the generation of the content folder name.

Throws:
Exception

testDetailPages2

public void testDetailPages2()
                      throws Exception
Tests inheritance of detail page configurations.

Throws:
Exception

testDiscardInheritedModelPages

public void testDiscardInheritedModelPages()
                                    throws Exception
Tests the 'Disable all' option for model pages.

Throws:
Exception

testDiscardInheritedProperties

public void testDiscardInheritedProperties()
                                    throws Exception
Tests the 'Disable all' option for properties

Throws:
Exception

testDiscardInheritedTypes

public void testDiscardInheritedTypes()
                               throws Exception
Tests the 'Disable all' option for resource types.

Throws:
Exception

testInheritedFolderName1

public void testInheritedFolderName1()
                              throws Exception
Tests inheritance of folder names for resource types.

Throws:
Exception

testInheritedFolderName2

public void testInheritedFolderName2()
                              throws Exception
Tests inheritance of folder names for resource types.

Throws:
Exception

testInheritNamePattern

public void testInheritNamePattern()
                            throws Exception
Tests inheritance of name patterns for resource types.

Throws:
Exception

testInheritProperties

public void testInheritProperties()
                           throws Exception
Tests inheritance of property definitions.

Throws:
Exception

testInheritResourceTypes1

public void testInheritResourceTypes1()
                               throws Exception
Tests inheritance of resource types.

Throws:
Exception

testModelPages1

public void testModelPages1()
                     throws Exception
Tests inheritance of model pages.

Throws:
Exception

testModelPages2

public void testModelPages2()
                     throws Exception
Tests inheritance of model pages.

Throws:
Exception

testOverrideResourceType

public void testOverrideResourceType()
                              throws Exception
Tests overriding of resource types.

Throws:
Exception

testParseConfiguration

public void testParseConfiguration()
                            throws Exception
Tests the configuration parser.

Throws:
Exception

testParseModuleConfiguration

public void testParseModuleConfiguration()
                                  throws Exception
Tests the parsing of module configurations.

Throws:
Exception

testRemoveResourceType

public void testRemoveResourceType()
                            throws Exception
Test for disabling single resource types.

Throws:
Exception

testReorderResourceTypes

public void testReorderResourceTypes()
                              throws Exception
Test for reordering resource types.

Throws:
Exception

testResolveFolderName1

public void testResolveFolderName1()
                            throws Exception
Tests folder name generation.

Throws:
Exception

testResourceTypeConfigObjectsNotSame

public void testResourceTypeConfigObjectsNotSame()
                                          throws Exception
Tests that for each configuration file there are distinct resource type configuration objects.

Throws:
Exception

testXsdFormatters1

public void testXsdFormatters1()
                        throws Exception
Tests accessing the XSD formatter configuration.

Throws:
Exception

assertPathEquals

protected void assertPathEquals(String path1,
                                String path2)
Helper method for comparing paths which ignores leading/trailing slashes.

Parameters:
path1 - the first path
path2 - the second path

createDisabledPropertyConfig

protected CmsPropertyConfig createDisabledPropertyConfig(String name)
Helper method for creating a disabled property configuration.

Parameters:
name - the property name
Returns:
the property configuration object

createPropertyConfig

protected CmsPropertyConfig createPropertyConfig(String name,
                                                 String description)
Helper method for creating a property configuration object.

Parameters:
name - the property name
description - the property description
Returns:
the property configuration object

createXmlContentProperty

protected CmsXmlContentProperty createXmlContentProperty(String name,
                                                         String description)
Helper method for creating an XML content property with only a name and description.

Parameters:
name - the property name
description - the property description
Returns:
the content property description bean

dumpTree

protected void dumpTree()
                 throws CmsException
Helper method for dumping the whole VFS tree to the console.

Throws:
CmsException

dumpTree

protected void dumpTree(CmsObject cms,
                        CmsResource res,
                        int indentation)
                 throws CmsException
Helper method for dumping a VFS tree to the console.

Parameters:
cms - the CMS context
res - the root resource
indentation - the initial indentation level
Throws:
CmsException - if something goes wrong

getId

protected CmsUUID getId(String rootPath)
                 throws CmsException
Helper method for getting the structure id of a file given by root path.

Parameters:
rootPath - the file root path
Returns:
the structure id of the file
Throws:
CmsException

list

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

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

rootCms

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

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

set

protected <X> Set<X> set(X... elems)
Helper method for creating a set of elements.

Parameters:
elems - the elements
Returns:
a set of the elements

writeIndentation

protected void writeIndentation(int indent)
Helper method for writing a number of spaces.

Parameters:
indent - the number of spaces to write