Skip to content

Commit

Permalink
Quality Dashboard Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
darpanLalwani committed Jan 17, 2024
1 parent ef74517 commit 3a4a238
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 95 deletions.
16 changes: 15 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>

<artifactId>browserstack-integration</artifactId>
<version>1.2.12-SNAPSHOT</version>
<version>1.2.13-SNAPSHOT</version>
<packaging>hpi</packaging>

<name>BrowserStack</name>
Expand Down Expand Up @@ -177,6 +177,19 @@
<version>1.24</version>
</dependency>

<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.11.5</version>
</dependency>

<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-zip</artifactId>
<version>1.16</version>
<type>jar</type>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down Expand Up @@ -286,6 +299,7 @@
<artifactId>spring-beans</artifactId>
<version>5.3.18</version>
</dependency>

</dependencies>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ public static final class SessionStatus {
}

public static final class QualityDashboardAPI {
public static final String URL_BASE = "https://quality-dashboard.browserstack.com/api/v1/jenkins";

public static final String URL_BASE = "https://quality-dashboard-api.browserstack.com/api/v1/jenkins";
public static final String LOG_MESSAGE = URL_BASE + "/log-message";
public static final String IS_INIT_SETUP_REQUIRED = URL_BASE + "/init-setup-required";

public static final String HISTORY_FOR_DAYS = URL_BASE + "/history-for-days";

public static final String ADD_ALL_PIPELINES = URL_BASE + "/add-all-pipelines";
public static final String SAVE_PIPELINES = URL_BASE + "/save-pipelines";

public static final String SAVE_PIPELINE_RESULTS = URL_BASE + "/save-pipeline-results";

public static final String ITEM_CRUD = URL_BASE + "/item";
public static final String IS_QD_ENABLED = URL_BASE + "/qd-enabled";
Expand All @@ -79,5 +82,7 @@ public static final class QualityDashboardAPI {
public static final String UPLOAD_RESULT_ZIP = URL_BASE + "/upload-result";
public static final String STORE_PIPELINE_RESULTS = URL_BASE + "/save-results";

public static final String PROJECTS_PAGE_SIZE = URL_BASE + "/projects-page-size";
public static final String RESULTS_PAGE_SIZE = URL_BASE + "/results-page-size";
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.browserstack.automate.ci.jenkins.qualityDashboard;

import com.browserstack.automate.ci.common.constants.Constants;
import com.browserstack.automate.ci.jenkins.BrowserStackCredentials;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import okhttp3.*;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.io.Serializable;

public class QualityDashboardAPIUtil {

Expand Down Expand Up @@ -68,4 +71,22 @@ public Response makeDeleteRequestToQd(String postUrl, BrowserStackCredentials br
}
return null;
}

public void logToQD(BrowserStackCredentials browserStackCredentials, String logMessage) throws JsonProcessingException {
LogMessage logMessageObj = new LogMessage(logMessage);
ObjectMapper objectMapper = new ObjectMapper();
String jsonBody = objectMapper.writeValueAsString(logMessageObj);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody);
makePostRequestToQd(Constants.QualityDashboardAPI.LOG_MESSAGE, browserStackCredentials, requestBody);
}
}

class LogMessage implements Serializable {

@JsonProperty("message")
private String message;

public LogMessage(String message) {
this.message = message;
}
}
Loading

0 comments on commit 3a4a238

Please sign in to comment.