1515
1616import io .dapr .testcontainers .converter .ComponentYamlConverter ;
1717import io .dapr .testcontainers .converter .ConfigurationYamlConverter ;
18+ import io .dapr .testcontainers .converter .HttpEndpointYamlConverter ;
1819import io .dapr .testcontainers .converter .SubscriptionYamlConverter ;
1920import io .dapr .testcontainers .converter .YamlConverter ;
2021import io .dapr .testcontainers .converter .YamlMapperFactory ;
@@ -48,6 +49,7 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
4849 private static final Yaml YAML_MAPPER = YamlMapperFactory .create ();
4950 private static final YamlConverter <Component > COMPONENT_CONVERTER = new ComponentYamlConverter (YAML_MAPPER );
5051 private static final YamlConverter <Subscription > SUBSCRIPTION_CONVERTER = new SubscriptionYamlConverter (YAML_MAPPER );
52+ private static final YamlConverter <HttpEndpoint > HTTPENDPOINT_CONVERTER = new HttpEndpointYamlConverter (YAML_MAPPER );
5153 private static final YamlConverter <Configuration > CONFIGURATION_CONVERTER = new ConfigurationYamlConverter (
5254 YAML_MAPPER );
5355 private static final WaitStrategy WAIT_STRATEGY = Wait .forHttp ("/v1.0/healthz/outbound" )
@@ -56,6 +58,7 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
5658
5759 private final Set <Component > components = new HashSet <>();
5860 private final Set <Subscription > subscriptions = new HashSet <>();
61+ private final Set <HttpEndpoint > httpEndpoints = new HashSet <>();
5962 private DaprLogLevel daprLogLevel = DaprLogLevel .INFO ;
6063 private String appChannelAddress = "localhost" ;
6164 private String placementService = "placement" ;
@@ -99,6 +102,10 @@ public Set<Subscription> getSubscriptions() {
99102 return subscriptions ;
100103 }
101104
105+ public Set <HttpEndpoint > getHttpEndpoints () {
106+ return httpEndpoints ;
107+ }
108+
102109 public DaprContainer withAppPort (Integer port ) {
103110 this .appPort = port ;
104111 return this ;
@@ -134,6 +141,11 @@ public DaprContainer withSubscription(Subscription subscription) {
134141 return this ;
135142 }
136143
144+ public DaprContainer withHttpEndpoint (HttpEndpoint httpEndpoint ) {
145+ httpEndpoints .add (httpEndpoint );
146+ return this ;
147+ }
148+
137149 public DaprContainer withPlacementImage (String placementDockerImageName ) {
138150 this .placementDockerImageName = placementDockerImageName ;
139151 return this ;
@@ -291,6 +303,15 @@ protected void configure() {
291303 withCopyToContainer (Transferable .of (subscriptionYaml ), "/dapr-resources/" + subscription .getName () + ".yaml" );
292304 }
293305
306+ for (HttpEndpoint endpoint : httpEndpoints ) {
307+ String endpointYaml = HTTPENDPOINT_CONVERTER .convert (endpoint );
308+
309+ LOGGER .info ("> HTTPEndpoint YAML: \n " );
310+ LOGGER .info ("\t \n " + endpointYaml + "\n " );
311+
312+ withCopyToContainer (Transferable .of (endpointYaml ), "/dapr-resources/" + endpoint .getName () + ".yaml" );
313+ }
314+
294315 dependsOn (placementContainer );
295316 }
296317
0 commit comments