File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
sdk-tests/src/test/java/io/dapr/it/testcontainers Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 77import io .dapr .testcontainers .Component ;
88import io .dapr .testcontainers .DaprContainer ;
99import io .dapr .testcontainers .DaprLogLevel ;
10- import org .junit .jupiter .api .BeforeAll ;
10+ import org .junit .jupiter .api .BeforeEach ;
1111import org .junit .jupiter .api .Tag ;
1212import org .junit .jupiter .api .Test ;
1313import org .springframework .beans .factory .annotation .Autowired ;
@@ -57,17 +57,19 @@ static void daprProperties(DynamicPropertyRegistry registry) {
5757 registry .add ("dapr.grpc.endpoint" , DAPR_CONTAINER ::getGrpcEndpoint );
5858 }
5959
60- @ BeforeAll
61- public static void setUp (){
62- ActorRuntime .getInstance ().registerActor (TestActorImpl .class );
63- }
64-
6560 @ Autowired
6661 private ActorClient daprActorClient ;
6762
68- @ Test
69- public void testActors () throws Exception {
63+ @ Autowired
64+ private ActorRuntime daprActorRuntime ;
7065
66+ @ BeforeEach
67+ public void setUp (){
68+ daprActorRuntime .registerActor (TestActorImpl .class );
69+ }
70+
71+ @ Test
72+ public void testActors () throws Exception {
7173 ActorProxyBuilder <TestActor > builder = new ActorProxyBuilder <>(TestActor .class , daprActorClient );
7274 ActorId actorId = ActorId .createRandom ();
7375 TestActor actor = builder .build (actorId );
Original file line number Diff line number Diff line change 22
33import java .util .Map ;
44
5+ import io .dapr .actors .runtime .ActorRuntime ;
56import org .springframework .beans .factory .annotation .Value ;
67import org .springframework .context .annotation .Bean ;
78import org .springframework .context .annotation .Configuration ;
@@ -23,4 +24,17 @@ public ActorClient daprActorClient(
2324
2425 return new ActorClient (new Properties (overrides ));
2526 }
27+
28+ @ Bean
29+ public ActorRuntime daprActorRuntime (
30+ @ Value ("${dapr.http.endpoint}" ) String daprHttpEndpoint ,
31+ @ Value ("${dapr.grpc.endpoint}" ) String daprGrpcEndpoint
32+ ){
33+ Map <String , String > overrides = Map .of (
34+ "dapr.http.endpoint" , daprHttpEndpoint ,
35+ "dapr.grpc.endpoint" , daprGrpcEndpoint
36+ );
37+
38+ return ActorRuntime .getInstance (new Properties (overrides ));
39+ }
2640}
You can’t perform that action at this time.
0 commit comments