Package org.xwiki.rendering.test.cts
Class TestDataParser
- java.lang.Object
-
- org.xwiki.rendering.test.cts.TestDataParser
-
public class TestDataParser extends Object
Finds all test files in the current classloader, read them and return test data to represent them. SeeCompatibilityTestSuite
for a description of the algorithm.- Since:
- 4.1M1
- Version:
- $Id: b54262ae990c998944b70444e61cf908ddabb028 $
- See Also:
CompatibilityTestSuite
-
-
Constructor Summary
Constructors Constructor Description TestDataParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
findRelativeTestDirectoryNames(String ctsRootPackageName, String packageFilter, String pattern)
Find*.xml
files in the classpath and return the list of all resources found, without their filename extensions.List<TestData>
parseSingleTestData(String syntaxDirectory, String ctsRootPackageName, String relativeDirectoryName, TestDataConfiguration configuration, ClassLoader classLoader)
Parse data for single test.TestDataConfiguration
parseTestConfiguration(String syntaxDirectory, String ctsRootPackageName, ClassLoader classLoader)
Parse Test configuration by looking for aconfig.properties
file in the Syntax directory.List<TestData>
parseTestData(String syntaxId, String ctsRootPackageName, String packageFilter, String pattern)
Read all test data.
-
-
-
Method Detail
-
parseTestData
public List<TestData> parseTestData(String syntaxId, String ctsRootPackageName, String packageFilter, String pattern) throws Exception
Read all test data. SeeCompatibilityTestSuite
for a detailed explanation of the algorithm.- Parameters:
syntaxId
- the id of the syntax for which to parse data forctsRootPackageName
- the root of the CTS resourcespackageFilter
- the regex to filter packagespattern
- a regex to decide which*.xml
resources should be found. The default should be to find them all- Returns:
- the list of test data
- Throws:
Exception
- in case of error while reading test data
-
parseSingleTestData
public List<TestData> parseSingleTestData(String syntaxDirectory, String ctsRootPackageName, String relativeDirectoryName, TestDataConfiguration configuration, ClassLoader classLoader) throws Exception
Parse data for single test.- Parameters:
syntaxDirectory
- the syntax directory from where to read syntax test data (eg "xwiki20" for "xwiki/2.0" syntax)ctsRootPackageName
- the root of the CTS resourcesrelativeDirectoryName
- the name of the relative directory for a CTS test (eg "/simple/bold/bold1")configuration
- the test configurationclassLoader
- the class loader from which the test data is read from- Returns:
- the TestData instances for both input and output tests, including possible input alias tests
- Throws:
Exception
- in case of error while reading test data or inherited configurations
-
parseTestConfiguration
public TestDataConfiguration parseTestConfiguration(String syntaxDirectory, String ctsRootPackageName, ClassLoader classLoader) throws Exception
Parse Test configuration by looking for aconfig.properties
file in the Syntax directory.- Parameters:
syntaxDirectory
- the syntax directory under which to look for the configuration filectsRootPackageName
- the root of the CTS resourcesclassLoader
- the class loader from which the test configuration is read from- Returns:
- the configuration
- Throws:
Exception
- in case of error while reading test configuration
-
findRelativeTestDirectoryNames
public Set<String> findRelativeTestDirectoryNames(String ctsRootPackageName, String packageFilter, String pattern)
Find*.xml
files in the classpath and return the list of all resources found, without their filename extensions. For example if{ctsDirectoryName}/simple/bold/bold1.*.xml
is found, returnsimple/bold/bold1
.- Parameters:
ctsRootPackageName
- the root of the CTS resourcespackageFilter
- the regex to filter packagespattern
- a regex to decide which*.xml
resources should be found. The default should be to find them all- Returns:
- the list of relative test directories found
-
-