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
All Methods Static Methods Concrete Methods 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 Detail
-
RESOURCE_PATH
public static String RESOURCE_PATH
-
-
Method Detail
-
getAllFiles
public static void getAllFiles(File curDir)
git all files in given directory- Parameters:
curDir- target directory
-
getAllKeys
public static Map<String,String> getAllKeys(String path)
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
public static void loadConfig(String testId)
loads config And properties files to TestObject config map- Parameters:
testId- id of the test
-
loadConfigProperties
public static Map<String,Object> loadConfigProperties()
loads configs and profiles to TestObject config map- Returns:
-
checkForDuplicateKeys
public static List<String> checkForDuplicateKeys()
check for config duplicate keys and print out the key + property file name- Returns:
-
getConfigs
public 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 key- Parameters:
propertiesMap-- Returns:
-
getConfigProfiles
public static List<String> getConfigProfiles(Map<String,String> propertiesMap)
get the list of profile path specified by profile. in properties.property file multiple profiles can be separated by ","- Parameters:
propertiesMap-- Returns:
-
getConfigGroup
public static List<String> getConfigGroup(Map<String,String> propertiesMap)
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
public static String getValue(String key)
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getValue
public static String getValue(String key, boolean isFailable)
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getGlobalIntValue
public static int getGlobalIntValue(String key)
gets int value from properties key- Parameters:
key- key in properties file- Returns:
- returns the integer value of key from properties
-
getGlobalObjectValue
public static Object getGlobalObjectValue(String key)
gets the object value from property key- Parameters:
key- key in properties file- Returns:
- returns the object value of key from properties
-
getGlobalBooleanValue
public static Boolean getGlobalBooleanValue(String key)
gets boolean value from properties key- Parameters:
key- target key from properties file- Returns:
- the boolean value of key from properties
-
getGlobalValue
public static String getGlobalValue(String key)
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getGlobalValue
public static String getGlobalValue(String key, boolean isFailable)
returns config value- Parameters:
key- get string value of key from properties- Returns:
- string value of key
-
getBooleanValue
public static Boolean getBooleanValue(String key)
gets boolean value from properties key- Parameters:
key- target key from properties file- Returns:
- the boolean value of key from properties
-
getBooleanValue
public static Boolean getBooleanValue(String key, boolean isFailable)
gets boolean value from properties key- Parameters:
key- target key from properties file- Returns:
- the boolean value of key from properties
-
getObjectValue
public static Object getObjectValue(String key)
gets the object value from property key- Parameters:
key- key in properties file- Returns:
- returns the object value of key from properties
-
getIntValue
public static int getIntValue(String key)
gets int value from properties key- Parameters:
key- key in properties file- Returns:
- returns the integer value of key from properties
-
getIntValue
public static int getIntValue(String key, boolean isFailable)
gets int value from properties key- Parameters:
key- key in properties file- Returns:
- returns the integer value of key from properties
-
getDoubleValue
public static double getDoubleValue(String key)
gets double value from properties key- Parameters:
key- key in properties file- Returns:
- the double value of key from properties
-
getDoubleValue
public static double getDoubleValue(String key, boolean isFailable)
gets double value from properties key- Parameters:
key- key in properties file- Returns:
- the double value of key from properties
-
getValueList
public static ArrayList<String> getValueList(String key)
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
public static ArrayList<String> getValueList(String key, boolean isFailable)
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
public static void putValue(String key, Object value)
puts key value pair in config- Parameters:
key- key in properties filevalue- value associated with key
-
putValue
public static void putValue(String key, Object value, boolean isLog)
puts key value pair in config- Parameters:
key- key in properties filevalue- value associated with key
-
setParentValue
public static void setParentValue(String key, Object value)
set parent config value- Parameters:
key-value-
-
setGlobalValue
public static void setGlobalValue(String key, Object value)
set global config value- Parameters:
key-value-
-
getParentValue
public static boolean getParentValue(String key)
get parent config value- Parameters:
key-- Returns:
-
printMissingConfigVariables
public static void printMissingConfigVariables()
print a list of missing config variables
-
-