Skip to content

Commit

Permalink
Merge pull request #784 from commercetools/httpclient-solutioninfos
Browse files Browse the repository at this point in the history
[DEVX-516] add HttpClient info to UserAgent
  • Loading branch information
kodiakhq[bot] authored Jan 20, 2025
2 parents dc88d99 + 85fce78 commit 6d87b53
Show file tree
Hide file tree
Showing 39 changed files with 375 additions and 190 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8
token: ${{ steps.generate_github_token.outputs.token }}
- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
with:
token: ${{ steps.generate_github_token.outputs.token }}

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
token: ${{ steps.generate_github_token.outputs.token }}

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- uses: jenschude/auto-create-pr-action@a5369414c74963e6ec065dab49066d3711b8c1db # v0.3.2
if: github.ref_name == 'gen-sdk-updates'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
distribution: 'temurin'
java-version: '17'

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
token: ${{ steps.generate_github_token.outputs.token }}

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
ref: main
token: ${{ steps.generate_github_token.outputs.token }}

- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
- uses: gradle/actions/wrapper-validation@v4

- run: ./gradlew -Pversion=$REF_NAME writeVersionToExamples writeVersionToReadme setVersion nextMinorVersion snapshotVersion
env:
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

package com.commercetools.http.apachehttp;

import io.vrap.rmf.base.client.SolutionInfo;

import org.apache.hc.client5.http.classic.HttpClient;
import org.apache.hc.core5.util.VersionInfo;

