Package org.anasoid.jmc.core.config
Class JmcConfig
- java.lang.Object
-
- org.anasoid.jmc.core.config.JmcConfig
-
public final class JmcConfig extends java.lang.ObjectJmc 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.AutoCloseablecreateLocalJmcConfig(java.lang.String... paths)Create local Jmc Config, local config is related to thread.static java.lang.AutoCloseablecreateLocalJmcConfig(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.AutoCloseablecreateLocalJmcConfig(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.BooleangetBoolean(java.lang.String key)get property from config.static java.lang.BooleangetBoolean(java.lang.String key, java.lang.Boolean defaultValue)get property from config s boolean.static java.lang.StringgetDataRootFolder()Get Data root folder.static java.lang.IntegergetInteger(java.lang.String key)get property from config.static java.lang.IntegergetInteger(java.lang.String key, java.lang.Integer defaultValue)get property from config as Integer.static java.lang.StringgetJMeterVersion()Gets the JMeter Version (from Jmeter).static java.lang.StringgetPropertiesVersion()Gets the JMeter Properties Version.static java.lang.StringgetProperty(java.lang.String key)get property from config.static java.lang.StringgetProperty(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.StringgetResultRootFolder()Get Result root folder.static java.lang.StringgetScriptRootFolder()Get Script root folder.static java.lang.StringgetVersion()Gets the Version (from Jmeter).static booleanisDataResource()Get Data csv fom resource, use only when executing from code source.static booleanisScriptResource()Get Script root folder.static voidreset()static voidsetBoolean(java.lang.String key, java.lang.Boolean value)set boolean value to config.static voidsetInteger(java.lang.String key, java.lang.Integer value)set boolean value to config.static voidsetProperty(java.lang.String key, java.lang.String value)set property to config.
-
-
-
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.
-
-