From 637c715d983d30560973992c821744f89a42b920 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 4 Apr 2024 16:34:39 +0300 Subject: [PATCH] Dependencies update --- CHANGELOG.md | 5 +++++ build.gradle | 7 +++---- .../epam/reportportal/cucumber/AbstractReporter.java | 12 ++---------- .../epam/reportportal/cucumber/EmbeddingTest.java | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b03402c..096bf5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog ## [Unreleased] +### Changed +- Client version updated on [5.2.13](https://github.com/reportportal/client-java/releases/tag/5.2.13), by @HardNorth +### Removed +- `OkHttp` dependency, by @HardNorth +- JSR-305 dependency, by @HardNorth ## [5.3.1] ### Changed diff --git a/build.gradle b/build.gradle index 005c825..181f0c8 100644 --- a/build.gradle +++ b/build.gradle @@ -39,15 +39,14 @@ repositories { } dependencies { - api 'com.epam.reportportal:client-java:5.2.4' - api 'com.google.code.findbugs:jsr305:3.0.2' + api 'com.epam.reportportal:client-java:5.2.13' - implementation 'com.squareup.okhttp3:okhttp:4.12.0' implementation "io.cucumber:cucumber-gherkin:${project.cucumber_version}" implementation 'org.slf4j:slf4j-api:2.0.7' + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' testImplementation "io.cucumber:cucumber-java:${project.cucumber_version}" - testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.2' + testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.6' testImplementation "io.cucumber:cucumber-testng:${project.cucumber_version}" testImplementation 'org.aspectj:aspectjweaver:1.9.19' testImplementation 'org.hamcrest:hamcrest-core:2.2' diff --git a/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java b/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java index 854eec7..e3519c4 100644 --- a/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java +++ b/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java @@ -27,6 +27,7 @@ import com.epam.reportportal.service.tree.TestItemTree; import com.epam.reportportal.utils.*; import com.epam.reportportal.utils.files.ByteSource; +import com.epam.reportportal.utils.http.ContentType; import com.epam.reportportal.utils.markdown.MarkdownUtils; import com.epam.reportportal.utils.properties.SystemAttributesExtractor; import com.epam.reportportal.utils.reflect.Accessible; @@ -40,7 +41,6 @@ import io.cucumber.plugin.ConcurrentEventListener; import io.cucumber.plugin.event.*; import io.reactivex.Maybe; -import okhttp3.MediaType; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -581,15 +581,7 @@ private static String getDataType(@Nonnull byte[] data, @Nullable String name) { * @param data data to attach */ protected void embedding(@Nullable String name, @Nullable String mimeType, @Nonnull byte[] data) { - String type = ofNullable(mimeType).filter(m -> { - try { - MediaType.get(m); - return true; - } catch (IllegalArgumentException e) { - LOGGER.warn("Incorrect media type '{}'", m); - return false; - } - }).orElseGet(() -> getDataType(data, name)); + String type = ofNullable(mimeType).filter(ContentType::isValidType).orElseGet(() -> getDataType(data, name)); String attachmentName = ofNullable(name).filter(m -> !m.isEmpty()) .orElseGet(() -> ofNullable(type).map(t -> t.substring(0, t.indexOf("/"))).orElse("")); ReportPortal.emitLog(new ReportPortalMessage(ByteSource.wrap(data), type, attachmentName), diff --git a/src/test/java/com/epam/reportportal/cucumber/EmbeddingTest.java b/src/test/java/com/epam/reportportal/cucumber/EmbeddingTest.java index 65e2806..83f482d 100644 --- a/src/test/java/com/epam/reportportal/cucumber/EmbeddingTest.java +++ b/src/test/java/com/epam/reportportal/cucumber/EmbeddingTest.java @@ -158,7 +158,7 @@ public void verify_text_embedding() { .collect(Collectors.toList()); assertThat(types, hasSize(3)); - assertThat(types, containsInAnyOrder("text/plain", "image/png", "application/octet-stream")); + assertThat(types, containsInAnyOrder("text/plain", "image/png", "text/plain")); } @Test