Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update EDC version to 0.11.0 #1764

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
516 changes: 259 additions & 257 deletions DEPENDENCIES

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void setup() throws JOSEException, IOException, ParseException {
void resolve_withInvalidCredential(String token) {
// prime STS and CS
when(csMock.requestPresentation(anyString(), anyString(), anyList()))
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(token, CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()))));
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(token, CredentialFormat.VC1_0_JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()))));

assertThatThrownBy(() -> client.resolve("BPN1")).isInstanceOf(EdcException.class)
.hasMessageContaining("code: 401, message: Unauthorized");
Expand All @@ -182,7 +182,7 @@ void resolve_withSpoofedCredential() throws JOSEException {
var presentation = createJwt(vpHolderKey, HOLDER_DID, null, "bdrs-server-audience", Map.of("vp", asMap(VP_CONTENT_EXAMPLE.formatted(HOLDER_DID, "\"" + membershipCredential + "\""))));

when(csMock.requestPresentation(anyString(), anyString(), anyList()))
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.JWT, null))));
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.VC1_0_JWT, null))));

assertThatThrownBy(() -> client.resolve("BPN1"))
.isInstanceOf(EdcException.class)
Expand All @@ -200,7 +200,7 @@ void resolve_withSpoofedPresentation() throws JOSEException {
var presentation = createJwt(spoofedKey, HOLDER_DID, null, "bdrs-server-audience", Map.of("vp", asMap(VP_CONTENT_EXAMPLE.formatted(HOLDER_DID, "\"" + membershipCredential + "\""))));

when(csMock.requestPresentation(anyString(), anyString(), anyList()))
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.JWT, null))));
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.VC1_0_JWT, null))));

assertThatThrownBy(() -> client.resolve("BPN1"))
.isInstanceOf(EdcException.class)
Expand All @@ -217,7 +217,7 @@ void resolve_withValidCredential() {
var presentation = createJwt(vpHolderKey, HOLDER_DID, null, "bdrs-server-audience", Map.of("vp", asMap(VP_CONTENT_EXAMPLE.formatted(HOLDER_DID, "\"" + membershipCredential + "\""))));

when(csMock.requestPresentation(anyString(), anyString(), anyList()))
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.JWT, null))));
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.VC1_0_JWT, null))));

assertThatNoException().describedAs(BDRS_SERVER_CONTAINER::getLogs)
.isThrownBy(() -> client.resolve("BPN1"));
Expand All @@ -234,7 +234,7 @@ void resolve_withExpiredMembership() {
var presentation = createJwt(vpHolderKey, HOLDER_DID, null, "bdrs-server-audience", Map.of("vp", asMap(VP_CONTENT_EXAMPLE.formatted(HOLDER_DID, "\"" + membershipCredential + "\""))));

when(csMock.requestPresentation(anyString(), anyString(), anyList()))
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.JWT, null))));
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(presentation, CredentialFormat.VC1_0_JWT, null))));

assertThatThrownBy(() -> client.resolve("BPN1"))
.isInstanceOf(EdcException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void setup() {
// prime STS and CS
when(stsMock.createToken(anyMap(), notNull())).thenReturn(Result.success(TokenRepresentation.Builder.newInstance().token("my-fancy-sitoken").build()));
when(csMock.requestPresentation(anyString(), anyString(), anyList()))
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(TEST_VP_CONTENT, CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()))));
.thenReturn(Result.success(List.of(new VerifiablePresentationContainer(TEST_VP_CONTENT, CredentialFormat.VC1_0_JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()))));

}

