@@ -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
Map <String , Object > spec = (Map <String , Object >) component .get ("spec" );
218
231
String version = (String ) spec .get ("version" );
219
232
List <Map <String , String >> specMetadata =
220
- (List <Map <String , String >>) spec .getOrDefault ("metadata" , Collections .emptyMap ());
233
+ (List <Map <String , String >>) spec .getOrDefault ("metadata" , Collections .emptyList ());
221
234
222
235
ArrayList <MetadataEntry > metadataEntries = new ArrayList <>();
223
236
@@ -260,17 +273,17 @@ protected void configure() {
260
273
261
274
if (this .placementContainer == null ) {
262
275
this .placementContainer = new DaprPlacementContainer (this .placementDockerImageName )
263
- .withNetwork (getNetwork ())
264
- .withNetworkAliases (placementService )
265
- .withReuse (this .shouldReusePlacement );
276
+ .withNetwork (getNetwork ())
277
+ .withNetworkAliases (placementService )
278
+ .withReuse (this .shouldReusePlacement );
266
279
this .placementContainer .start ();
267
280
}
268
281
269
282
if (this .schedulerContainer == null ) {
270
283
this .schedulerContainer = new DaprSchedulerContainer (this .schedulerDockerImageName )
271
- .withNetwork (getNetwork ())
272
- .withNetworkAliases (schedulerService )
273
- .withReuse (this .shouldReuseScheduler );
284
+ .withNetwork (getNetwork ())
285
+ .withNetworkAliases (schedulerService )
286
+ .withReuse (this .shouldReuseScheduler );
274
287
this .schedulerContainer .start ();
275
288
}
276
289
@@ -386,6 +399,14 @@ public static DockerImageName getDefaultImageName() {
386
399
return DEFAULT_IMAGE_NAME ;
387
400
}
388
401
402
+ public DockerImageName getPlacementDockerImageName () {
403
+ return placementDockerImageName ;
404
+ }
405
+
406
+ public DockerImageName getSchedulerDockerImageName () {
407
+ return schedulerDockerImageName ;
408
+ }
409
+
389
410
// Required by spotbugs plugin
390
411
@ Override
391
412
public boolean equals (Object o ) {
0 commit comments