I've been looking and looking and can't find an answer. I use java .properties files for my test data. I need a way to iterate through the .properties file and create a map of only certain keys. The structure of the section of the .properties file I want is:
emulator.Android.driver.URL = https://emulator.com:443/wd/hub
emulator.Android.driver.appiumVersion = 1.7.1
emulator.Android.driver.deviceOrientation = portrait
emulator.Android.driver.browserName = ""
emulator.Android.driver.app = myApp.apk
emulator.Android.driver.platformName = Android
emulator.Android.driver.platformVersion = 6.0
emulator.Android.driver.name = sSuiteName
emulator.Android.driver.deviceName = Android Emulator
emulator.Android.driver.appPackage=com.app.android.debug
emulator.Android.driver.appActivity=com.app.android.LaunchActivity
emulator.iOS.driver.URL = https://emulator.com:443/wd/hub
emulator.iOS.driver.appiumVersion = 1.7.1
emulator.iOS.driver.deviceOrientation = portrait
emulator.iOS.driver.browserName = ""
emulator.iOS.driver.app = myApp.zip
emulator.iOS.driver.platformName = iOS
emulator.iOS.driver.platformVersion = 10.2
emulator.iOS.driver.deviceName = iPhone Simulator
emulator.iOS.driver.bundleId=com.qa
live.Android.driver.URL = https://live.com/wd/hub
live.Android.driver.apiKey = myKey
live.Android.driver.appiumVersion = 1.7.1
live.Android.driver.deviceOrientation = portrait
live.Android.driver.browserName = ""
live.Android.driver.app = myApp.apk
live.Android.driver.platformName = Android
live.Android.driver.platformVersion = 6.0
live.Android.driver.appPackage=com.app.android.debug
live.Android.driver.appActivity=com.app.android.LaunchActivity
live.iOS.driver.URL = https://live.com/wd/hub
live.iOS.driver.apiKey = myKey
live.iOS.driver.appiumVersion = 1.7.1
live.iOS.driver.deviceOrientation = portrait
live.iOS.driver.browserName = ""
live.iOS.driver.app = myApp.zip
live.iOS.driver.platformName = iOS
live.iOS.driver.platformVersion = 10.2
live.iOS.driver.name = sSuiteName
live.iOS.driver.bundleId=com.qa
NOTE: There are other properties in this file, but I only want the above. My goal is to extract all the properties such as emulator.Android.driver.* remove the emulator.Android.driver. and wind up with a map. For example, let's say I want to extract the properties for the emulator running on iOS. I would wind up with a map that would contain:
URL = https://emulator.com:443/wd/hub
appiumVersion = 1.7.1
deviceOrientation = portrait
browserName = ""
app = myApp.zip
platformName = iOS
platformVersion = 10.2
deviceName = iPhone Simulator
bundleId=com.qa
Next run I might select live with Android and should wind up with the map containing:
URL = https://live.com/wd/hub
apiKey = myKey
appiumVersion = 1.7.1
deviceOrientation = portrait
browserName = ""
app = myApp.apk
platformName = Android
platformVersion = 6.0
appPackage=com.app.android.debug
appActivity=com.app.android.LaunchActivity
Can anyone point me in the right direction?