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" ;
@@ -99,6 +102,10 @@ public Set<Subscription> getSubscriptions() {
99
102
return subscriptions ;
100
103
}
101
104
105
+ public Set <HttpEndpoint > getHttpEndpoints () {
106
+ return httpEndpoints ;
107
+ }
108
+
102
109
public DaprContainer withAppPort (Integer port ) {
103
110
this .appPort = port ;
104
111
return this ;
@@ -134,6 +141,11 @@ public DaprContainer withSubscription(Subscription subscription) {
134
141
return this ;
135
142
}
136
143
144
+ public DaprContainer withHttpEndpoint (HttpEndpoint httpEndpoint ) {
145
+ httpEndpoints .add (httpEndpoint );
146
+ return this ;
147
+ }
148
+
137
149
public DaprContainer withPlacementImage (String placementDockerImageName ) {
138
150
this .placementDockerImageName = placementDockerImageName ;
139
151
return this ;
@@ -291,6 +303,15 @@ protected void configure() {
291
303
withCopyToContainer (Transferable .of (subscriptionYaml ), "/dapr-resources/" + subscription .getName () + ".yaml" );
292
304
}
293
305
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
+
294
315
dependsOn (placementContainer );
295
316
}
296
317
0 commit comments