From fc48cfb382cae6e431723449ceda1fbc2362882d Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 10:17:19 +0200 Subject: [PATCH 01/10] optimize OkHttp3 client --- .../commercetools-money/build.gradle | 4 +- .../http/okhttp3/CtOkHttp3Client.java | 12 ++--- .../http/okhttp3/SupplierTest.java | 48 +++++++++++++++++++ .../commercetools-sdk-java-api/build.gradle | 4 +- 4 files changed, 58 insertions(+), 10 deletions(-) diff --git a/commercetools/commercetools-money/build.gradle b/commercetools/commercetools-money/build.gradle index 3df68729f0f..c783444ae16 100644 --- a/commercetools/commercetools-money/build.gradle +++ b/commercetools/commercetools-money/build.gradle @@ -1,4 +1,6 @@ dependencies { api "javax.money:money-api:1.1" - api group: 'org.javamoney.moneta', name: 'moneta-core', version: '1.4.4' + api('org.javamoney.moneta:moneta-core:1.4.4') { + exclude group: "com.squareup.okhttp3", module: "okhttp" + } } diff --git a/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java b/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java index ed584f08fe2..f5428bdfe4b 100644 --- a/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java +++ b/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java @@ -107,7 +107,7 @@ public CompletableFuture> execute(final ApiHttpRequest r } - private static ApiHttpResponse toResponse(final okhttp3.Response response) { + static ApiHttpResponse toResponse(final okhttp3.Response response) { final ApiHttpHeaders apiHttpHeaders = new ApiHttpHeaders(response.headers() .toMultimap() .entrySet() @@ -194,17 +194,15 @@ public okhttp3.Response intercept(Chain chain) throws IOException { return unzip(response); } - private okhttp3.Response unzip(final okhttp3.Response response) throws IOException { + okhttp3.Response unzip(final okhttp3.Response response) { if (!"gzip".equalsIgnoreCase(response.header("Content-Encoding"))) { return response; } - okhttp3.ResponseBody responseBody = response.body(); - if (responseBody == null) { + if (response.body() == null) { return response; } - GzipSource gzipSource = new GzipSource(responseBody.source()); okhttp3.Headers strippedHeaders = response.headers() .newBuilder() .removeAll("Content-Encoding") @@ -213,8 +211,8 @@ private okhttp3.Response unzip(final okhttp3.Response response) throws IOExcepti String contentType = response.header("Content-Type"); return response.newBuilder() .headers(strippedHeaders) - .body( - okhttp3.ResponseBody.create(okhttp3.MediaType.parse(contentType), -1L, Okio.buffer(gzipSource))) + .body(okhttp3.ResponseBody.create(okhttp3.MediaType.parse(contentType), -1L, + Okio.buffer(new GzipSource(response.body().source())))) .build(); } } diff --git a/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java b/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java index 45dd9a2d2c6..2fe52ee4845 100644 --- a/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java +++ b/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java @@ -1,14 +1,62 @@ package com.commercetools.http.okhttp3; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.zip.GZIPOutputStream; + +import io.vrap.rmf.base.client.ApiHttpResponse; import io.vrap.rmf.base.client.HttpClientSupplier; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; +import okhttp3.*; +import okio.Okio; + public class SupplierTest { @Test public void testCreate() { Assertions.assertThat(HttpClientSupplier.of().get()).isInstanceOf(CtOkHttp3Client.class); } + + @Test + public void testUnzip() throws IOException { + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + GZIPOutputStream gzipOs = new GZIPOutputStream(os); + byte[] buffer = "Sample Text".getBytes(); + gzipOs.write(buffer, 0, buffer.length); + gzipOs.close(); + ByteArrayInputStream inputStream = new ByteArrayInputStream(os.toByteArray()); + + CtOkHttp3Client.UnzippingInterceptor interceptor = new CtOkHttp3Client.UnzippingInterceptor(); + + Response gzipped = new Response.Builder().request(new Request.Builder().url("http://localhost").build()) + .protocol(Protocol.HTTP_1_1) + .addHeader("content-encoding", "gzip") + .addHeader("content-type", "application/json") + .code(200) + .message("Ok") + .body(ResponseBody.create(MediaType.parse("application/json"), -1L, + Okio.buffer(Okio.source(inputStream)))) + .build(); + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + + Response unzipped = interceptor.unzip(gzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(unzipped.body().source().isOpen()).isTrue(); + + ApiHttpResponse response = CtOkHttp3Client.toResponse(unzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(unzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(inputStream.available()).isEqualTo(0); + + String text = new String(response.getBody(), StandardCharsets.UTF_8); + Assertions.assertThat(text).isEqualTo("Sample Text"); + } } diff --git a/commercetools/commercetools-sdk-java-api/build.gradle b/commercetools/commercetools-sdk-java-api/build.gradle index 97f3edb921d..a5eebd7d903 100644 --- a/commercetools/commercetools-sdk-java-api/build.gradle +++ b/commercetools/commercetools-sdk-java-api/build.gradle @@ -9,8 +9,8 @@ dependencies { api slf4j.api api commons.lang3 - testImplementation project(':commercetools:commercetools-http-client') - testImplementation project(':commercetools:commercetools-okhttp-client4') +// testImplementation project(':commercetools:commercetools-http-client') + testImplementation project(':commercetools:commercetools-okhttp-client3') testImplementation project(':commercetools:commercetools-apachehttp-client') testImplementation commons.io version commons.io_version From 1a83890285d8c758e8951233f8fdaa0cde19459b Mon Sep 17 00:00:00 2001 From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 08:22:42 +0000 Subject: [PATCH 02/10] TASK: Updating license information --- licenses/commercetools-graphql-api/index.json | 60 ------------ licenses/commercetools-money/index.json | 95 ------------------- .../commercetools-sdk-java-api/index.json | 95 ------------------- licenses/index.json | 4 - 4 files changed, 254 deletions(-) diff --git a/licenses/commercetools-graphql-api/index.json b/licenses/commercetools-graphql-api/index.json index a12be64a684..656e2bef85c 100644 --- a/licenses/commercetools-graphql-api/index.json +++ b/licenses/commercetools-graphql-api/index.json @@ -129,36 +129,6 @@ } ] }, - { - "moduleName": "com.squareup.okhttp3:okhttp", - "moduleVersion": "4.12.0", - "moduleUrls": [ - "https://square.github.io/okhttp/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "com.squareup.okio:okio", - "moduleVersion": "3.6.0" - }, - { - "moduleName": "com.squareup.okio:okio-jvm", - "moduleVersion": "3.6.0", - "moduleUrls": [ - "https://github.com/square/okio/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, { "moduleName": "dev.failsafe:failsafe", "moduleVersion": "3.3.2", @@ -284,36 +254,6 @@ } ] }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-common", - "moduleVersion": "1.9.22" - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk7", - "moduleVersion": "1.9.22", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk8", - "moduleVersion": "1.9.22", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, { "moduleName": "org.jetbrains:annotations", "moduleVersion": "13.0", diff --git a/licenses/commercetools-money/index.json b/licenses/commercetools-money/index.json index 9a5d4989704..04bcb4848a6 100644 --- a/licenses/commercetools-money/index.json +++ b/licenses/commercetools-money/index.json @@ -1,35 +1,5 @@ { "dependencies": [ - { - "moduleName": "com.squareup.okhttp3:okhttp", - "moduleVersion": "4.12.0", - "moduleUrls": [ - "https://square.github.io/okhttp/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "com.squareup.okio:okio", - "moduleVersion": "3.6.0" - }, - { - "moduleName": "com.squareup.okio:okio-jvm", - "moduleVersion": "3.6.0", - "moduleUrls": [ - "https://github.com/square/okio/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, { "moduleName": "jakarta.annotation:jakarta.annotation-api", "moduleVersion": "2.0.0", @@ -79,71 +49,6 @@ "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" } ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-common", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk7", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk8", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains:annotations", - "moduleVersion": "13.0", - "moduleUrls": [ - "http://www.jetbrains.org" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] } ] } \ No newline at end of file diff --git a/licenses/commercetools-sdk-java-api/index.json b/licenses/commercetools-sdk-java-api/index.json index ba4b599a157..b18e8f1019c 100644 --- a/licenses/commercetools-sdk-java-api/index.json +++ b/licenses/commercetools-sdk-java-api/index.json @@ -78,36 +78,6 @@ } ] }, - { - "moduleName": "com.squareup.okhttp3:okhttp", - "moduleVersion": "4.12.0", - "moduleUrls": [ - "https://square.github.io/okhttp/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "com.squareup.okio:okio", - "moduleVersion": "3.6.0" - }, - { - "moduleName": "com.squareup.okio:okio-jvm", - "moduleVersion": "3.6.0", - "moduleUrls": [ - "https://github.com/square/okio/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, { "moduleName": "dev.failsafe:failsafe", "moduleVersion": "3.3.2", @@ -207,71 +177,6 @@ } ] }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-common", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk7", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk8", - "moduleVersion": "1.9.10", - "moduleUrls": [ - "https://kotlinlang.org/" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, - { - "moduleName": "org.jetbrains:annotations", - "moduleVersion": "13.0", - "moduleUrls": [ - "http://www.jetbrains.org" - ], - "moduleLicenses": [ - { - "moduleLicense": "Apache License, Version 2.0", - "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" - } - ] - }, { "moduleName": "org.slf4j:slf4j-api", "moduleVersion": "2.0.13", diff --git a/licenses/index.json b/licenses/index.json index 2678e31018e..2f089bedfb5 100644 --- a/licenses/index.json +++ b/licenses/index.json @@ -1783,10 +1783,6 @@ } ] }, - { - "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-common", - "moduleVersion": "1.9.22" - }, { "moduleName": "org.jetbrains.kotlin:kotlin-stdlib-jdk7", "moduleVersion": "1.9.10", From b02c5a3cd727f33644d7c93627f98cde0dec5abc Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 10:24:52 +0200 Subject: [PATCH 03/10] test stream length --- .../test/java/com/commercetools/http/okhttp3/SupplierTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java b/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java index 2fe52ee4845..358c1e0039c 100644 --- a/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java +++ b/commercetools/commercetools-okhttp-client3/src/test/java/com/commercetools/http/okhttp3/SupplierTest.java @@ -49,6 +49,7 @@ public void testUnzip() throws IOException { Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); Assertions.assertThat(unzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(inputStream.available()).isEqualTo(31); ApiHttpResponse response = CtOkHttp3Client.toResponse(unzipped); From 1674febe6106e8f117ecc9a77e199acf1333c311 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 10:49:25 +0200 Subject: [PATCH 04/10] fix test --- .../test/java/com/commercetools/LongRunningTimeoutTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java index 2c8b7e10a2b..5f4c63ffe9b 100644 --- a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java +++ b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java @@ -13,7 +13,7 @@ import com.commercetools.api.defaultconfig.ServiceRegion; import com.commercetools.api.models.message.MessagePagedQueryResponse; import com.commercetools.http.apachehttp.CtApacheHttpClient; -import com.commercetools.http.okhttp4.CtOkHttp4Client; +import com.commercetools.http.okhttp3.CtOkHttp3Client; import io.vrap.rmf.base.client.ApiHttpResponse; import io.vrap.rmf.base.client.AuthenticationToken; @@ -35,7 +35,7 @@ public class LongRunningTimeoutTest { */ public static void main(String[] args) throws InterruptedException, ExecutionException, IOException { final TokenSupplier tokenSupplier = new ClientCredentialsTokenSupplier(getClientId(), getClientSecret(), null, - ServiceRegion.GCP_EUROPE_WEST1.getOAuthTokenUrl(), new CtOkHttp4Client()); + ServiceRegion.GCP_EUROPE_WEST1.getOAuthTokenUrl(), new CtOkHttp3Client()); final AuthenticationToken token = tokenSupplier.getToken().get(); final ApiRoot client = ApiRootBuilder.of(new CtApacheHttpClient()) .defaultClient( From c12b2669cf6d9b17b359d42498efb3dad8faa360 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 10:51:27 +0200 Subject: [PATCH 05/10] fix test --- .../src/test/java/com/commercetools/ExampleTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java index ebdd11b8480..34a60c6cf3b 100644 --- a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java +++ b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java @@ -18,7 +18,7 @@ import com.commercetools.api.models.common.LocalizedString; import com.commercetools.api.models.common.LocalizedStringBuilder; import com.commercetools.api.models.tax_category.TaxCategoryPagedQueryResponse; -import com.commercetools.http.okhttp4.CtOkHttp4Client; +import com.commercetools.http.okhttp3.CtOkHttp3Client; import io.vrap.rmf.base.client.ApiHttpResponse; import io.vrap.rmf.base.client.VrapHttpClient; @@ -169,7 +169,7 @@ public void retry() { public void proxy() { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy", 8080)); - VrapHttpClient httpClient = new CtOkHttp4Client(builder -> builder.proxy(proxy)); + VrapHttpClient httpClient = new CtOkHttp3Client(builder -> builder.proxy(proxy)); ApiRoot apiRoot = ApiRootBuilder.of(httpClient) .defaultClient(ClientCredentials.of() From 14cbeb5f97feae0927cc32c61619d0b264ab9937 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 10:58:19 +0200 Subject: [PATCH 06/10] optimize okhttp4 client to not hold local references to response body --- .../com/commercetools/http/okhttp4/CtOkHttp4Client.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java b/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java index 746f2450245..a79889b200f 100644 --- a/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java +++ b/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java @@ -201,17 +201,15 @@ public okhttp3.Response intercept(Chain chain) throws IOException { return unzip(response); } - private okhttp3.Response unzip(final okhttp3.Response response) throws IOException { + private okhttp3.Response unzip(final okhttp3.Response response) { if (!"gzip".equalsIgnoreCase(response.header("Content-Encoding"))) { return response; } - okhttp3.ResponseBody responseBody = response.body(); - if (responseBody == null) { + if (response.body() == null) { return response; } - GzipSource gzipSource = new GzipSource(responseBody.source()); okhttp3.Headers strippedHeaders = response.headers() .newBuilder() .removeAll("Content-Encoding") @@ -220,7 +218,8 @@ private okhttp3.Response unzip(final okhttp3.Response response) throws IOExcepti String contentType = response.header("Content-Type"); return response.newBuilder() .headers(strippedHeaders) - .body(okhttp3.ResponseBody.create(Okio.buffer(gzipSource), okhttp3.MediaType.get(contentType), -1L)) + .body(okhttp3.ResponseBody.create(Okio.buffer(new GzipSource(response.body().source())), + okhttp3.MediaType.get(contentType), -1L)) .build(); } } From 13a06eed85f9e7703d20f6d868d7daeb1d82daa4 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 13:42:01 +0200 Subject: [PATCH 07/10] add benchmark for okhttp unzip --- build.gradle | 2 +- .../commercetools-okhttp-client3/build.gradle | 12 +- .../http/okhttp3/UnzipBenchmark.java | 120 ++++++++++++++++++ .../http/okhttp3/CtOkHttp3Client.java | 2 +- .../commercetools-okhttp-client4/build.gradle | 10 ++ .../http/okhttp4/UnzipBenchmark.java | 120 ++++++++++++++++++ .../http/okhttp4/CtOkHttp4Client.java | 6 +- .../http/okhttp4/SupplierTest.java | 49 +++++++ 8 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 commercetools/commercetools-okhttp-client3/src/jmh/java/com/commercetools/http/okhttp3/UnzipBenchmark.java create mode 100644 commercetools/commercetools-okhttp-client4/src/jmh/java/com/commercetools/http/okhttp4/UnzipBenchmark.java diff --git a/build.gradle b/build.gradle index 5e3bca76272..32a90550b9d 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ plugins { id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' id 'com.github.jk1.dependency-license-report' version '2.0' - id "me.champeau.jmh" version "0.7.2" + id "me.champeau.jmh" version "0.6.8" id "jacoco" } diff --git a/commercetools/commercetools-okhttp-client3/build.gradle b/commercetools/commercetools-okhttp-client3/build.gradle index b7605566d7b..c08ac3cb6c7 100644 --- a/commercetools/commercetools-okhttp-client3/build.gradle +++ b/commercetools/commercetools-okhttp-client3/build.gradle @@ -1,8 +1,18 @@ +apply plugin: "me.champeau.jmh" + +jmh { + iterations = 5 + benchmarkMode = ['thrpt'] + threads = 25 + fork = 3 + timeOnIteration = '1s' + profilers = ['gc'] +} dependencies { api project(":rmf:rmf-java-base") - api "com.squareup.okio:okio:3.9.0" + implementation "com.squareup.okio:okio:3.9.0" api "com.squareup.okhttp3:okhttp:3.14.9" version { strictly "[3.0,4.0[" prefer "3.14.9" diff --git a/commercetools/commercetools-okhttp-client3/src/jmh/java/com/commercetools/http/okhttp3/UnzipBenchmark.java b/commercetools/commercetools-okhttp-client3/src/jmh/java/com/commercetools/http/okhttp3/UnzipBenchmark.java new file mode 100644 index 00000000000..38ce5e74e08 --- /dev/null +++ b/commercetools/commercetools-okhttp-client3/src/jmh/java/com/commercetools/http/okhttp3/UnzipBenchmark.java @@ -0,0 +1,120 @@ + +package com.commercetools.http.okhttp3; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.zip.GZIPOutputStream; + +import io.vrap.rmf.base.client.ApiHttpResponse; + +import org.assertj.core.api.Assertions; +import org.openjdk.jmh.annotations.*; + +import okhttp3.*; +import okio.Okio; + +public class UnzipBenchmark { + + @State(Scope.Benchmark) + public static class InterceptorState { + private CtOkHttp3Client.UnzippingInterceptor interceptor; + + @Setup(Level.Trial) + public void init() { + interceptor = new CtOkHttp3Client.UnzippingInterceptor(); + printUsedMemory(); + + } + + @TearDown(Level.Trial) + public void tearDown() { + printUsedMemory(); + } + } + @Benchmark + public void unzip(InterceptorState state) throws IOException { + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + GZIPOutputStream gzipOs = new GZIPOutputStream(os); + byte[] buffer = "Sample Text".getBytes(); + gzipOs.write(buffer, 0, buffer.length); + gzipOs.close(); + ByteArrayInputStream inputStream = new ByteArrayInputStream(os.toByteArray()); + + Response gzipped = new Response.Builder().request(new Request.Builder().url("http://localhost").build()) + .protocol(Protocol.HTTP_1_1) + .addHeader("content-encoding", "gzip") + .addHeader("content-type", "application/json") + .code(200) + .message("Ok") + .body(ResponseBody.create(MediaType.parse("application/json"), -1L, + Okio.buffer(Okio.source(inputStream)))) + .build(); + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + + Response unzipped = state.interceptor.unzip(gzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(unzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(inputStream.available()).isEqualTo(31); + + ApiHttpResponse response = CtOkHttp3Client.toResponse(unzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(unzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(inputStream.available()).isEqualTo(0); + + String text = new String(response.getBody(), StandardCharsets.UTF_8); + Assertions.assertThat(text).isEqualTo("Sample Text"); + } + + public static void printUsedMemory() { + long _usedMem; + long _total; + long _total2; + long _count = -1; + System.out.flush(); + // loop to get a stable reading, since memory may be resized between the method calls + do { + _count++; + _total = Runtime.getRuntime().totalMemory(); + try { + Thread.sleep(12); + } + catch (Exception ignore) { + } + long _free = Runtime.getRuntime().freeMemory(); + _total2 = Runtime.getRuntime().totalMemory(); + _usedMem = _total - _free; + } while (_total != _total2); + System.out.println("before GC: used=" + _usedMem + ", loopCount=" + _count + ", total=" + _total); + try { + Runtime.getRuntime().gc(); + Thread.sleep(55); + Runtime.getRuntime().gc(); + Thread.sleep(55); + Runtime.getRuntime().gc(); + Thread.sleep(55); + Runtime.getRuntime().gc(); + Thread.sleep(55); + } + catch (Exception ignore) { + } + // loop to get a stable reading, since memory may be resized between the method calls + do { + _count++; + _total = Runtime.getRuntime().totalMemory(); + try { + Thread.sleep(12); + } + catch (Exception ignore) { + } + long _free = Runtime.getRuntime().freeMemory(); + _total2 = Runtime.getRuntime().totalMemory(); + _usedMem = _total - _free; + } while (_total != _total2); + System.out.println("after GC: used=" + _usedMem + ", loopCount=" + _count + ", total=" + _total); + } +} diff --git a/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java b/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java index f5428bdfe4b..765031ea614 100644 --- a/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java +++ b/commercetools/commercetools-okhttp-client3/src/main/java/com/commercetools/http/okhttp3/CtOkHttp3Client.java @@ -120,7 +120,7 @@ static ApiHttpResponse toResponse(final okhttp3.Response response) { .map(Utils.wrapToCompletionException(okhttp3.ResponseBody::bytes)) .orElse(null), response.message()); - if (apiHttpResponse.getBody() != null) { + if (response.body() != null) { response.body().close(); } return apiHttpResponse; diff --git a/commercetools/commercetools-okhttp-client4/build.gradle b/commercetools/commercetools-okhttp-client4/build.gradle index fd77de638b5..91851dee307 100644 --- a/commercetools/commercetools-okhttp-client4/build.gradle +++ b/commercetools/commercetools-okhttp-client4/build.gradle @@ -1,3 +1,13 @@ +apply plugin: "me.champeau.jmh" + +jmh { + iterations = 5 + benchmarkMode = ['thrpt'] + threads = 25 + fork = 3 + timeOnIteration = '1s' + profilers = ['gc'] +} dependencies { api project(":rmf:rmf-java-base") diff --git a/commercetools/commercetools-okhttp-client4/src/jmh/java/com/commercetools/http/okhttp4/UnzipBenchmark.java b/commercetools/commercetools-okhttp-client4/src/jmh/java/com/commercetools/http/okhttp4/UnzipBenchmark.java new file mode 100644 index 00000000000..1ab6865683a --- /dev/null +++ b/commercetools/commercetools-okhttp-client4/src/jmh/java/com/commercetools/http/okhttp4/UnzipBenchmark.java @@ -0,0 +1,120 @@ + +package com.commercetools.http.okhttp4; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.zip.GZIPOutputStream; + +import io.vrap.rmf.base.client.ApiHttpResponse; + +import org.assertj.core.api.Assertions; +import org.openjdk.jmh.annotations.*; + +import okhttp3.*; +import okio.Okio; + +public class UnzipBenchmark { + + @State(Scope.Benchmark) + public static class InterceptorState { + private CtOkHttp4Client.UnzippingInterceptor interceptor; + + @Setup(Level.Trial) + public void init() { + interceptor = new CtOkHttp4Client.UnzippingInterceptor(); + printUsedMemory(); + + } + + @TearDown(Level.Trial) + public void tearDown() { + printUsedMemory(); + } + } + @Benchmark + public void unzip(InterceptorState state) throws IOException { + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + GZIPOutputStream gzipOs = new GZIPOutputStream(os); + byte[] buffer = "Sample Text".getBytes(); + gzipOs.write(buffer, 0, buffer.length); + gzipOs.close(); + ByteArrayInputStream inputStream = new ByteArrayInputStream(os.toByteArray()); + + Response gzipped = new Response.Builder().request(new Request.Builder().url("http://localhost").build()) + .protocol(Protocol.HTTP_1_1) + .addHeader("content-encoding", "gzip") + .addHeader("content-type", "application/json") + .code(200) + .message("Ok") + .body(ResponseBody.create(MediaType.parse("application/json"), -1L, + Okio.buffer(Okio.source(inputStream)))) + .build(); + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + + Response unzipped = state.interceptor.unzip(gzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(unzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(inputStream.available()).isEqualTo(31); + + ApiHttpResponse response = CtOkHttp4Client.toResponse(unzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(unzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(inputStream.available()).isEqualTo(0); + + String text = new String(response.getBody(), StandardCharsets.UTF_8); + Assertions.assertThat(text).isEqualTo("Sample Text"); + } + + public static void printUsedMemory() { + long _usedMem; + long _total; + long _total2; + long _count = -1; + System.out.flush(); + // loop to get a stable reading, since memory may be resized between the method calls + do { + _count++; + _total = Runtime.getRuntime().totalMemory(); + try { + Thread.sleep(12); + } + catch (Exception ignore) { + } + long _free = Runtime.getRuntime().freeMemory(); + _total2 = Runtime.getRuntime().totalMemory(); + _usedMem = _total - _free; + } while (_total != _total2); + System.out.println("before GC: used=" + _usedMem + ", loopCount=" + _count + ", total=" + _total); + try { + Runtime.getRuntime().gc(); + Thread.sleep(55); + Runtime.getRuntime().gc(); + Thread.sleep(55); + Runtime.getRuntime().gc(); + Thread.sleep(55); + Runtime.getRuntime().gc(); + Thread.sleep(55); + } + catch (Exception ignore) { + } + // loop to get a stable reading, since memory may be resized between the method calls + do { + _count++; + _total = Runtime.getRuntime().totalMemory(); + try { + Thread.sleep(12); + } + catch (Exception ignore) { + } + long _free = Runtime.getRuntime().freeMemory(); + _total2 = Runtime.getRuntime().totalMemory(); + _usedMem = _total - _free; + } while (_total != _total2); + System.out.println("after GC: used=" + _usedMem + ", loopCount=" + _count + ", total=" + _total); + } +} diff --git a/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java b/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java index a79889b200f..e8166fac7d9 100644 --- a/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java +++ b/commercetools/commercetools-okhttp-client4/src/main/java/com/commercetools/http/okhttp4/CtOkHttp4Client.java @@ -107,7 +107,7 @@ public CompletableFuture> execute(final ApiHttpRequest r } - private static ApiHttpResponse toResponse(final okhttp3.Response response) { + static ApiHttpResponse toResponse(final okhttp3.Response response) { final ApiHttpHeaders apiHttpHeaders = new ApiHttpHeaders(response.headers() .toMultimap() .entrySet() @@ -120,7 +120,7 @@ private static ApiHttpResponse toResponse(final okhttp3.Response respons .map(Utils.wrapToCompletionException(okhttp3.ResponseBody::bytes)) .orElse(null), response.message()); - if (apiHttpResponse.getBody() != null) { + if (response.body() != null) { response.close(); } return apiHttpResponse; @@ -201,7 +201,7 @@ public okhttp3.Response intercept(Chain chain) throws IOException { return unzip(response); } - private okhttp3.Response unzip(final okhttp3.Response response) { + okhttp3.Response unzip(final okhttp3.Response response) { if (!"gzip".equalsIgnoreCase(response.header("Content-Encoding"))) { return response; } diff --git a/commercetools/commercetools-okhttp-client4/src/test/java/com/commercetools/http/okhttp4/SupplierTest.java b/commercetools/commercetools-okhttp-client4/src/test/java/com/commercetools/http/okhttp4/SupplierTest.java index 61251c78ee3..011f9112dd6 100644 --- a/commercetools/commercetools-okhttp-client4/src/test/java/com/commercetools/http/okhttp4/SupplierTest.java +++ b/commercetools/commercetools-okhttp-client4/src/test/java/com/commercetools/http/okhttp4/SupplierTest.java @@ -1,14 +1,63 @@ package com.commercetools.http.okhttp4; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.zip.GZIPOutputStream; + +import io.vrap.rmf.base.client.ApiHttpResponse; import io.vrap.rmf.base.client.HttpClientSupplier; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; +import okhttp3.*; +import okio.Okio; + public class SupplierTest { @Test public void testCreate() { Assertions.assertThat(HttpClientSupplier.of().get()).isInstanceOf(CtOkHttp4Client.class); } + + @Test + public void testUnzip() throws IOException { + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + GZIPOutputStream gzipOs = new GZIPOutputStream(os); + byte[] buffer = "Sample Text".getBytes(); + gzipOs.write(buffer, 0, buffer.length); + gzipOs.close(); + ByteArrayInputStream inputStream = new ByteArrayInputStream(os.toByteArray()); + + CtOkHttp4Client.UnzippingInterceptor interceptor = new CtOkHttp4Client.UnzippingInterceptor(); + + Response gzipped = new Response.Builder().request(new Request.Builder().url("http://localhost").build()) + .protocol(Protocol.HTTP_1_1) + .addHeader("content-encoding", "gzip") + .addHeader("content-type", "application/json") + .code(200) + .message("Ok") + .body(ResponseBody.create(MediaType.parse("application/json"), -1L, + Okio.buffer(Okio.source(inputStream)))) + .build(); + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + + Response unzipped = interceptor.unzip(gzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(unzipped.body().source().isOpen()).isTrue(); + Assertions.assertThat(inputStream.available()).isEqualTo(31); + + ApiHttpResponse response = CtOkHttp4Client.toResponse(unzipped); + + Assertions.assertThat(gzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(unzipped.body().source().isOpen()).isFalse(); + Assertions.assertThat(inputStream.available()).isEqualTo(0); + + String text = new String(response.getBody(), StandardCharsets.UTF_8); + Assertions.assertThat(text).isEqualTo("Sample Text"); + } } From c1ecf8ccf29a33b546282d6218e3372a3ae0f9df Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 13:57:25 +0200 Subject: [PATCH 08/10] revert change to okhttp client3 in api tests --- commercetools/commercetools-sdk-java-api/build.gradle | 4 ++-- .../src/test/java/com/commercetools/ExampleTest.java | 4 ++-- .../test/java/com/commercetools/LongRunningTimeoutTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commercetools/commercetools-sdk-java-api/build.gradle b/commercetools/commercetools-sdk-java-api/build.gradle index a5eebd7d903..97f3edb921d 100644 --- a/commercetools/commercetools-sdk-java-api/build.gradle +++ b/commercetools/commercetools-sdk-java-api/build.gradle @@ -9,8 +9,8 @@ dependencies { api slf4j.api api commons.lang3 -// testImplementation project(':commercetools:commercetools-http-client') - testImplementation project(':commercetools:commercetools-okhttp-client3') + testImplementation project(':commercetools:commercetools-http-client') + testImplementation project(':commercetools:commercetools-okhttp-client4') testImplementation project(':commercetools:commercetools-apachehttp-client') testImplementation commons.io version commons.io_version diff --git a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java index 34a60c6cf3b..ebdd11b8480 100644 --- a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java +++ b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/ExampleTest.java @@ -18,7 +18,7 @@ import com.commercetools.api.models.common.LocalizedString; import com.commercetools.api.models.common.LocalizedStringBuilder; import com.commercetools.api.models.tax_category.TaxCategoryPagedQueryResponse; -import com.commercetools.http.okhttp3.CtOkHttp3Client; +import com.commercetools.http.okhttp4.CtOkHttp4Client; import io.vrap.rmf.base.client.ApiHttpResponse; import io.vrap.rmf.base.client.VrapHttpClient; @@ -169,7 +169,7 @@ public void retry() { public void proxy() { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy", 8080)); - VrapHttpClient httpClient = new CtOkHttp3Client(builder -> builder.proxy(proxy)); + VrapHttpClient httpClient = new CtOkHttp4Client(builder -> builder.proxy(proxy)); ApiRoot apiRoot = ApiRootBuilder.of(httpClient) .defaultClient(ClientCredentials.of() diff --git a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java index 5f4c63ffe9b..2c8b7e10a2b 100644 --- a/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java +++ b/commercetools/commercetools-sdk-java-api/src/test/java/com/commercetools/LongRunningTimeoutTest.java @@ -13,7 +13,7 @@ import com.commercetools.api.defaultconfig.ServiceRegion; import com.commercetools.api.models.message.MessagePagedQueryResponse; import com.commercetools.http.apachehttp.CtApacheHttpClient; -import com.commercetools.http.okhttp3.CtOkHttp3Client; +import com.commercetools.http.okhttp4.CtOkHttp4Client; import io.vrap.rmf.base.client.ApiHttpResponse; import io.vrap.rmf.base.client.AuthenticationToken; @@ -35,7 +35,7 @@ public class LongRunningTimeoutTest { */ public static void main(String[] args) throws InterruptedException, ExecutionException, IOException { final TokenSupplier tokenSupplier = new ClientCredentialsTokenSupplier(getClientId(), getClientSecret(), null, - ServiceRegion.GCP_EUROPE_WEST1.getOAuthTokenUrl(), new CtOkHttp3Client()); + ServiceRegion.GCP_EUROPE_WEST1.getOAuthTokenUrl(), new CtOkHttp4Client()); final AuthenticationToken token = tokenSupplier.getToken().get(); final ApiRoot client = ApiRootBuilder.of(new CtApacheHttpClient()) .defaultClient( From 7213b5eaf9c7bb1a2757e13f3ebf73c0c972a2eb Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Thu, 10 Oct 2024 14:45:50 +0200 Subject: [PATCH 09/10] use AHC for v1 client benchmark --- .../commercetools-sdk-compat-v1/build.gradle | 1 - .../src/jmh/resources/logback-jmh.xml | 17 +++++++++++++++++ commercetools/internal-docs/build.gradle | 1 - gradle-scripts/extensions.gradle | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 commercetools/commercetools-sdk-compat-v1/src/jmh/resources/logback-jmh.xml diff --git a/commercetools/commercetools-sdk-compat-v1/build.gradle b/commercetools/commercetools-sdk-compat-v1/build.gradle index b3e6cc6d093..810859949e5 100644 --- a/commercetools/commercetools-sdk-compat-v1/build.gradle +++ b/commercetools/commercetools-sdk-compat-v1/build.gradle @@ -28,7 +28,6 @@ dependencies { testImplementation project(':commercetools:commercetools-http-client') testImplementation ctsdkv1.client version ctsdkv1.version testImplementation ctsdkv1.models version ctsdkv1.version - testImplementation ctsdkv1.convenience version ctsdkv1.version } sourceSets.main.java.srcDirs += "src/main/java-generated" diff --git a/commercetools/commercetools-sdk-compat-v1/src/jmh/resources/logback-jmh.xml b/commercetools/commercetools-sdk-compat-v1/src/jmh/resources/logback-jmh.xml new file mode 100644 index 00000000000..963882c38cd --- /dev/null +++ b/commercetools/commercetools-sdk-compat-v1/src/jmh/resources/logback-jmh.xml @@ -0,0 +1,17 @@ + + + true + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + + + + + + + + + diff --git a/commercetools/internal-docs/build.gradle b/commercetools/internal-docs/build.gradle index ba613f8b3f6..885fffba9c7 100644 --- a/commercetools/internal-docs/build.gradle +++ b/commercetools/internal-docs/build.gradle @@ -12,7 +12,6 @@ dependencies { testImplementation ctsdkv1.client version ctsdkv1.version implementation ctsdkv1.models version ctsdkv1.version - testImplementation ctsdkv1.convenience version ctsdkv1.version testImplementation commons.io version commons.io_version diff --git a/gradle-scripts/extensions.gradle b/gradle-scripts/extensions.gradle index a1b321c7fc8..2af09bf4783 100644 --- a/gradle-scripts/extensions.gradle +++ b/gradle-scripts/extensions.gradle @@ -1,6 +1,6 @@ ext { ctsdkv1 = [ - client: 'com.commercetools.sdk.jvm.core:commercetools-java-client-core:2.16.0', + client: 'com.commercetools.sdk.jvm.core:commercetools-java-client:2.16.0', models: 'com.commercetools.sdk.jvm.core:commercetools-models:2.16.0', convenience: 'com.commercetools.sdk.jvm.core:commercetools-convenience:2.16.0', version: { From 99faf0e2514389b7aea4a099d41987331fd9a102 Mon Sep 17 00:00:00 2001 From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:50:47 +0000 Subject: [PATCH 10/10] TASK: Updating license information --- .../commercetools-sdk-compat-v1/index.json | 195 ++++++++++++++++++ licenses/index.json | 195 ++++++++++++++++++ 2 files changed, 390 insertions(+) diff --git a/licenses/commercetools-sdk-compat-v1/index.json b/licenses/commercetools-sdk-compat-v1/index.json index 01aeb24d192..a170c063b5b 100644 --- a/licenses/commercetools-sdk-compat-v1/index.json +++ b/licenses/commercetools-sdk-compat-v1/index.json @@ -1,5 +1,25 @@ { "dependencies": [ + { + "moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client", + "moduleVersion": "2.14.0", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-ahc-2_0", + "moduleVersion": "2.14.0", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core", "moduleVersion": "2.14.0", @@ -40,6 +60,16 @@ } ] }, + { + "moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_0", + "moduleVersion": "2.14.0", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "com.fasterxml.jackson.core:jackson-annotations", "moduleVersion": "2.17.1", @@ -187,6 +217,16 @@ } ] }, + { + "moduleName": "com.typesafe.netty:netty-reactive-streams", + "moduleVersion": "1.0.8", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "dev.failsafe:failsafe", "moduleVersion": "3.3.2", @@ -201,6 +241,97 @@ } ] }, + { + "moduleName": "io.netty:netty-buffer", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "io.netty:netty-codec", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "io.netty:netty-codec-http", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "io.netty:netty-common", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "io.netty:netty-handler", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "io.netty:netty-transport", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "io.netty:netty-transport-native-epoll", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "jakarta.annotation:jakarta.annotation-api", "moduleVersion": "2.0.0", @@ -317,6 +448,56 @@ } ] }, + { + "moduleName": "org.asynchttpclient:async-http-client", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "org.asynchttpclient:async-http-client-netty-utils", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "org.asynchttpclient:netty-codec-dns", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "org.asynchttpclient:netty-resolver", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "org.asynchttpclient:netty-resolver-dns", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "org.javamoney.moneta:moneta-convert", "moduleVersion": "1.4.2", @@ -448,6 +629,20 @@ } ] }, + { + "moduleName": "org.reactivestreams:reactive-streams", + "moduleVersion": "1.0.0", + "moduleUrls": [ + "http://reactive-streams.org", + "http://www.reactive-streams.org/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Creative Commons Legal Code", + "moduleLicenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/legalcode" + } + ] + }, { "moduleName": "org.slf4j:slf4j-api", "moduleVersion": "2.0.13", diff --git a/licenses/index.json b/licenses/index.json index 2f089bedfb5..714d0883352 100644 --- a/licenses/index.json +++ b/licenses/index.json @@ -1,5 +1,25 @@ { "dependencies": [ + { + "moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client", + "moduleVersion": "2.14.0", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-ahc-2_0", + "moduleVersion": "2.14.0", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core", "moduleVersion": "2.14.0", @@ -40,6 +60,16 @@ } ] }, + { + "moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_0", + "moduleVersion": "2.14.0", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "com.datadoghq:datadog-api-client", "moduleVersion": "2.25.0", @@ -510,6 +540,16 @@ } ] }, + { + "moduleName": "com.typesafe.netty:netty-reactive-streams", + "moduleVersion": "1.0.8", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "com.typesafe.netty:netty-reactive-streams", "moduleVersion": "2.0.4", @@ -576,6 +616,19 @@ } ] }, + { + "moduleName": "io.netty:netty-buffer", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-buffer", "moduleVersion": "4.1.109.Final", @@ -589,6 +642,19 @@ } ] }, + { + "moduleName": "io.netty:netty-codec", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-codec", "moduleVersion": "4.1.109.Final", @@ -615,6 +681,19 @@ } ] }, + { + "moduleName": "io.netty:netty-codec-http", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-codec-http", "moduleVersion": "4.1.109.Final", @@ -654,6 +733,19 @@ } ] }, + { + "moduleName": "io.netty:netty-common", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-common", "moduleVersion": "4.1.109.Final", @@ -667,6 +759,19 @@ } ] }, + { + "moduleName": "io.netty:netty-handler", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-handler", "moduleVersion": "4.1.109.Final", @@ -745,6 +850,19 @@ } ] }, + { + "moduleName": "io.netty:netty-transport", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-transport", "moduleVersion": "4.1.109.Final", @@ -771,6 +889,19 @@ } ] }, + { + "moduleName": "io.netty:netty-transport-native-epoll", + "moduleVersion": "4.0.54.Final", + "moduleUrls": [ + "http://netty.io/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "io.netty:netty-transport-native-epoll", "moduleVersion": "4.1.109.Final", @@ -1143,6 +1274,16 @@ } ] }, + { + "moduleName": "org.asynchttpclient:async-http-client", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "org.asynchttpclient:async-http-client", "moduleVersion": "2.12.3", @@ -1153,6 +1294,16 @@ } ] }, + { + "moduleName": "org.asynchttpclient:async-http-client-netty-utils", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "org.asynchttpclient:async-http-client-netty-utils", "moduleVersion": "2.12.3", @@ -1163,6 +1314,36 @@ } ] }, + { + "moduleName": "org.asynchttpclient:netty-codec-dns", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "org.asynchttpclient:netty-resolver", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, + { + "moduleName": "org.asynchttpclient:netty-resolver-dns", + "moduleVersion": "2.0.38", + "moduleLicenses": [ + { + "moduleLicense": "Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" + } + ] + }, { "moduleName": "org.glassfish.hk2.external:aopalliance-repackaged", "moduleVersion": "3.0.3", @@ -1977,6 +2158,20 @@ } ] }, + { + "moduleName": "org.reactivestreams:reactive-streams", + "moduleVersion": "1.0.0", + "moduleUrls": [ + "http://reactive-streams.org", + "http://www.reactive-streams.org/" + ], + "moduleLicenses": [ + { + "moduleLicense": "Creative Commons Legal Code", + "moduleLicenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/legalcode" + } + ] + }, { "moduleName": "org.reactivestreams:reactive-streams", "moduleVersion": "1.0.3",