From ecd3f9b1459e42c2fab72d655065dc88abfc0985 Mon Sep 17 00:00:00 2001 From: Artur Souza Date: Mon, 14 Oct 2024 15:44:24 -0700 Subject: [PATCH] Fix more tests requiring dapr-api-token Signed-off-by: Artur Souza --- .../actors/services/springboot/StatefulActorService.java | 2 ++ .../io/dapr/it/state/HelloWorldGrpcStateService.java | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sdk-tests/src/test/java/io/dapr/it/actors/services/springboot/StatefulActorService.java b/sdk-tests/src/test/java/io/dapr/it/actors/services/springboot/StatefulActorService.java index 3a15a0c6b..c96fa05d0 100644 --- a/sdk-tests/src/test/java/io/dapr/it/actors/services/springboot/StatefulActorService.java +++ b/sdk-tests/src/test/java/io/dapr/it/actors/services/springboot/StatefulActorService.java @@ -14,10 +14,12 @@ package io.dapr.it.actors.services.springboot; import io.dapr.actors.runtime.ActorRuntime; +import io.dapr.it.DaprRunConfig; import io.dapr.serializer.DefaultObjectSerializer; import java.time.Duration; +@DaprRunConfig(enableDaprApiToken = false) public class StatefulActorService { public static final String SUCCESS_MESSAGE = "dapr initialized. Status: Running"; diff --git a/sdk-tests/src/test/java/io/dapr/it/state/HelloWorldGrpcStateService.java b/sdk-tests/src/test/java/io/dapr/it/state/HelloWorldGrpcStateService.java index a5b92eb8d..be493b469 100644 --- a/sdk-tests/src/test/java/io/dapr/it/state/HelloWorldGrpcStateService.java +++ b/sdk-tests/src/test/java/io/dapr/it/state/HelloWorldGrpcStateService.java @@ -14,7 +14,9 @@ package io.dapr.it.state; import com.google.protobuf.ByteString; +import io.dapr.client.DaprClientBuilder; import io.dapr.config.Properties; +import io.dapr.internal.grpc.DaprClientGrpcInterceptors; import io.dapr.v1.CommonProtos.StateItem; import io.dapr.v1.DaprGrpc; import io.dapr.v1.DaprGrpc.DaprBlockingStub; @@ -38,8 +40,11 @@ public static void main(String[] args) { // If port string is not valid, it will throw an exception. int grpcPortInt = Integer.parseInt(grpcPort); - ManagedChannel channel = ManagedChannelBuilder.forAddress(Properties.SIDECAR_IP.get(), grpcPortInt).usePlaintext().build(); - DaprBlockingStub client = DaprGrpc.newBlockingStub(channel); + ManagedChannel channel = ManagedChannelBuilder.forAddress( + Properties.SIDECAR_IP.get(), grpcPortInt).usePlaintext().build(); + DaprClientGrpcInterceptors interceptors = new DaprClientGrpcInterceptors( + Properties.API_TOKEN.get(), null); + DaprBlockingStub client = interceptors.intercept(DaprGrpc.newBlockingStub(channel)); String key = "mykey"; // First, write key-value pair.