Class Config

java.lang.Object
core.support.configReader.Config

public class Config extends Object
  • Field Details

    • RESOURCE_PATH

      public static String RESOURCE_PATH
  • Constructor Details

    • Config

      public Config()
  • Method Details

    • 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 file
      value - 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 file
      value - value associated with key
    • putValue

      public static void putValue(String key, Object value, String info)
    • 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