From 3837c6d2be1a29710b7b86b1187b4d45cd07b9f1 Mon Sep 17 00:00:00 2001 From: SergeiSemenov Date: Tue, 23 Jun 2020 18:35:02 +0300 Subject: [PATCH] fix the issue - https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/50 --- .../sdk_java/VisualRegressionTracker.java | 20 +++++++++---------- ...ava => VisualRegressionTrackerConfig.java} | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) rename src/main/java/io/visual_regression_tracker/sdk_java/{Config.java => VisualRegressionTrackerConfig.java} (80%) diff --git a/src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTracker.java b/src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTracker.java index 29ad537..425437d 100644 --- a/src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTracker.java +++ b/src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTracker.java @@ -9,12 +9,12 @@ public class VisualRegressionTracker { static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); - Config config; + VisualRegressionTrackerConfig visualRegressionTrackerConfig; String buildId; OkHttpClient client; - public VisualRegressionTracker(Config config) { - this.config = config; + public VisualRegressionTracker(VisualRegressionTrackerConfig visualRegressionTrackerConfig) { + this.visualRegressionTrackerConfig = visualRegressionTrackerConfig; this.client = new OkHttpClient(); } @@ -22,14 +22,14 @@ public VisualRegressionTracker(Config config) { void startBuild() throws IOException { if (this.buildId == null) { Map data = new HashMap<>(); - data.put("projectId", this.config.projectId); - data.put("branchName", this.config.branchName); + data.put("projectId", this.visualRegressionTrackerConfig.projectId); + data.put("branchName", this.visualRegressionTrackerConfig.branchName); RequestBody body = RequestBody.create(new Gson().toJson(data), JSON); Request request = new Request.Builder() - .url(this.config.apiUrl.concat("/builds")) - .addHeader("apiKey", this.config.apiKey) + .url(this.visualRegressionTrackerConfig.apiUrl.concat("/builds")) + .addHeader("apiKey", this.visualRegressionTrackerConfig.apiKey) .post(body) .build(); @@ -42,7 +42,7 @@ void startBuild() throws IOException { TestResultDTO submitTestRun(String name, String imageBase64, TestRunOptions testRunOptions) throws IOException { Map data = new HashMap<>(); - data.put("projectId", this.config.projectId); + data.put("projectId", this.visualRegressionTrackerConfig.projectId); data.put("buildId", this.buildId); data.put("name", name); data.put("imageBase64", imageBase64); @@ -55,8 +55,8 @@ TestResultDTO submitTestRun(String name, String imageBase64, TestRunOptions test RequestBody body = RequestBody.create(new Gson().toJson(data), JSON); Request request = new Request.Builder() - .url(this.config.apiUrl.concat("/test")) - .addHeader("apiKey", this.config.apiKey) + .url(this.visualRegressionTrackerConfig.apiUrl.concat("/test")) + .addHeader("apiKey", this.visualRegressionTrackerConfig.apiKey) .post(body) .build(); diff --git a/src/main/java/io/visual_regression_tracker/sdk_java/Config.java b/src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTrackerConfig.java similarity index 80% rename from src/main/java/io/visual_regression_tracker/sdk_java/Config.java rename to src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTrackerConfig.java index 000c3aa..3b66e23 100644 --- a/src/main/java/io/visual_regression_tracker/sdk_java/Config.java +++ b/src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTrackerConfig.java @@ -3,7 +3,7 @@ import lombok.AllArgsConstructor; @AllArgsConstructor -public class Config { +public class VisualRegressionTrackerConfig { String apiUrl; String projectId; String apiKey;