Skip to content

Commit

Permalink
Dependencies update
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Jan 10, 2024
1 parent afc9cb5 commit aa3a4dd
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [Unreleased]
### Changed
- Guava version update to address a vulnerability on `33.0.0-android`, by @HardNorth
- Okhttp version update to address a vulnerability on `4.12.0`, by @HardNorth
- Logback version update to address a vulnerability on `1.3.12`, by @HardNorth

## [5.1.26]
### Added
Expand Down
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ dependencies {
}
api 'io.reactivex.rxjava2:rxjava:2.2.10'
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'com.google.guava:guava:30.1-android'
api "com.squareup.retrofit2:retrofit:${project.retrofit_version}"
api 'com.google.guava:guava:33.0.0-android'

api ("com.squareup.retrofit2:retrofit:${project.retrofit_version}") {
exclude module: 'okhttp'
}
api 'com.fasterxml.jackson.core:jackson-databind:2.12.7.1'
implementation "com.squareup.retrofit2:converter-scalars:${project.retrofit_version}"
implementation ("com.squareup.retrofit2:converter-jackson:${project.retrofit_version}") {
Expand All @@ -55,7 +58,8 @@ dependencies {
implementation ("com.squareup.retrofit2:adapter-rxjava2:${project.retrofit_version}") {
exclude module: 'rxjava'
}
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.9'
implementation "com.squareup.okhttp3:okhttp:${project.okhttp_version}"
implementation "com.squareup.okhttp3:logging-interceptor:${project.okhttp_version}"

api "org.aspectj:aspectjrt:${project.aspectj_version}"
implementation "org.aspectj:aspectjweaver:${project.aspectj_version}"
Expand All @@ -72,7 +76,7 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest-core:2.2'
testImplementation "org.mockito:mockito-core:${project.mockito_version}"
testImplementation "org.mockito:mockito-junit-jupiter:${project.mockito_version}"
testImplementation 'ch.qos.logback:logback-classic:1.3.8'
testImplementation 'ch.qos.logback:logback-classic:1.3.12'
testImplementation('org.awaitility:awaitility:4.0.2') {
exclude group: 'org.hamcrest'
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version=5.1.27-SNAPSHOT
description=EPAM ReportPortal. Client
retrofit_version=2.9.0
okhttp_version=4.12.0
junit_version=5.6.3
junit_runner_version=1.6.3
mockito_version=3.3.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DummyClient implements Statistics {

@Override
public Maybe<Response<ResponseBody>> send(StatisticsItem item) {
return Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create(MediaType.get("text/plain"), ""))));
return Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create("", MediaType.get("text/plain")))));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ private HttpRequestUtils() {
public static List<MultipartBody.Part> buildLogMultiPartRequest(List<SaveLogRQ> rqs) {
List<MultipartBody.Part> result = new ArrayList<>();
try {
String payload = MAPPER.writerFor(new TypeReference<List<SaveLogRQ>>() {
}).writeValueAsString(rqs);
result.add(MultipartBody.Part.createFormData(Constants.LOG_REQUEST_JSON_PART,
null,
RequestBody.create(okhttp3.MediaType.get("application/json; charset=utf-8"),
MAPPER.writerFor(new TypeReference<List<SaveLogRQ>>() {
}).writeValueAsString(rqs)
)
RequestBody.create(payload, okhttp3.MediaType.get("application/json; charset=utf-8"))
));
} catch (JsonProcessingException e) {
throw new InternalReportPortalClientException("Unable to process JSON", e);
Expand All @@ -85,7 +84,7 @@ public static List<MultipartBody.Part> buildLogMultiPartRequest(List<SaveLogRQ>
}
result.add(MultipartBody.Part.createFormData(Constants.LOG_REQUEST_BINARY_PART,
file.getName(),
RequestBody.create(type, file.getContent())
RequestBody.create(file.getContent(), type)
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class StatisticsClientTest {
void sendRequestWithoutError() {

when(httpClient.send(anyString(), anyString(), anyString(), any(StatisticsItem.class))).thenReturn(Maybe.create(
e -> e.onSuccess(Response.success(ResponseBody.create(MediaType.get("text/plain"), "")))));
e -> e.onSuccess(Response.success(ResponseBody.create("", MediaType.get("text/plain"))))));

try (StatisticsClient googleAnalytics = new StatisticsClient("id", "secret", httpClient)) {
StatisticsItem item = new StatisticsItem("client-id");
Expand All @@ -62,8 +62,6 @@ void sendRequestErrorShouldNotThrowException() {
Maybe<Response<ResponseBody>> result = googleAnalytics.send(new StatisticsItem("client-id"));

verify(httpClient).send(anyString(), anyString(), anyString(), any(StatisticsItem.class));

//noinspection ResultOfMethodCallIgnored
Assertions.assertThrows(RuntimeException.class, result::blockingGet);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public static void main(String... args) {
anyString(),
anyString(),
any(StatisticsItem.class)
)).thenReturn(Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create(MediaType.get("text/plain"),
""
)))));
)).thenReturn(Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create("", MediaType.get("text/plain"))))));

