From 82e5bc84f920c0a5d2e5b5ca470dad7aecc943dc Mon Sep 17 00:00:00 2001
From: Jonathan Lukas <jonathan.lukas@camunda.com>
Date: Tue, 7 Jan 2025 15:13:09 +0100
Subject: [PATCH] proposal: move to 8.5.16 of spring zeebe

---
 connector-runtime/connector-runtime-core/pom.xml |  2 +-
 .../connector-runtime-spring/pom.xml             |  2 +-
 .../runtime/secret/ConsoleSecretApiClient.java   |  2 +-
 .../secret/ConsoleSecretProviderTest.java        | 16 ++++++++--------
 .../connectors-e2e-test-base/pom.xml             |  4 ++++
 parent/pom.xml                                   |  4 ++--
 6 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/connector-runtime/connector-runtime-core/pom.xml b/connector-runtime/connector-runtime-core/pom.xml
index b6fb989a6c..42ee64ba4f 100644
--- a/connector-runtime/connector-runtime-core/pom.xml
+++ b/connector-runtime/connector-runtime-core/pom.xml
@@ -49,7 +49,7 @@
     </dependency>
     <dependency>
       <groupId>io.camunda.spring</groupId>
-      <artifactId>java-client-operate</artifactId>
+      <artifactId>java-client-operate-legacy</artifactId>
     </dependency>
 
     <dependency>
diff --git a/connector-runtime/connector-runtime-spring/pom.xml b/connector-runtime/connector-runtime-spring/pom.xml
index 12d010f7bb..adfe611836 100644
--- a/connector-runtime/connector-runtime-spring/pom.xml
+++ b/connector-runtime/connector-runtime-spring/pom.xml
@@ -49,7 +49,7 @@
     </dependency>
     <dependency>
       <groupId>io.camunda.spring</groupId>
-      <artifactId>java-client-operate</artifactId>
+      <artifactId>java-client-operate-legacy</artifactId>
     </dependency>
 
     <dependency>
