Skip to content

Commit 1e17a08

Browse files
committed
dev testing enhancements
1 parent 0e535c3 commit 1e17a08

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportAction.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private boolean isReportCompletedOrFailed() {
7373
}
7474

7575
private void fetchReport() {
76-
Map<String, String> params = createReportParams();
76+
Map<String, Object> params = createReportParams();
7777
String reportUrl = Constants.CAD_BASE_URL + Constants.BROWSERSTACK_CONFIG_DETAILS_ENDPOINT;
7878

7979
try {
@@ -85,19 +85,19 @@ private void fetchReport() {
8585
}
8686
}
8787

88-
private Map<String, String> createReportParams() {
88+
private Map<String, Object> createReportParams() {
8989
String RquestTypeForJenkins = "POLL";
90-
Map<String, String> params = new HashMap<>();
90+
Map<String, Object> params = new HashMap<>();
9191
params.put("buildStartedAt", buildCreatedAt);
92-
params.put("buildName", buildName);
92+
params.put("originalBuildName", buildName);
9393
params.put("requestingCi", Constants.INTEGRATIONS_TOOL_KEY);
94-
params.put("reportFormat", Arrays.asList(Constants.REPORT_FORMAT).toString());
94+
params.put("reportFormat", Arrays.asList(Constants.REPORT_FORMAT));
9595
params.put("requestType", RquestTypeForJenkins);
9696
params.put("userTimeout", DEFAULT_REPORT_TIMEOUT);
9797
return params;
9898
}
9999

100-
private RequestBody createRequestBody(Map<String, String> params) {
100+
private RequestBody createRequestBody(Map<String, Object> params) {
101101
Gson gson = new Gson();
102102
String json = gson.toJson(params);
103103
return RequestBody.create(MediaType.parse("application/json"), json);

src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportPublisher.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ public void perform(Run<?, ?> build, @NonNull FilePath workspace, @NonNull Launc
6565
Date buildTimestamp = new Date(build.getStartTimeInMillis());
6666

6767
// Format the timestamp (e.g., YYYY-MM-DD HH:MM:SS)
68-
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
69-
String formattedTime = sdf.format(buildTimestamp);
68+
long unixTimestamp = buildTimestamp.getTime() / 1000;
7069

71-
// Encode the timestamp to make it URL-safe
72-
String buildCreatedAt = URLEncoder.encode(formattedTime, "UTF-8");
70+
String buildCreatedAt = String.valueOf(unixTimestamp);
7371

7472
build.addAction(new BrowserStackTestReportAction(build, credentials, browserStackBuildName,buildCreatedAt, logger));
7573

0 commit comments

Comments
 (0)