@@ -56,10 +56,10 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
56
56
private static final YamlConverter <Subscription > SUBSCRIPTION_CONVERTER = new SubscriptionYamlConverter (YAML_MAPPER );
57
57
private static final YamlConverter <HttpEndpoint > HTTPENDPOINT_CONVERTER = new HttpEndpointYamlConverter (YAML_MAPPER );
58
58
private static final YamlConverter <Configuration > CONFIGURATION_CONVERTER = new ConfigurationYamlConverter (
59
- YAML_MAPPER );
59
+ YAML_MAPPER );
60
60
private static final WaitStrategy WAIT_STRATEGY = Wait .forHttp ("/v1.0/healthz/outbound" )
61
- .forPort (DAPRD_DEFAULT_HTTP_PORT )
62
- .forStatusCodeMatching (statusCode -> statusCode >= 200 && statusCode <= 399 );
61
+ .forPort (DAPRD_DEFAULT_HTTP_PORT )
62
+ .forStatusCodeMatching (statusCode -> statusCode >= 200 && statusCode <= 399 );
63
63
64
64
private final Set <Component > components = new HashSet <>();
65
65
private final Set <Subscription > subscriptions = new HashSet <>();
@@ -68,8 +68,8 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
68
68
private String appChannelAddress = "localhost" ;
69
69
private String placementService = "placement" ;
70
70
private String schedulerService = "scheduler" ;
71
- private String placementDockerImageName = DAPR_PLACEMENT_IMAGE_TAG ;
72
- private String schedulerDockerImageName = DAPR_SCHEDULER_IMAGE_TAG ;
71
+ private DockerImageName placementDockerImageName = DockerImageName . parse ( DAPR_PLACEMENT_IMAGE_TAG ) ;
72
+ private DockerImageName schedulerDockerImageName = DockerImageName . parse ( DAPR_SCHEDULER_IMAGE_TAG ) ;
73
73
74
74
private Configuration configuration ;
75
75
private DaprPlacementContainer placementContainer ;
@@ -82,6 +82,7 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
82
82
83
83
/**
84
84
* Creates a new Dapr container.
85
+ *
85
86
* @param dockerImageName Docker image name.
86
87
*/
87
88
public DaprContainer (DockerImageName dockerImageName ) {
@@ -94,6 +95,7 @@ public DaprContainer(DockerImageName dockerImageName) {
94
95
95
96
/**
96
97
* Creates a new Dapr container.
98
+ *
97
99
* @param image Docker image name.
98
100
*/
99
101
public DaprContainer (String image ) {
@@ -166,16 +168,26 @@ public DaprContainer withHttpEndpoint(HttpEndpoint httpEndpoint) {
166
168
return this ;
167
169
}
168
170
169
- public DaprContainer withPlacementImage (String placementDockerImageName ) {
171
+ public DaprContainer withPlacementImage (DockerImageName placementDockerImageName ) {
170
172
this .placementDockerImageName = placementDockerImageName ;
171
173
return this ;
172
174
}
173
175
174
- public DaprContainer withSchedulerImage (String schedulerDockerImageName ) {
176
+ public DaprContainer withPlacementImage (String placementDockerImageName ) {
177
+ this .placementDockerImageName = DockerImageName .parse (placementDockerImageName );
178
+ return this ;
179
+ }
180
+
181
+ public DaprContainer withSchedulerImage (DockerImageName schedulerDockerImageName ) {
175
182
this .schedulerDockerImageName = schedulerDockerImageName ;
176
183
return this ;
177
184
}
178
185
186
+ public DaprContainer withSchedulerImage (String schedulerDockerImageName ) {
187
+ this .schedulerDockerImageName = DockerImageName .parse (schedulerDockerImageName );
188
+ return this ;
189
+ }
190
+
179
191
public DaprContainer withReusablePlacement (boolean shouldReusePlacement ) {
180
192
this .shouldReusePlacement = shouldReusePlacement ;
181
193
return this ;
@@ -203,6 +215,7 @@ public DaprContainer withComponent(Component component) {
203
215
204
216
/**
205
217
* Adds a Dapr component from a YAML file.
218
+ *
206
219
* @param path Path to the YAML file.
207
220
* @return This container.
208
221
*/
@@ -217,7 +230,7 @@ public DaprContainer withComponent(Path path) {
217
230
String type = (String ) spec .get ("type" );
218
231
String version = (String ) spec .get ("version" );
219
232
List <Map <String , String >> specMetadata =
220
- (List <Map <String , String >>) spec .getOrDefault ("metadata" , Collections .emptyList ());
233
+ (List <Map <String , String >>) spec .getOrDefault ("metadata" , Collections .emptyList ());
221
234
222
235
ArrayList <MetadataEntry > metadataEntries = new ArrayList <>();
223
236
@@ -258,17 +271,17 @@ protected void configure() {
258
271
259
272
if (this .placementContainer == null ) {
260
273
this .placementContainer = new DaprPlacementContainer (this .placementDockerImageName )
261
- .withNetwork (getNetwork ())
262
- .withNetworkAliases (placementService )
263
- .withReuse (this .shouldReusePlacement );
274
+ .withNetwork (getNetwork ())
275
+ .withNetworkAliases (placementService )
276
+ .withReuse (this .shouldReusePlacement );
264
277
this .placementContainer .start ();
265
278
}
266
279
267
280
if (this .schedulerContainer == null ) {
268
281
this .schedulerContainer = new DaprSchedulerContainer (this .schedulerDockerImageName )
269
- .withNetwork (getNetwork ())
270
- .withNetworkAliases (schedulerService )
271
- .withReuse (this .shouldReuseScheduler );
282
+ .withNetwork (getNetwork ())
283
+ .withNetworkAliases (schedulerService )
284
+ .withReuse (this .shouldReuseScheduler );
272
285
this .schedulerContainer .start ();
273
286
}
274
287
@@ -384,6 +397,14 @@ public static DockerImageName getDefaultImageName() {
384
397
return DEFAULT_IMAGE_NAME ;
385
398
}
386
399
400
+ public DockerImageName getPlacementDockerImageName () {
401
+ return placementDockerImageName ;
402
+ }
403
+
404
+ public DockerImageName getSchedulerDockerImageName () {
405
+ return schedulerDockerImageName ;
406
+ }
407
+
387
408
// Required by spotbugs plugin
388
409
@ Override
389
410
public boolean equals (Object o ) {
0 commit comments