Class JmcConfig


  • public final class JmcConfig
    extends java.lang.Object
    Jmc Config to have access to all JMC configuration and Jmeter configuration.
     Load properties by the following order resource than file:
    
     1 -org/anasoid/jmc/core/config/jmc.properties
     2- jmc-user.properties
     3- {user.home}/jmc-user.properties
     4- System properties
     
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.AutoCloseable createLocalJmcConfig​(java.lang.String... paths)
      Create local Jmc Config, local config is related to thread.
      static java.lang.AutoCloseable createLocalJmcConfig​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String... paths)
      Create local Jmc Config, local config is related to thread.
      static java.lang.AutoCloseable createLocalJmcConfig​(java.util.Map<java.lang.String,​java.lang.String> properties, java.util.List<java.lang.String> paths)
      Create local Jmc Config, local config is related to thread.
      static java.lang.Boolean getBoolean​(java.lang.String key)
      get property from config.
      static java.lang.Boolean getBoolean​(java.lang.String key, java.lang.Boolean defaultValue)
      get property from config s boolean.
      static java.lang.String getDataRootFolder()
      Get Data root folder.
      static java.lang.Integer getInteger​(java.lang.String key)
      get property from config.
      static java.lang.Integer getInteger​(java.lang.String key, java.lang.Integer defaultValue)
      get property from config as Integer.
      static java.lang.String getJMeterVersion()
      Gets the JMeter Version (from Jmeter).
      static java.lang.String getPropertiesVersion()
      Gets the JMeter Properties Version.
      static java.lang.String getProperty​(java.lang.String key)
      get property from config.
      static java.lang.String getProperty​(java.lang.String key, java.lang.String defaultValue)
      get property from config.
      static java.util.Map<java.lang.String,​java.lang.String> getPropertyPrefix​(java.lang.String prefix)
      get property from config.
      static java.lang.String getResultRootFolder()
      Get Result root folder.
      static java.lang.String getScriptRootFolder()
      Get Script root folder.
      static java.lang.String getVersion()
      Gets the Version (from Jmeter).
      static boolean isDataResource()
      Get Data csv fom resource, use only when executing from code source.
      static boolean isScriptResource()
      Get Script root folder.
      static void reset()  
      static void setBoolean​(java.lang.String key, java.lang.Boolean value)
      set boolean value to config.
      static void setInteger​(java.lang.String key, java.lang.Integer value)
      set boolean value to config.
      static void setProperty​(java.lang.String key, java.lang.String value)
      set property to config.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDataRootFolder

        public static java.lang.String getDataRootFolder()
        Get Data root folder.
      • getScriptRootFolder

        public static java.lang.String getScriptRootFolder()
        Get Script root folder.
      • getResultRootFolder

        public static java.lang.String getResultRootFolder()
        Get Result root folder.
      • isDataResource

        public static boolean isDataResource()
        Get Data csv fom resource, use only when executing from code source.
      • isScriptResource

        public static boolean isScriptResource()
        Get Script root folder.
      • getVersion

        public static java.lang.String getVersion()
        Gets the Version (from Jmeter).
        Returns:
        the version string
      • getJMeterVersion

        public static java.lang.String getJMeterVersion()
        Gets the JMeter Version (from Jmeter).
        Returns:
        the JMeter version string
      • getPropertiesVersion

        public static java.lang.String getPropertiesVersion()
        Gets the JMeter Properties Version.
        Returns:
        the JMeter Properties version string
      • getProperty

        public static java.lang.String getProperty​(java.lang.String key)
        get property from config.
        Parameters:
        key - key.
        Returns:
        null or value.
      • getProperty

        public static java.lang.String getProperty​(java.lang.String key,
                                                   java.lang.String defaultValue)
        get property from config.
        Parameters:
        key - key.
        defaultValue - defaultValue, return if key not found.
        Returns:
        value or defaultValue.
      • getBoolean

        public static java.lang.Boolean getBoolean​(java.lang.String key,
                                                   java.lang.Boolean defaultValue)
        get property from config s boolean.
        Parameters:
        key - key.
        defaultValue - defaultValue, return if key not found.
        Returns:
        value or defaultValue.
      • getBoolean

        public static java.lang.Boolean getBoolean​(java.lang.String key)
        get property from config.
        Parameters:
        key - key.
        Returns:
        value or null.
      • setBoolean

        public static void setBoolean​(java.lang.String key,
                                      java.lang.Boolean value)
        set boolean value to config.
        Parameters:
        key - key.
        value - value.
      • getInteger

        public static java.lang.Integer getInteger​(java.lang.String key,
                                                   java.lang.Integer defaultValue)
        get property from config as Integer.
        Parameters:
        key - key.
        defaultValue - defaultValue, return if key not found.
        Returns:
        value or defaultValue.
      • getInteger

        public static java.lang.Integer getInteger​(java.lang.String key)
        get property from config.
        Parameters:
        key - key.
        Returns:
        value or null.
      • setInteger

        public static void setInteger​(java.lang.String key,
                                      java.lang.Integer value)
        set boolean value to config.
        Parameters:
        key - key.
        value - value.
      • setProperty

        public static void setProperty​(java.lang.String key,
                                       java.lang.String value)
        set property to config.
        Parameters:
        key - key.
        value - value.
      • getPropertyPrefix

        public static java.util.Map<java.lang.String,​java.lang.String> getPropertyPrefix​(java.lang.String prefix)
        get property from config.
        Parameters:
        prefix - prefix, keys start with "prefix." .
        Returns:
        null or value.
      • reset

        public static void reset()
      • createLocalJmcConfig

        public static java.lang.AutoCloseable createLocalJmcConfig​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                                   java.lang.String... paths)
        Create local Jmc Config, local config is related to thread. Clone old config and add additional properties.
        Parameters:
        properties - additional properties.
        paths - additional properties files, try to find file on resource than on file system.
        Returns:
        AutoCloseable to close the local config.
      • createLocalJmcConfig

        public static java.lang.AutoCloseable createLocalJmcConfig​(java.lang.String... paths)
        Create local Jmc Config, local config is related to thread. Clone old config and add additional properties.
        Parameters:
        paths - additional properties files, try to find file on resource than on file system.
        Returns:
        AutoCloseable to close the local config.
      • createLocalJmcConfig

        public static java.lang.AutoCloseable createLocalJmcConfig​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                                                   java.util.List<java.lang.String> paths)
        Create local Jmc Config, local config is related to thread. Clone old config and add additional properties.
        Parameters:
        properties - additional properties.
        paths - additional properties files, try to find file on resource than on file system.
        Returns:
        AutoCloseable to close the local config.