16
16
17
17
import io .restassured .common .mapper .TypeRef ;
18
18
import jakarta .json .Json ;
19
- import jakarta . json . JsonObject ;
19
+ import org . assertj . core . api . ThrowingConsumer ;
20
20
import org .eclipse .edc .connector .controlplane .test .system .utils .Participant ;
21
21
import org .eclipse .edc .spi .types .domain .DataAddress ;
22
- import org .hamcrest .Matcher ;
23
22
import org .jetbrains .annotations .NotNull ;
24
23
25
24
import java .net .URI ;
33
32
import static jakarta .json .Json .createArrayBuilder ;
34
33
import static jakarta .json .Json .createObjectBuilder ;
35
34
import static java .io .File .separator ;
35
+ import static org .assertj .core .api .Assertions .assertThat ;
36
36
import static org .eclipse .edc .boot .BootServicesExtension .PARTICIPANT_ID ;
37
37
import static org .eclipse .edc .jsonld .spi .JsonLdKeywords .CONTEXT ;
38
38
import static org .eclipse .edc .jsonld .spi .JsonLdKeywords .ID ;
@@ -48,25 +48,14 @@ public class TransferEndToEndParticipant extends Participant {
48
48
private final URI dataPlaneDefault = URI .create ("http://localhost:" + getFreePort ());
49
49
private final URI dataPlaneControl = URI .create ("http://localhost:" + getFreePort () + "/control" );
50
50
private final URI dataPlanePublic = URI .create ("http://localhost:" + getFreePort () + "/public" );
51
- private final URI backendService = URI . create ( "http://localhost:" + getFreePort () );
51
+ private final int httpProvisionerPort = getFreePort ();
52
52
53
53
protected TransferEndToEndParticipant () {
54
54
super ();
55
55
}
56
56
57
- /**
58
- * Get private properties to configure a dynamic http receiver for EDR.
59
- *
60
- * @return the receiver properties.
61
- */
62
- public JsonObject dynamicReceiverPrivateProperties () {
63
- return Json .createObjectBuilder ()
64
- .add ("receiverHttpEndpoint" , backendService + "/api/consumer/dataReference" )
65
- .build ();
66
- }
67
-
68
- public URI backendService () {
69
- return backendService ;
57
+ public int getHttpProvisionerPort () {
58
+ return httpProvisionerPort ;
70
59
}
71
60
72
61
/**
@@ -125,7 +114,6 @@ public Map<String, String> controlPlaneConfiguration() {
125
114
put ("edc.vault" , resourceAbsolutePath (getName () + "-vault.properties" ));
126
115
put ("edc.keystore" , resourceAbsolutePath ("certs/cert.pfx" ));
127
116
put ("edc.keystore.password" , "123456" );
128
- put ("edc.receiver.http.endpoint" , backendService + "/api/consumer/dataReference" );
129
117
put ("edc.transfer.proxy.endpoint" , dataPlanePublic .toString ());
130
118
put ("edc.transfer.send.retry.limit" , "1" );
131
119
put ("edc.transfer.send.retry.base-delay.ms" , "100" );
@@ -135,7 +123,7 @@ public Map<String, String> controlPlaneConfiguration() {
135
123
put ("edc.negotiation.provider.send.retry.base-delay.ms" , "100" );
136
124
137
125
put ("provisioner.http.entries.default.provisioner.type" , "provider" );
138
- put ("provisioner.http.entries.default.endpoint" , backendService + "/api/ provision" );
126
+ put ("provisioner.http.entries.default.endpoint" , "http://localhost:%d/ provision". formatted ( httpProvisionerPort ) );
139
127
put ("provisioner.http.entries.default.data.address.type" , "HttpProvision" );
140
128
}
141
129
};
@@ -181,14 +169,6 @@ public Map<String, String> dataPlanePostgresConfiguration() {
181
169
return baseConfiguration ;
182
170
}
183
171
184
- public Map <String , String > backendServiceConfiguration () {
185
- return new HashMap <>() {
186
- {
187
- put ("web.http.port" , String .valueOf (backendService .getPort ()));
188
- }
189
- };
190
- }
191
-
192
172
/**
193
173
* Get the EDR from the EDR cache by transfer process id.
194
174
*
@@ -219,10 +199,10 @@ public DataAddress getEdr(String transferProcessId) {
219
199
*
220
200
* @param edr endpoint data reference
221
201
* @param queryParams query parameters
222
- * @param bodyMatcher matcher for response body
202
+ * @param bodyAssertion assertion to be verified on the body
223
203
*/
224
- public void pullData (DataAddress edr , Map <String , String > queryParams , Matcher <String > bodyMatcher ) {
225
- given ()
204
+ public void pullData (DataAddress edr , Map <String , String > queryParams , ThrowingConsumer <String > bodyAssertion ) {
205
+ var data = given ()
226
206
.baseUri (edr .getStringProperty ("endpoint" ))
227
207
.header ("Authorization" , edr .getStringProperty ("authorization" ))
228
208
.queryParams (queryParams )
@@ -231,7 +211,9 @@ public void pullData(DataAddress edr, Map<String, String> queryParams, Matcher<S
231
211
.then ()
232
212
.log ().ifError ()
233
213
.statusCode (200 )
234
- .body ("message" , bodyMatcher );
214
+ .extract ().body ().asString ();
215
+
216
+ assertThat (data ).satisfies (bodyAssertion );
235
217
}
236
218
237
219
@ NotNull
0 commit comments