Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ff4dfdf
Replace travis-ci config with GitHub action to create a CI build incl…
sceiler Jul 15, 2021
adef21c
Replace Travis-CI badge with GitHub action badge
sceiler Jul 15, 2021
3a3c07c
Fix GitHub action badge
sceiler Jul 15, 2021
6a1c162
Replace equal sign paragraph in readme with something more dynamic.
sceiler Jul 15, 2021
d5e3b85
Add a user story issue template with examples
sceiler Jul 16, 2021
b6be867
Delete user_story.md
sceiler Jul 16, 2021
bb1334f
Merge pull request #155 from saucelabs/master
sceiler Jul 16, 2021
d5465aa
Merge pull request #156 from saucelabs/1.1.0_master
sceiler Jul 16, 2021
5f891e3
Merge pull request #158 from saucelabs/master
sceiler Jul 16, 2021
de94e88
Merge pull request #159 from saucelabs/1.1.0_master
sceiler Jul 16, 2021
f3fcb16
Should resolve #161.
sceiler Jul 17, 2021
05bb0f8
Merge pull request #167 from saucelabs/master
sceiler Aug 11, 2021
b47681d
Merge pull request #168 from saucelabs/master
sceiler Aug 11, 2021
58b3b20
Merge pull request #169 from saucelabs/master
sceiler Aug 11, 2021
4be2522
Merge pull request #170 from saucelabs/master
sceiler Aug 12, 2021
f6f1e2e
Merge pull request #171 from saucelabs/1.1.0_master
sceiler Aug 12, 2021
2766a65
Merge pull request #173 from saucelabs/master
sceiler Aug 19, 2021
b4c8390
Merge pull request #162 from saucelabs/refactor-deleteTunnel
sceiler Aug 19, 2021
7d5a270
Resolve #172
sceiler Aug 19, 2021
8165c4c
Merge pull request #175 from saucelabs/refactor-use_HttpMethod_Enum
sceiler Aug 19, 2021
562f6cd
Resolves #154
sceiler Aug 19, 2021
a0e749c
Merge pull request #177 from saucelabs/refactor/remove_deprecated_fun…
sceiler Aug 19, 2021
4d12b47
Rename unit tests to follow naming conventions of rest of the unit tests
sceiler Aug 19, 2021
2f8587d
Merge pull request #179 from saucelabs/refactor/align_unit_test_naming
sceiler Aug 19, 2021
5e9a305
Replace method to get a public link for a test result based on sessio…
sceiler Aug 19, 2021
53f1179
Merge pull request #180 from saucelabs/refactor/update_getPublicJobLi…
sceiler Aug 20, 2021
cb3ce03
Merge pull request #189 from saucelabs/master
sceiler Sep 21, 2021
788f3ef
Merge pull request #191 from saucelabs/master
sceiler Sep 23, 2021
8fb34fc
Resolve #181 (#194)
sceiler Oct 25, 2021
1661bb6
Introduce JobSource enum
krzysieksulejczak Nov 18, 2021
a9af33a
Add method to retrive build's jobs from v2 api
krzysieksulejczak Nov 19, 2021
8e8ed71
Use get build endpoint from v2 api
krzysieksulejczak Nov 19, 2021
b50baed
Add method to retrieve builds from v2 endpoint
krzysieksulejczak Nov 22, 2021
c59befe
Add method to fetch build of job identified by id
krzysieksulejczak Nov 22, 2021
8b4636d
Add method to fetch builds by name
krzysieksulejczak Nov 26, 2021
a943305
Merge pull request #196 from krzysieksulejczak/PERF-4204/bump_builds_…
sceiler Nov 29, 2021
9e8c789
Use JDK 11 to compile
sceiler Nov 29, 2021
7961ee3
Merge pull request #199 from saucelabs/master
sceiler Dec 6, 2021
a389c77
Merge pull request #200 from saucelabs/1.1.0_dev
sceiler Dec 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '8'
java-version: '11'
distribution: 'zulu'
- name: Build with Maven
run: mvn clean install -Dgpg.skip -B -V
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/saucelabs/saucerest/ErrorExplainers.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ static String LogNotFound() {
" * A error occurred where the job was created on Sauce Labs but no test were executed."
);
}