public class ApacheHttpClientSolutionInfo extends io.vrap.rmf.base.client.SolutionInfo {
public class ApacheHttpClientSolutionInfo extends SolutionInfo {
public ApacheHttpClientSolutionInfo() {
setName("ApacheHttpAsyncClient");
setVersion(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.apachehttp;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SolutionInfoTest {
@Test
public void version() {
String version = new ApacheHttpClientSolutionInfo().getVersion();

Assertions.assertThat(version).isEqualTo("5.4.1");
}
}
8 changes: 5 additions & 3 deletions commercetools/commercetools-async-http-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ dependencies {
api project(":rmf:rmf-java-base")
api "org.asynchttpclient:async-http-client:2.12.4"
api commons.io version commons.io_version
api "io.netty:netty-codec-http:${netty.version}"
api "io.netty:netty-codec-socks:${netty.version}"
api "io.netty:netty-handler-proxy:${netty.version}"
api "io.netty:netty-codec:4.1.116.Final"
api "io.netty:netty-codec-http:4.1.116.Final"
api "io.netty:netty-codec-socks:4.1.116.Final"
api "io.netty:netty-handler-proxy:4.1.116.Final"
api "io.netty:netty-handler:4.1.116.Final"
implementation javax.validation
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.asynchttp;

import io.vrap.rmf.base.client.SolutionInfo;
import io.vrap.rmf.base.client.VersionLoader;

public class AsyncHttpClientSolutionInfo extends SolutionInfo {

public AsyncHttpClientSolutionInfo() {
setName("AsyncHttpAsyncClient");
setVersion(VersionLoader.loadVersionInfo("org.asynchttpclient", "async-http-client", "pom.properties",
"version", this.getClass().getClassLoader()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.commercetools.http.asynchttp.AsyncHttpClientSolutionInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

package com.commercetools.http.asynchttpclient;

import com.commercetools.http.asynchttp.AsyncHttpClientSolutionInfo;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SolutionInfoTest {
@Test
public void version() {
String version = new AsyncHttpClientSolutionInfo().getVersion();

Assertions.assertThat(version).isEqualTo("2.12.4");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.javanet;

import io.vrap.rmf.base.client.SolutionInfo;

import org.apache.commons.lang3.SystemUtils;

public class JavaNetHttpClientSolutionInfo extends SolutionInfo {

public JavaNetHttpClientSolutionInfo() {
setName("JavaNetHttpClient");
setVersion(SystemUtils.JAVA_RUNTIME_VERSION);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.commercetools.http.javanet.JavaNetHttpClientSolutionInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.javanet;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SolutionInfoTest {
@Test
public void version() {
String version = new JavaNetHttpClientSolutionInfo().getVersion();

Assertions.assertThat(version).isNotEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.okhttp3;

import io.vrap.rmf.base.client.SolutionInfo;
import io.vrap.rmf.base.client.VersionLoader;

public class OkHttpClientSolutionInfo extends SolutionInfo {

public OkHttpClientSolutionInfo() {
setName("OkHttpClient");
setVersion(VersionLoader.loadVersionInfo("com.squareup.okhttp3", "okhttp", "pom.properties", "version",
this.getClass().getClassLoader()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.commercetools.http.okhttp3.OkHttpClientSolutionInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.okhttp3;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SolutionInfoTest {
@Test
public void version() {
String version = new OkHttpClientSolutionInfo().getVersion();

Assertions.assertThat(version).isEqualTo("3.14.9");
}
}
2 changes: 1 addition & 1 deletion commercetools/commercetools-okhttp-client4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
api project(":rmf:rmf-java-base")
api "com.squareup.okhttp3:okhttp:4.12.0" version {
strictly '[4.0,5.0['
prefer "4.10.0"
prefer "4.12.0"
}
implementation "com.squareup.okio:okio:3.9.1"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.okhttp4;

import io.vrap.rmf.base.client.SolutionInfo;

import okhttp3.OkHttp;

public class OkHttpClientSolutionInfo extends SolutionInfo {

public OkHttpClientSolutionInfo() {
setName("OkHttpClient");
setVersion(OkHttp.VERSION);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.commercetools.http.okhttp4.OkHttpClientSolutionInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.okhttp4;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SolutionInfoTest {
@Test
public void version() {
String version = new OkHttpClientSolutionInfo().getVersion();

Assertions.assertThat(version).isEqualTo("4.12.0");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.netty;

import io.vrap.rmf.base.client.SolutionInfo;

import reactor.netty.http.client.HttpClient;

public class NettyHttpClientSolutionInfo extends SolutionInfo {

public NettyHttpClientSolutionInfo() {
setName("NettyHttpClient");
setVersion(HttpClient.class.getPackage().getImplementationVersion());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.commercetools.http.netty.NettyHttpClientSolutionInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package com.commercetools.http.netty;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SolutionInfoTest {
@Test
public void version() {
String version = new NettyHttpClientSolutionInfo().getVersion();

Assertions.assertThat(version).isEqualTo("1.2.1");
}
}
2 changes: 2 additions & 0 deletions commercetools/commercetools-sdk-compat-v1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ dependencies {
api project(':commercetools:commercetools-sdk-java-api')
api ctsdkv1.client version ctsdkv1.version
api ctsdkv1.models version ctsdkv1.version
api "io.netty:netty-codec:4.1.116.Final"
api "io.netty:netty-codec-http:4.1.116.Final"

jmhImplementation project(':commercetools:commercetools-async-http-client')
jmhImplementation project(':commercetools:commercetools-apachehttp-client')
Expand Down
5 changes: 1 addition & 4 deletions gradle-scripts/extensions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ ext {
}
]

netty = [
version: '4.1.109.Final'
]
commons = [
text: 'org.apache.commons:commons-text:1.13.0',
lang3: 'org.apache.commons:commons-lang3:3.17.0',
io: 'commons-io:commons-io:2.18.0',
io_version: {
strictly '[2.8.0,)'
prefer '2.11.0'
prefer '2.16.1'
}
]

Expand Down
2 changes: 1 addition & 1 deletion licenses/commercetools-apachehttp-client/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
{
"moduleName": "commons-io:commons-io",
"moduleVersion": "2.11.0",
"moduleVersion": "2.16.1",
"moduleUrls": [
"https://commons.apache.org/proper/commons-io/"
],
Expand Down
Loading

0 comments on commit 6d87b53

Please sign in to comment.