Class TestConfigSupplier<M extends PMessage<M>>
- java.lang.Object
-
- net.morimekta.providence.config.impl.UpdatingConfigSupplier<M>
-
- net.morimekta.providence.config.testing.TestConfigSupplier<M>
-
- Type Parameters:
M
- The message type.
- All Implemented Interfaces:
java.util.function.Supplier<M>
,ConfigSupplier<M>
public class TestConfigSupplier<M extends PMessage<M>> extends UpdatingConfigSupplier<M>
Config supplier meant for testing only. It is an updating config supplier, but that exposes the config update method itself.
-
-
Constructor Summary
Constructors Constructor Description TestConfigSupplier(java.lang.String initialResource, PMessageDescriptor<M> descriptor)
Start with an initial config value.TestConfigSupplier(java.time.Clock clock, M initialConfig)
Start with an initial config value.TestConfigSupplier(M initialConfig)
Start with an initial config value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Get a simple descriptive name for this config supplier.void
testUpdate(java.lang.String resourceName)
Update the current config and trigger updates.void
testUpdate(M newInstance)
Update the current config and trigger updates.java.lang.String
toString()
-
Methods inherited from class net.morimekta.providence.config.impl.UpdatingConfigSupplier
addListener, configTimestamp, get, getClock, reference, removeListener, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.config.ConfigSupplier
override, override, snapshot
-
-
-
-
Constructor Detail
-
TestConfigSupplier
public TestConfigSupplier(@Nonnull java.lang.String initialResource, PMessageDescriptor<M> descriptor) throws ConfigException
Start with an initial config value.- Parameters:
initialResource
- The initial config value.descriptor
- The message descriptor.- Throws:
ConfigException
- If unable to load the config.
-
TestConfigSupplier
public TestConfigSupplier(@Nonnull M initialConfig)
Start with an initial config value.- Parameters:
initialConfig
- The initial config value.
-
TestConfigSupplier
public TestConfigSupplier(@Nonnull java.time.Clock clock, @Nonnull M initialConfig)
Start with an initial config value.- Parameters:
clock
- The clock to use for timing.initialConfig
- The initial config value.
-
-
Method Detail
-
testUpdate
public void testUpdate(@Nonnull M newInstance)
Update the current config and trigger updates.- Parameters:
newInstance
- The new config instance.
-
testUpdate
public void testUpdate(@Nonnull java.lang.String resourceName) throws ConfigException
Update the current config and trigger updates.- Parameters:
resourceName
- The new config resource name.- Throws:
ConfigException
- If the loaded config is not valid.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()
Description copied from interface:ConfigSupplier
Get a simple descriptive name for this config supplier.- Returns:
- The supplier name.
-
-