try (StatisticsClient client = new StatisticsClient("id", "secret", api)) {
try (StatisticsService service = new StatisticsService(TestUtils.standardParameters(), client)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ protected Statistics getStatistics() {
private ListenerParameters parameters;

private void stubSend() {
when(statistics.send(any())).thenReturn(Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create(MediaType.get("text/plain"),
""
)))));
when(statistics.send(any())).thenReturn(Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create("", MediaType.get("text/plain"))))));
}

@BeforeEach
Expand Down Expand Up @@ -168,7 +166,7 @@ public void test_statistics_send_event_async() {
@Test
public void verify_service_sends_same_client_id() {
when(httpClient.send(anyString(), anyString(), anyString(), any(StatisticsItem.class))).thenReturn(Maybe.create(
e -> e.onSuccess(Response.success(ResponseBody.create(MediaType.get("text/plain"), "")))));
e -> e.onSuccess(Response.success(ResponseBody.create("", MediaType.get("text/plain"))))));
String cid;
try (StatisticsClient client = new StatisticsClient("id", "secret", httpClient)) {
try (StatisticsService service = new StatisticsService(TestUtils.standardParameters(), client)) {
Expand All @@ -182,7 +180,7 @@ public void verify_service_sends_same_client_id() {
}
StatisticsApiClient secondClient = mock(StatisticsApiClient.class);
when(secondClient.send(anyString(), anyString(), anyString(), any())).thenReturn(Maybe.create(e -> e.onSuccess(
Response.success(ResponseBody.create(MediaType.get("text/plain"), "")))));
Response.success(ResponseBody.create("", MediaType.get("text/plain"))))));

try (StatisticsClient client = new StatisticsClient("id", "secret", secondClient)) {
try (StatisticsService service = new StatisticsService(TestUtils.standardParameters(), client)) {
Expand All @@ -205,13 +203,13 @@ public void verify_service_sends_same_client_id_for_processes()
assertThat("Exit code should be '0'", process.waitFor(), equalTo(0));
String result = Utils.readInputStreamToString(process.getInputStream());
process.destroyForcibly();
Map<String, String> values = Arrays.stream(result.split(System.getProperty("line.separator")))
Map<String, String> values = Arrays.stream(result.split(System.lineSeparator()))
.collect(Collectors.toMap(k -> k.substring(0, k.indexOf("=")), v -> v.substring(v.indexOf("=") + 1)));

Process process2 = ProcessUtils.buildProcess(false, StatisticsIdsRunnable.class);
assertThat("Exit code should be '0'", process2.waitFor(), equalTo(0));
String result2 = Utils.readInputStreamToString(process2.getInputStream());
Map<String, String> values2 = Arrays.stream(result2.split(System.getProperty("line.separator")))
Map<String, String> values2 = Arrays.stream(result2.split(System.lineSeparator()))
.collect(Collectors.toMap(k -> k.substring(0, k.indexOf("=")), v -> v.substring(v.indexOf("=") + 1)));

assertThat(values2.get("cid"), equalTo(values.get("cid")));
Expand Down

0 comments on commit aa3a4dd

Please sign in to comment.