/** * Returns a String (in JSON format) representing the details for a Sauce job. * * @param jobId the Sauce Job id to retrieve * @return String (in JSON format) representing the details for a Sauce job */ public String getJobInfo(String jobId) { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId); return retrieveResults(restEndpoint); }
/** * Downloads the log file for a Sauce Job to the filesystem. The file will be stored in * a directory specified by the <code>location</code> field. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @param location represents the base directory where the video should be downloaded to */ public void downloadLog(String jobId, String location) { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/selenium-server.log"); saveFile(jobId, location, restEndpoint); }
/** * Uploads a file to Sauce storage. * * @param file the file to upload * @param fileName name of the file in sauce storage * -param overwrite set to true * @return the md5 hash returned by sauce of the file * @throws IOException can be thrown when server returns an error (tcp or http status not in the 200 range) */ public String uploadFile(File file, String fileName) throws IOException { return uploadFile(file, fileName, true); }
/** * Downloads the log file for a Sauce Job and returns it. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return a BufferedInputStream containing the logfile * @throws IOException if there is a problem fetching the file */ public BufferedInputStream downloadLog(String jobId) throws IOException { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/selenium-server.log"); return downloadFileData(jobId, restEndpoint); }
private void initSSLSocketFactoryEx(SSLContext ctx) { m_ctx = ctx; m_protocols = GetProtocolList(); m_ciphers = GetCipherList(); }
/** * Returns a String (in JSON format) representing the details for a Sauce job. * * @return String (in JSON format) representing the details for a Sauce job */ public String getFullJobs() { return getFullJobs(20); }
/** * Returns the HTTP response for invoking https://saucelabs.com/rest/v1/path. * * @param path path to append to the url * @return HTTP response contents */ public String retrieveResults(String path) { URL restEndpoint = this.buildURL("v1/" + path); return retrieveResults(restEndpoint); }
/** * Downloads the video for a Sauce Job to the filesystem. The file will be stored in * a directory specified by the <code>location</code> field. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @param location represents the base directory where the video should be downloaded to */ public void downloadVideo(String jobId, String location) { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/video.mp4"); saveFile(jobId, location, restEndpoint); }
/** * Downloads the log file for a Sauce Job and returns it. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return a BufferedInputStream containing the logfile * @throws IOException if there is a problem fetching the file */ public BufferedInputStream downloadLog(String jobId) throws IOException { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/selenium-server.log"); return downloadFileData(jobId, restEndpoint); }
/** * Returns a String (in JSON format) representing the basic account information * * @return String (in JSON format) representing the basic account information */ public String getUser() { URL restEndpoint = this.buildURL("v1/users/" + username); return retrieveResults(restEndpoint); }
/** * Returns a String (in JSON format) representing the details for a Sauce job. * * @return String (in JSON format) representing the jobID for a sauce Job */ public String getJobs() { URL restEndpoint = this.buildURL("v1/" + username + "/jobs"); return retrieveResults(restEndpoint); }
/** * Returns a String (in JSON format) representing the details for a Sauce job. * * @param limit Number of jobs to return(max of 500) * @param to value in Epoch time format denoting the time to end the job list searh * @param from value in Epoch time format denoting the time to start the search * @return String (in JSON format) representing the jobID for a sauce Job */ public String getJobs(int limit, long to, int from) { URL restEndpoint = this.buildURL("v1/" + username + "/jobs?limit=" + limit + "&from=" + to + "&to=" + from); return retrieveResults(restEndpoint); }
/** * Retrieve build info * @param build Build name * @return String (in JSON format) representing the build */ public String getBuild(String build) { URL restEndpoint = this.buildURL( "v1/" + this.username + "/builds/" + build); // yes, this goes to builds instead of build like the above return retrieveResults(restEndpoint); }
/** * Returns a String (in JSON format) representing the details for a Sauce job. * * @param limit Number of jobs to return(max of 500) * @return String (in JSON format) representing the jobID for a sauce Job */ public String getJobs(int limit) { URL restEndpoint = this.buildURL("v1/" + username + "/jobs?limit=" + limit); return retrieveResults(restEndpoint); }
/** * Invokes the Sauce REST API to retrieve the concurrency details of the user. * * @return String (in JSON format) representing the concurrency information */ public String getConcurrency() { URL restEndpoint = this.buildURL("v1/users/" + username + "/concurrency"); return retrieveResults(restEndpoint); }
/** * Returns a String (in JSON format) representing the stored files list * * @return String (in JSON format) representing the stored files list */ public String getStoredFiles() { URL restEndpoint = this.buildURL("v1/storage/" + username); return retrieveResults(restEndpoint); }
/** * Returns a String (in JSON format) representing the list of objects describing all the OS and browser platforms * currently supported on Sauce Labs. * (see <a href="https://docs.saucelabs.com/reference/rest-api/#get-supported-platforms">https://docs.saucelabs.com/reference/rest-api/#get-supported-platforms</a>). * @param automationApi the automation API name * @return String (in JSON format) representing the supported platforms information */ public String getSupportedPlatforms(String automationApi) { URL restEndpoint = this.buildURL("v1/info/platforms/" + automationApi); return retrieveResults(restEndpoint); }
/** * Invokes the Sauce REST API to retrieve the details of the tunnels currently associated with the user. * * @return String (in JSON format) representing the tunnel information */ public String getTunnels() { URL restEndpoint = this.buildURL("v1/" + username + "/tunnels"); return retrieveResults(restEndpoint); }
/** * Returns a String (in JSON format) representing the details for a Sauce job. * * @param limit Number of jobs to return * @return String (in JSON format) representing the details for a Sauce job */ public String getFullJobs(int limit) { URL restEndpoint = this.buildURL("v1/" + username + "/jobs?full=true&limit=" + limit); return retrieveResults(restEndpoint); }
/** * Invokes the Sauce REST API to retrieve the activity details of the user. * * @return String (in JSON format) representing the activity information */ public String getActivity() { URL restEndpoint = this.buildURL("v1/" + username + "/activity"); return retrieveResults(restEndpoint); }