diff --git a/connector-runtime/connector-runtime-spring/src/main/java/io/camunda/connector/runtime/secret/ConsoleSecretApiClient.java b/connector-runtime/connector-runtime-spring/src/main/java/io/camunda/connector/runtime/secret/ConsoleSecretApiClient.java
index e49d4bd578..05577efae7 100644
--- a/connector-runtime/connector-runtime-spring/src/main/java/io/camunda/connector/runtime/secret/ConsoleSecretApiClient.java
+++ b/connector-runtime/connector-runtime-spring/src/main/java/io/camunda/connector/runtime/secret/ConsoleSecretApiClient.java
@@ -66,7 +66,7 @@ public Map<String, String> getSecrets() {
     try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
       var request = new HttpGet(secretsEndpoint);
       var authHeader = authentication.getTokenHeader(Product.CONSOLE);
-      request.addHeader(authHeader.getKey(), authHeader.getValue());
+      authHeader.forEach(request::addHeader);
       return httpClient.execute(request, this::handleSecretsResponse);
     } catch (Exception e) {
       throw new RuntimeException(e);
diff --git a/connector-runtime/connector-runtime-spring/src/test/java/io/camunda/connector/runtime/secret/ConsoleSecretProviderTest.java b/connector-runtime/connector-runtime-spring/src/test/java/io/camunda/connector/runtime/secret/ConsoleSecretProviderTest.java
index 1e09254cae..dbc1350d2d 100644
--- a/connector-runtime/connector-runtime-spring/src/test/java/io/camunda/connector/runtime/secret/ConsoleSecretProviderTest.java
+++ b/connector-runtime/connector-runtime-spring/src/test/java/io/camunda/connector/runtime/secret/ConsoleSecretProviderTest.java
@@ -37,6 +37,7 @@
 import org.mockito.Mockito;
 
 public class ConsoleSecretProviderTest {
+  private static final String TOKEN_VALUE = "Bearer XXX";
 
   @RegisterExtension
   static WireMockExtension wm =
@@ -44,7 +45,7 @@ public class ConsoleSecretProviderTest {
 
   static Authentication auth;
 
-  static Map.Entry<String, String> authToken;
+  static Map<String, String> authToken;
 
   static ConsoleSecretApiClient client;
 
@@ -52,8 +53,7 @@ public class ConsoleSecretProviderTest {
   static void beforeAll() {
     // Mock authentication
     auth = Mockito.mock(Authentication.class);
-    authToken =
-        Collections.singletonMap("Authorization", "Bearer XXX").entrySet().iterator().next();
+    authToken = Collections.singletonMap("Authorization", TOKEN_VALUE);
     when(auth.getTokenHeader(Product.CONSOLE)).thenReturn(authToken);
 
     client = new ConsoleSecretApiClient(wm.baseUrl() + "/secrets", auth);
@@ -65,7 +65,7 @@ void testSuccessfulSecretsHandling() {
     var secretsResponse = Collections.singletonMap("secretKey", "secretValue");
     wm.stubFor(
         get(urlPathMatching("/secrets"))
-            .withHeader("Authorization", matching(authToken.getValue()))
+            .withHeader("Authorization", matching(TOKEN_VALUE))
             .willReturn(ResponseDefinitionBuilder.okForJson(secretsResponse)));
 
     // Test the client
@@ -82,7 +82,7 @@ void testFailureOnInitialLoad() {
     // Mock failing response
     wm.stubFor(
         get(urlPathMatching("/secrets"))
-            .withHeader("Authorization", matching(authToken.getValue()))
+            .withHeader("Authorization", matching(TOKEN_VALUE))
             .willReturn(ResponseDefinitionBuilder.responseDefinition().withStatus(500)));
 
     // Test the client
@@ -95,7 +95,7 @@ void testSuccessfulSecretResolvingInCaseOfFailure() throws InterruptedException
     var secretsResponse = Collections.singletonMap("secretKey", "secretValue");
     wm.stubFor(
         get(urlPathMatching("/secrets"))
-            .withHeader("Authorization", matching(authToken.getValue()))
+            .withHeader("Authorization", matching(TOKEN_VALUE))
             .willReturn(ResponseDefinitionBuilder.okForJson(secretsResponse)));
 
     var consoleSecretProvider = new ConsoleSecretProvider(client, Duration.ofMillis(1));
@@ -107,7 +107,7 @@ void testSuccessfulSecretResolvingInCaseOfFailure() throws InterruptedException
     // Mock failing response
     wm.stubFor(
         get(urlPathMatching("/secrets"))
-            .withHeader("Authorization", matching(authToken.getValue()))
+            .withHeader("Authorization", matching(TOKEN_VALUE))
             .willReturn(ResponseDefinitionBuilder.responseDefinition().withStatus(500)));
 
     // Previously cached secret should still be resolved
@@ -120,7 +120,7 @@ void testSuccessfulSecretResolvingInCaseOfFailure() throws InterruptedException
     secretsResponse = Collections.singletonMap("secretKey", "newSecretValue");
     wm.stubFor(
         get(urlPathMatching("/secrets"))
-            .withHeader("Authorization", matching(authToken.getValue()))
+            .withHeader("Authorization", matching(TOKEN_VALUE))
             .willReturn(ResponseDefinitionBuilder.okForJson(secretsResponse)));
 
     // New secrets should be resolved
diff --git a/connectors-e2e-test/connectors-e2e-test-base/pom.xml b/connectors-e2e-test/connectors-e2e-test-base/pom.xml
index e042b89a36..d30ffb823c 100644
--- a/connectors-e2e-test/connectors-e2e-test-base/pom.xml
+++ b/connectors-e2e-test/connectors-e2e-test-base/pom.xml
@@ -44,6 +44,10 @@
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.assertj</groupId>
             <artifactId>assertj-core</artifactId>
diff --git a/parent/pom.xml b/parent/pom.xml
index 63843ea8fb..1ecd17a301 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -73,7 +73,7 @@ limitations under the License.</license.inlineheader>
     <!-- Camunda internal libraries -->
     <version.zeebe>8.5.5</version.zeebe>
     <version.feel-engine>1.17.7</version.feel-engine>
-    <version.spring-zeebe>8.5.5</version.spring-zeebe>
+    <version.spring-zeebe>8.5.16</version.spring-zeebe>
     <version.identity-sdk>8.5.5</version.identity-sdk>
 
     <!-- Third party dependencies -->
@@ -295,7 +295,7 @@ limitations under the License.</license.inlineheader>
       </dependency>
       <dependency>
         <groupId>io.camunda.spring</groupId>
-        <artifactId>java-client-operate</artifactId>
+        <artifactId>java-client-operate-legacy</artifactId>
         <version>${version.spring-zeebe}</version>
       </dependency>
       <dependency>