From 3ac68595029b9de85f1535c0a9fc27e4cf48ccef Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 24 Mar 2025 18:07:43 +0530 Subject: [PATCH 1/8] making qei url configurable for testing --- .../BrowserStackBuildWrapperOperations.java | 7 ++ .../ci/common/BrowserStackEnvVars.java | 1 + .../ci/common/constants/Constants.java | 99 ++++++++++++++----- .../BrowserStackPipelineStepExecution.java | 5 + .../QualityDashboardAPIUtil.java | 2 +- .../QualityDashboardInit.java | 12 +-- .../QualityDashboardInitItemListener.java | 6 +- .../QualityDashboardPipelineTracker.java | 10 +- 8 files changed, 105 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java index 0e04218..68dc2fb 100644 --- a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java +++ b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java @@ -186,6 +186,13 @@ public void buildEnvVars(Map env) { env.put(BrowserStackEnvVars.BROWSERSTACK_RERUN, reRun); logEnvVar(BrowserStackEnvVars.BROWSERSTACK_RERUN, reRun); } + + // TODO + String host = env.get(BrowserStackEnvVars.QEI_URL); + if ( host != null ) { + logEnvVar(BrowserStackEnvVars.QEI_URL, host); + Constants.QualityDashboardAPI.setHost(host, logger); + } } public void logEnvVar(String key, String value) { diff --git a/src/main/java/com/browserstack/automate/ci/common/BrowserStackEnvVars.java b/src/main/java/com/browserstack/automate/ci/common/BrowserStackEnvVars.java index 9b717bc..9a7b8c4 100644 --- a/src/main/java/com/browserstack/automate/ci/common/BrowserStackEnvVars.java +++ b/src/main/java/com/browserstack/automate/ci/common/BrowserStackEnvVars.java @@ -15,4 +15,5 @@ public interface BrowserStackEnvVars { String GRR_JENKINS_KEY = "BROWSERSTACK_GRR_REGION"; String AUTOMATE_API_ENV_KEY = "browserstack.automate.api"; String APP_AUTOMATE_API_ENV_KEY = "browserstack.app-automate.api"; + String QEI_URL = "QEI_URL"; } diff --git a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java index 0b87979..433656a 100644 --- a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java +++ b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java @@ -1,5 +1,7 @@ package com.browserstack.automate.ci.common.constants; +// TODO +import java.io.PrintStream; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -62,27 +64,80 @@ public static final class SessionStatus { public static final String PASSED = "passed"; } - public static final class QualityDashboardAPI { - public static final String URL_BASE = "https://quality-engineering-insights.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 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"; - public static final String IS_PIPELINE_ENABLED = URL_BASE + "/pipeline-enabled"; - public static final String GET_RESULT_DIRECTORY = URL_BASE + "/get-result-directory"; - - 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"; +public static class QualityDashboardAPI { + // TODO + public static String host = "https://quality-engineering-insights.browserstack.com"; + public static String URL_BASE; + // public static PrintStream newlogger = System.out; // Ensure logging to console + + public static String getHost() { + return host; + } + + public static void setHost(String newHost, PrintStream logger) { + host = newHost; + // newlogger = logger; + + // log(logger, "QualityDashboardAPI newHost: " + getHost()); + // URL_BASE = host + "/api/v1/jenkins"; + // log(newlogger, "QualityDashboardAPI url base host: " + URL_BASE); + // log(newlogger, "QualityDashboardAPI host1: " + getHost()); + } + + public static String getURLBase() { + return getHost() + "/api/v1/jenkins"; + } + + public static String getLogMessageEndpoint() { + return getURLBase() + "/log-message"; + } + + public static String getIsInitSetupRequiredEndpoint() { + return getURLBase() + "/init-setup-required"; + } + + public static String getHistoryForDaysEndpoint() { + return getURLBase() + "/history-for-days"; + } + + public static String getSavePipelinesEndpoint() { + return getURLBase() + "/save-pipelines"; + } + + public static String getSavePipelineResultsEndpoint() { + return getURLBase() + "/save-pipeline-results"; + } + + public static String getItemCrudEndpoint() { + return getURLBase() + "/item"; + } + + public static String getIsQdEnabledEndpoint() { + return getURLBase() + "/qd-enabled"; + } + + public static String getIsPipelineEnabledEndpoint() { + return getURLBase() + "/pipeline-enabled"; + } + + public static String getResultDirectoryEndpoint() { + return getURLBase() + "/get-result-directory"; + } + + public static String getUploadResultZipEndpoint() { + return getURLBase() + "/upload-result"; + } + + public static String getStorePipelineResultsEndpoint() { + return getURLBase() + "/save-results"; + } + + public static String getProjectsPageSizeEndpoint() { + return getURLBase() + "/projects-page-size"; + } + + public static String getResultsPageSizeEndpoint() { + return getURLBase() + "/results-page-size"; + } } } diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java b/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java index 4873356..b492b62 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java @@ -100,6 +100,11 @@ public boolean start() throws Exception { EnvVars overrides = run.getEnvironment(taskListener); HashMap overridesMap = new HashMap(); overridesMap.put(Constants.JENKINS_BUILD_TAG, overrides.get(Constants.JENKINS_BUILD_TAG)); + // TODO + log(logger, overrides.toString()); + if ( overrides.containsKey(BrowserStackEnvVars.QEI_URL) ) { + overridesMap.put(BrowserStackEnvVars.QEI_URL, overrides.get(BrowserStackEnvVars.QEI_URL)); + } if ( parentContextEnvVars.containsKey(BrowserStackEnvVars.GRR_JENKINS_KEY) ) { overridesMap.put(BrowserStackEnvVars.GRR_JENKINS_KEY, parentContextEnvVars.get(BrowserStackEnvVars.GRR_JENKINS_KEY)); } diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardAPIUtil.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardAPIUtil.java index 963416e..84236be 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardAPIUtil.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardAPIUtil.java @@ -77,7 +77,7 @@ public void logToQD(BrowserStackCredentials browserStackCredentials, String logM 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); + makePostRequestToQd(Constants.QualityDashboardAPI.getLogMessageEndpoint(), browserStackCredentials, requestBody); } } diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java index 52da1fe..d74f654 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java @@ -90,7 +90,7 @@ private static void checkQDIntegrationAndDumpMetaData(BrowserStackCredentials br private static boolean initialQDSetupRequired(BrowserStackCredentials browserStackCredentials) throws JsonProcessingException { try { - Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.IS_INIT_SETUP_REQUIRED, browserStackCredentials); + Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.getIsInitSetupRequiredEndpoint(), browserStackCredentials); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { ResponseBody responseBody = response.body(); if(responseBody != null && responseBody.string().equals("REQUIRED")) { @@ -134,7 +134,7 @@ private static boolean sendPipelinesPaginated(BrowserStackCredentials browserSta PipelinesPaginated pipelinesPaginated = new PipelinesPaginated(page, totalPages, singlePagePipelineList); String jsonBody = objectMapper.writeValueAsString(pipelinesPaginated); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody); - Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.SAVE_PIPELINES, browserStackCredentials, requestBody); + Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getSavePipelinesEndpoint(), browserStackCredentials, requestBody); if (response == null || response.code() != HttpURLConnection.HTTP_OK) { apiUtil.logToQD(browserStackCredentials,"Got Non 200 response while saving projects"); isSuccess = false; @@ -188,7 +188,7 @@ private static void sendBuildsPaginated(BrowserStackCredentials browserStackCred BuildResultsPaginated buildResultsPaginated = new BuildResultsPaginated(page, totalPages, buildResultList); String jsonBody = objectMapper.writeValueAsString(buildResultsPaginated); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody); - Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.SAVE_PIPELINE_RESULTS, browserStackCredentials, requestBody); + Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getSavePipelineResultsEndpoint(), browserStackCredentials, requestBody); if (response == null || response.code() != HttpURLConnection.HTTP_OK) { apiUtil.logToQD(browserStackCredentials,"Got Non 200 response while saving projects"); break; @@ -202,7 +202,7 @@ private static void sendBuildsPaginated(BrowserStackCredentials browserStackCred private static int getHistoryForDays(BrowserStackCredentials browserStackCredentials) { int no_of_days = 90; try { - Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.HISTORY_FOR_DAYS, browserStackCredentials); + Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.getHistoryForDaysEndpoint(), browserStackCredentials); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { ResponseBody responseBody = response.body(); if(responseBody != null) { @@ -221,7 +221,7 @@ private static int getHistoryForDays(BrowserStackCredentials browserStackCredent private static int getProjectPageSize(BrowserStackCredentials browserStackCredentials) { int projectPageSize = 2000; try { - Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.PROJECTS_PAGE_SIZE, browserStackCredentials); + Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.getProjectsPageSizeEndpoint(), browserStackCredentials); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { ResponseBody responseBody = response.body(); if(responseBody != null) { @@ -240,7 +240,7 @@ private static int getProjectPageSize(BrowserStackCredentials browserStackCreden private static int getResultPageSize(BrowserStackCredentials browserStackCredentials) { int resultPageSize = 1000; try { - Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.RESULTS_PAGE_SIZE, browserStackCredentials); + Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.getResultsPageSizeEndpoint(), browserStackCredentials); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { ResponseBody responseBody = response.body(); if(responseBody != null) { diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java index 86bec77..619ad2f 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java @@ -25,7 +25,7 @@ public void onCreated(Item job) { if(itemType != null && itemType.equals("PIPELINE")) { try { String jsonBody = getJsonReqBody(new ItemUpdate(itemName, itemType)); - syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.ITEM_CRUD, "POST"); + syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.getItemCrudEndpoint(), "POST"); } catch(IOException e) { e.printStackTrace(); } @@ -39,7 +39,7 @@ public void onDeleted(Item job) { if(itemType != null) { try { String jsonBody = getJsonReqBody(new ItemUpdate(itemName, itemType)); - syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.ITEM_CRUD, "DELETE"); + syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.getItemCrudEndpoint(), "DELETE"); } catch(IOException e) { e.printStackTrace(); } @@ -54,7 +54,7 @@ public void onRenamed(Item job, String oldName, String newName) { oldName = job.getParent().getFullName() + "/" + oldName; newName = job.getParent().getFullName() + "/" + newName; String jsonBody = getJsonReqBody(new ItemRename(oldName, newName, itemType)); - syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.ITEM_CRUD, "PUT"); + syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.getItemCrudEndpoint(), "PUT"); } catch(IOException e) { e.printStackTrace(); } diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardPipelineTracker.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardPipelineTracker.java index ac08d2d..ae8c90f 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardPipelineTracker.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardPipelineTracker.java @@ -109,7 +109,7 @@ private void sendBuildDataToQD(Run run, Result overallResult, String finalZipPat RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody); apiUtil.logToQD(browserStackCredentials, "Sending Final Results for jobName: " + jobName + " and buildNumber: " + buildNumber); - apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.STORE_PIPELINE_RESULTS, browserStackCredentials, requestBody); + apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getStorePipelineResultsEndpoint(), browserStackCredentials, requestBody); } catch(IOException e) { e.printStackTrace(); } @@ -153,7 +153,7 @@ private String getUrlForPipeline(Run build) { } private boolean isQDEnabled(BrowserStackCredentials browserStackCredentials) throws IOException { - Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.IS_QD_ENABLED, browserStackCredentials); + Response response = apiUtil.makeGetRequestToQd(Constants.QualityDashboardAPI.getIsQdEnabledEndpoint(), browserStackCredentials); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { ResponseBody responseBody = response.body(); if(responseBody != null && Boolean.parseBoolean(response.body().string())) { @@ -170,7 +170,7 @@ private boolean isPipelineEnabledForQD(BrowserStackCredentials browserStackCrede ObjectMapper objectMapper = new ObjectMapper(); String jsonBody = objectMapper.writeValueAsString(getPipelineEnabledObj); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody); - Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.IS_PIPELINE_ENABLED, browserStackCredentials, requestBody); + Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getIsPipelineEnabledEndpoint(), browserStackCredentials, requestBody); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { ResponseBody responseBody = response.body(); if(responseBody != null && Boolean.parseBoolean(response.body().string())) { @@ -190,7 +190,7 @@ private String getResultDirForPipeline(String pipelineUrl, BrowserStackCredentia String jsonBody = objectMapper.writeValueAsString(getResultDirReqObj); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody); - Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.GET_RESULT_DIRECTORY, browserStackCredentials, requestBody); + Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getResultDirectoryEndpoint(), browserStackCredentials, requestBody); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { String responseBody = response.body() !=null ? response.body().string() : null; resultDir = responseBody; @@ -234,7 +234,7 @@ private String uploadZipToQd(String pathToZip, BrowserStackCredentials browserSt .addFormDataPart("buildNumber", String.valueOf(buildNumber)) .build(); - Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.UPLOAD_RESULT_ZIP, browserStackCredentials, requestBody); + Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getUploadResultZipEndpoint(), browserStackCredentials, requestBody); if (response != null && response.code() == HttpURLConnection.HTTP_OK) { qdS3Url = response.body() !=null ? response.body().string() : null; } From 3cf236c227aff10d947f196a45ab71ecc19b7a33 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 24 Mar 2025 18:30:02 +0530 Subject: [PATCH 2/8] removing comments --- pom.xml.releaseBackup | 431 ++++++++++++++++++ release.properties | 19 + .../BrowserStackBuildWrapperOperations.java | 3 +- .../ci/common/constants/Constants.java | 15 +- .../BrowserStackPipelineStepExecution.java | 3 +- 5 files changed, 455 insertions(+), 16 deletions(-) create mode 100644 pom.xml.releaseBackup create mode 100644 release.properties diff --git a/pom.xml.releaseBackup b/pom.xml.releaseBackup new file mode 100644 index 0000000..34c6093 --- /dev/null +++ b/pom.xml.releaseBackup @@ -0,0 +1,431 @@ + + + 4.0.0 + + + org.jenkins-ci.plugins + plugin + 3.4 + + + + browserstack-integration + 1.2.16-SNAPSHOT + hpi + + BrowserStack + This plugin allows you to integrate with BrowserStack. + https://github.com/jenkinsci/browserstack-integration-plugin + + + + support + BrowserStack Support + support@browserstack.com + + + integration + BrowserStack Integrations + integrations@browserstack.com + + + + + scm:git:ssh://github.com/jenkinsci/browserstack-integration-plugin.git + scm:git:ssh://git@github.com/jenkinsci/browserstack-integration-plugin.git + https://github.com/jenkinsci/browserstack-integration-plugin + HEAD + + + + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/releases/ + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/snapshots/ + + + + + + + 2.334 + 8 + 8 + 2.9 + 0.8 + UTF-8 + + + UA-79358556-2 + + + + + MIT License + http://opensource.org/licenses/MIT + + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/public + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/releases + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/public + + + + + + + com.brsanthu + google-analytics-java + 1.1.2 + + + org.apache.httpcomponents + httpclient + + + + + + org.jmockit + jmockit + 1.24 + test + + + + junit + junit + 4.13.1 + test + + + + org.assertj + assertj-core + 3.9.1 + test + + + + com.pholser + junit-quickcheck-core + ${junit-quickcheck.version} + + + + com.pholser + junit-quickcheck-generators + ${junit-quickcheck.version} + + + + com.browserstack + automate-client-java + 0.7 + + + + com.browserstack + browserstack-local-java + 1.0.9 + + + + commons-codec + commons-codec + 1.11 + + + + org.jenkins-ci.plugins + credentials + 2.6.1.1 + + + + org.jenkins-ci.plugins + junit + 1.24 + + + + org.zeroturnaround + zt-zip + 1.16 + jar + + + + + com.google.code.gson + gson + 2.8.9 + + + + org.jenkins-ci.plugins.workflow + workflow-step-api + 2.12 + compile + + + + org.jenkins-ci.plugins.workflow + workflow-cps + 2.39 + compile + + + + org.jenkins-ci.plugins.workflow + workflow-job + 2.11.2 + compile + + + + org.jenkins-ci.plugins.workflow + workflow-basic-steps + 2.6 + compile + + + + org.jenkins-ci.plugins.workflow + workflow-durable-task-step + 2.13 + compile + + + + org.jenkins-ci.plugins.workflow + workflow-api + 2.22 + compile + + + + org.jenkins-ci.plugins.workflow + workflow-support + 2.14 + compile + + + + org.jenkins-ci.plugins + structs + 1.23 + + + + com.fasterxml.jackson.core + jackson-core + 2.12.6 + + + + com.fasterxml.jackson.core + jackson-databind + 2.12.6.1 + + + + + com.squareup.okhttp3 + okhttp + 3.14.9 + + + + + + commons-io + commons-io + 2.7 + + + + + org.slf4j + slf4j-api + 1.7.25 + + + + + org.jenkins-ci.plugins + script-security + 1.31 + + + + + org.springframework + spring-beans + 5.3.20 + + + + + + + + org.json + json + 20230227 + + + + + + + + src/main/resources + true + + plugin.properties + + + + src/main/resources + false + + plugin.properties + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + false + + pom.xml + + + + + + org.jacoco + jacoco-maven-plugin + 0.7.5.201505241946 + + + + prepare-agent + + + + report + test + + report + + + + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + hudson.udp + 33849 + + + true + 1 + ${argLine} -Xmx512m -XX:MaxPermSize=256m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.1.0 + + + enforce-bytecode-version + + enforce + + + + + 1.8 + + module-info + + + + + + + + + org.codehaus.mojo + extra-enforcer-rules + 1.4 + + + + + + org.codehaus.mojo + animal-sniffer-maven-plugin + 1.16 + + + + check + + + + + + + + + + release + + UA-79358556-1 + + + + + diff --git a/release.properties b/release.properties new file mode 100644 index 0000000..6e972ac --- /dev/null +++ b/release.properties @@ -0,0 +1,19 @@ +#release configuration +#Mon Mar 24 18:09:36 IST 2025 +scm.tagNameFormat=@{project.artifactId}-@{project.version} +scm.tag=test112 +project.scm.org.jenkins-ci.plugins\:browserstack-integration.developerConnection=scm\:git\:ssh\://git@github.com/jenkinsci/browserstack-integration-plugin.git +project.scm.org.jenkins-ci.plugins\:browserstack-integration.connection=scm\:git\:ssh\://github.com/jenkinsci/browserstack-integration-plugin.git +project.dev.org.jenkins-ci.plugins\:browserstack-integration=1.2.19-SNAPSHOT +pushChanges=false +scm.url=scm\:git\:ssh\://git@github.com/jenkinsci/browserstack-integration-plugin.git +preparationGoals=clean install +remoteTagging=true +projectVersionPolicyId=default +scm.commentPrefix=[maven-release-plugin] +project.scm.org.jenkins-ci.plugins\:browserstack-integration.tag=HEAD +project.scm.org.jenkins-ci.plugins\:browserstack-integration.url=https\://github.com/jenkinsci/browserstack-integration-plugin +exec.snapshotReleasePluginAllowed=false +exec.additionalArguments=-DskipTests -Prelease +project.rel.org.jenkins-ci.plugins\:browserstack-integration=1.2.17 +completedPhase=end-release diff --git a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java index 68dc2fb..862f399 100644 --- a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java +++ b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java @@ -187,11 +187,10 @@ public void buildEnvVars(Map env) { logEnvVar(BrowserStackEnvVars.BROWSERSTACK_RERUN, reRun); } - // TODO String host = env.get(BrowserStackEnvVars.QEI_URL); if ( host != null ) { logEnvVar(BrowserStackEnvVars.QEI_URL, host); - Constants.QualityDashboardAPI.setHost(host, logger); + Constants.QualityDashboardAPI.setHost(host); } } diff --git a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java index 433656a..9c6fea3 100644 --- a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java +++ b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java @@ -1,7 +1,5 @@ package com.browserstack.automate.ci.common.constants; -// TODO -import java.io.PrintStream; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -64,24 +62,17 @@ public static final class SessionStatus { public static final String PASSED = "passed"; } -public static class QualityDashboardAPI { - // TODO + public static class QualityDashboardAPI { + public static String host = "https://quality-engineering-insights.browserstack.com"; public static String URL_BASE; - // public static PrintStream newlogger = System.out; // Ensure logging to console public static String getHost() { return host; } - public static void setHost(String newHost, PrintStream logger) { + public static void setHost(String newHost) { host = newHost; - // newlogger = logger; - - // log(logger, "QualityDashboardAPI newHost: " + getHost()); - // URL_BASE = host + "/api/v1/jenkins"; - // log(newlogger, "QualityDashboardAPI url base host: " + URL_BASE); - // log(newlogger, "QualityDashboardAPI host1: " + getHost()); } public static String getURLBase() { diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java b/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java index b492b62..323a5ae 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/pipeline/BrowserStackPipelineStepExecution.java @@ -100,8 +100,7 @@ public boolean start() throws Exception { EnvVars overrides = run.getEnvironment(taskListener); HashMap overridesMap = new HashMap(); overridesMap.put(Constants.JENKINS_BUILD_TAG, overrides.get(Constants.JENKINS_BUILD_TAG)); - // TODO - log(logger, overrides.toString()); + if ( overrides.containsKey(BrowserStackEnvVars.QEI_URL) ) { overridesMap.put(BrowserStackEnvVars.QEI_URL, overrides.get(BrowserStackEnvVars.QEI_URL)); } From 9db035aaf690bc7566d6b5e8fb959603c8a55fd8 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 24 Mar 2025 19:34:54 +0530 Subject: [PATCH 3/8] removing release files --- pom.xml.releaseBackup | 431 ------------------------------------------ release.properties | 19 -- 2 files changed, 450 deletions(-) delete mode 100644 pom.xml.releaseBackup delete mode 100644 release.properties diff --git a/pom.xml.releaseBackup b/pom.xml.releaseBackup deleted file mode 100644 index 34c6093..0000000 --- a/pom.xml.releaseBackup +++ /dev/null @@ -1,431 +0,0 @@ - - - 4.0.0 - - - org.jenkins-ci.plugins - plugin - 3.4 - - - - browserstack-integration - 1.2.16-SNAPSHOT - hpi - - BrowserStack - This plugin allows you to integrate with BrowserStack. - https://github.com/jenkinsci/browserstack-integration-plugin - - - - support - BrowserStack Support - support@browserstack.com - - - integration - BrowserStack Integrations - integrations@browserstack.com - - - - - scm:git:ssh://github.com/jenkinsci/browserstack-integration-plugin.git - scm:git:ssh://git@github.com/jenkinsci/browserstack-integration-plugin.git - https://github.com/jenkinsci/browserstack-integration-plugin - HEAD - - - - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/releases/ - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/snapshots/ - - - - - - - 2.334 - 8 - 8 - 2.9 - 0.8 - UTF-8 - - - UA-79358556-2 - - - - - MIT License - http://opensource.org/licenses/MIT - - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/public - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/releases - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/public - - - - - - - com.brsanthu - google-analytics-java - 1.1.2 - - - org.apache.httpcomponents - httpclient - - - - - - org.jmockit - jmockit - 1.24 - test - - - - junit - junit - 4.13.1 - test - - - - org.assertj - assertj-core - 3.9.1 - test - - - - com.pholser - junit-quickcheck-core - ${junit-quickcheck.version} - - - - com.pholser - junit-quickcheck-generators - ${junit-quickcheck.version} - - - - com.browserstack - automate-client-java - 0.7 - - - - com.browserstack - browserstack-local-java - 1.0.9 - - - - commons-codec - commons-codec - 1.11 - - - - org.jenkins-ci.plugins - credentials - 2.6.1.1 - - - - org.jenkins-ci.plugins - junit - 1.24 - - - - org.zeroturnaround - zt-zip - 1.16 - jar - - - - - com.google.code.gson - gson - 2.8.9 - - - - org.jenkins-ci.plugins.workflow - workflow-step-api - 2.12 - compile - - - - org.jenkins-ci.plugins.workflow - workflow-cps - 2.39 - compile - - - - org.jenkins-ci.plugins.workflow - workflow-job - 2.11.2 - compile - - - - org.jenkins-ci.plugins.workflow - workflow-basic-steps - 2.6 - compile - - - - org.jenkins-ci.plugins.workflow - workflow-durable-task-step - 2.13 - compile - - - - org.jenkins-ci.plugins.workflow - workflow-api - 2.22 - compile - - - - org.jenkins-ci.plugins.workflow - workflow-support - 2.14 - compile - - - - org.jenkins-ci.plugins - structs - 1.23 - - - - com.fasterxml.jackson.core - jackson-core - 2.12.6 - - - - com.fasterxml.jackson.core - jackson-databind - 2.12.6.1 - - - - - com.squareup.okhttp3 - okhttp - 3.14.9 - - - - - - commons-io - commons-io - 2.7 - - - - - org.slf4j - slf4j-api - 1.7.25 - - - - - org.jenkins-ci.plugins - script-security - 1.31 - - - - - org.springframework - spring-beans - 5.3.20 - - - - - - - - org.json - json - 20230227 - - - - - - - - src/main/resources - true - - plugin.properties - - - - src/main/resources - false - - plugin.properties - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - true - false - - pom.xml - - - - - - org.jacoco - jacoco-maven-plugin - 0.7.5.201505241946 - - - - prepare-agent - - - - report - test - - report - - - - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - hudson.udp - 33849 - - - true - 1 - ${argLine} -Xmx512m -XX:MaxPermSize=256m - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.1.0 - - - enforce-bytecode-version - - enforce - - - - - 1.8 - - module-info - - - - - - - - - org.codehaus.mojo - extra-enforcer-rules - 1.4 - - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.16 - - - - check - - - - - - - - - - release - - UA-79358556-1 - - - - - diff --git a/release.properties b/release.properties deleted file mode 100644 index 6e972ac..0000000 --- a/release.properties +++ /dev/null @@ -1,19 +0,0 @@ -#release configuration -#Mon Mar 24 18:09:36 IST 2025 -scm.tagNameFormat=@{project.artifactId}-@{project.version} -scm.tag=test112 -project.scm.org.jenkins-ci.plugins\:browserstack-integration.developerConnection=scm\:git\:ssh\://git@github.com/jenkinsci/browserstack-integration-plugin.git -project.scm.org.jenkins-ci.plugins\:browserstack-integration.connection=scm\:git\:ssh\://github.com/jenkinsci/browserstack-integration-plugin.git -project.dev.org.jenkins-ci.plugins\:browserstack-integration=1.2.19-SNAPSHOT -pushChanges=false -scm.url=scm\:git\:ssh\://git@github.com/jenkinsci/browserstack-integration-plugin.git -preparationGoals=clean install -remoteTagging=true -projectVersionPolicyId=default -scm.commentPrefix=[maven-release-plugin] -project.scm.org.jenkins-ci.plugins\:browserstack-integration.tag=HEAD -project.scm.org.jenkins-ci.plugins\:browserstack-integration.url=https\://github.com/jenkinsci/browserstack-integration-plugin -exec.snapshotReleasePluginAllowed=false -exec.additionalArguments=-DskipTests -Prelease -project.rel.org.jenkins-ci.plugins\:browserstack-integration=1.2.17 -completedPhase=end-release From 41f6187237966a9cff3f1f2d32b089334f2cd037 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 24 Mar 2025 20:04:47 +0530 Subject: [PATCH 4/8] qei logging changes --- .../QualityDashboardInit.java | 44 +++++++++++++++++-- .../QualityDashboardInitItemListener.java | 30 +++++++++---- 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java index d74f654..48499af 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInit.java @@ -105,19 +105,54 @@ private static boolean initialQDSetupRequired(BrowserStackCredentials browserSta return false; } - private static List getAllPipelines(BrowserStackCredentials browserStackCredentials) throws JsonProcessingException { + private static List getAllPipelines(BrowserStackCredentials browserStackCredentials) { List allPipelines = new ArrayList<>(); Jenkins jenkins = Jenkins.getInstanceOrNull(); + Integer totalPipelines = 0; + if (jenkins != null) { + totalPipelines = jenkins.getAllItems().size(); jenkins.getAllItems().forEach(job -> { - if(job instanceof WorkflowJob) { - String pipelineName = job.getFullName(); + try { + // Logging job details + apiUtil.logToQD( + browserStackCredentials, + String.format( + "Job name: %s, instance type: %s, and is_workflow_job: %s", + job.getName(), + job.getClass().getSimpleName(), + (job instanceof WorkflowJob) ? "yes" : "no" + ) + ); + } catch (JsonProcessingException e) { + // Handling the exception and logging an error + System.err.println("Error processing JSON for job: " + job.getName()); + e.printStackTrace(); + } + + if (job instanceof WorkflowJob) { + String pipelineName = job.getFullName(); // Getting pipeline name allPipelines.add(pipelineName); } }); } else { - apiUtil.logToQD(browserStackCredentials,"Issue getting Jenkins Instance"); + try { + apiUtil.logToQD(browserStackCredentials, "Issue getting Jenkins Instance"); + } catch (JsonProcessingException e) { + System.err.println("Error logging issue with Jenkins instance."); + e.printStackTrace(); + } + } + + try { + apiUtil.logToQD(browserStackCredentials,"Total Pipelines on the jenkins side : " + totalPipelines); + apiUtil.logToQD(browserStackCredentials,"Total Pipelines detected : " + allPipelines.size()); + } catch (JsonProcessingException e) { + // Handling the exception and logging an error + System.err.println("Error processing JSON for total pipelines: "); + e.printStackTrace(); } + // Returning the list of filtered pipelines return allPipelines; } @@ -135,6 +170,7 @@ private static boolean sendPipelinesPaginated(BrowserStackCredentials browserSta String jsonBody = objectMapper.writeValueAsString(pipelinesPaginated); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonBody); Response response = apiUtil.makePostRequestToQd(Constants.QualityDashboardAPI.getSavePipelinesEndpoint(), browserStackCredentials, requestBody); + apiUtil.logToQD(browserStackCredentials, "Sending page " + page + " with " + singlePagePipelineList.size() + " pipelines"); if (response == null || response.code() != HttpURLConnection.HTTP_OK) { apiUtil.logToQD(browserStackCredentials,"Got Non 200 response while saving projects"); isSuccess = false; diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java index 619ad2f..4d87801 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java @@ -20,15 +20,29 @@ public class QualityDashboardInitItemListener extends ItemListener { @Override public void onCreated(Item job) { - String itemName = job.getFullName(); - String itemType = getItemTypeModified(job); - if(itemType != null && itemType.equals("PIPELINE")) { - try { - String jsonBody = getJsonReqBody(new ItemUpdate(itemName, itemType)); - syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.getItemCrudEndpoint(), "POST"); - } catch(IOException e) { - e.printStackTrace(); + try { + BrowserStackCredentials browserStackCredentials = QualityDashboardUtil.getBrowserStackCreds(); + QualityDashboardAPIUtil apiUtil = new QualityDashboardAPIUtil(); + apiUtil.logToQD(browserStackCredentials, "Item Created : " ); + apiUtil.logToQD(browserStackCredentials, "Item Created : " + job.getClass().getName()) ; + // apiUtil.logToQD(browserStackCredentials, "Job Type : " + job.getClass().getName() + "---" + job.getFullName() + "---" + job instanceof FreeStyleProject); + + String itemName = job.getFullName(); + String itemType = getItemTypeModified(job); + + apiUtil.logToQD(browserStackCredentials, "Item Type : " + itemType + " : " + itemName + " : " + itemType.equals("PIPELINE")); + if(itemType != null && itemType.equals("PIPELINE")) { + try { + apiUtil.logToQD(browserStackCredentials, "Item Type inside the Folder : " + itemType + " : " + itemName + " : " + itemType.equals("PIPELINE")); + String jsonBody = getJsonReqBody(new ItemUpdate(itemName, itemType)); + syncItemListToQD(jsonBody, Constants.QualityDashboardAPI.getItemCrudEndpoint(), "POST"); + + } catch(IOException e) { + e.printStackTrace(); + } } + } catch(Exception e) { + e.printStackTrace(); } } From c49763dcec57eefeee2d7e72b90eba3bbc39e329 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 24 Mar 2025 20:30:53 +0530 Subject: [PATCH 5/8] added else block to set default host --- .../ci/common/BrowserStackBuildWrapperOperations.java | 2 ++ .../browserstack/automate/ci/common/constants/Constants.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java index 862f399..e9ab893 100644 --- a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java +++ b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java @@ -191,6 +191,8 @@ public void buildEnvVars(Map env) { if ( host != null ) { logEnvVar(BrowserStackEnvVars.QEI_URL, host); Constants.QualityDashboardAPI.setHost(host); + } else { + Constants.QualityDashboardAPI.setHost(Constants.QualityDashboardAPI.QD_DEFAULT_URL); } } diff --git a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java index 9c6fea3..ece6f81 100644 --- a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java +++ b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java @@ -63,8 +63,8 @@ public static final class SessionStatus { } public static class QualityDashboardAPI { - - public static String host = "https://quality-engineering-insights.browserstack.com"; + public static final String QD_DEFAULT_URL = "https://quality-engineering-insights.browserstack.com"; + public static String host = QD_DEFAULT_URL; public static String URL_BASE; public static String getHost() { From 1f36b9cc548247d69c5e169c866a143509785fa0 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 24 Mar 2025 20:45:27 +0530 Subject: [PATCH 6/8] changed qd to qei --- .../ci/common/BrowserStackBuildWrapperOperations.java | 2 +- .../browserstack/automate/ci/common/constants/Constants.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java index e9ab893..d051492 100644 --- a/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java +++ b/src/main/java/com/browserstack/automate/ci/common/BrowserStackBuildWrapperOperations.java @@ -192,7 +192,7 @@ public void buildEnvVars(Map env) { logEnvVar(BrowserStackEnvVars.QEI_URL, host); Constants.QualityDashboardAPI.setHost(host); } else { - Constants.QualityDashboardAPI.setHost(Constants.QualityDashboardAPI.QD_DEFAULT_URL); + Constants.QualityDashboardAPI.setHost(Constants.QualityDashboardAPI.QEI_DEFAULT_URL); } } diff --git a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java index ece6f81..52d43f2 100644 --- a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java +++ b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java @@ -63,8 +63,8 @@ public static final class SessionStatus { } public static class QualityDashboardAPI { - public static final String QD_DEFAULT_URL = "https://quality-engineering-insights.browserstack.com"; - public static String host = QD_DEFAULT_URL; + public static final String QEI_DEFAULT_URL = "https://quality-engineering-insights.browserstack.com"; + public static String host = QEI_DEFAULT_URL; public static String URL_BASE; public static String getHost() { From d27dbab9e7a7832d03585c67dce7b4d29ea5b615 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Thu, 27 Mar 2025 12:21:02 +0530 Subject: [PATCH 7/8] removed comment --- .../qualityDashboard/QualityDashboardInitItemListener.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java index 4d87801..fd4259f 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/qualityDashboard/QualityDashboardInitItemListener.java @@ -23,9 +23,7 @@ public void onCreated(Item job) { try { BrowserStackCredentials browserStackCredentials = QualityDashboardUtil.getBrowserStackCreds(); QualityDashboardAPIUtil apiUtil = new QualityDashboardAPIUtil(); - apiUtil.logToQD(browserStackCredentials, "Item Created : " ); apiUtil.logToQD(browserStackCredentials, "Item Created : " + job.getClass().getName()) ; - // apiUtil.logToQD(browserStackCredentials, "Job Type : " + job.getClass().getName() + "---" + job.getFullName() + "---" + job instanceof FreeStyleProject); String itemName = job.getFullName(); String itemType = getItemTypeModified(job); From 70cd3e47058b4b17b6139878bed442eef779fb88 Mon Sep 17 00:00:00 2001 From: Khushi Mehta Date: Mon, 21 Apr 2025 15:26:01 +0530 Subject: [PATCH 8/8] added final in constants class --- .../ci/common/constants/Constants.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java index 52d43f2..a9f6d90 100644 --- a/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java +++ b/src/main/java/com/browserstack/automate/ci/common/constants/Constants.java @@ -62,10 +62,9 @@ public static final class SessionStatus { public static final String PASSED = "passed"; } - public static class QualityDashboardAPI { + public static final class QualityDashboardAPI { public static final String QEI_DEFAULT_URL = "https://quality-engineering-insights.browserstack.com"; public static String host = QEI_DEFAULT_URL; - public static String URL_BASE; public static String getHost() { return host; @@ -75,59 +74,59 @@ public static void setHost(String newHost) { host = newHost; } - public static String getURLBase() { + public static final String getURLBase() { return getHost() + "/api/v1/jenkins"; } - public static String getLogMessageEndpoint() { + public static final String getLogMessageEndpoint() { return getURLBase() + "/log-message"; } - public static String getIsInitSetupRequiredEndpoint() { + public static final String getIsInitSetupRequiredEndpoint() { return getURLBase() + "/init-setup-required"; } - public static String getHistoryForDaysEndpoint() { + public static final String getHistoryForDaysEndpoint() { return getURLBase() + "/history-for-days"; } - public static String getSavePipelinesEndpoint() { + public static final String getSavePipelinesEndpoint() { return getURLBase() + "/save-pipelines"; } - public static String getSavePipelineResultsEndpoint() { + public static final String getSavePipelineResultsEndpoint() { return getURLBase() + "/save-pipeline-results"; } - public static String getItemCrudEndpoint() { + public static final String getItemCrudEndpoint() { return getURLBase() + "/item"; } - public static String getIsQdEnabledEndpoint() { + public static final String getIsQdEnabledEndpoint() { return getURLBase() + "/qd-enabled"; } - public static String getIsPipelineEnabledEndpoint() { + public static final String getIsPipelineEnabledEndpoint() { return getURLBase() + "/pipeline-enabled"; } - public static String getResultDirectoryEndpoint() { + public static final String getResultDirectoryEndpoint() { return getURLBase() + "/get-result-directory"; } - public static String getUploadResultZipEndpoint() { + public static final String getUploadResultZipEndpoint() { return getURLBase() + "/upload-result"; } - public static String getStorePipelineResultsEndpoint() { + public static final String getStorePipelineResultsEndpoint() { return getURLBase() + "/save-results"; } - public static String getProjectsPageSizeEndpoint() { + public static final String getProjectsPageSizeEndpoint() { return getURLBase() + "/projects-page-size"; } - public static String getResultsPageSizeEndpoint() { + public static final String getResultsPageSizeEndpoint() { return getURLBase() + "/results-page-size"; } }