Package io.dropwizard.testing
Class ConfigOverride
- java.lang.Object
-
- io.dropwizard.testing.ConfigOverride
-
- Direct Known Subclasses:
ConfigOverrideRandomPorts
,ConfigOverrideValue
public abstract class ConfigOverride extends Object
An override for a field in dropwizard configuration intended for use withDropwizardAppExtension
.Given a configuration file containing
--- server: applicationConnectors: - type: http port: 8000 adminConnectors: - type: http port: 8001 logging: loggers: com.example.foo: INFO
ConfigOverride.config("debug", "true")
will add a top level field named "debug" mapped to the string "true".ConfigOverride.config("server.applicationConnectors[0].type", "https")
will change the sole application connector to have type "https" instead of type "http".ConfigOverride.config("logging.loggers.com\\.example\\.bar", "DEBUG")
will add a logger with the name "com.example.bar" configured for debug logging.ConfigOverride.randomPorts()
will change the ports of the default applicationConnectors and adminConnectors to 0 so the tests start with random ports.
-
-
Constructor Summary
Constructors Constructor Description ConfigOverride()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addToSystemProperties()
static ConfigOverride
config(String key, String value)
static ConfigOverride
config(String propertyPrefix, String key, String value)
static ConfigOverride
config(String propertyPrefix, String key, Supplier<String> value)
static ConfigOverride
config(String key, Supplier<String> value)
static ConfigOverride
randomPorts()
static ConfigOverride
randomPorts(String propertyPrefix)
abstract void
removeFromSystemProperties()
-
-
-
Method Detail
-
config
public static ConfigOverride config(String key, String value)
-
config
public static ConfigOverride config(String propertyPrefix, String key, String value)
-
config
public static ConfigOverride config(String key, Supplier<String> value)
-
config
public static ConfigOverride config(String propertyPrefix, String key, Supplier<String> value)
-
randomPorts
public static ConfigOverride randomPorts()
-
randomPorts
public static ConfigOverride randomPorts(String propertyPrefix)
-
addToSystemProperties
public abstract void addToSystemProperties()
-
removeFromSystemProperties
public abstract void removeFromSystemProperties()
-
-