16
16
import io .dapr .actors .ActorId ;
17
17
import io .dapr .actors .client .ActorProxy ;
18
18
import io .dapr .actors .client .ActorProxyBuilder ;
19
+ import io .dapr .it .AppRun ;
19
20
import io .dapr .it .BaseIT ;
20
21
import io .dapr .it .DaprRun ;
21
22
import io .dapr .it .actors .services .springboot .StatefulActor ;
22
23
import io .dapr .it .actors .services .springboot .StatefulActorService ;
23
- import org .junit .jupiter .api .Test ;
24
+ import org .junit .jupiter .params .ParameterizedTest ;
25
+ import org .junit .jupiter .params .provider .Arguments ;
26
+ import org .junit .jupiter .params .provider .MethodSource ;
24
27
import org .slf4j .Logger ;
25
28
import org .slf4j .LoggerFactory ;
26
29
30
+ import java .util .stream .Stream ;
31
+
27
32
import static io .dapr .it .Retry .callWithRetry ;
28
33
import static org .junit .jupiter .api .Assertions .assertArrayEquals ;
29
34
import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -33,16 +38,30 @@ public class ActorStateIT extends BaseIT {
33
38
34
39
private static Logger logger = LoggerFactory .getLogger (ActorStateIT .class );
35
40
36
- @ Test
37
- public void writeReadState () throws Exception {
41
+ /**
42
+ * Parameters for this test.
43
+ * Param #1: useGrpc.
44
+ * @return Collection of parameter tuples.
45
+ */
46
+ public static Stream <Arguments > data () {
47
+ return Stream .of (
48
+ Arguments .of (AppRun .AppProtocol .HTTP ),
49
+ Arguments .of (AppRun .AppProtocol .GRPC )
50
+ );
51
+ }
52
+
53
+ @ ParameterizedTest
54
+ @ MethodSource ("data" )
55
+ public void writeReadState (AppRun .AppProtocol serviceAppProtocol ) throws Exception {
38
56
logger .debug ("Starting actor runtime ..." );
39
57
// The call below will fail if service cannot start successfully.
40
58
DaprRun run = startDaprApp (
41
- this .getClass ().getSimpleName (),
42
- StatefulActorService .SUCCESS_MESSAGE ,
43
- StatefulActorService .class ,
44
- true ,
45
- 60000 );
59
+ this .getClass ().getSimpleName (),
60
+ StatefulActorService .SUCCESS_MESSAGE ,
61
+ StatefulActorService .class ,
62
+ true ,
63
+ 60000 ,
64
+ serviceAppProtocol );
46
65
47
66
String message = "This is a message to be saved and retrieved." ;
48
67
String name = "Jon Doe" ;
@@ -134,7 +153,8 @@ public void writeReadState() throws Exception {
134
153
StatefulActorService .SUCCESS_MESSAGE ,
135
154
StatefulActorService .class ,
136
155
true ,
137
- 60000 );
156
+ 60000 ,
157
+ serviceAppProtocol );
138
158
139
159
// Need new proxy builder because the proxy builder holds the channel.
140
160
proxyBuilder = new ActorProxyBuilder (actorType , ActorProxy .class , deferClose (run2 .newActorClient ()));
@@ -219,7 +239,7 @@ public void stateTTL(AppRun.AppProtocol serviceAppProtocol) throws Exception {
219
239
Thread .sleep (10000 );
220
240
221
241
logger .debug ("Stopping service ..." );
222
- runtime .stop ();
242
+ run .stop ();
223
243
224
244
logger .debug ("Starting service ..." );
225
245
DaprRun run2 = startDaprApp (
0 commit comments