static String TunnelNotFound() {
return String.join(System.lineSeparator(),
" * Tunnel id could not be found. Possible reasons:",
" * The tunnel id requested does not exist in this data center. Ensure the data center endpoint is correct.",
" * A tunnel with this id never existed."
);
}
}
17 changes: 17 additions & 0 deletions src/main/java/com/saucelabs/saucerest/HttpMethod.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.saucelabs.saucerest;

public enum HttpMethod {
GET("GET"),
POST("POST"),
PUT("PUT"),
DELETE("DELETE"),
PATCH("PATCH"),
HEAD("HEAD"),
OPTIONS("OPTIONS");

public final String label;

HttpMethod(String label) {
this.label = label;
}
}
6 changes: 6 additions & 0 deletions src/main/java/com/saucelabs/saucerest/JobSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.saucelabs.saucerest;

public enum JobSource {
RDC,
VDC,
}
10 changes: 10 additions & 0 deletions src/main/java/com/saucelabs/saucerest/SauceException.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public NotAuthorized() {
}
}

public static class NotFound extends SauceException {

public NotFound(String message) {
super(message);
}

public NotFound() {
}
}

public static class TooManyRequests extends SauceException {
}

Expand Down
395 changes: 176 additions & 219 deletions src/main/java/com/saucelabs/saucerest/SauceREST.java

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions src/main/java/com/saucelabs/saucerest/SauceShareableLink.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.saucelabs.saucerest;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

import static java.nio.charset.StandardCharsets.US_ASCII;

/**
* Class providing a method to create a shareable test results link of a test executed on Sauce Labs.
*/
public class SauceShareableLink {
/**
* Based on the code from here: https://docs.saucelabs.com/test-results/sharing-test-results/index.html#example---java
* @param username Sauce Labs username
* @param accessKey Sauce Labs access key
* @param sauceJobId Sauce Labs job id
* @param server Sauce Labs data center endpoint
* @return A url of the test result with an authentication token, so it can be accessed without Sauce Labs credentials.
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public static String getShareableLink(String username, String accessKey, String sauceJobId, String server) throws NoSuchAlgorithmException, InvalidKeyException {
String key = String.format("%s:%s", username , accessKey);
SecretKeySpec sks = new SecretKeySpec(key.getBytes(US_ASCII), "HmacMD5");
Mac mac = Mac.getInstance("HmacMD5");
mac.init(sks);
byte[] result = mac.doFinal(sauceJobId.getBytes(US_ASCII));
StringBuilder hash = new StringBuilder();
for (byte b : result) {
String hex = Integer.toHexString(0xFF & b);
if (hex.length() == 1) {
hash.append('0');
}
hash.append(hex);
}
String digest = hash.toString();
return String.format("%s%s/%s?auth=%s", server, "tests", sauceJobId, digest);
}
}
40 changes: 0 additions & 40 deletions src/main/java/com/saucelabs/saucerest/SecurityUtils.java

This file was deleted.

21 changes: 21 additions & 0 deletions src/main/java/com/saucelabs/saucerest/TestAsset.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.saucelabs.saucerest;

public enum TestAsset {
SAUCE_LOG("log.json"),
VIDEO("video.mp4"),
SELENIUM_LOG("selenium-server.log"),
AUTOMATOR_LOG("automator.log"),
LOGCAT_LOG("logcat.log"),
SYSLOG_LOG("ios-syslog.log"),
HAR("network.har"),
PERFORMANCE("performance.json"),
CONSOLE_LOG("console.json"),
SCREENSHOTS("screenshots.zip"),
APPIUM_LOG("appium-server.log");

public final String label;

TestAsset(String label) {
this.label = label;
}
}
Loading