Class SystemEnvironmentVariables

java.lang.Object
net.thucydides.core.util.SystemEnvironmentVariables
All Implemented Interfaces:
EnvironmentVariables

public class SystemEnvironmentVariables
extends java.lang.Object
implements EnvironmentVariables
Return system environment variable values.
  • Constructor Summary

    Constructors
    Constructor Description
    SystemEnvironmentVariables()  
  • Method Summary

    Modifier and Type Method Description
    java.util.Map<java.lang.String,​java.lang.String> asMap()  
    boolean aValueIsDefinedFor​(java.lang.Enum<?> property)  
    boolean aValueIsDefinedFor​(java.lang.String property)  
    void clearProperty​(java.lang.String name)  
    EnvironmentVariables copy()  
    static EnvironmentVariables createEnvironmentVariables()  
    java.util.List<java.lang.String> getKeys()  
    java.util.Properties getProperties()  
    java.util.Properties getPropertiesWithPrefix​(java.lang.String prefix)  
    java.lang.String getProperty​(java.lang.Enum<?> property)  
    java.lang.String getProperty​(java.lang.Enum<?> property, java.lang.String defaultValue)  
    java.lang.String getProperty​(java.lang.String name)  
    java.lang.String getProperty​(java.lang.String name, java.lang.String defaultValue)  
    java.lang.Boolean getPropertyAsBoolean​(java.lang.Enum<?> property, boolean defaultValue)  
    java.lang.Boolean getPropertyAsBoolean​(java.lang.String name, boolean defaultValue)  
    java.lang.Integer getPropertyAsInteger​(java.lang.Enum<?> property, java.lang.Integer defaultValue)  
    java.lang.Integer getPropertyAsInteger​(java.lang.String property, java.lang.Integer defaultValue)  
    java.lang.String getValue​(java.lang.Enum<?> property)  
    java.lang.String getValue​(java.lang.Enum<?> property, java.lang.String defaultValue)  
    java.lang.String getValue​(java.lang.String name)  
    java.lang.String getValue​(java.lang.String name, java.lang.String defaultValue)  
    java.lang.String injectSystemPropertiesInto​(java.lang.String value)  
    java.util.Optional<java.lang.String> optionalProperty​(java.lang.String name)
    Returns an optional system property.
    void setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)  
    void setProperty​(java.lang.String name, java.lang.String value)  
    java.util.Map<java.lang.String,​java.lang.String> simpleSystemPropertiesAsMap()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SystemEnvironmentVariables

      public SystemEnvironmentVariables()
  • Method Details

    • getValue

      public java.lang.String getValue​(java.lang.String name)
      Specified by:
      getValue in interface EnvironmentVariables
    • getValue

      public java.lang.String getValue​(java.lang.Enum<?> property)
      Specified by:
      getValue in interface EnvironmentVariables
    • getValue

      public java.lang.String getValue​(java.lang.String name, java.lang.String defaultValue)
      Specified by:
      getValue in interface EnvironmentVariables
    • getValue

      public java.lang.String getValue​(java.lang.Enum<?> property, java.lang.String defaultValue)
      Specified by:
      getValue in interface EnvironmentVariables
    • getKeys

      public java.util.List<java.lang.String> getKeys()
      Specified by:
      getKeys in interface EnvironmentVariables
    • getProperties

      public java.util.Properties getProperties()
      Specified by:
      getProperties in interface EnvironmentVariables
    • getPropertiesWithPrefix

      public java.util.Properties getPropertiesWithPrefix​(java.lang.String prefix)
      Specified by:
      getPropertiesWithPrefix in interface EnvironmentVariables
    • aValueIsDefinedFor

      public boolean aValueIsDefinedFor​(java.lang.Enum<?> property)
      Specified by:
      aValueIsDefinedFor in interface EnvironmentVariables
    • aValueIsDefinedFor

      public boolean aValueIsDefinedFor​(java.lang.String property)
      Specified by:
      aValueIsDefinedFor in interface EnvironmentVariables
    • injectSystemPropertiesInto

      public java.lang.String injectSystemPropertiesInto​(java.lang.String value)
      Specified by:
      injectSystemPropertiesInto in interface EnvironmentVariables
    • getPropertyAsInteger

      public java.lang.Integer getPropertyAsInteger​(java.lang.String property, java.lang.Integer defaultValue)
      Specified by:
      getPropertyAsInteger in interface EnvironmentVariables
    • getPropertyAsInteger

      public java.lang.Integer getPropertyAsInteger​(java.lang.Enum<?> property, java.lang.Integer defaultValue)
      Specified by:
      getPropertyAsInteger in interface EnvironmentVariables
    • getPropertyAsBoolean

      public java.lang.Boolean getPropertyAsBoolean​(java.lang.String name, boolean defaultValue)
      Specified by:
      getPropertyAsBoolean in interface EnvironmentVariables
    • getPropertyAsBoolean

      public java.lang.Boolean getPropertyAsBoolean​(java.lang.Enum<?> property, boolean defaultValue)
      Specified by:
      getPropertyAsBoolean in interface EnvironmentVariables
    • getProperty

      public java.lang.String getProperty​(java.lang.String name)
      Specified by:
      getProperty in interface EnvironmentVariables
    • optionalProperty

      public java.util.Optional<java.lang.String> optionalProperty​(java.lang.String name)
      Description copied from interface: EnvironmentVariables
      Returns an optional system property. The property may be defined in the project's serenity.properties or serenity.conf file, or be provided as a a system property. This is designed particularly for user-provided properties, to make it easier to store test confiuration properties in a single file. Sample usage: ``` EnvironmentVariables environmentVariables; String environment = environmentVariables.optionalProperty("env").orElse("DEV") ```
      Specified by:
      optionalProperty in interface EnvironmentVariables
    • getProperty

      public java.lang.String getProperty​(java.lang.Enum<?> property)
      Specified by:
      getProperty in interface EnvironmentVariables
    • getProperty

      public java.lang.String getProperty​(java.lang.String name, java.lang.String defaultValue)
      Specified by:
      getProperty in interface EnvironmentVariables
    • getProperty

      public java.lang.String getProperty​(java.lang.Enum<?> property, java.lang.String defaultValue)
      Specified by:
      getProperty in interface EnvironmentVariables
    • setProperty

      public void setProperty​(java.lang.String name, java.lang.String value)
      Specified by:
      setProperty in interface EnvironmentVariables
    • setProperties

      public void setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
      Specified by:
      setProperties in interface EnvironmentVariables
    • clearProperty

      public void clearProperty​(java.lang.String name)
      Specified by:
      clearProperty in interface EnvironmentVariables
    • asMap

      public java.util.Map<java.lang.String,​java.lang.String> asMap()
      Specified by:
      asMap in interface EnvironmentVariables
    • simpleSystemPropertiesAsMap

      public java.util.Map<java.lang.String,​java.lang.String> simpleSystemPropertiesAsMap()
      Specified by:
      simpleSystemPropertiesAsMap in interface EnvironmentVariables
    • copy

      public EnvironmentVariables copy()
      Specified by:
      copy in interface EnvironmentVariables
    • createEnvironmentVariables

      public static EnvironmentVariables createEnvironmentVariables()