15
15
16
16
import io .dapr .testcontainers .converter .ComponentYamlConverter ;
17
17
import io .dapr .testcontainers .converter .ConfigurationYamlConverter ;
18
+ import io .dapr .testcontainers .converter .HttpEndpointYamlConverter ;
18
19
import io .dapr .testcontainers .converter .SubscriptionYamlConverter ;
19
20
import io .dapr .testcontainers .converter .YamlConverter ;
20
21
import io .dapr .testcontainers .converter .YamlMapperFactory ;
@@ -48,6 +49,7 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
48
49
private static final Yaml YAML_MAPPER = YamlMapperFactory .create ();
49
50
private static final YamlConverter <Component > COMPONENT_CONVERTER = new ComponentYamlConverter (YAML_MAPPER );
50
51
private static final YamlConverter <Subscription > SUBSCRIPTION_CONVERTER = new SubscriptionYamlConverter (YAML_MAPPER );
52
+ private static final YamlConverter <HttpEndpoint > HTTPENDPOINT_CONVERTER = new HttpEndpointYamlConverter (YAML_MAPPER );
51
53
private static final YamlConverter <Configuration > CONFIGURATION_CONVERTER = new ConfigurationYamlConverter (
52
54
YAML_MAPPER );
53
55
private static final WaitStrategy WAIT_STRATEGY = Wait .forHttp ("/v1.0/healthz/outbound" )
@@ -56,6 +58,7 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
56
58
57
59
private final Set <Component > components = new HashSet <>();
58
60
private final Set <Subscription > subscriptions = new HashSet <>();
61
+ private final Set <HttpEndpoint > httpEndpoints = new HashSet <>();
59
62
private DaprLogLevel daprLogLevel = DaprLogLevel .INFO ;
60
63
private String appChannelAddress = "localhost" ;
61
64
private String placementService = "placement" ;
@@ -100,6 +103,10 @@ public Set<Subscription> getSubscriptions() {
100
103
return subscriptions ;
101
104
}
102
105
106
+ public Set <HttpEndpoint > getHttpEndpoints () {
107
+ return httpEndpoints ;
108
+ }
109
+
103
110
public DaprContainer withAppPort (Integer port ) {
104
111
this .appPort = port ;
105
112
return this ;
@@ -140,6 +147,11 @@ public DaprContainer withSubscription(Subscription subscription) {
140
147
return this ;
141
148
}
142
149
150
+ public DaprContainer withHttpEndpoint (HttpEndpoint httpEndpoint ) {
151
+ httpEndpoints .add (httpEndpoint );
152
+ return this ;
153
+ }
154
+
143
155
public DaprContainer withPlacementImage (String placementDockerImageName ) {
144
156
this .placementDockerImageName = placementDockerImageName ;
145
157
return this ;
@@ -304,6 +316,15 @@ protected void configure() {
304
316
withCopyToContainer (Transferable .of (subscriptionYaml ), "/dapr-resources/" + subscription .getName () + ".yaml" );
305
317
}
306
318
319
+ for (HttpEndpoint endpoint : httpEndpoints ) {
320
+ String endpointYaml = HTTPENDPOINT_CONVERTER .convert (endpoint );
321
+
322
+ LOGGER .info ("> HTTPEndpoint YAML: \n " );
323
+ LOGGER .info ("\t \n " + endpointYaml + "\n " );
324
+
325
+ withCopyToContainer (Transferable .of (endpointYaml ), "/dapr-resources/" + endpoint .getName () + ".yaml" );
326
+ }
327
+
307
328
dependsOn (placementContainer );
308
329
}
309
330
0 commit comments