-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTestSuiteUploader.java
36 lines (30 loc) · 1.28 KB
/
TestSuiteUploader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package io.github.lambdatest.gradle;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestSuiteUploader {
private static final Logger logger = LogManager.getLogger(TestSuiteUploader.class);
private String username;
private String accessKey;
private String testSuiteFilePath;
public TestSuiteUploader(String username, String accessKey, String testSuiteFilePath) {
this.username = username;
this.accessKey = accessKey;
this.testSuiteFilePath = testSuiteFilePath;
}
public CompletableFuture<String> uploadTestSuiteAsync() {
return CompletableFuture.supplyAsync(
() -> {
try {
String testSuiteId =
UploaderUtil.uploadAndGetId(username, accessKey, testSuiteFilePath);
logger.info("Uploaded test suite ID: {}", testSuiteId);
return testSuiteId;
} catch (IOException e) {
logger.error("Error uploading test suite app: {}", e.getMessage());
throw new RuntimeException(e);
}
});
}
}