From fbd8402ddebfade1f1407b1c23e0381db7b7175e Mon Sep 17 00:00:00 2001 From: Artur Souza Date: Wed, 2 Oct 2024 15:54:48 -0700 Subject: [PATCH] Remove all global state from setProperty (#1138) * Remove all global state in from setProperty Signed-off-by: Artur Souza * use Map.of Signed-off-by: Artur Souza * Remove dependency that is not needed. Signed-off-by: Artur Souza --------- Signed-off-by: Artur Souza Signed-off-by: salaboy --- .../spring/messaging/DaprMessagingTemplate.java | 5 +++++ .../java/io/dapr/it/binding/http/BindingIT.java | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dapr-spring/dapr-spring-messaging/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java b/dapr-spring/dapr-spring-messaging/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java index 03e4cb61b..34de90f0b 100644 --- a/dapr-spring/dapr-spring-messaging/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java +++ b/dapr-spring/dapr-spring-messaging/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java @@ -32,10 +32,15 @@ import reactor.core.publisher.Hooks; import reactor.core.publisher.Mono; <<<<<<< HEAD +<<<<<<< HEAD import reactor.util.context.Context; import java.util.Collections; import java.util.HashMap; ======= +======= + +import java.util.Map; +>>>>>>> 7490434d (Remove all global state from setProperty (#1138)) >>>>>>> 7490434d (Remove all global state from setProperty (#1138)) import java.util.Map; diff --git a/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java b/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java index e023ef9ea..8b104f0d8 100644 --- a/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java +++ b/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java @@ -38,10 +38,10 @@ public class BindingIT extends BaseIT { @Test public void httpOutputBindingError() throws Exception { - startDaprApp( + var run = startDaprApp( this.getClass().getSimpleName() + "-httpoutputbinding-exception", 60000); - try(DaprClient client = new DaprClientBuilder().build()) { + try(DaprClient client = run.newDaprClientBuilder().build()) { // Validate error message callWithRetry(() -> { System.out.println("Checking exception handling for output binding ..."); @@ -61,10 +61,10 @@ public void httpOutputBindingError() throws Exception { @Test public void httpOutputBindingErrorIgnoredByComponent() throws Exception { - startDaprApp( + var run = startDaprApp( this.getClass().getSimpleName() + "-httpoutputbinding-ignore-error", 60000); - try(DaprClient client = new DaprClientBuilder().build()) { + try(DaprClient client = run.newDaprClientBuilder().build()) { // Validate error message callWithRetry(() -> { System.out.println("Checking exception handling for output binding ..."); @@ -93,7 +93,7 @@ public void inputOutputBinding() throws Exception { var bidingName = "sample123"; - try(DaprClient client = new DaprClientBuilder().build()) { + try(DaprClient client = daprRun.newDaprClientBuilder().build()) { callWithRetry(() -> { System.out.println("Checking if input binding is up before publishing events ..."); client.invokeBinding( @@ -116,14 +116,14 @@ public void inputOutputBinding() throws Exception { System.out.println("sending first message"); client.invokeBinding( - bidingName, "create", myClass, Collections.singletonMap("MyMetadata", "MyValue"), Void.class).block(); + bidingName, "create", myClass, Map.of("MyMetadata", "MyValue"), Void.class).block(); // This is an example of sending a plain string. The input binding will receive // cat final String m = "cat"; System.out.println("sending " + m); client.invokeBinding( - bidingName, "create", m, Collections.singletonMap("MyMetadata", "MyValue"), Void.class).block(); + bidingName, "create", m, Map.of("MyMetadata", "MyValue"), Void.class).block(); // Metadata is not used by Kafka component, so it is not possible to validate. callWithRetry(() -> {