From 639668b7264634a2c9fd8cb42eb8cb86bcd04efb Mon Sep 17 00:00:00 2001 From: Mavlushechka Date: Thu, 3 Nov 2022 22:44:00 +0500 Subject: Add putTest(String sid, String projectName, String testName, String methodName, String env), putLogToTest(int testId, String content) and putAttachmentToTest(int testId, byte[] content, String contentType) methods to the SiteApiUtils class --- .../a1qa/project/utils/SiteApiUtils.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/main/java/com/mavlushechka') diff --git a/src/main/java/com/mavlushechka/a1qa/project/utils/SiteApiUtils.java b/src/main/java/com/mavlushechka/a1qa/project/utils/SiteApiUtils.java index 5579448..6932687 100644 --- a/src/main/java/com/mavlushechka/a1qa/project/utils/SiteApiUtils.java +++ b/src/main/java/com/mavlushechka/a1qa/project/utils/SiteApiUtils.java @@ -4,6 +4,7 @@ import com.mavlushechka.a1qa.framework.utils.JsonParser; import com.mavlushechka.a1qa.framework.utils.UrlConnectionManager; import java.io.IOException; +import java.util.Base64; public class SiteApiUtils { @@ -22,4 +23,24 @@ public class SiteApiUtils { return UrlConnectionManager.post("%s/test/get/json?projectId=%d".formatted(url, projectId)); } + public static int putTest(String sid, String projectName, String testName, String methodName, String env) throws IOException { + return Integer.parseInt( + UrlConnectionManager.post( + "%s/test/put?SID=%s&projectName=%s&testName=%s&methodName=%s&env=%s" + .formatted(url, sid, projectName, testName, methodName, env) + ) + ); + } + + public static void putLogToTest(int testId, String content) throws IOException { + UrlConnectionManager.post("%s/test/put/log?testId=%d&content=%s".formatted(url, testId, content)); + } + + public static void putAttachmentToTest(int testId, byte[] content, String contentType) throws IOException { + UrlConnectionManager.post( + "%s/test/put/attachment?testId=%d&content=%s&contentType=%s" + .formatted(url, testId, Base64.getEncoder().encodeToString(content), contentType) + ); + } + } -- cgit v1.2.3