3939import java .util .List ;
4040import java .util .Map ;
4141import java .util .Set ;
42- import java .util .UUID ;
4342
4443import static io .dapr .testcontainers .DaprContainerConstants .DAPR_PLACEMENT_IMAGE_TAG ;
4544import static io .dapr .testcontainers .DaprContainerConstants .DAPR_RUNTIME_IMAGE_TAG ;
@@ -288,42 +287,6 @@ protected void configure() {
288287 withNetwork (Network .newNetwork ());
289288 }
290289
291- if (configuration != null ) {
292- String configurationYaml = CONFIGURATION_CONVERTER .convert (configuration );
293-
294- LOGGER .info ("> Configuration YAML: \n " );
295- LOGGER .info ("\t \n " + configurationYaml + "\n " );
296-
297- withCopyToContainer (Transferable .of (configurationYaml ), "/dapr-resources/" + configuration .getName () + ".yaml" );
298- }
299-
300- for (Component component : components ) {
301- String componentYaml = COMPONENT_CONVERTER .convert (component );
302-
303- LOGGER .info ("> Component YAML: \n " );
304- LOGGER .info ("\t \n " + componentYaml + "\n " );
305-
306- withCopyToContainer (Transferable .of (componentYaml ), "/dapr-resources/" + component .getName () + ".yaml" );
307- }
308-
309- for (Subscription subscription : subscriptions ) {
310- String subscriptionYaml = SUBSCRIPTION_CONVERTER .convert (subscription );
311-
312- LOGGER .info ("> Subscription YAML: \n " );
313- LOGGER .info ("\t \n " + subscriptionYaml + "\n " );
314-
315- withCopyToContainer (Transferable .of (subscriptionYaml ), "/dapr-resources/" + subscription .getName () + ".yaml" );
316- }
317-
318- for (HttpEndpoint endpoint : httpEndpoints ) {
319- String endpointYaml = HTTPENDPOINT_CONVERTER .convert (endpoint );
320-
321- LOGGER .info ("> HTTPEndpoint YAML: \n " );
322- LOGGER .info ("\t \n " + endpointYaml + "\n " );
323-
324- withCopyToContainer (Transferable .of (endpointYaml ), "/dapr-resources/" + endpoint .getName () + ".yaml" );
325- }
326-
327290 if (this .placementContainer == null ) {
328291 this .placementContainer = new DaprPlacementContainer (this .placementDockerImageName )
329292 .withNetwork (getNetwork ())
@@ -340,8 +303,6 @@ protected void configure() {
340303 this .schedulerContainer .start ();
341304 }
342305
343- dependsOn (placementContainer , schedulerContainer );
344-
345306 List <String > cmds = new ArrayList <>();
346307 cmds .add ("./daprd" );
347308 cmds .add ("--app-id" );
@@ -395,6 +356,53 @@ protected void configure() {
395356 LOGGER .info ("\t " + Arrays .toString (cmdArray ) + "\n " );
396357
397358 withCommand (cmdArray );
359+
360+ if (configuration != null ) {
361+ String configurationYaml = CONFIGURATION_CONVERTER .convert (configuration );
362+
363+ LOGGER .info ("> Configuration YAML: \n " );
364+ LOGGER .info ("\t \n " + configurationYaml + "\n " );
365+
366+ withCopyToContainer (Transferable .of (configurationYaml ), "/dapr-resources/" + configuration .getName () + ".yaml" );
367+ }
368+
369+ if (components .isEmpty ()) {
370+ components .add (new Component ("kvstore" , "state.in-memory" , "v1" , Collections .emptyMap ()));
371+ components .add (new Component ("pubsub" , "pubsub.in-memory" , "v1" , Collections .emptyMap ()));
372+ }
373+
374+ if (subscriptions .isEmpty () && !components .isEmpty ()) {
375+ subscriptions .add (new Subscription ("local" , "pubsub" , "topic" , "/events" ));
376+ }
377+
378+ for (Component component : components ) {
379+ String componentYaml = COMPONENT_CONVERTER .convert (component );
380+
381+ LOGGER .info ("> Component YAML: \n " );
382+ LOGGER .info ("\t \n " + componentYaml + "\n " );
383+
384+ withCopyToContainer (Transferable .of (componentYaml ), "/dapr-resources/" + component .getName () + ".yaml" );
385+ }
386+
387+ for (Subscription subscription : subscriptions ) {
388+ String subscriptionYaml = SUBSCRIPTION_CONVERTER .convert (subscription );
389+
390+ LOGGER .info ("> Subscription YAML: \n " );
391+ LOGGER .info ("\t \n " + subscriptionYaml + "\n " );
392+
393+ withCopyToContainer (Transferable .of (subscriptionYaml ), "/dapr-resources/" + subscription .getName () + ".yaml" );
394+ }
395+
396+ for (HttpEndpoint endpoint : httpEndpoints ) {
397+ String endpointYaml = HTTPENDPOINT_CONVERTER .convert (endpoint );
398+
399+ LOGGER .info ("> HTTPEndpoint YAML: \n " );
400+ LOGGER .info ("\t \n " + endpointYaml + "\n " );
401+
402+ withCopyToContainer (Transferable .of (endpointYaml ), "/dapr-resources/" + endpoint .getName () + ".yaml" );
403+ }
404+
405+ dependsOn (placementContainer , schedulerContainer );
398406 }
399407
400408 public String getAppName () {
0 commit comments