Class PropertyManager
- java.lang.Object
-
- com.trivago.cluecumber.engine.properties.PropertyManager
-
@Singleton public class PropertyManager extends Object
This class stores and serves all Cluecumber properties.
-
-
Constructor Summary
Constructors Constructor Description PropertyManager(CluecumberLogger logger, FileIO fileIO, PropertiesFileLoader propertiesFileLoader)Constructor for dependency injection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCustomCssFile()Get the custom CSS file path.StringgetCustomPageTitle()Get the custom page title of the report.Map<String,String>getCustomParameters()Get the custom parameters to be shown at the top of the report.Settings.CustomParamDisplayModegetCustomParametersDisplayMode()Get the display mode for custom parameters (on which page they should appear).StringgetCustomParametersFile()Get the path to the custom parameter file.StringgetCustomStatusColorFailed()Get the custom hex color for failed elements.StringgetCustomStatusColorPassed()Get the custom hex color for passed elements.StringgetCustomStatusColorSkipped()Get the custom hex color for skipped elements.StringgetGeneratedHtmlReportDirectory()Get the root directory of the target HTML report.List<Link>getNavigationLinks()Get the custom navigation links to appear next to the default Cluecumber navigation.StringgetSourceJsonReportDirectory()Get the root directory of the source JSON files.Settings.StartPagegetStartPage()Get the start page of the report.booleanisExpandAttachments()This determines whether attachments should be expanded by default.booleanisExpandBeforeAfterHooks()This determines whether before and after hooks should be expanded by default.booleanisExpandDocStrings()This determines whether doc strings should be expanded by default.booleanisExpandOutputs()This determines whether step outputs should be expanded by default.booleanisExpandPreviousScenarioRuns()This determines whether the not last run elements should be expanded and shown.booleanisExpandStepHooks()This determines whether step hooks should be expanded by default.booleanisExpandSubSections()This determines whether sub sections should be expanded by default.booleanisFailScenariosOnPendingOrUndefinedSteps()This determines whether a scenario should be considered failed if it contains pending or undefined steps.booleanisGroupPreviousScenarioRuns()This determines whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.voidlogProperties()Log Cluecumber properties on the command line based on the set log level.voidsetCustomCssFile(String customCssFile)Set the custom CSS file path.voidsetCustomNavigationLinks(Map<String,String> customNavigationLinks)Set the custom navigation links to appear next to the default Cluecumber navigation.voidsetCustomPageTitle(String customPageTitle)Set the custom page title of the report.voidsetCustomParameters(Map<String,String> customParameters)Set the custom parameters to be shown at the top of the report.voidsetCustomParametersDisplayMode(String customParametersDisplayMode)Set the display mode for custom parameters (on which page they should appear).voidsetCustomParametersFile(String customParametersFile)Set the path to the custom parameter file.voidsetCustomStatusColorFailed(String customStatusColorFailed)Set a custom hex color for failed elements.voidsetCustomStatusColorPassed(String customStatusColorPassed)Set a custom hex color for passed elements.voidsetCustomStatusColorSkipped(String customStatusColorSkipped)Set a custom hex color for skipped elements.voidsetExpandAttachments(boolean expandAttachments)Set whether attachments should be expanded by default.voidsetExpandBeforeAfterHooks(boolean expandBeforeAfterHooks)Set whether before and after hooks should be expanded by default.voidsetExpandDocStrings(boolean expandDocStrings)Set whether doc strings should be expanded by default.voidsetExpandOutputs(boolean expandOutputs)Set whether step outputs should be expanded by default.voidsetExpandPreviousScenarioRuns(boolean expandPreviousScenarioRuns)Set whether the not last run elements should be expanded and shown.voidsetExpandStepHooks(boolean expandStepHooks)Set whether step hooks should be expanded by default.voidsetExpandSubSections(boolean expandSubSections)Set whether sub sections should be expanded by default.voidsetFailScenariosOnPendingOrUndefinedSteps(boolean failScenariosOnPendingOrUndefinedSteps)Set whether a scenario should be considered failed if it contains pending or undefined steps.voidsetGeneratedHtmlReportDirectory(String generatedHtmlReportDirectory)Set the root directory of the target HTML report.voidsetGroupPreviousScenarioRuns(boolean groupPreviousScenarioRuns)Set whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.voidsetSourceJsonReportDirectory(String sourceJsonReportDirectory)Set the root directory of the source JSON files.voidsetStartPage(String startPage)Set the start page of the report.
-
-
-
Constructor Detail
-
PropertyManager
@Inject public PropertyManager(CluecumberLogger logger, FileIO fileIO, PropertiesFileLoader propertiesFileLoader)
Constructor for dependency injection.- Parameters:
logger- TheCluecumberLoggerinstance.fileIO- TheFileIOinstance.propertiesFileLoader- ThePropertiesFileLoaderinstance.
-
-
Method Detail
-
getSourceJsonReportDirectory
public String getSourceJsonReportDirectory()
Get the root directory of the source JSON files.- Returns:
- The path.
-
setSourceJsonReportDirectory
public void setSourceJsonReportDirectory(String sourceJsonReportDirectory) throws WrongOrMissingPropertyException
Set the root directory of the source JSON files.- Parameters:
sourceJsonReportDirectory- The path.- Throws:
WrongOrMissingPropertyException- Thrown on any error.
-
getGeneratedHtmlReportDirectory
public String getGeneratedHtmlReportDirectory()
Get the root directory of the target HTML report.- Returns:
- The path.
-
setGeneratedHtmlReportDirectory
public void setGeneratedHtmlReportDirectory(String generatedHtmlReportDirectory) throws WrongOrMissingPropertyException
Set the root directory of the target HTML report.- Parameters:
generatedHtmlReportDirectory- The path.- Throws:
WrongOrMissingPropertyException- Thrown on any error.
-
getCustomParameters
public Map<String,String> getCustomParameters()
Get the custom parameters to be shown at the top of the report.- Returns:
- The map of custom parameter key value pairs.
-
setCustomParameters
public void setCustomParameters(Map<String,String> customParameters)
Set the custom parameters to be shown at the top of the report.- Parameters:
customParameters- The map of custom parameter key value pairs.
-
getCustomParametersFile
public String getCustomParametersFile()
Get the path to the custom parameter file.- Returns:
- The path as string.
-
setCustomParametersFile
public void setCustomParametersFile(String customParametersFile) throws CluecumberException
Set the path to the custom parameter file.- Parameters:
customParametersFile- The path as string.- Throws:
CluecumberException- Thrown on every error.
-
getCustomParametersDisplayMode
public Settings.CustomParamDisplayMode getCustomParametersDisplayMode()
Get the display mode for custom parameters (on which page they should appear).- Returns:
- The
Settings.CustomParamDisplayModevalue.
-
setCustomParametersDisplayMode
public void setCustomParametersDisplayMode(String customParametersDisplayMode)
Set the display mode for custom parameters (on which page they should appear). Must be a value ofSettings.CustomParamDisplayMode.- Parameters:
customParametersDisplayMode- The display mode string.
-
setCustomNavigationLinks
public void setCustomNavigationLinks(Map<String,String> customNavigationLinks)
Set the custom navigation links to appear next to the default Cluecumber navigation. The map key represents the caption to be display in the navigation, the value is the actual URL to link to.- Parameters:
customNavigationLinks- The map of key value pairs.
-
getNavigationLinks
public List<Link> getNavigationLinks()
Get the custom navigation links to appear next to the default Cluecumber navigation. The map key represents the caption to be display in the navigation, the value is the actual URL to link to.- Returns:
- The map of key value pairs.
-
isFailScenariosOnPendingOrUndefinedSteps
public boolean isFailScenariosOnPendingOrUndefinedSteps()
This determines whether a scenario should be considered failed if it contains pending or undefined steps.- Returns:
- true means fail on pending or undefined steps.
-
setFailScenariosOnPendingOrUndefinedSteps
public void setFailScenariosOnPendingOrUndefinedSteps(boolean failScenariosOnPendingOrUndefinedSteps)
Set whether a scenario should be considered failed if it contains pending or undefined steps.- Parameters:
failScenariosOnPendingOrUndefinedSteps- true means fail on pending or undefined steps.
-
isExpandSubSections
public boolean isExpandSubSections()
This determines whether sub sections should be expanded by default.- Returns:
- true means they should be expanded.
-
setExpandSubSections
public void setExpandSubSections(boolean expandSubSections)
Set whether sub sections should be expanded by default.- Parameters:
expandSubSections- true means they should be expanded.
-
isExpandBeforeAfterHooks
public boolean isExpandBeforeAfterHooks()
This determines whether before and after hooks should be expanded by default.- Returns:
- true means they should be expanded.
-
setExpandBeforeAfterHooks
public void setExpandBeforeAfterHooks(boolean expandBeforeAfterHooks)
Set whether before and after hooks should be expanded by default.- Parameters:
expandBeforeAfterHooks- true means they should be expanded.
-
isExpandStepHooks
public boolean isExpandStepHooks()
This determines whether step hooks should be expanded by default.- Returns:
- true means they should be expanded.
-
setExpandStepHooks
public void setExpandStepHooks(boolean expandStepHooks)
Set whether step hooks should be expanded by default.- Parameters:
expandStepHooks- true means they should be expanded.
-
isExpandDocStrings
public boolean isExpandDocStrings()
This determines whether doc strings should be expanded by default.- Returns:
- true means they should be expanded.
-
setExpandDocStrings
public void setExpandDocStrings(boolean expandDocStrings)
Set whether doc strings should be expanded by default.- Parameters:
expandDocStrings- true means they should be expanded.
-
isExpandAttachments
public boolean isExpandAttachments()
This determines whether attachments should be expanded by default.- Returns:
- true means they should be expanded.
-
isExpandOutputs
public boolean isExpandOutputs()
This determines whether step outputs should be expanded by default.- Returns:
- true means they should be expanded.
-
setExpandAttachments
public void setExpandAttachments(boolean expandAttachments)
Set whether attachments should be expanded by default.- Parameters:
expandAttachments- true means they should be expanded.
-
setExpandOutputs
public void setExpandOutputs(boolean expandOutputs)
Set whether step outputs should be expanded by default.- Parameters:
expandOutputs- true means they should be expanded.
-
isGroupPreviousScenarioRuns
public boolean isGroupPreviousScenarioRuns()
This determines whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.- Returns:
- true means scenarios should be grouped and toggle should be shown.
-
setGroupPreviousScenarioRuns
public void setGroupPreviousScenarioRuns(boolean groupPreviousScenarioRuns)
Set whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.- Parameters:
groupPreviousScenarioRuns- true means scenarios should be grouped and toggle should be shown.
-
isExpandPreviousScenarioRuns
public boolean isExpandPreviousScenarioRuns()
This determines whether the not last run elements should be expanded and shown.- Returns:
- true means it should be expanded.
-
setExpandPreviousScenarioRuns
public void setExpandPreviousScenarioRuns(boolean expandPreviousScenarioRuns)
Set whether the not last run elements should be expanded and shown.- Parameters:
expandPreviousScenarioRuns- true means elements should be expanded.
-
getCustomCssFile
public String getCustomCssFile()
Get the custom CSS file path.- Returns:
- The path.
-
setCustomCssFile
public void setCustomCssFile(String customCssFile) throws MissingFileException
Set the custom CSS file path.- Parameters:
customCssFile- The path.- Throws:
MissingFileException- Thrown if the file is not found.
-
getCustomStatusColorPassed
public String getCustomStatusColorPassed()
Get the custom hex color for passed elements.- Returns:
- The hex color string.
-
setCustomStatusColorPassed
public void setCustomStatusColorPassed(String customStatusColorPassed) throws WrongOrMissingPropertyException
Set a custom hex color for passed elements.- Parameters:
customStatusColorPassed- The color as a hex string (e.g. '#00ff00').- Throws:
WrongOrMissingPropertyException- Thrown on any error.
-
getCustomStatusColorFailed
public String getCustomStatusColorFailed()
Get the custom hex color for failed elements.- Returns:
- The hex color string.
-
setCustomStatusColorFailed
public void setCustomStatusColorFailed(String customStatusColorFailed) throws WrongOrMissingPropertyException
Set a custom hex color for failed elements.- Parameters:
customStatusColorFailed- The color as a hex string (e.g. '#00ff00').- Throws:
WrongOrMissingPropertyException- Thrown on any error.
-
getCustomStatusColorSkipped
public String getCustomStatusColorSkipped()
Get the custom hex color for skipped elements.- Returns:
- The hex color string.
-
setCustomStatusColorSkipped
public void setCustomStatusColorSkipped(String customStatusColorSkipped) throws WrongOrMissingPropertyException
Set a custom hex color for skipped elements.- Parameters:
customStatusColorSkipped- The color as a hex string (e.g. '#00ff00').- Throws:
WrongOrMissingPropertyException- Thrown on any error.
-
getCustomPageTitle
public String getCustomPageTitle()
Get the custom page title of the report.- Returns:
- The page title.
-
setCustomPageTitle
public void setCustomPageTitle(String customPageTitle)
Set the custom page title of the report.- Parameters:
customPageTitle- The page title.
-
logProperties
public void logProperties()
Log Cluecumber properties on the command line based on the set log level.
-
getStartPage
public Settings.StartPage getStartPage()
Get the start page of the report.- Returns:
- The
Settings.StartPagevalue.
-
setStartPage
public void setStartPage(String startPage)
Set the start page of the report.- Parameters:
startPage- The name of the start page (must be included in theSettings.StartPageenum.
-
-