Expand Down Expand Up @@ -178,8 +178,8 @@ void getData_whenPresentationQueryFails() {
@Test
void getData_whenPresentationQueryReturnsTooManyVps() {
var presentations = List.of(
new VerifiablePresentationContainer(TEST_VP_CONTENT, CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()),
new VerifiablePresentationContainer("test-raw-vp-2", CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()));
new VerifiablePresentationContainer(TEST_VP_CONTENT, CredentialFormat.VC1_0_JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()),
new VerifiablePresentationContainer("test-raw-vp-2", CredentialFormat.VC1_0_JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()));

when(csMock.requestPresentation(anyString(), anyString(), anyList())).thenReturn(Result.success(presentations));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public String negotiateEdr(TransferParticipant other, String assetId, JsonArray
.add(ODRL_ASSIGNER_ATTRIBUTE, createObjectBuilder().add(ID, other.getBpn()))
.build();

var requestBody = createEdrNegotiationRequest(other.getProtocolEndpoint().getUrl().toString(), policy, callbacks);
var connectorAddress = other.getConfiguration().get("edc.dsp.callback.address");

var requestBody = createEdrNegotiationRequest(connectorAddress, policy, callbacks);


var response = baseEdrRequest()
Expand Down Expand Up @@ -229,6 +231,6 @@ private String createQuery(String leftOp, String op, String rightOp) {
}

private RequestSpecification baseEdrRequest() {
return participant.getManagementEndpoint().baseRequest().contentType(JSON);
return participant.baseManagementRequest().contentType(JSON);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public B trustedIssuer(String trustedIssuer) {
}

@Override
public TractusxIatpParticipantBase build() {
public P build() {
super.build();
Objects.requireNonNull(participant.stsUri, "STS URI should not be null");
Objects.requireNonNull(participant.trustedIssuer, "Trusted issuer cannot be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public abstract class TractusxParticipantBase extends IdentityParticipant {
public static final Duration ASYNC_TIMEOUT = ofSeconds(120);
public static final Duration ASYNC_POLL_INTERVAL = ofSeconds(1);
private static final String CONSUMER_PROXY_API_KEY = "consumerProxyKey";
private static final String API_KEY_HEADER_NAME = "x-api-key";
protected final URI dataPlaneProxy = URI.create("http://localhost:" + getFreePort());
private final URI controlPlaneDefault = URI.create("http://localhost:" + getFreePort());
private final URI controlPlaneControl = URI.create("http://localhost:" + getFreePort() + "/control");
Expand Down Expand Up @@ -91,17 +92,17 @@ public Map<String, String> getConfiguration() {
put("edc.participant.id", id);
put("web.http.port", String.valueOf(controlPlaneDefault.getPort()));
put("web.http.path", "/api");
put("web.http.protocol.port", String.valueOf(protocolEndpoint.getUrl().getPort()));
put("web.http.protocol.path", protocolEndpoint.getUrl().getPath());
put("web.http.management.port", String.valueOf(managementEndpoint.getUrl().getPort()));
put("web.http.management.path", managementEndpoint.getUrl().getPath());
put("web.http.protocol.port", String.valueOf(controlPlaneProtocol.get().getPort()));
put("web.http.protocol.path", controlPlaneProtocol.get().getPath());
put("web.http.management.port", String.valueOf(controlPlaneManagement.get().getPort()));
put("web.http.management.path", controlPlaneManagement.get().getPath());
put("web.http.control.port", String.valueOf(controlPlaneControl.getPort()));
put("web.http.control.path", controlPlaneControl.getPath());
put("web.http.catalog.port", String.valueOf(federatedCatalog.getUrl().getPort()));
put("web.http.catalog.path", federatedCatalog.getUrl().getPath());
put("web.http.catalog.auth.type", "tokenbased");
put("web.http.catalog.auth.key", MANAGEMENT_API_KEY);
put("edc.dsp.callback.address", protocolEndpoint.getUrl().toString());
put("edc.dsp.callback.address", controlPlaneProtocol.get().toString());
put("edc.api.auth.key", MANAGEMENT_API_KEY);
put("web.http.public.path", "/api/public");
put("web.http.public.port", String.valueOf(dataPlanePublic.getPort()));
Expand Down Expand Up @@ -160,7 +161,7 @@ public void storeBusinessPartner(String bpn, String... groups) {
.add(ID, bpn)
.add(TX_NAMESPACE + "groups", Json.createArrayBuilder(Arrays.asList(groups)))
.build();
managementEndpoint.baseRequest()
baseManagementRequest()
.contentType(JSON)
.body(body)
.when()
Expand All @@ -175,7 +176,7 @@ public ValidatableResponse retireProviderAgreement(String agreementId) {
.add(AR_ENTRY_AGREEMENT_ID, agreementId)
.add(AR_ENTRY_REASON, "long-reason")
.build();
return managementEndpoint.baseRequest()
return baseManagementRequest()
.contentType(JSON)
.body(body)
.when()
Expand Down Expand Up @@ -243,7 +244,6 @@ public ValidatableResponse getFederatedCatalog() {
}

public static class Builder<P extends TractusxParticipantBase, B extends Builder<P, B>> extends Participant.Builder<P, B> {

protected Builder(P participant) {
super(participant);
}
Expand All @@ -254,14 +254,13 @@ public B did(String did) {
}

@Override
public TractusxParticipantBase build() {
public P build() {
if (participant.did == null) {
participant.did = "did:web:" + participant.name.toLowerCase();
}

participant.federatedCatalog = new Endpoint(URI.create("http://localhost:" + getFreePort() + "/api/catalog"), Map.of("x-api-key", MANAGEMENT_API_KEY));
super.managementEndpoint(new Endpoint(URI.create("http://localhost:" + getFreePort() + "/api/management"), Map.of("x-api-key", MANAGEMENT_API_KEY)));
super.protocolEndpoint(new Endpoint(URI.create("http://localhost:" + getFreePort() + "/protocol")));
participant.enrichManagementRequest = requestSpecification -> requestSpecification.headers(Map.of(API_KEY_HEADER_NAME, MANAGEMENT_API_KEY));
super.timeout(ASYNC_TIMEOUT);
super.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static class TestTargetNodeDirectory implements TargetNodeDirectory {
@Override
public List<TargetNode> getAll() {
return participants.stream()
.map(p -> new TargetNode(p.getDid(), p.getBpn(), p.getProtocolEndpoint().getUrl().toString(), List.of("dataspace-protocol-http")))
.map(p -> new TargetNode(p.getDid(), p.getBpn(), p.getConfiguration().get("edc.dsp.callback.address"), List.of("dataspace-protocol-http")))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void catalogRequest_whenCredentialExpired() {
.issuerId(DATASPACE_ISSUER_PARTICIPANT.didUrl())
.participantId(did)
.holderId(bpn)
.credential(new VerifiableCredentialContainer(newVcString, CredentialFormat.JWT, newCred))
.credential(new VerifiableCredentialContainer(newVcString, CredentialFormat.VC1_0_JWT, newCred))
.build())
.orElseThrow(f -> new RuntimeException(f.getFailureDetail()));

Expand Down Expand Up @@ -297,7 +297,7 @@ void catalogRequest_whenCredentialRevoked() {
.issuerId(DATASPACE_ISSUER_PARTICIPANT.didUrl())
.participantId(did)
.holderId(bpn)
.credential(new VerifiableCredentialContainer(newVcString, CredentialFormat.JWT, newCred))
.credential(new VerifiableCredentialContainer(newVcString, CredentialFormat.VC1_0_JWT, newCred))
.build())
.orElseThrow(f -> new RuntimeException(f.getFailureDetail()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public VerifiableCredentialResource issueCredential(String did, String bpn, Json
.issuerId(didUrl())
.participantId(did)
.holderId(bpn)
.credential(new VerifiableCredentialContainer(rawVc, CredentialFormat.JWT, credential))
.credential(new VerifiableCredentialContainer(rawVc, CredentialFormat.VC1_0_JWT, credential))
.build();

}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
format.version = "1.1"

[versions]
edc = "0.11.0-20250110-SNAPSHOT"
edc = "0.11.0"
assertj = "3.27.3"
awaitility = "4.2.2"
aws = "2.30.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private VerifiableCredentialResource generateMembershipCredential(JWK jwk) {
.issuerId(DID)
.participantId(DID)
.holderId(DID)
.credential(new VerifiableCredentialContainer(rawVc, CredentialFormat.JWT, credential))
.credential(new VerifiableCredentialContainer(rawVc, CredentialFormat.VC1_0_JWT, credential))
.build();
}

Expand Down
Loading