Package hudson.plugins.sauce_ondemand
Class SauceEnvironmentUtil
- java.lang.Object
-
- hudson.plugins.sauce_ondemand.SauceEnvironmentUtil
-
public final class SauceEnvironmentUtil extends Object
Contains helper methods.- Author:
- Ross Rowe
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
browserAsJSON(net.sf.json.JSONArray browsersJSON, com.saucelabs.ci.Browser browserInstance, String userName, String apiKey)
Populates the JSONArray with a JSON representation of the selected browserstatic String
generateTunnelName(String projectName, int buildNumber)
static String
getBuildName(Run<?,?> build)
static SauceOnDemandBuildWrapper
getBuildWrapper(AbstractProject<?,?> project)
static String
getSanitizedBuildNumber(Run run)
static void
outputEnvironmentVariable(Map<String,String> env, String key, String value, boolean overwrite, boolean verboseLogging, PrintStream printStream)
Adds the key/value pair to the map of environment variables.static void
outputEnvironmentVariable(Map<String,String> env, String key, String value, boolean verboseLogging, PrintStream printStream)
Adds the key/value pair to the map of environment variables.static void
outputEnvironmentVariablesForBrowser(Map<String,String> env, com.saucelabs.ci.Browser browserInstance, String userName, String apiKey, boolean overwrite, boolean verboseLogging, PrintStream printStream)
Adds the environment variables for the selected browser.static void
outputEnvironmentVariablesForBrowser(Map<String,String> env, com.saucelabs.ci.Browser browserInstance, String userName, String apiKey, boolean verboseLogging, PrintStream printStream)
Adds the environment variables for the selected browser.static void
outputVariables(Map<String,String> env, List<com.saucelabs.ci.Browser> browsers, String userName, String apiKey, boolean verboseLogging, PrintStream logger)
Adds the environment variables for the selected Appium browsers.
-
-
-
Method Detail
-
outputVariables
public static void outputVariables(Map<String,String> env, List<com.saucelabs.ci.Browser> browsers, String userName, String apiKey, boolean verboseLogging, PrintStream logger)
Adds the environment variables for the selected Appium browsers.- Parameters:
env
- the map of environment variablesbrowsers
- the list of selected browsersuserName
- the Sauce user nameapiKey
- the Sauce access keyverboseLogging
- Enable/Disable verbose logging of env variableslogger
- Where to log if necessary
-
browserAsJSON
public static void browserAsJSON(net.sf.json.JSONArray browsersJSON, com.saucelabs.ci.Browser browserInstance, String userName, String apiKey)
Populates the JSONArray with a JSON representation of the selected browser- Parameters:
browsersJSON
- array of browsersbrowserInstance
- selected Browser being processeduserName
- the Sauce usernameapiKey
- the Sauce access key
-
outputEnvironmentVariablesForBrowser
public static void outputEnvironmentVariablesForBrowser(Map<String,String> env, com.saucelabs.ci.Browser browserInstance, String userName, String apiKey, boolean verboseLogging, PrintStream printStream)
Adds the environment variables for the selected browser.- Parameters:
env
- the map of environment variablesbrowserInstance
- FIXMEuserName
- the Sauce user nameapiKey
- the Sauce access keyverboseLogging
- Enable/Disable verbose logging of env variablesprintStream
- Where to log if necessary
-
outputEnvironmentVariablesForBrowser
public static void outputEnvironmentVariablesForBrowser(Map<String,String> env, com.saucelabs.ci.Browser browserInstance, String userName, String apiKey, boolean overwrite, boolean verboseLogging, PrintStream printStream)
Adds the environment variables for the selected browser.- Parameters:
env
- the map of environment variablesbrowserInstance
- FIXMEuserName
- the Sauce user nameapiKey
- the Sauce access keyoverwrite
- indicates whether existing environment variables should be overwrittenverboseLogging
- Enable/Disable verbose logging of env variablesprintStream
- Where to log if necessary
-
outputEnvironmentVariable
public static void outputEnvironmentVariable(Map<String,String> env, String key, String value, boolean verboseLogging, PrintStream printStream)
Adds the key/value pair to the map of environment variables.- Parameters:
env
- the map of environment variableskey
- environment variable keyvalue
- environment variable valueverboseLogging
- Enable/Disable verbose logging of env variablesprintStream
- Where to log if necessary
-
outputEnvironmentVariable
public static void outputEnvironmentVariable(Map<String,String> env, String key, String value, boolean overwrite, boolean verboseLogging, PrintStream printStream)
Adds the key/value pair to the map of environment variables.- Parameters:
env
- the map of environment variableskey
- environment variable keyvalue
- environment variable valueoverwrite
- indicates whether existing environment variables should be overwrittenverboseLogging
- Enable/Disable verbose logging of env variablesprintStream
- Where to log if necessary
-
getBuildWrapper
public static SauceOnDemandBuildWrapper getBuildWrapper(AbstractProject<?,?> project)
- Parameters:
project
- the Jenkins project to check- Returns:
- the SauceOnDemandBuildWrapper instance associated with the project, can be null
-
getBuildName
@NonNull public static String getBuildName(Run<?,?> build)
- Parameters:
build
- the Jenkins build- Returns:
- String representing the Jenkins build
-
-