Class SauceEnvironmentUtil


  • public final class SauceEnvironmentUtil
    extends Object
    Contains helper methods.
    Author:
    Ross Rowe
    • 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 variables
        browsers - the list of selected browsers
        userName - the Sauce user name
        apiKey - the Sauce access key
        verboseLogging - Enable/Disable verbose logging of env variables
        logger - 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 browsers
        browserInstance - selected Browser being processed
        userName - the Sauce username
        apiKey - 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 variables
        browserInstance - FIXME
        userName - the Sauce user name
        apiKey - the Sauce access key
        verboseLogging - Enable/Disable verbose logging of env variables
        printStream - 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 variables
        browserInstance - FIXME
        userName - the Sauce user name
        apiKey - the Sauce access key
        overwrite - indicates whether existing environment variables should be overwritten
        verboseLogging - Enable/Disable verbose logging of env variables
        printStream - 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 variables
        key - environment variable key
        value - environment variable value
        verboseLogging - Enable/Disable verbose logging of env variables
        printStream - 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 variables
        key - environment variable key
        value - environment variable value
        overwrite - indicates whether existing environment variables should be overwritten
        verboseLogging - Enable/Disable verbose logging of env variables
        printStream - 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
      • generateTunnelName

        public static String generateTunnelName​(String projectName,
                                                int buildNumber)
      • getSanitizedBuildNumber

        public static String getSanitizedBuildNumber​(Run run)