From 855e5904b78d5ffa9a4a72a21e466de35ae6d9ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:45:59 +0000 Subject: [PATCH 01/24] chore(deps): bump com.android.tools.build:gradle in /android Bumps com.android.tools.build:gradle from 8.7.1 to 8.7.2. --- updated-dependencies: - dependency-name: com.android.tools.build:gradle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 2c9ea95c..6b198e62 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { dependencies { classpath "com.gradle:gradle-enterprise-gradle-plugin:3.18.1" - classpath "com.android.tools.build:gradle:8.7.1" + classpath "com.android.tools.build:gradle:8.7.2" classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0" } } From 31cbd34f177c6c80e41c64b09f1603c9a480ad3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 08:23:20 +0000 Subject: [PATCH 02/24] chore(deps): bump com.azure:azure-core from 1.53.0 to 1.54.0 Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.53.0 to 1.54.0. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.53.0...azure-core_1.54.0) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a199192c..e5861bcd 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ com.azure azure-core - 1.53.0 + 1.54.0 org.junit.jupiter From a3b3c79f92537e9e9056a788b90cda493dc42c23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:52:50 +0000 Subject: [PATCH 03/24] chore(deps): bump com.azure:azure-core from 1.53.0 to 1.54.0 Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.53.0 to 1.54.0. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.53.0...azure-core_1.54.0) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index c569a3f6..215ded4b 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -12,7 +12,7 @@ dependencies { implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.azure:azure-core:1.53.0' + api 'com.azure:azure-core:1.54.0' api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.7.0' api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.7.0' From bebaa9aab555d0f299a9bb196b8fb5d7142c5c51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:53:09 +0000 Subject: [PATCH 04/24] chore(deps): bump com.azure:azure-core from 1.53.0 to 1.54.0 in /java-8 Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.53.0 to 1.54.0. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.53.0...azure-core_1.54.0) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index c569a3f6..215ded4b 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -12,7 +12,7 @@ dependencies { implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.azure:azure-core:1.53.0' + api 'com.azure:azure-core:1.54.0' api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.7.0' api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.7.0' From 43794f5ac08eca24ee7dc8bb79090a121336106d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:16:03 +0000 Subject: [PATCH 05/24] chore(deps): bump com.azure:azure-core from 1.53.0 to 1.54.0 in /android Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.53.0 to 1.54.0. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.53.0...azure-core_1.54.0) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index c569a3f6..215ded4b 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -12,7 +12,7 @@ dependencies { implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.azure:azure-core:1.53.0' + api 'com.azure:azure-core:1.54.0' api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.7.0' api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.7.0' From abd80397a3586c4ae843d07e342bd9825c949d77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:26:21 +0000 Subject: [PATCH 06/24] chore(deps): bump com.github.spotbugs from 6.0.25 to 6.0.26 Bumps com.github.spotbugs from 6.0.25 to 6.0.26. --- updated-dependencies: - dependency-name: com.github.spotbugs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d8f84e58..e156b5e6 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'maven-publish' id 'signing' id 'jacoco' - id 'com.github.spotbugs' version '6.0.25' + id 'com.github.spotbugs' version '6.0.26' id "org.sonarqube" version "5.1.0.4882" id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' } From 54ecff084b424af9e441b97d0d18bf11c76813a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:27:33 +0000 Subject: [PATCH 07/24] chore(deps): bump android-actions/setup-android from 3.2.1 to 3.2.2 Bumps [android-actions/setup-android](https://github.com/android-actions/setup-android) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/android-actions/setup-android/releases) - [Commits](https://github.com/android-actions/setup-android/compare/v3.2.1...v3.2.2) --- updated-dependencies: - dependency-name: android-actions/setup-android dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/api-level-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-level-lint.yml b/.github/workflows/api-level-lint.yml index d84787fd..0761df0a 100644 --- a/.github/workflows/api-level-lint.yml +++ b/.github/workflows/api-level-lint.yml @@ -18,7 +18,7 @@ jobs: java-version: 21 cache: gradle - name: Setup Android SDK - uses: android-actions/setup-android@v3.2.1 + uses: android-actions/setup-android@v3.2.2 - name: Add execution right to the script run: chmod +x gradlew working-directory: ./android From ff5362cae6b2264d8c04d6523eb9ae06c10f7014 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:33:15 +0000 Subject: [PATCH 08/24] chore(deps): bump the open-telemetry group in /android with 2 updates Bumps the open-telemetry group in /android with 2 updates: [io.opentelemetry:opentelemetry-api](https://github.com/open-telemetry/opentelemetry-java) and [io.opentelemetry:opentelemetry-context](https://github.com/open-telemetry/opentelemetry-java). Updates `io.opentelemetry:opentelemetry-api` from 1.43.0 to 1.44.1 - [Release notes](https://github.com/open-telemetry/opentelemetry-java/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-java/compare/v1.43.0...v1.44.1) Updates `io.opentelemetry:opentelemetry-context` from 1.43.0 to 1.44.1 - [Release notes](https://github.com/open-telemetry/opentelemetry-java/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-java/compare/v1.43.0...v1.44.1) --- updated-dependencies: - dependency-name: io.opentelemetry:opentelemetry-api dependency-type: direct:production update-type: version-update:semver-minor dependency-group: open-telemetry - dependency-name: io.opentelemetry:opentelemetry-context dependency-type: direct:production update-type: version-update:semver-minor dependency-group: open-telemetry ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 215ded4b..4d3c1565 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -4,8 +4,8 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.3' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3' testImplementation 'org.mockito:mockito-core:5.14.2' - testImplementation 'io.opentelemetry:opentelemetry-api:1.43.0' - testImplementation 'io.opentelemetry:opentelemetry-context:1.43.0' + testImplementation 'io.opentelemetry:opentelemetry-api:1.44.1' + testImplementation 'io.opentelemetry:opentelemetry-context:1.44.1' testImplementation 'io.github.std-uritemplate:std-uritemplate:1.0.6' implementation 'com.google.code.gson:gson:2.11.0' From e0b0b7c20959af5c0aa9c8e3fd6b120d29323165 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:43:49 +0000 Subject: [PATCH 09/24] chore(deps): bump com.gradle:gradle-enterprise-gradle-plugin in /android Bumps com.gradle:gradle-enterprise-gradle-plugin from 3.18.1 to 3.18.2. --- updated-dependencies: - dependency-name: com.gradle:gradle-enterprise-gradle-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 6b198e62..426aad76 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath "com.gradle:gradle-enterprise-gradle-plugin:3.18.1" + classpath "com.gradle:gradle-enterprise-gradle-plugin:3.18.2" classpath "com.android.tools.build:gradle:8.7.2" classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0" } From 28d0bb76ff7d2e21ce78fa1828c25beba8529c30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:43:36 +0000 Subject: [PATCH 10/24] chore(deps): bump the kiota-dependencies group Bumps the kiota-dependencies group in /android with 6 updates: | Package | From | To | | --- | --- | --- | | [com.microsoft.kiota:microsoft-kiota-abstractions](https://github.com/microsoft/kiota-java) | `1.7.0` | `1.8.0` | | [com.microsoft.kiota:microsoft-kiota-authentication-azure](https://github.com/microsoft/kiota-java) | `1.7.0` | `1.8.0` | | [com.microsoft.kiota:microsoft-kiota-http-okHttp](https://github.com/microsoft/kiota-java) | `1.7.0` | `1.8.0` | | [com.microsoft.kiota:microsoft-kiota-serialization-json](https://github.com/microsoft/kiota-java) | `1.7.0` | `1.8.0` | | [com.microsoft.kiota:microsoft-kiota-serialization-text](https://github.com/microsoft/kiota-java) | `1.7.0` | `1.8.0` | | [com.microsoft.kiota:microsoft-kiota-serialization-form](https://github.com/microsoft/kiota-java) | `1.7.0` | `1.8.0` | Updates `com.microsoft.kiota:microsoft-kiota-abstractions` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) Updates `com.microsoft.kiota:microsoft-kiota-authentication-azure` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) Updates `com.microsoft.kiota:microsoft-kiota-http-okHttp` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) Updates `com.microsoft.kiota:microsoft-kiota-serialization-json` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) Updates `com.microsoft.kiota:microsoft-kiota-serialization-text` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) Updates `com.microsoft.kiota:microsoft-kiota-serialization-form` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) --- updated-dependencies: - dependency-name: com.microsoft.kiota:microsoft-kiota-abstractions dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: com.microsoft.kiota:microsoft-kiota-authentication-azure dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: com.microsoft.kiota:microsoft-kiota-http-okHttp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: com.microsoft.kiota:microsoft-kiota-serialization-json dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: com.microsoft.kiota:microsoft-kiota-serialization-text dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: com.microsoft.kiota:microsoft-kiota-serialization-form dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 4d3c1565..7623bcff 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -14,11 +14,11 @@ dependencies { api 'com.squareup.okhttp3:okhttp:4.12.0' api 'com.azure:azure-core:1.54.0' - api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.7.0' - api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.7.0' - implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.7.0' - implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.7.0' - implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.7.0' - implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.7.0' + api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.8.0' + api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.8.0' + implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.8.0' + implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.8.0' + implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.8.0' + implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.8.0' implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.7.0' } From a3096d34a82469c72fc05651202acb6cb2561ec7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:12:36 +0000 Subject: [PATCH 11/24] chore(deps): bump com.azure:azure-core from 1.54.0 to 1.54.1 Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.54.0 to 1.54.1. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.54.0...azure-core_1.54.1) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e5861bcd..882ffd7b 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ com.azure azure-core - 1.54.0 + 1.54.1 org.junit.jupiter From ea70a68da6d174f18a739c60a6fe66a79eded396 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:45:58 +0000 Subject: [PATCH 12/24] chore(deps): bump com.azure:azure-core from 1.54.0 to 1.54.1 Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.54.0 to 1.54.1. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.54.0...azure-core_1.54.1) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 7623bcff..16ed69de 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -12,7 +12,7 @@ dependencies { implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.azure:azure-core:1.54.0' + api 'com.azure:azure-core:1.54.1' api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.8.0' api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.8.0' From dc2bdf37d1ca759f666fd4947dc33699eb0e61bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:46:16 +0000 Subject: [PATCH 13/24] chore(deps): bump com.azure:azure-core from 1.54.0 to 1.54.1 in /java-8 Bumps [com.azure:azure-core](https://github.com/Azure/azure-sdk-for-java) from 1.54.0 to 1.54.1. - [Release notes](https://github.com/Azure/azure-sdk-for-java/releases) - [Commits](https://github.com/Azure/azure-sdk-for-java/compare/azure-core_1.54.0...azure-core_1.54.1) --- updated-dependencies: - dependency-name: com.azure:azure-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 7623bcff..16ed69de 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -12,7 +12,7 @@ dependencies { implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.azure:azure-core:1.54.0' + api 'com.azure:azure-core:1.54.1' api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.8.0' api 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.8.0' From adf470aa76e12920effbc9d8feee5721ecb68101 Mon Sep 17 00:00:00 2001 From: Raghu Sammeta Date: Mon, 30 Sep 2024 19:34:23 -0400 Subject: [PATCH 14/24] fix: issue where custom interceptors would fail to override default interceptors --- .../core/requests/GraphClientFactory.java | 14 +------ .../core/requests/GraphClientFactoryTest.java | 38 +++++++++++++++++++ .../middleware/GraphTelemetryHandlerTest.java | 24 ++++++++---- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index baa38bd7..f6ca8b23 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -75,19 +75,7 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication */ @Nonnull public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClientOption, @Nonnull Interceptor... interceptors) { - final OkHttpClient.Builder builder = create(graphClientOption); - //Skip adding interceptor if that class of interceptor already exist. - final List appliedInterceptors = new ArrayList<>(); - for(Interceptor interceptor: builder.interceptors()) { - appliedInterceptors.add(interceptor.getClass().toString()); - } - for (Interceptor interceptor:interceptors){ - if(appliedInterceptors.contains(interceptor.getClass().toString())) { - continue; - } - builder.addInterceptor(interceptor); - } - return builder; + return KiotaClientFactory.create(interceptors); } /** diff --git a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java index fcc2972b..3d8baf28 100644 --- a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java @@ -11,14 +11,22 @@ import java.io.IOException; import java.net.URI; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.microsoft.graph.core.CoreConstants; import com.microsoft.graph.core.authentication.AzureIdentityAccessTokenProvider; import com.microsoft.graph.core.authentication.AzureIdentityAuthenticationProvider; +import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; import com.microsoft.kiota.authentication.AccessTokenProvider; import com.microsoft.kiota.authentication.AllowedHostsValidator; import com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider; +import com.microsoft.kiota.http.middleware.RedirectHandler; +import com.microsoft.kiota.http.middleware.RetryHandler; +import com.microsoft.kiota.http.middleware.options.RetryHandlerOption; +import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -42,6 +50,29 @@ void testCreateWithAuthenticationProvider() throws IOException { assertEquals("Bearer " + ACCESS_TOKEN_STRING, response.request().header("Authorization")); } + @Test + void testCreateWithCustomInterceptorsOverwritesDefaults() throws IOException { + + final Interceptor[] interceptors = {new GraphTelemetryHandler(), getDisabledRetryHandler(), + new RedirectHandler()}; + final OkHttpClient client = GraphClientFactory.create(interceptors).build(); + final Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/users/").build(); + final Response response = client.newCall(request).execute(); + + for (Interceptor clientInterceptor : client.interceptors()) { + if (clientInterceptor instanceof RetryHandler) { + RetryHandlerOption retryOptions = ((RetryHandler) clientInterceptor).getRetryOptions(); + Assertions.assertEquals(0, retryOptions.maxRetries()); + Assertions.assertEquals(0, retryOptions.delay()); + + } + + assertTrue(clientInterceptor instanceof GraphTelemetryHandler + || clientInterceptor instanceof RedirectHandler + || clientInterceptor instanceof RetryHandler); + } + } + private static BaseBearerTokenAuthenticationProvider getMockAuthenticationProvider() { final AccessTokenProvider mockAccessTokenProvider = mock(AzureIdentityAccessTokenProvider.class); when(mockAccessTokenProvider.getAuthorizationToken(any(URI.class), anyMap())) @@ -53,4 +84,11 @@ private static BaseBearerTokenAuthenticationProvider getMockAuthenticationProvid .thenReturn(mockAccessTokenProvider); return mockAuthenticationProvider; } + + private static @NotNull RetryHandler getDisabledRetryHandler() { + RetryHandlerOption retryHandlerOption = new RetryHandlerOption( + (delay, executionCount, request, response) -> false, 0, 0); + RetryHandler retryHandler = new RetryHandler(retryHandlerOption); + return retryHandler; + } } diff --git a/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java b/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java index b03f4061..ef021147 100644 --- a/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java @@ -6,11 +6,15 @@ import com.microsoft.kiota.http.middleware.RedirectHandler; import com.microsoft.kiota.http.middleware.RetryHandler; +import com.microsoft.kiota.http.middleware.options.RetryHandlerOption; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -30,22 +34,26 @@ void telemetryHandlerDefaultTests() throws IOException { assertNotNull(response); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCore)); - assertTrue(!response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(CoreConstants.Headers.ANDROID_VERSION_PREFIX)); // Android version is not going to be present on unit tests running on java platform - assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); + assertTrue(!response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains( + CoreConstants.Headers.ANDROID_VERSION_PREFIX)); // Android version is not going to be present on unit tests running on java platform + assertTrue( + response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); } @Test void arrayInterceptorsTest() throws IOException { final String expectedCore = CoreConstants.Headers.GRAPH_VERSION_PREFIX + "/" + CoreConstants.Headers.VERSION; - final Interceptor[] interceptors = {new GraphTelemetryHandler(), new RetryHandler(), new RedirectHandler()}; + final Interceptor[] interceptors = {new GraphTelemetryHandler(), new RetryHandler(), + new RedirectHandler()}; final OkHttpClient client = GraphClientFactory.create(interceptors).build(); final Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/users/").build(); final Response response = client.newCall(request).execute(); assertNotNull(response); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCore)); - assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); + assertTrue( + response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); } @Test @@ -59,7 +67,8 @@ void arrayInterceptorEmptyTest() throws IOException { assertNotNull(response); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCore)); - assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); + assertTrue( + response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); } @Test @@ -76,7 +85,7 @@ void testClientOptions() throws IOException { graphClientOption.setGraphServiceTargetVersion(serviceLibVer); final String expectedCoreVer = - CoreConstants.Headers.GRAPH_VERSION_PREFIX + "/" +coreLibVer; + CoreConstants.Headers.GRAPH_VERSION_PREFIX + "/" + coreLibVer; final String expectedClientEndpoint = CoreConstants.Headers.JAVA_VERSION_PREFIX + "-" + serviceLibVer + "/" + clientLibVer; @@ -85,7 +94,8 @@ void testClientOptions() throws IOException { final Response response = client.newCall(request).execute(); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCoreVer)); - assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedClientEndpoint)); + assertTrue( + response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedClientEndpoint)); assertTrue(response.request().header(CoreConstants.Headers.CLIENT_REQUEST_ID).contains(requestId)); } } From 667cae662ec46e938d73817e79d58e84d97171e6 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 11:28:56 +0200 Subject: [PATCH 15/24] feat: Support overriding default interceptors via request options --- .../core/requests/GraphClientFactory.java | 49 ++++++++++++++++--- .../core/requests/GraphClientFactoryTest.java | 32 ++++++++++++ 2 files changed, 74 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index f6ca8b23..aed9c92c 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -3,6 +3,7 @@ import com.microsoft.graph.core.CoreConstants; import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; import com.microsoft.graph.core.requests.options.GraphClientOption; +import com.microsoft.kiota.RequestOption; import com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider; import com.microsoft.kiota.http.KiotaClientFactory; import com.microsoft.kiota.http.middleware.AuthorizationHandler; @@ -58,8 +59,13 @@ public static OkHttpClient.Builder create(@Nonnull List interceptor */ @Nonnull public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthenticationProvider authenticationProvider) { + return create(authenticationProvider, new RequestOption[0]); + } + + @Nonnull + public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthenticationProvider authenticationProvider, @Nonnull RequestOption[] requestOptions) { final GraphClientOption graphClientOption = new GraphClientOption(); - final Interceptor[] interceptors = createDefaultGraphInterceptors(graphClientOption); + final Interceptor[] interceptors = createDefaultGraphInterceptors(graphClientOption, requestOptions); final ArrayList interceptorList = new ArrayList<>(Arrays.asList(interceptors)); interceptorList.add(new AuthorizationHandler(authenticationProvider)); graphClientOption.featureTracker.setFeatureUsage(FeatureFlag.AUTH_HANDLER_FLAG); @@ -75,7 +81,13 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication */ @Nonnull public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClientOption, @Nonnull Interceptor... interceptors) { - return KiotaClientFactory.create(interceptors); + var builder = KiotaClientFactory.create(interceptors); + var customInterceptors = builder.interceptors(); + var telemetryHandlerExists = customInterceptors.stream().anyMatch(x -> x instanceof GraphTelemetryHandler); + if (!telemetryHandlerExists) { + customInterceptors.add(new GraphTelemetryHandler(graphClientOption)); + } + return builder; } /** @@ -97,9 +109,15 @@ public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClient */ @Nonnull public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClientOption) { + return create(graphClientOption, new RequestOption[0]); + } + + @Nonnull + public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClientOption, @Nonnull RequestOption[] requestOptions) { GraphClientOption options = graphClientOption != null ? graphClientOption : new GraphClientOption(); - return KiotaClientFactory.create(createDefaultGraphInterceptors(options)); + return KiotaClientFactory.create(createDefaultGraphInterceptors(options, requestOptions)); } + /** * Creates the default Interceptors for use with Graph. * @@ -108,14 +126,31 @@ public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClien */ @Nonnull public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientOption graphClientOption) { - List handlers = new ArrayList<>(); - addDefaultFeatureUsages(graphClientOption); + return createDefaultGraphInterceptors(graphClientOption, new RequestOption[0]); + } + + @Nonnull + public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientOption graphClientOption, @Nonnull RequestOption[] requestOptions) { + Objects.requireNonNull(requestOptions, "parameter requestOptions cannot be null"); + + UrlReplaceHandlerOption urlReplaceHandlerOption = new UrlReplaceHandlerOption(CoreConstants.ReplacementConstants.getDefaultReplacementPairs()); - handlers.add(new UrlReplaceHandler(new UrlReplaceHandlerOption(CoreConstants.ReplacementConstants.getDefaultReplacementPairs()))); + for (RequestOption option : requestOptions) { + if (option instanceof UrlReplaceHandlerOption) { + urlReplaceHandlerOption = (UrlReplaceHandlerOption) option; + } + } + + List handlers = new ArrayList<>(); + handlers.add(urlReplaceHandlerOption == null ? + new UrlReplaceHandler(new UrlReplaceHandlerOption(CoreConstants.ReplacementConstants.getDefaultReplacementPairs())) : + new UrlReplaceHandler(urlReplaceHandlerOption)); handlers.add(new GraphTelemetryHandler(graphClientOption)); - handlers.addAll(Arrays.asList(KiotaClientFactory.createDefaultInterceptors())); + handlers.addAll(Arrays.asList(KiotaClientFactory.createDefaultInterceptors(requestOptions))); + addDefaultFeatureUsages(graphClientOption); return handlers.toArray(new Interceptor[0]); } + //These are the default features used by the Graph Client private static void addDefaultFeatureUsages(GraphClientOption graphClientOption) { graphClientOption.featureTracker.setFeatureUsage(FeatureFlag.RETRY_HANDLER_FLAG); diff --git a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java index 3d8baf28..b6cfa454 100644 --- a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java @@ -10,15 +10,18 @@ import java.io.IOException; import java.net.URI; +import java.util.ArrayList; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.azure.core.http.policy.RetryOptions; import com.microsoft.graph.core.CoreConstants; import com.microsoft.graph.core.authentication.AzureIdentityAccessTokenProvider; import com.microsoft.graph.core.authentication.AzureIdentityAuthenticationProvider; import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; +import com.microsoft.kiota.RequestOption; import com.microsoft.kiota.authentication.AccessTokenProvider; import com.microsoft.kiota.authentication.AllowedHostsValidator; import com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider; @@ -50,6 +53,35 @@ void testCreateWithAuthenticationProvider() throws IOException { assertEquals("Bearer " + ACCESS_TOKEN_STRING, response.request().header("Authorization")); } + @Test + void testCreateWithAuthenticationProviderAndCustomRequestOptions() throws IOException { + final BaseBearerTokenAuthenticationProvider mockAuthenticationProvider = + getMockAuthenticationProvider(); + var requestOptions = new ArrayList(); + requestOptions.add(new RetryHandlerOption(null, 0, 0)); + OkHttpClient graphClient = GraphClientFactory.create(mockAuthenticationProvider, requestOptions.toArray(new RequestOption[0])).addInterceptor(new MockResponseHandler()).build(); + + var interceptors = graphClient.interceptors(); + for (Interceptor interceptor : interceptors) { + if (interceptor instanceof RetryHandler) { + RetryHandlerOption retryOptions = ((RetryHandler) interceptor).getRetryOptions(); + Assertions.assertEquals(0, retryOptions.maxRetries()); + Assertions.assertEquals(0, retryOptions.delay()); + } + } + + Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/me") + .addHeader("CustomHeader", "CustomValue").build(); + Response response = graphClient.newCall(request).execute(); + + assertEquals(200, response.code()); + assertNotNull(response.request()); + assertTrue(response.request().headers().names().contains("Authorization")); + assertTrue(response.request().headers().names().contains("CustomHeader")); + assertEquals("Bearer " + ACCESS_TOKEN_STRING, response.request().header("Authorization")); + assertEquals("CustomValue", response.request().header("CustomHeader")); + } + @Test void testCreateWithCustomInterceptorsOverwritesDefaults() throws IOException { From 5c1cd2fe216f1ff6bf3c3e5833f52451d7338840 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 12:10:45 +0200 Subject: [PATCH 16/24] fix build issues --- spotBugsExcludeFilter.xml | 3 +- .../core/requests/GraphClientFactory.java | 28 +++++++++++++++---- .../core/requests/GraphClientFactoryTest.java | 4 +-- .../middleware/GraphTelemetryHandlerTest.java | 13 +++++++-- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/spotBugsExcludeFilter.xml b/spotBugsExcludeFilter.xml index ffb0ea6f..619fb292 100644 --- a/spotBugsExcludeFilter.xml +++ b/spotBugsExcludeFilter.xml @@ -64,6 +64,7 @@ xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubu + @@ -111,4 +112,4 @@ xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubu - \ No newline at end of file + diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index aed9c92c..ec12cf10 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -62,6 +62,12 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication return create(authenticationProvider, new RequestOption[0]); } + /** + * OkHttpClient Builder for Graph with specified AuthenticationProvider and RequestOptions to override default graph interceptors + * @param authenticationProvider the AuthenticationProvider to use for requests. + * @param requestOptions custom request options to override default graph interceptors + * @return an OkHttpClient Builder instance. + */ @Nonnull public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthenticationProvider authenticationProvider, @Nonnull RequestOption[] requestOptions) { final GraphClientOption graphClientOption = new GraphClientOption(); @@ -81,9 +87,9 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication */ @Nonnull public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClientOption, @Nonnull Interceptor... interceptors) { - var builder = KiotaClientFactory.create(interceptors); - var customInterceptors = builder.interceptors(); - var telemetryHandlerExists = customInterceptors.stream().anyMatch(x -> x instanceof GraphTelemetryHandler); + final OkHttpClient.Builder builder = KiotaClientFactory.create(interceptors); + final List customInterceptors = builder.interceptors(); + final boolean telemetryHandlerExists = customInterceptors.stream().anyMatch(x -> x instanceof GraphTelemetryHandler); if (!telemetryHandlerExists) { customInterceptors.add(new GraphTelemetryHandler(graphClientOption)); } @@ -112,6 +118,12 @@ public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClien return create(graphClientOption, new RequestOption[0]); } + /** + * The OkHttpClient Builder with optional GraphClientOption and RequestOptions to override default graph interceptors + * @param graphClientOption the GraphClientOption for use in requests. + * @param requestOptions custom request options to override default graph interceptors + * @return an OkHttpClient Builder instance. + */ @Nonnull public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClientOption, @Nonnull RequestOption[] requestOptions) { GraphClientOption options = graphClientOption != null ? graphClientOption : new GraphClientOption(); @@ -129,6 +141,12 @@ public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientO return createDefaultGraphInterceptors(graphClientOption, new RequestOption[0]); } + /** + * Creates the default Interceptors for use with Graph configured with the provided RequestOptions. + * @param graphClientOption the GraphClientOption used to create the GraphTelemetryHandler with. + * @param requestOptions custom request options to override default graph interceptors + * @return an array of interceptors. + */ @Nonnull public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientOption graphClientOption, @Nonnull RequestOption[] requestOptions) { Objects.requireNonNull(requestOptions, "parameter requestOptions cannot be null"); @@ -142,9 +160,7 @@ public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientO } List handlers = new ArrayList<>(); - handlers.add(urlReplaceHandlerOption == null ? - new UrlReplaceHandler(new UrlReplaceHandlerOption(CoreConstants.ReplacementConstants.getDefaultReplacementPairs())) : - new UrlReplaceHandler(urlReplaceHandlerOption)); + handlers.add(new UrlReplaceHandler(urlReplaceHandlerOption)); handlers.add(new GraphTelemetryHandler(graphClientOption)); handlers.addAll(Arrays.asList(KiotaClientFactory.createDefaultInterceptors(requestOptions))); addDefaultFeatureUsages(graphClientOption); diff --git a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java index b6cfa454..41372c1d 100644 --- a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java @@ -16,8 +16,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.azure.core.http.policy.RetryOptions; -import com.microsoft.graph.core.CoreConstants; import com.microsoft.graph.core.authentication.AzureIdentityAccessTokenProvider; import com.microsoft.graph.core.authentication.AzureIdentityAuthenticationProvider; import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; @@ -89,7 +87,7 @@ void testCreateWithCustomInterceptorsOverwritesDefaults() throws IOException { new RedirectHandler()}; final OkHttpClient client = GraphClientFactory.create(interceptors).build(); final Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/users/").build(); - final Response response = client.newCall(request).execute(); + client.newCall(request).execute(); for (Interceptor clientInterceptor : client.interceptors()) { if (clientInterceptor instanceof RetryHandler) { diff --git a/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java b/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java index ef021147..06bf4f9e 100644 --- a/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/middleware/GraphTelemetryHandlerTest.java @@ -6,13 +6,11 @@ import com.microsoft.kiota.http.middleware.RedirectHandler; import com.microsoft.kiota.http.middleware.RetryHandler; -import com.microsoft.kiota.http.middleware.options.RetryHandlerOption; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; -import org.jetbrains.annotations.NotNull; -import org.junit.jupiter.api.Assertions; + import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -33,6 +31,8 @@ void telemetryHandlerDefaultTests() throws IOException { final Response response = client.newCall(request).execute(); assertNotNull(response); + assertNotNull(response.request()); + assertNotNull(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME)); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCore)); assertTrue(!response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains( CoreConstants.Headers.ANDROID_VERSION_PREFIX)); // Android version is not going to be present on unit tests running on java platform @@ -51,6 +51,8 @@ void arrayInterceptorsTest() throws IOException { final Response response = client.newCall(request).execute(); assertNotNull(response); + assertNotNull(response.request()); + assertNotNull(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME)); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCore)); assertTrue( response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); @@ -66,6 +68,8 @@ void arrayInterceptorEmptyTest() throws IOException { final Response response = client.newCall(request).execute(); assertNotNull(response); + assertNotNull(response.request()); + assertNotNull(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME)); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCore)); assertTrue( response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(defaultSDKVersion)); @@ -93,6 +97,9 @@ void testClientOptions() throws IOException { final Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/users/").build(); final Response response = client.newCall(request).execute(); + assertNotNull(response); + assertNotNull(response.request()); + assertNotNull(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME)); assertTrue(response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedCoreVer)); assertTrue( response.request().header(CoreConstants.Headers.SDK_VERSION_HEADER_NAME).contains(expectedClientEndpoint)); From a54fc4ccbf11e0eb8b75e50048caea805cd69503 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 12:20:26 +0200 Subject: [PATCH 17/24] Use final method parameter references --- .../core/requests/GraphClientFactory.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index ec12cf10..bcfe3db1 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -37,7 +37,7 @@ public static OkHttpClient.Builder create() { * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nonnull Interceptor... interceptors) { + public static OkHttpClient.Builder create(@Nonnull final Interceptor... interceptors) { return create(new GraphClientOption(), interceptors); } @@ -47,7 +47,7 @@ public static OkHttpClient.Builder create(@Nonnull Interceptor... interceptors) * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nonnull List interceptors) { + public static OkHttpClient.Builder create(@Nonnull final List interceptors) { return create(new GraphClientOption(), interceptors.toArray(new Interceptor[0])); } @@ -58,7 +58,7 @@ public static OkHttpClient.Builder create(@Nonnull List interceptor * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthenticationProvider authenticationProvider) { + public static OkHttpClient.Builder create(@Nonnull final BaseBearerTokenAuthenticationProvider authenticationProvider) { return create(authenticationProvider, new RequestOption[0]); } @@ -69,7 +69,7 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthenticationProvider authenticationProvider, @Nonnull RequestOption[] requestOptions) { + public static OkHttpClient.Builder create(@Nonnull final BaseBearerTokenAuthenticationProvider authenticationProvider, @Nonnull final RequestOption[] requestOptions) { final GraphClientOption graphClientOption = new GraphClientOption(); final Interceptor[] interceptors = createDefaultGraphInterceptors(graphClientOption, requestOptions); final ArrayList interceptorList = new ArrayList<>(Arrays.asList(interceptors)); @@ -86,7 +86,7 @@ public static OkHttpClient.Builder create(@Nonnull BaseBearerTokenAuthentication * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClientOption, @Nonnull Interceptor... interceptors) { + public static OkHttpClient.Builder create(@Nonnull final GraphClientOption graphClientOption, @Nonnull final Interceptor... interceptors) { final OkHttpClient.Builder builder = KiotaClientFactory.create(interceptors); final List customInterceptors = builder.interceptors(); final boolean telemetryHandlerExists = customInterceptors.stream().anyMatch(x -> x instanceof GraphTelemetryHandler); @@ -103,7 +103,7 @@ public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClient * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClientOption, @Nonnull List interceptors) { + public static OkHttpClient.Builder create(@Nonnull final GraphClientOption graphClientOption, @Nonnull final List interceptors) { return create(graphClientOption, interceptors.toArray(new Interceptor[0])); } @@ -114,7 +114,7 @@ public static OkHttpClient.Builder create(@Nonnull GraphClientOption graphClient * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClientOption) { + public static OkHttpClient.Builder create(@Nullable final GraphClientOption graphClientOption) { return create(graphClientOption, new RequestOption[0]); } @@ -125,7 +125,7 @@ public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClien * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClientOption, @Nonnull RequestOption[] requestOptions) { + public static OkHttpClient.Builder create(@Nullable final GraphClientOption graphClientOption, @Nonnull final RequestOption[] requestOptions) { GraphClientOption options = graphClientOption != null ? graphClientOption : new GraphClientOption(); return KiotaClientFactory.create(createDefaultGraphInterceptors(options, requestOptions)); } @@ -137,7 +137,7 @@ public static OkHttpClient.Builder create(@Nullable GraphClientOption graphClien * @return an array of interceptors. */ @Nonnull - public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientOption graphClientOption) { + public static Interceptor[] createDefaultGraphInterceptors(@Nonnull final GraphClientOption graphClientOption) { return createDefaultGraphInterceptors(graphClientOption, new RequestOption[0]); } @@ -148,7 +148,7 @@ public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientO * @return an array of interceptors. */ @Nonnull - public static Interceptor[] createDefaultGraphInterceptors(@Nonnull GraphClientOption graphClientOption, @Nonnull RequestOption[] requestOptions) { + public static Interceptor[] createDefaultGraphInterceptors(@Nonnull final GraphClientOption graphClientOption, @Nonnull final RequestOption[] requestOptions) { Objects.requireNonNull(requestOptions, "parameter requestOptions cannot be null"); UrlReplaceHandlerOption urlReplaceHandlerOption = new UrlReplaceHandlerOption(CoreConstants.ReplacementConstants.getDefaultReplacementPairs()); From 5b20cf7e1fe031b7b8aa1a50c9018f263736e937 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 16:48:35 +0200 Subject: [PATCH 18/24] Refactor + add tests --- .../core/requests/GraphClientFactory.java | 32 ++++++--- .../core/requests/GraphClientFactoryTest.java | 71 +++++++++++++++++++ 2 files changed, 92 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index bcfe3db1..c006371c 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -71,7 +71,9 @@ public static OkHttpClient.Builder create(@Nonnull final BaseBearerTokenAuthenti @Nonnull public static OkHttpClient.Builder create(@Nonnull final BaseBearerTokenAuthenticationProvider authenticationProvider, @Nonnull final RequestOption[] requestOptions) { final GraphClientOption graphClientOption = new GraphClientOption(); - final Interceptor[] interceptors = createDefaultGraphInterceptors(graphClientOption, requestOptions); + final List requestOptionsList = new ArrayList<>(Arrays.asList(requestOptions)); + requestOptionsList.add(graphClientOption); + final Interceptor[] interceptors = createDefaultGraphInterceptors(requestOptionsList.toArray(new RequestOption[0])); final ArrayList interceptorList = new ArrayList<>(Arrays.asList(interceptors)); interceptorList.add(new AuthorizationHandler(authenticationProvider)); graphClientOption.featureTracker.setFeatureUsage(FeatureFlag.AUTH_HANDLER_FLAG); @@ -115,19 +117,17 @@ public static OkHttpClient.Builder create(@Nonnull final GraphClientOption graph */ @Nonnull public static OkHttpClient.Builder create(@Nullable final GraphClientOption graphClientOption) { - return create(graphClientOption, new RequestOption[0]); + return KiotaClientFactory.create(createDefaultGraphInterceptors(graphClientOption)); } /** * The OkHttpClient Builder with optional GraphClientOption and RequestOptions to override default graph interceptors - * @param graphClientOption the GraphClientOption for use in requests. * @param requestOptions custom request options to override default graph interceptors * @return an OkHttpClient Builder instance. */ @Nonnull - public static OkHttpClient.Builder create(@Nullable final GraphClientOption graphClientOption, @Nonnull final RequestOption[] requestOptions) { - GraphClientOption options = graphClientOption != null ? graphClientOption : new GraphClientOption(); - return KiotaClientFactory.create(createDefaultGraphInterceptors(options, requestOptions)); + public static OkHttpClient.Builder create(@Nonnull final RequestOption[] requestOptions) { + return KiotaClientFactory.create(createDefaultGraphInterceptors(requestOptions)); } /** @@ -138,25 +138,35 @@ public static OkHttpClient.Builder create(@Nullable final GraphClientOption grap */ @Nonnull public static Interceptor[] createDefaultGraphInterceptors(@Nonnull final GraphClientOption graphClientOption) { - return createDefaultGraphInterceptors(graphClientOption, new RequestOption[0]); + return getDefaultGraphInterceptors(new RequestOption[]{ graphClientOption }).toArray(new Interceptor[0]); } /** * Creates the default Interceptors for use with Graph configured with the provided RequestOptions. - * @param graphClientOption the GraphClientOption used to create the GraphTelemetryHandler with. * @param requestOptions custom request options to override default graph interceptors * @return an array of interceptors. */ @Nonnull - public static Interceptor[] createDefaultGraphInterceptors(@Nonnull final GraphClientOption graphClientOption, @Nonnull final RequestOption[] requestOptions) { + public static Interceptor[] createDefaultGraphInterceptors(@Nonnull final RequestOption[] requestOptions) { Objects.requireNonNull(requestOptions, "parameter requestOptions cannot be null"); + return getDefaultGraphInterceptors(requestOptions).toArray(new Interceptor[0]); + } + /** + * Creates the default Interceptors for use with Graph. + * @param requestOptions custom request options to override default graph interceptors + * @return a list of interceptors. + */ + private static List getDefaultGraphInterceptors(@Nonnull final RequestOption[] requestOptions) { + GraphClientOption graphClientOption = new GraphClientOption(); UrlReplaceHandlerOption urlReplaceHandlerOption = new UrlReplaceHandlerOption(CoreConstants.ReplacementConstants.getDefaultReplacementPairs()); - for (RequestOption option : requestOptions) { if (option instanceof UrlReplaceHandlerOption) { urlReplaceHandlerOption = (UrlReplaceHandlerOption) option; } + if (option instanceof GraphClientOption) { + graphClientOption = (GraphClientOption) option; + } } List handlers = new ArrayList<>(); @@ -164,7 +174,7 @@ public static Interceptor[] createDefaultGraphInterceptors(@Nonnull final GraphC handlers.add(new GraphTelemetryHandler(graphClientOption)); handlers.addAll(Arrays.asList(KiotaClientFactory.createDefaultInterceptors(requestOptions))); addDefaultFeatureUsages(graphClientOption); - return handlers.toArray(new Interceptor[0]); + return handlers; } //These are the default features used by the Graph Client diff --git a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java index 41372c1d..bee692fe 100644 --- a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java @@ -11,6 +11,9 @@ import java.io.IOException; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Assertions; @@ -19,12 +22,17 @@ import com.microsoft.graph.core.authentication.AzureIdentityAccessTokenProvider; import com.microsoft.graph.core.authentication.AzureIdentityAuthenticationProvider; import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; +import com.microsoft.graph.core.requests.options.GraphClientOption; import com.microsoft.kiota.RequestOption; import com.microsoft.kiota.authentication.AccessTokenProvider; import com.microsoft.kiota.authentication.AllowedHostsValidator; import com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider; +import com.microsoft.kiota.http.middleware.HeadersInspectionHandler; +import com.microsoft.kiota.http.middleware.ParametersNameDecodingHandler; import com.microsoft.kiota.http.middleware.RedirectHandler; import com.microsoft.kiota.http.middleware.RetryHandler; +import com.microsoft.kiota.http.middleware.UrlReplaceHandler; +import com.microsoft.kiota.http.middleware.UserAgentHandler; import com.microsoft.kiota.http.middleware.options.RetryHandlerOption; import okhttp3.Interceptor; @@ -36,6 +44,51 @@ class GraphClientFactoryTest { private static final String ACCESS_TOKEN_STRING = "token"; + @Test + void testDefaultCreate() { + final OkHttpClient.Builder clientBuilder = GraphClientFactory.create(); + assertDefaultHandlersPresent(clientBuilder.interceptors()); + } + + @Test + void testCreateWithCustomInterceptorsAddsTelemetry() { + final OkHttpClient.Builder clientBuilder = GraphClientFactory.create( + new RetryHandler(), new RedirectHandler() + ); + + assertEquals(3, clientBuilder.interceptors().size()); + + for (Interceptor interceptor : clientBuilder.interceptors()) { + assertTrue( + interceptor instanceof GraphTelemetryHandler + || interceptor instanceof RetryHandler + || interceptor instanceof RedirectHandler + ); + } + } + + @Test + void testCreateWithGraphClientOption() { + final OkHttpClient.Builder clientBuilder = GraphClientFactory.create(new GraphClientOption()); + assertDefaultHandlersPresent(clientBuilder.interceptors()); + } + + @Test + void testCreateDefaultInterceptorsWithCustomOptions() { + Interceptor[] interceptors = GraphClientFactory.createDefaultGraphInterceptors( + new RequestOption[] {new RetryHandlerOption(null, 0, 0)} + ); + assertDefaultHandlersPresent(Arrays.asList(interceptors)); + + for (Interceptor interceptor : interceptors) { + if (interceptor instanceof RetryHandler) { + RetryHandlerOption retryOptions = ((RetryHandler) interceptor).getRetryOptions(); + Assertions.assertEquals(0, retryOptions.maxRetries()); + Assertions.assertEquals(0, retryOptions.delay()); + } + } + } + @Test void testCreateWithAuthenticationProvider() throws IOException { final BaseBearerTokenAuthenticationProvider mockAuthenticationProvider = @@ -103,6 +156,24 @@ void testCreateWithCustomInterceptorsOverwritesDefaults() throws IOException { } } + private void assertDefaultHandlersPresent(final List interceptors) { + HashSet> expectedInterceptors = new HashSet<>( + Arrays.asList( + GraphTelemetryHandler.class, + RetryHandler.class, + UrlReplaceHandler.class, + UserAgentHandler.class, + RedirectHandler.class, + ParametersNameDecodingHandler.class, + HeadersInspectionHandler.class + ) + ); + + for (Interceptor interceptor : interceptors) { + assertTrue(expectedInterceptors.contains(interceptor.getClass())); + } + } + private static BaseBearerTokenAuthenticationProvider getMockAuthenticationProvider() { final AccessTokenProvider mockAccessTokenProvider = mock(AzureIdentityAccessTokenProvider.class); when(mockAccessTokenProvider.getAuthorizationToken(any(URI.class), anyMap())) From b75c471d17436712d7e6cc8e32e606af200670e7 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 17:10:38 +0200 Subject: [PATCH 19/24] feat: add GraphClientFactory method using TokenCredential --- .../core/requests/GraphClientFactory.java | 23 +++++++++++++++++++ .../core/requests/GraphClientFactoryTest.java | 19 +++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index c006371c..54e70202 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -1,6 +1,8 @@ package com.microsoft.graph.core.requests; +import com.azure.core.credential.TokenCredential; import com.microsoft.graph.core.CoreConstants; +import com.microsoft.graph.core.authentication.AzureIdentityAccessTokenProvider; import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; import com.microsoft.graph.core.requests.options.GraphClientOption; import com.microsoft.kiota.RequestOption; @@ -51,6 +53,27 @@ public static OkHttpClient.Builder create(@Nonnull final List inter return create(new GraphClientOption(), interceptors.toArray(new Interceptor[0])); } + /** + * OkHttpClient Builder for Graph with authentication middleware that uses the specified TokenCredential. + * @param tokenCredential the TokenCredential to use for authentication. + * @return an OkHttpClient Builder instance. + */ + @Nonnull + public static OkHttpClient.Builder create(@Nonnull final TokenCredential tokenCredential) { + return create(tokenCredential, new RequestOption[0]); + } + + /** + * OkHttpClient Builder for Graph with authentication middleware that uses the specified TokenCredential and RequestOptions to override default graph interceptors. + * @param tokenCredential the TokenCredential to use for authentication. + * @param requestOptions custom request options to override default graph interceptors + * @return an OkHttpClient Builder instance. + */ + @Nonnull + public static OkHttpClient.Builder create(@Nonnull final TokenCredential tokenCredential, @Nonnull final RequestOption[] requestOptions) { + return create(new BaseBearerTokenAuthenticationProvider(new AzureIdentityAccessTokenProvider(tokenCredential)), requestOptions); + } + /** * OkHttpClient Builder for Graph with specified AuthenticationProvider. * Adds an AuthorizationHandler to the OkHttpClient Builder. diff --git a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java index bee692fe..001173c4 100644 --- a/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java +++ b/src/test/java/com/microsoft/graph/core/requests/GraphClientFactoryTest.java @@ -19,6 +19,8 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.azure.core.credential.AccessToken; +import com.azure.core.credential.TokenCredential; import com.microsoft.graph.core.authentication.AzureIdentityAccessTokenProvider; import com.microsoft.graph.core.authentication.AzureIdentityAuthenticationProvider; import com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler; @@ -39,6 +41,7 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; +import reactor.core.publisher.Mono; class GraphClientFactoryTest { @@ -104,6 +107,22 @@ void testCreateWithAuthenticationProvider() throws IOException { assertEquals("Bearer " + ACCESS_TOKEN_STRING, response.request().header("Authorization")); } + @Test + void testCreateWithTokenCredential() throws IOException { + final TokenCredential tokenCredential = mock(TokenCredential.class); + when(tokenCredential.getTokenSync(any())).thenReturn(new AccessToken(ACCESS_TOKEN_STRING, null)); + when(tokenCredential.getToken(any())).thenReturn(Mono.just(new AccessToken(ACCESS_TOKEN_STRING, null))); + + final OkHttpClient graphClient = GraphClientFactory.create(tokenCredential).addInterceptor(new MockResponseHandler()).build(); + Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/me").build(); + Response response = graphClient.newCall(request).execute(); + + assertEquals(200, response.code()); + assertNotNull(response.request()); + assertTrue(response.request().headers().names().contains("Authorization")); + assertEquals("Bearer " + ACCESS_TOKEN_STRING, response.request().header("Authorization")); + } + @Test void testCreateWithAuthenticationProviderAndCustomRequestOptions() throws IOException { final BaseBearerTokenAuthenticationProvider mockAuthenticationProvider = From 061d5ee533d79ee94a486e889d21275008dcd317 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 17:22:51 +0200 Subject: [PATCH 20/24] Improve SonarCloud reliability --- .../com/microsoft/graph/core/requests/GraphClientFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java index 54e70202..d20c9afa 100644 --- a/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java +++ b/src/main/java/com/microsoft/graph/core/requests/GraphClientFactory.java @@ -140,7 +140,8 @@ public static OkHttpClient.Builder create(@Nonnull final GraphClientOption graph */ @Nonnull public static OkHttpClient.Builder create(@Nullable final GraphClientOption graphClientOption) { - return KiotaClientFactory.create(createDefaultGraphInterceptors(graphClientOption)); + GraphClientOption option = graphClientOption == null ? new GraphClientOption() : graphClientOption; + return KiotaClientFactory.create(createDefaultGraphInterceptors(option)); } /** From 8bf69f16accde78d8ddaea56ac9890c25b64bbe8 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 12 Nov 2024 17:28:22 +0200 Subject: [PATCH 21/24] disable android-to-kotlin portability warning --- android/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/build.gradle b/android/build.gradle index 426aad76..884e2c04 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -55,6 +55,7 @@ android { disable "GradleDependency" disable "NewerVersionAvailable" disable "DuplicatePlatformClasses" // xpp3 added by azure-identity + disable "LambdaLast" } sourceSets { main { From f62e98964bb2cef38b2f0999672ad14594c4a172 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:39:30 +0000 Subject: [PATCH 22/24] chore(deps): bump the kiota-dependencies group across 2 directories with 1 update Bumps the kiota-dependencies group with 1 update in the / directory: [com.microsoft.kiota:microsoft-kiota-serialization-multipart](https://github.com/microsoft/kiota-java). Bumps the kiota-dependencies group with 1 update in the /java-8 directory: [com.microsoft.kiota:microsoft-kiota-serialization-multipart](https://github.com/microsoft/kiota-java). Updates `com.microsoft.kiota:microsoft-kiota-serialization-multipart` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) Updates `com.microsoft.kiota:microsoft-kiota-serialization-multipart` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/microsoft/kiota-java/releases) - [Changelog](https://github.com/microsoft/kiota-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-java/compare/v1.7.0...v1.8.0) --- updated-dependencies: - dependency-name: com.microsoft.kiota:microsoft-kiota-serialization-multipart dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: com.microsoft.kiota:microsoft-kiota-serialization-multipart dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 16ed69de..03159bff 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -20,5 +20,5 @@ dependencies { implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.8.0' implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.8.0' implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.8.0' - implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.7.0' + implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.8.0' } From 0a815b3d65c636a1db8ff958bf70349f7e0a55bf Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Tue, 19 Nov 2024 12:34:07 +0300 Subject: [PATCH 23/24] Add android lint baseline file and config --- android/build.gradle | 15 ++++++--------- android/lint-baseline.xml | 11 +++++++++++ android/lint.xml | 6 ++++++ 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 android/lint-baseline.xml create mode 100644 android/lint.xml diff --git a/android/build.gradle b/android/build.gradle index 884e2c04..9821c0c2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -43,20 +43,17 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } + lint { + baseline = file("lint-baseline.xml") + } + lintOptions { textOutput "stdout" checkAllWarnings true warningsAsErrors true - disable "UnusedResources" // Unused will be removed on release - disable "IconExpectedSize" // Using the material icons provided from Google - disable "GoogleAppIndexingApiWarning" // We might want to index our app later - disable "InvalidPackage" // Butterknife, Okio and Realm - disable "ResourceType" // Annotation binding - disable "GradleDependency" - disable "NewerVersionAvailable" - disable "DuplicatePlatformClasses" // xpp3 added by azure-identity - disable "LambdaLast" + lintConfig file("lint.xml") } + sourceSets { main { java.srcDirs = ['../src/main/java'] diff --git a/android/lint-baseline.xml b/android/lint-baseline.xml new file mode 100644 index 00000000..11149ca5 --- /dev/null +++ b/android/lint-baseline.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/android/lint.xml b/android/lint.xml new file mode 100644 index 00000000..0e7a8f71 --- /dev/null +++ b/android/lint.xml @@ -0,0 +1,6 @@ + + + + + + From 1d857b71459a1ae72f314f33d3f3c2e44cc3cc51 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:51:25 +0000 Subject: [PATCH 24/24] chore(main): release 3.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ README.md | 4 ++-- gradle.properties | 4 ++-- pom.xml | 2 +- .../com/microsoft/graph/core/CoreConstants.java | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 466b7195..395791d4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.3.1" + ".": "3.4.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b60af6..3ba81fb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.4.0](https://github.com/microsoftgraph/msgraph-sdk-java-core/compare/v3.3.1...v3.4.0) (2024-11-19) + + +### Features + +* add GraphClientFactory method using TokenCredential ([b75c471](https://github.com/microsoftgraph/msgraph-sdk-java-core/commit/b75c471d17436712d7e6cc8e32e606af200670e7)) +* Support overriding default interceptors via request options ([667cae6](https://github.com/microsoftgraph/msgraph-sdk-java-core/commit/667cae662ec46e938d73817e79d58e84d97171e6)) + + +### Bug Fixes + +* issue where custom interceptors would fail to override default interceptors ([adf470a](https://github.com/microsoftgraph/msgraph-sdk-java-core/commit/adf470aa76e12920effbc9d8feee5721ecb68101)) + ## [3.3.1](https://github.com/microsoftgraph/msgraph-sdk-java-core/compare/v3.3.0...v3.3.1) (2024-10-23) diff --git a/README.md b/README.md index 54296fc8..09866781 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ repositories { dependencies { // Include the sdk as a dependency // x-release-please-start-version - implementation 'com.microsoft.graph:microsoft-graph-core:3.3.1' + implementation 'com.microsoft.graph:microsoft-graph-core:3.4.0' // x-release-please-end // This dependency is only needed if you are using the TokenCredentialAuthProvider implementation 'com.azure:azure-identity:1.11.0' @@ -40,7 +40,7 @@ Add the dependency in `dependencies` in pom.xml com.microsoft.graph microsoft-graph-core - 3.3.1 + 3.4.0 com.azure diff --git a/gradle.properties b/gradle.properties index ee942d98..9996fb85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,10 +27,10 @@ mavenArtifactId = microsoft-graph-core mavenMajorVersion = 3 # x-release-please-end # x-release-please-start-minor -mavenMinorVersion = 3 +mavenMinorVersion = 4 # x-release-please-end # x-release-please-start-patch -mavenPatchVersion = 1 +mavenPatchVersion = 0 # x-release-please-end mavenArtifactSuffix = diff --git a/pom.xml b/pom.xml index 882ffd7b..a99338be 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ com.microsoft.graph microsoft-graph-core - 3.3.1 + 3.4.0 pom diff --git a/src/main/java/com/microsoft/graph/core/CoreConstants.java b/src/main/java/com/microsoft/graph/core/CoreConstants.java index 9025da1e..2aaf8a7c 100644 --- a/src/main/java/com/microsoft/graph/core/CoreConstants.java +++ b/src/main/java/com/microsoft/graph/core/CoreConstants.java @@ -16,10 +16,10 @@ private static class VersionValues { private static final int MAJOR = 3; // x-release-please-end // x-release-please-start-minor - private static final int MINOR = 3; + private static final int MINOR = 4; // x-release-please-end // x-release-please-start-patch - private static final int PATCH = 1; + private static final int PATCH = 0; // x-release-please-end }