Package ru.vyarus.yaml.updater.profile
Class TestConfigurator
- java.lang.Object
-
- ru.vyarus.yaml.updater.UpdateConfig.Configurator<TestConfigurator>
-
- ru.vyarus.yaml.updater.profile.TestConfigurator
-
public final class TestConfigurator extends UpdateConfig.Configurator<TestConfigurator>
Utility to simplify testing updates: it could search file on fs, in classpath or as url. Executes updater in dry run mode (to avoid modifications). Temp file is used as original config (with copied content), so nothing could be changed in any case.By default, prints update report and complete merged file (for visual validation).
Target use case: keep old config somewhere in test classpath and compare it with the newer config version to make sure production migration will not fail.
- Since:
- 06.10.2021
- See Also:
YamlUpdater.createTest(String, String)
-
-
Field Summary
-
Fields inherited from class ru.vyarus.yaml.updater.UpdateConfig.Configurator
config
-
-
Constructor Summary
Constructors Constructor Description TestConfigurator(java.lang.String config, java.lang.String update)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestConfiguratordryRun(boolean dryRun)Test execution - performs complete update, but did not override existing file.TestConfiguratorprintReport(boolean printReport)Enabled by default.TestConfiguratorprintResult(boolean printResult)Enabled by default.UpdateReportupdate()Performs configuration migration.-
Methods inherited from class ru.vyarus.yaml.updater.UpdateConfig.Configurator
backup, backupDir, deleteProps, deleteProps, envVars, listen, validateResult, var, vars, varsFile
-
-
-
-
Method Detail
-
printReport
public TestConfigurator printReport(boolean printReport)
Enabled by default.- Parameters:
printReport- print update summary report- Returns:
- tester instance for chained calls
-
printResult
public TestConfigurator printResult(boolean printResult)
Enabled by default. Print file only if it's changed during merge.- Parameters:
printResult- print entire merged file- Returns:
- tester instance for chained calls
-
dryRun
public TestConfigurator dryRun(boolean dryRun)
Description copied from class:UpdateConfig.ConfiguratorTest execution - performs complete update, but did not override existing file. Useful for validations (in tests or with CLI to make sure upgrade would be successful).- Overrides:
dryRunin classUpdateConfig.Configurator<TestConfigurator>- Parameters:
dryRun- true to not perform any modifications (test run)- Returns:
- builder instance for chained calls
-
update
public UpdateReport update()
Description copied from class:UpdateConfig.ConfiguratorPerforms configuration migration.- Overrides:
updatein classUpdateConfig.Configurator<TestConfigurator>- Returns:
- update report
- See Also:
for default report formatter
-
-