Package core.support.configReader
Class Config
java.lang.Object
core.support.configReader.Config
public class Config extends Object
-
Field Summary
Fields Modifier and Type Field Description static StringRESOURCE_PATH -
Constructor Summary
Constructors Constructor Description Config() -
Method Summary
Modifier and Type Method Description static List<String>checkForDuplicateKeys()check for config duplicate keys and print out the key + property file namestatic voidgetAllFiles(File curDir)git all files in given directorystatic Map<String,String>getAllKeys(String path)get all key values from property files in directory at path Fails if duplicate key exists.static BooleangetBooleanValue(String key)gets boolean value from properties keystatic BooleangetBooleanValue(String key, boolean isFailable)gets boolean value from properties keystatic List<String>getConfigGroup(Map<String,String> propertiesMap)get the list of group path specified by profile.group.groupName.static List<String>getConfigProfiles(Map<String,String> propertiesMap)get the list of profile path specified by profile.static List<String>getConfigs(Map<String,String> propertiesMap)get a list of config path from properties.property file prefix: "config.", not including profiles: config.profile keystatic doublegetDoubleValue(String key)gets double value from properties keystatic doublegetDoubleValue(String key, boolean isFailable)gets double value from properties keystatic BooleangetGlobalBooleanValue(String key)gets boolean value from properties keystatic intgetGlobalIntValue(String key)gets int value from properties keystatic ObjectgetGlobalObjectValue(String key)gets the object value from property keystatic StringgetGlobalValue(String key)returns config valuestatic StringgetGlobalValue(String key, boolean isFailable)returns config valuestatic intgetIntValue(String key)gets int value from properties keystatic intgetIntValue(String key, boolean isFailable)gets int value from properties keystatic ObjectgetObjectValue(String key)gets the object value from property keystatic booleangetParentValue(String key)get parent config valuestatic StringgetValue(String key)returns config valuestatic StringgetValue(String key, boolean isFailable)returns config valuestatic ArrayList<String>getValueList(String key)returns a list from config value values separated by ","static ArrayList<String>getValueList(String key, boolean isFailable)returns a list from config value values separated by ","static voidloadConfig(String testId)loads config And properties files to TestObject config mapstatic Map<String,Object>loadConfigProperties()loads configs and profiles to TestObject config mapstatic voidprintMissingConfigVariables()print a list of missing config variablesstatic voidputValue(String key, Object value)puts key value pair in configstatic voidputValue(String key, Object value, boolean isLog)puts key value pair in configstatic voidputValue(String key, Object value, String info)static voidsetGlobalValue(String key, Object value)set global config valuestatic voidsetParentValue(String key, Object value)set parent config value
-
Field Details
-
RESOURCE_PATH
-
-
Constructor Details
-
Config
public Config()
-
-
Method Details
-
getAllFiles
git all files in given directory- Parameters:
curDir- target directory
-
getAllKeys
get all key values from property files in directory at path Fails if duplicate key exists. All keys need to be unique- Parameters:
path- path to proeprties file- Returns:
- map of all key and values in all property files in given path
-
loadConfig
loads config And properties files to TestObject config map- Parameters:
testId- id of the test
-
loadConfigProperties
loads configs and profiles to TestObject config map- Returns:
-
checkForDuplicateKeys
check for config duplicate keys and print out the key + property file name- Returns:
-
getConfigs
get a list of config path from properties.property file prefix: "config.", not including profiles: config.profile key- Parameters:
propertiesMap-- Returns:
-
getConfigProfiles
get the list of profile path specified by profile. in properties.property file multiple profiles can be separated by ","- Parameters:
propertiesMap-- Returns:
-
getConfigGroup
get the list of group path specified by profile.group.groupName. in properties.property file multiple profiles can be separated by ","- Parameters:
propertiesMap-- Returns:
-
getValue
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getValue
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getGlobalIntValue
gets int value from properties key- Parameters:
key- key in properties file- Returns:
- returns the integer value of key from properties
-
getGlobalObjectValue
gets the object value from property key- Parameters:
key- key in properties file- Returns:
- returns the object value of key from properties
-
getGlobalBooleanValue
gets boolean value from properties key- Parameters:
key- target key from properties file- Returns:
- the boolean value of key from properties
-
getGlobalValue
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getGlobalValue
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getBooleanValue
gets boolean value from properties key- Parameters:
key- target key from properties file- Returns:
- the boolean value of key from properties
-
getBooleanValue
gets boolean value from properties key- Parameters:
key- target key from properties file- Returns:
- the boolean value of key from properties
-
getObjectValue
gets the object value from property key- Parameters:
key- key in properties file- Returns:
- returns the object value of key from properties
-
getIntValue
gets int value from properties key- Parameters:
key- key in properties file- Returns:
- returns the integer value of key from properties
-
getIntValue
gets int value from properties key- Parameters:
key- key in properties file- Returns:
- returns the integer value of key from properties
-
getDoubleValue
gets double value from properties key- Parameters:
key- key in properties file- Returns:
- the double value of key from properties
-
getDoubleValue
gets double value from properties key- Parameters:
key- key in properties file- Returns:
- the double value of key from properties
-
getValueList
returns a list from config value values separated by ","- Parameters:
key- key in properties file- Returns:
- the list of values from key separated by ","
-
getValueList
returns a list from config value values separated by ","- Parameters:
key- key in properties file- Returns:
- the list of values from key separated by ","
-
putValue
puts key value pair in config- Parameters:
key- key in properties filevalue- value associated with key
-
putValue
puts key value pair in config- Parameters:
key- key in properties filevalue- value associated with key
-
putValue
-
setParentValue
set parent config value- Parameters:
key-value-
-
setGlobalValue
set global config value- Parameters:
key-value-
-
getParentValue
get parent config value- Parameters:
key-- Returns:
-
printMissingConfigVariables
public static void printMissingConfigVariables()print a list of missing config variables
-