Skip to content

Commit

Permalink
Update ActorStateIT.java
Browse files Browse the repository at this point in the history
Fix compilation errors
  • Loading branch information
artur-ciocanu authored Mar 3, 2025
1 parent d9e8445 commit 4152393
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions sdk-tests/src/test/java/io/dapr/it/actors/ActorStateIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@
import io.dapr.actors.ActorId;
import io.dapr.actors.client.ActorProxy;
import io.dapr.actors.client.ActorProxyBuilder;
import io.dapr.it.AppRun;
import io.dapr.it.BaseIT;
import io.dapr.it.DaprRun;
import io.dapr.it.actors.services.springboot.StatefulActor;
import io.dapr.it.actors.services.springboot.StatefulActorService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.stream.Stream;

import static io.dapr.it.Retry.callWithRetry;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -33,16 +38,30 @@ public class ActorStateIT extends BaseIT {

private static Logger logger = LoggerFactory.getLogger(ActorStateIT.class);

@Test
public void writeReadState() throws Exception {
/**
* Parameters for this test.
* Param #1: useGrpc.
* @return Collection of parameter tuples.
*/
public static Stream<Arguments> data() {
return Stream.of(
Arguments.of(AppRun.AppProtocol.HTTP ),
Arguments.of(AppRun.AppProtocol.GRPC )
);
}

@ParameterizedTest
@MethodSource("data")
public void writeReadState(AppRun.AppProtocol serviceAppProtocol) throws Exception {
logger.debug("Starting actor runtime ...");
// The call below will fail if service cannot start successfully.
DaprRun run = startDaprApp(
this.getClass().getSimpleName(),
StatefulActorService.SUCCESS_MESSAGE,
StatefulActorService.class,
true,
60000);
this.getClass().getSimpleName(),
StatefulActorService.SUCCESS_MESSAGE,
StatefulActorService.class,
true,
60000,
serviceAppProtocol);

String message = "This is a message to be saved and retrieved.";
String name = "Jon Doe";
Expand Down Expand Up @@ -134,7 +153,8 @@ public void writeReadState() throws Exception {
StatefulActorService.SUCCESS_MESSAGE,
StatefulActorService.class,
true,
60000);
60000,
serviceAppProtocol);

// Need new proxy builder because the proxy builder holds the channel.
proxyBuilder = new ActorProxyBuilder(actorType, ActorProxy.class, deferClose(run2.newActorClient()));
Expand Down Expand Up @@ -219,7 +239,7 @@ public void stateTTL(AppRun.AppProtocol serviceAppProtocol) throws Exception {
Thread.sleep(10000);

logger.debug("Stopping service ...");
runtime.stop();
run.stop();

logger.debug("Starting service ...");
DaprRun run2 = startDaprApp(
Expand Down

0 comments on commit 4152393

Please sign in to comment.