Package io.mats3.spring.jms.factories
Class ConfigurableScenarioDecider.StandardSpecificScenarioDecider
- java.lang.Object
-
- io.mats3.spring.jms.factories.ConfigurableScenarioDecider.StandardSpecificScenarioDecider
-
- All Implemented Interfaces:
ConfigurableScenarioDecider.SpecificScenarioDecider
- Enclosing class:
- ConfigurableScenarioDecider
public static class ConfigurableScenarioDecider.StandardSpecificScenarioDecider extends java.lang.Object implements ConfigurableScenarioDecider.SpecificScenarioDecider
Standard implementation ofConfigurableScenarioDecider.SpecificScenarioDeciderused in the default configuration ofConfigurableScenarioDecider, which takes a set of profile-or-properties names and checks whether they are present as a Spring Profile, or (with the "-" replaced by ".") whether it exists as a property in the Spring Environment.
-
-
Constructor Summary
Constructors Constructor Description StandardSpecificScenarioDecider(java.lang.String... profileOrPropertyNames)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<java.lang.String>isProfileOrPropertyPresent(org.springframework.core.env.Environment env, java.lang.String... profileNames)java.util.Optional<java.lang.String>scenarioActive(org.springframework.core.env.Environment env)Decides whether a specific Scenario is active.
-
-
-
Method Detail
-
scenarioActive
public java.util.Optional<java.lang.String> scenarioActive(org.springframework.core.env.Environment env)
Description copied from interface:ConfigurableScenarioDecider.SpecificScenarioDeciderDecides whether a specific Scenario is active.- Specified by:
scenarioActivein interfaceConfigurableScenarioDecider.SpecificScenarioDecider- Parameters:
env- the SpringEnvironment, from which Spring Profiles and properties/variables can be gotten. Notice that in the default Spring configuration, the Environment is populated by System Properties (Java command line "-Dproperty=value"-properties) and System Environment.- Returns:
- an
Optional, which if present means that the specific Mats Scenario is active - and the returned String is used in logging to show why this Scenario was chosen (a string like e.g."Found active Spring Profile 'mats-test'"would make sense). IfOptional.empty(), this specific Mats Scenario was not active.
-
isProfileOrPropertyPresent
public static java.util.Optional<java.lang.String> isProfileOrPropertyPresent(org.springframework.core.env.Environment env, java.lang.String... profileNames)
-
-