From 7ba90f1c54d4baae6e462a2d5a21e541290a4425 Mon Sep 17 00:00:00 2001 From: Archish Thakkar Date: Wed, 27 Jan 2021 18:12:06 +0530 Subject: [PATCH 1/3] Simplifying media type object while tracking --- pom.xml | 2 +- .../automate/ci/common/tracking/PluginsTracker.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ab8cb6f5..9932dcde 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ browserstack-integration - 1.2.0 + 1.2.1 hpi BrowserStack diff --git a/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java b/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java index 27120e58..424b51fb 100644 --- a/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java +++ b/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java @@ -23,7 +23,7 @@ import java.util.Optional; public class PluginsTracker { - private static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); + private static final String URL = "https://api.browserstack.com/ci_plugins/track"; private final String trackingId; private transient OkHttpClient client; @@ -52,7 +52,7 @@ public PluginsTracker(@Nullable final String customProxy) { } private void asyncPostRequestSilent(final String url, final String json) { - RequestBody body = RequestBody.create(JSON, json); + RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), json); Request request = new Request.Builder() .url(url) .post(body) From a48c16452cf74e8ce0933bca95e59b14de693964 Mon Sep 17 00:00:00 2001 From: Archish Thakkar Date: Wed, 27 Jan 2021 18:19:31 +0530 Subject: [PATCH 2/3] Updating plugin version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9932dcde..0e3bd51f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ browserstack-integration - 1.2.1 + 1.2.2-SNAPSHOT hpi BrowserStack From 4695d38ec4a34faec2624e88d5504daaf9a111af Mon Sep 17 00:00:00 2001 From: Archish Thakkar Date: Fri, 29 Jan 2021 14:01:53 +0530 Subject: [PATCH 3/3] Updated plugin version & added logging in plugins tracker --- pom.xml | 2 +- .../automate/ci/common/tracking/PluginsTracker.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e3bd51f..286d5512 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ browserstack-integration - 1.2.2-SNAPSHOT + 1.2.2-debug-1 hpi BrowserStack diff --git a/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java b/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java index 424b51fb..4c753f78 100644 --- a/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java +++ b/src/main/java/com/browserstack/automate/ci/common/tracking/PluginsTracker.java @@ -3,7 +3,9 @@ import com.browserstack.automate.ci.common.Tools; import com.browserstack.automate.ci.common.constants.Constants; +import com.browserstack.automate.ci.common.logger.PluginLogger; import com.browserstack.automate.ci.common.proxysettings.JenkinsProxySettings; +import hudson.model.TaskListener; import okhttp3.Authenticator; import okhttp3.Call; import okhttp3.Callback; @@ -14,6 +16,7 @@ import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.Route; +import org.apache.log4j.Logger; import org.json.JSONObject; import javax.annotation.Nullable; @@ -31,6 +34,10 @@ public class PluginsTracker { private String accessKey; private String customProxy; + static { + Logger.getLogger(PluginsTracker.class).info("BrowserStack Plugin Tracker Initialized"); + } + public PluginsTracker(final String username, final String accessKey, @Nullable final String customProxy) { this.username = username; this.accessKey = accessKey;