diff --git a/.github/workflows/publish-context.yaml b/.github/workflows/publish-context.yaml index aedf732d5fc..e787ff65f2e 100644 --- a/.github/workflows/publish-context.yaml +++ b/.github/workflows/publish-context.yaml @@ -26,7 +26,7 @@ on: push: branches: [ main ] paths: - - 'extensions/common/json-ld/src/main/resources/document/**' + - 'core/common/lib/json-ld-lib/src/main/resources/document/**' - 'extensions/common/api/management-api-schema-validator/src/main/resources/schema/management/**' jobs: @@ -40,9 +40,9 @@ jobs: - name: copy contexts into public folder run: | mkdir -p public/context - cp extensions/common/json-ld/src/main/resources/document/management-context-v1.jsonld public/context/ - cp extensions/common/json-ld/src/main/resources/document/management-context-v2.jsonld public/context/ - cp extensions/common/json-ld/src/main/resources/document/dspace-edc-context-v1.jsonld public/context/ + cp core/common/lib/json-ld-lib/src/main/resources/document/management-context-v1.jsonld public/context/ + cp core/common/lib/json-ld-lib/src/main/resources/document/management-context-v2.jsonld public/context/ + cp core/common/lib/json-ld-lib/src/main/resources/document/dspace-edc-context-v1.jsonld public/context/ mkdir -p public/schema cp -r extensions/common/api/management-api-schema-validator/src/main/resources/schema/management public/schema/ - name: deploy to gh-pages @@ -50,4 +50,4 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public - keep_files: true \ No newline at end of file + keep_files: true diff --git a/core/common/lib/json-ld-lib/src/main/java/org/eclipse/edc/jsonld/CachedDocumentRegistry.java b/core/common/lib/json-ld-lib/src/main/java/org/eclipse/edc/jsonld/CachedDocumentRegistry.java new file mode 100644 index 00000000000..722eb0ef61a --- /dev/null +++ b/core/common/lib/json-ld-lib/src/main/java/org/eclipse/edc/jsonld/CachedDocumentRegistry.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025 Think-it GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Think-it GmbH - initial API and implementation + * + */ + +package org.eclipse.edc.jsonld; + +import org.eclipse.edc.jsonld.spi.JsonLdContext; +import org.eclipse.edc.spi.result.Result; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.stream.Stream; + +import static java.lang.String.format; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_CONTEXT_2025_1; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_ODRL_PROFILE_2025_1; +import static org.eclipse.edc.jsonld.spi.Namespaces.EDC_DSPACE_CONTEXT; +import static org.eclipse.edc.spi.constants.CoreConstants.EDC_CONNECTOR_MANAGEMENT_CONTEXT; +import static org.eclipse.edc.spi.constants.CoreConstants.EDC_CONNECTOR_MANAGEMENT_CONTEXT_V2; + +/** + * Manages the hardcoded json-ld documents cached + */ +public class CachedDocumentRegistry { + + /** + * Get the cached documents + * + * @return the cached documents + */ + public static Stream> getDocuments() { + return Map.of( + "odrl.jsonld", "http://www.w3.org/ns/odrl.jsonld", + "dspace.jsonld", "https://w3id.org/dspace/2024/1/context.json", + "management-context-v1.jsonld", EDC_CONNECTOR_MANAGEMENT_CONTEXT, + "management-context-v2.jsonld", EDC_CONNECTOR_MANAGEMENT_CONTEXT_V2, + "dspace-edc-context-v1.jsonld", EDC_DSPACE_CONTEXT, + "dspace-v2025-1.jsonld", DSPACE_CONTEXT_2025_1, + "dspace-v2025-1-odrl.jsonld", DSPACE_ODRL_PROFILE_2025_1 + ).entrySet().stream() + .map(entry -> getResourceUri("document/" + entry.getKey()) + .map(uri -> new JsonLdContext(uri, entry.getValue()))); + } + + static Result getResourceUri(String name) { + var uri = CachedDocumentRegistry.class.getClassLoader().getResource(name); + if (uri == null) { + return Result.failure(format("Cannot find resource %s", name)); + } + + try { + return Result.success(uri.toURI()); + } catch (URISyntaxException e) { + return Result.failure(format("Cannot read resource %s: %s", name, e.getMessage())); + } + } + +} diff --git a/extensions/common/json-ld/src/main/resources/document/dspace-edc-context-v1.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/dspace-edc-context-v1.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/dspace-edc-context-v1.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/dspace-edc-context-v1.jsonld diff --git a/extensions/common/json-ld/src/main/resources/document/dspace-v2025-1-odrl.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/dspace-v2025-1-odrl.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/dspace-v2025-1-odrl.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/dspace-v2025-1-odrl.jsonld diff --git a/extensions/common/json-ld/src/main/resources/document/dspace-v2025-1.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/dspace-v2025-1.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/dspace-v2025-1.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/dspace-v2025-1.jsonld diff --git a/extensions/common/json-ld/src/main/resources/document/dspace.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/dspace.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/dspace.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/dspace.jsonld diff --git a/extensions/common/json-ld/src/main/resources/document/management-context-v1.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/management-context-v1.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/management-context-v1.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/management-context-v1.jsonld diff --git a/extensions/common/json-ld/src/main/resources/document/management-context-v2.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/management-context-v2.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/management-context-v2.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/management-context-v2.jsonld diff --git a/extensions/common/json-ld/src/main/resources/document/odrl.jsonld b/core/common/lib/json-ld-lib/src/main/resources/document/odrl.jsonld similarity index 100% rename from extensions/common/json-ld/src/main/resources/document/odrl.jsonld rename to core/common/lib/json-ld-lib/src/main/resources/document/odrl.jsonld diff --git a/core/common/lib/json-ld-lib/src/test/java/org/eclipse/edc/jsonld/CachedDocumentRegistryTest.java b/core/common/lib/json-ld-lib/src/test/java/org/eclipse/edc/jsonld/CachedDocumentRegistryTest.java new file mode 100644 index 00000000000..df775d74899 --- /dev/null +++ b/core/common/lib/json-ld-lib/src/test/java/org/eclipse/edc/jsonld/CachedDocumentRegistryTest.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025 Think-it GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Think-it GmbH - initial API and implementation + * + */ + +package org.eclipse.edc.jsonld; + +import org.eclipse.edc.spi.result.Result; +import org.junit.jupiter.api.Test; + +import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; + +class CachedDocumentRegistryTest { + + @Test + void shouldGetCachedDocuments() { + var contexts = CachedDocumentRegistry.getDocuments().collect(Result.collector()); + + assertThat(contexts).isSucceeded(); + } +} diff --git a/data-protocols/dsp/dsp-2025/dsp-http-api-configuration-2025/src/main/java/org/eclipse/edc/protocol/dsp/http/api/configuration/v2025/DspApiConfigurationV2025Extension.java b/data-protocols/dsp/dsp-2025/dsp-http-api-configuration-2025/src/main/java/org/eclipse/edc/protocol/dsp/http/api/configuration/v2025/DspApiConfigurationV2025Extension.java index 0f779bf2401..c96941bdf5e 100644 --- a/data-protocols/dsp/dsp-2025/dsp-http-api-configuration-2025/src/main/java/org/eclipse/edc/protocol/dsp/http/api/configuration/v2025/DspApiConfigurationV2025Extension.java +++ b/data-protocols/dsp/dsp-2025/dsp-http-api-configuration-2025/src/main/java/org/eclipse/edc/protocol/dsp/http/api/configuration/v2025/DspApiConfigurationV2025Extension.java @@ -86,7 +86,8 @@ public void initialize(ServiceExtensionContext context) { registerNamespaces(); registerTransformers(); - dataspaceProfileContextRegistry.registerDefault(new DataspaceProfileContext(DATASPACE_PROTOCOL_HTTP_V_2025_1, V_2025_1, () -> dspWebhookAddress.get() + V_2025_1_PATH, participantIdExtractionFunction)); + var profileContext = new DataspaceProfileContext(DATASPACE_PROTOCOL_HTTP_V_2025_1, V_2025_1, () -> dspWebhookAddress.get() + V_2025_1_PATH, participantIdExtractionFunction); + dataspaceProfileContextRegistry.registerDefault(profileContext); } private void registerNamespaces() { diff --git a/data-protocols/dsp/dsp-core/dsp-http-core/src/main/java/org/eclipse/edc/protocol/dsp/http/dispatcher/DspRequestBasePathProviderImpl.java b/data-protocols/dsp/dsp-core/dsp-http-core/src/main/java/org/eclipse/edc/protocol/dsp/http/dispatcher/DspRequestBasePathProviderImpl.java index 88a07aa5631..8dbd7b499cb 100644 --- a/data-protocols/dsp/dsp-core/dsp-http-core/src/main/java/org/eclipse/edc/protocol/dsp/http/dispatcher/DspRequestBasePathProviderImpl.java +++ b/data-protocols/dsp/dsp-core/dsp-http-core/src/main/java/org/eclipse/edc/protocol/dsp/http/dispatcher/DspRequestBasePathProviderImpl.java @@ -36,13 +36,15 @@ public DspRequestBasePathProviderImpl(DataspaceProfileContextRegistry dataspaceP @Override public String provideBasePath(RemoteMessage message) { - var protocolPath = ""; - if (wellKnownPath) { - protocolPath = Optional.ofNullable(dataspaceProfileContextRegistry.getProtocolVersion(message.getProtocol())) - .map(ProtocolVersion::path) - .map(this::removeTrailingSlash) - .orElseThrow(() -> new EdcException(format("No protocol version found for protocol: %s", message.getProtocol()))); + if (!wellKnownPath) { + return message.getCounterPartyAddress(); } + + var protocolPath = Optional.ofNullable(dataspaceProfileContextRegistry.getProtocolVersion(message.getProtocol())) + .map(ProtocolVersion::path) + .map(this::removeTrailingSlash) + .orElseThrow(() -> new EdcException(format("No protocol version found for protocol: %s", message.getProtocol()))); + return message.getCounterPartyAddress() + protocolPath; } diff --git a/extensions/common/json-ld/src/main/java/org/eclipse/edc/jsonld/JsonLdExtension.java b/extensions/common/json-ld/src/main/java/org/eclipse/edc/jsonld/JsonLdExtension.java index d1b9af67e05..64b91d16816 100644 --- a/extensions/common/json-ld/src/main/java/org/eclipse/edc/jsonld/JsonLdExtension.java +++ b/extensions/common/json-ld/src/main/java/org/eclipse/edc/jsonld/JsonLdExtension.java @@ -31,14 +31,8 @@ import java.io.File; import java.net.URI; import java.net.URISyntaxException; -import java.util.stream.Stream; import static java.lang.String.format; -import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_CONTEXT_2025_1; -import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_ODRL_PROFILE_2025_1; -import static org.eclipse.edc.jsonld.spi.Namespaces.EDC_DSPACE_CONTEXT; -import static org.eclipse.edc.spi.constants.CoreConstants.EDC_CONNECTOR_MANAGEMENT_CONTEXT; -import static org.eclipse.edc.spi.constants.CoreConstants.EDC_CONNECTOR_MANAGEMENT_CONTEXT_V2; import static org.eclipse.edc.spi.constants.CoreConstants.JSON_LD; /** @@ -95,16 +89,8 @@ public JsonLd createJsonLdService(ServiceExtensionContext context) { var monitor = context.getMonitor(); var service = new TitaniumJsonLd(monitor, configuration); - Stream.of( - new JsonLdContext("odrl.jsonld", "http://www.w3.org/ns/odrl.jsonld"), - new JsonLdContext("dspace.jsonld", "https://w3id.org/dspace/2024/1/context.json"), - new JsonLdContext("management-context-v1.jsonld", EDC_CONNECTOR_MANAGEMENT_CONTEXT), - new JsonLdContext("management-context-v2.jsonld", EDC_CONNECTOR_MANAGEMENT_CONTEXT_V2), - new JsonLdContext("dspace-edc-context-v1.jsonld", EDC_DSPACE_CONTEXT), - new JsonLdContext("dspace-v2025-1.jsonld", DSPACE_CONTEXT_2025_1), - new JsonLdContext("dspace-v2025-1-odrl.jsonld", DSPACE_ODRL_PROFILE_2025_1) - ).forEach(jsonLdContext -> getResourceUri("document/" + jsonLdContext.fileName()) - .onSuccess(uri -> service.registerCachedDocument(jsonLdContext.url(), uri)) + CachedDocumentRegistry.getDocuments().forEach(result -> result + .onSuccess(c -> service.registerCachedDocument(c.url(), c.resource())) .onFailure(failure -> monitor.warning("Failed to register cached json-ld document: " + failure.getFailureDetail())) ); @@ -141,7 +127,4 @@ private Result getResourceUri(String name) { } } - record JsonLdContext(String fileName, String url) { - } - } diff --git a/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java b/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java index bb9a7a5dc13..83d5e836d34 100644 --- a/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java +++ b/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java @@ -24,6 +24,7 @@ import org.eclipse.edc.connector.controlplane.contract.spi.types.offer.ContractDefinition; import org.eclipse.edc.connector.controlplane.policy.spi.PolicyDefinition; import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcessStates; +import org.eclipse.edc.jsonld.CachedDocumentRegistry; import org.eclipse.edc.jsonld.TitaniumJsonLd; import org.eclipse.edc.jsonld.spi.JsonLd; import org.eclipse.edc.jsonld.util.JacksonJsonLd; @@ -69,12 +70,11 @@ public class Participant { protected String name; protected LazySupplier controlPlaneManagement = new LazySupplier<>(() -> URI.create("http://localhost:" + getFreePort() + "/management")); protected LazySupplier controlPlaneProtocol = new LazySupplier<>(() -> URI.create("http://localhost:" + getFreePort() + "/protocol")); - protected String protocolVersionPath = ""; protected UnaryOperator enrichManagementRequest = r -> r; protected JsonLd jsonLd; protected ObjectMapper objectMapper; protected Duration timeout = Duration.ofSeconds(30); - protected String protocol = "dataspace-protocol-http"; + protected Protocol protocol = new Protocol("dataspace-protocol-http:2025-1", "/2025-1"); protected String managementVersionBasePath = MANAGEMENT_V3; protected Participant() { @@ -88,23 +88,10 @@ public Duration getTimeout() { return timeout; } - public String getProtocol() { + public Protocol getProtocol() { return protocol; } - public void setProtocol(String protocol) { - setProtocol(protocol, ""); - } - - public void setProtocol(String protocol, String path) { - this.protocol = protocol; - this.protocolVersionPath = path; - } - - public String getProtocolVersionPath() { - return protocolVersionPath; - } - public String getId() { return id; } @@ -113,17 +100,13 @@ public JsonLd getJsonLd() { return jsonLd; } - public void setJsonLd(JsonLd jsonLd) { - this.jsonLd = jsonLd; - } - /** * Get the protocol URL of the participant which is the protocol base path + protocol version path (empty by default). * * @return protocol URL */ public String getProtocolUrl() { - return controlPlaneProtocol.get() + protocolVersionPath; + return controlPlaneProtocol.get() + protocol.versionPath(); } public String createAsset(JsonObject requestBody) { @@ -252,7 +235,7 @@ public JsonArray getCatalogDatasets(Participant provider, JsonObject querySpec) .add(TYPE, "CatalogRequest") .add("counterPartyId", provider.id) .add("counterPartyAddress", provider.getProtocolUrl()) - .add("protocol", protocol); + .add("protocol", protocol.name()); if (querySpec != null) { requestBodyBuilder.add("querySpec", querySpec); @@ -296,7 +279,7 @@ public JsonObject getDatasetForAsset(Participant provider, String assetId) { .add(ID, assetId) .add("counterPartyId", provider.id) .add("counterPartyAddress", provider.getProtocolUrl()) - .add("protocol", protocol) + .add("protocol", protocol.name()) .build(); var response = baseManagementRequest() @@ -345,7 +328,7 @@ public String initContractNegotiation(Participant provider, JsonObject policy) { .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) .add(TYPE, "ContractRequest") .add("counterPartyAddress", provider.getProtocolUrl()) - .add("protocol", protocol) + .add("protocol", protocol.name()) .add("policy", jsonLd.compact(policy).getContent()) .build(); @@ -408,7 +391,7 @@ public String initiateTransfer(Participant provider, String contractAgreementId, var requestBodyBuilder = createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) .add(TYPE, "TransferRequest") - .add("protocol", protocol) + .add("protocol", protocol.name()) .add("contractId", contractAgreementId) .add("connectorId", provider.id) .add("counterPartyAddress", provider.getProtocolUrl()); @@ -624,11 +607,6 @@ public B name(String name) { return self(); } - public B protocol(String protocol) { - participant.protocol = protocol; - return self(); - } - public B timeout(Duration timeout) { participant.timeout = timeout; return self(); @@ -649,12 +627,20 @@ public B managementVersionBasePath(String managementVersionBasePath) { return self(); } + public B protocol(String name, String versionPath) { + participant.protocol = new Protocol(name, versionPath); + return self(); + } + public P build() { Objects.requireNonNull(participant.id, "id"); Objects.requireNonNull(participant.name, "name"); if (participant.jsonLd == null) { participant.jsonLd = new TitaniumJsonLd(new ConsoleMonitor()); + CachedDocumentRegistry.getDocuments().forEach(result -> result + .onSuccess(c -> participant.jsonLd.registerCachedDocument(c.url(), c.resource())) + ); } if (participant.objectMapper == null) { participant.objectMapper = JacksonJsonLd.createObjectMapper(); @@ -720,4 +706,6 @@ public String execute() { return transferProcessId; } } + + public record Protocol(String name, String versionPath) { } } diff --git a/spi/common/json-ld-spi/src/main/java/org/eclipse/edc/jsonld/spi/JsonLdContext.java b/spi/common/json-ld-spi/src/main/java/org/eclipse/edc/jsonld/spi/JsonLdContext.java new file mode 100644 index 00000000000..a1beb982b85 --- /dev/null +++ b/spi/common/json-ld-spi/src/main/java/org/eclipse/edc/jsonld/spi/JsonLdContext.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Think-it GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Think-it GmbH - initial API and implementation + * + */ + +package org.eclipse.edc.jsonld.spi; + +import java.net.URI; + +/** + * Represent a json-ld context file in resources, associated to a context url. + * + * @param resource the resource uri where the cached + * @param url the context url. + */ +public record JsonLdContext(URI resource, String url) { +} diff --git a/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java b/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java index c4828bc7787..3e1a46642b0 100644 --- a/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java +++ b/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java @@ -37,13 +37,7 @@ protected TransferEndToEndParticipant() { } public static TransferEndToEndParticipant forContext(ComponentRuntimeContext ctx) { - var id = ctx.getConfig().getString("edc.participant.id"); - return TransferEndToEndParticipant.Builder.newInstance() - .id(id) - .name(ctx.getName()) - .managementUrl(ctx.getEndpoint(MANAGEMENT)) - .protocolUrl(ctx.getEndpoint(PROTOCOL)) - .build(); + return newInstance(ctx).build(); } public static TransferEndToEndParticipant.Builder newInstance(ComponentRuntimeContext ctx) { diff --git a/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferPullEndToEndTest.java b/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferPullEndToEndTest.java index 08ce11bf6d0..f52a4d4e569 100644 --- a/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferPullEndToEndTest.java +++ b/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferPullEndToEndTest.java @@ -22,7 +22,6 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.test.system.utils.PolicyFixtures; import org.eclipse.edc.connector.controlplane.transfer.spi.event.TransferProcessStarted; -import org.eclipse.edc.jsonld.spi.JsonLd; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest; import org.eclipse.edc.junit.annotations.Runtime; @@ -32,8 +31,6 @@ import org.eclipse.edc.spi.event.EventEnvelope; import org.eclipse.edc.spi.security.Vault; import org.eclipse.edc.spi.system.ServiceExtension; -import org.eclipse.edc.spi.system.configuration.Config; -import org.eclipse.edc.spi.system.configuration.ConfigFactory; import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.sql.testfixtures.PostgresqlEndToEndExtension; import org.jetbrains.annotations.NotNull; @@ -72,7 +69,6 @@ class TransferPullEndToEndTest { - abstract static class Tests extends TransferEndToEndTestBase { private static final ObjectMapper MAPPER = new ObjectMapper(); @@ -387,146 +383,6 @@ class InMemory extends Tests { } - @Nested - @EndToEndTest - class InMemoryV2024Rev1 extends Tests { - - @RegisterExtension - static final RuntimeExtension CONSUMER_CONTROL_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(CONSUMER_CP) - .modules(Runtimes.ControlPlane.MODULES) - .endpoints(Runtimes.ControlPlane.ENDPOINTS.build()) - .configurationProvider(() -> Runtimes.ControlPlane.config(CONSUMER_ID)) - .paramProvider(TransferEndToEndParticipant.class, TransferEndToEndParticipant::forContext) - .build(); - - static final Endpoints PROVIDER_ENDPOINTS = Runtimes.ControlPlane.ENDPOINTS.build(); - - @RegisterExtension - static final RuntimeExtension PROVIDER_CONTROL_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(PROVIDER_CP) - .modules(Runtimes.ControlPlane.MODULES) - .endpoints(PROVIDER_ENDPOINTS) - .configurationProvider(() -> Runtimes.ControlPlane.config(PROVIDER_ID)) - .paramProvider(TransferEndToEndParticipant.class, TransferEndToEndParticipant::forContext) - .build(); - - @RegisterExtension - static final RuntimeExtension PROVIDER_DATA_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(PROVIDER_DP) - .modules(Runtimes.DataPlane.IN_MEM_MODULES) - .endpoints(Runtimes.DataPlane.ENDPOINTS.build()) - .configurationProvider(Runtimes.DataPlane::config) - .configurationProvider(() -> Runtimes.ControlPlane.dataPlaneSelectorFor(PROVIDER_ENDPOINTS)) - .build() - .registerSystemExtension(ServiceExtension.class, new HttpProxyDataPlaneExtension()); - - @BeforeAll - static void beforeAll(@Runtime(CONSUMER_CP) TransferEndToEndParticipant consumer, - @Runtime(PROVIDER_CP) TransferEndToEndParticipant provider) { - consumer.setProtocol("dataspace-protocol-http:2024/1", "/2024/1"); - provider.setProtocol("dataspace-protocol-http:2024/1", "/2024/1"); - } - - } - - @Nested - @EndToEndTest - class InMemoryV2024Rev1WellKnownPath extends Tests { - - @RegisterExtension - static final RuntimeExtension CONSUMER_CONTROL_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(CONSUMER_CP) - .modules(Runtimes.ControlPlane.MODULES) - .endpoints(Runtimes.ControlPlane.ENDPOINTS.build()) - .configurationProvider(() -> Runtimes.ControlPlane.config(CONSUMER_ID)) - .configurationProvider(InMemoryV2024Rev1WellKnownPath::config) - .paramProvider(TransferEndToEndParticipant.class, TransferEndToEndParticipant::forContext) - - .build(); - - static final Endpoints PROVIDER_ENDPOINTS = Runtimes.ControlPlane.ENDPOINTS.build(); - - @RegisterExtension - static final RuntimeExtension PROVIDER_CONTROL_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(PROVIDER_CP) - .modules(Runtimes.ControlPlane.MODULES) - .endpoints(PROVIDER_ENDPOINTS) - .configurationProvider(() -> Runtimes.ControlPlane.config(PROVIDER_ID)) - .configurationProvider(InMemoryV2024Rev1WellKnownPath::config) - .paramProvider(TransferEndToEndParticipant.class, TransferEndToEndParticipant::forContext) - .build(); - - @RegisterExtension - static final RuntimeExtension PROVIDER_DATA_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(PROVIDER_DP) - .modules(Runtimes.DataPlane.IN_MEM_MODULES) - .endpoints(Runtimes.DataPlane.ENDPOINTS.build()) - .configurationProvider(Runtimes.DataPlane::config) - .configurationProvider(() -> Runtimes.ControlPlane.dataPlaneSelectorFor(PROVIDER_ENDPOINTS)) - .build() - .registerSystemExtension(ServiceExtension.class, new HttpProxyDataPlaneExtension()); - - private static Config config() { - var settings = Map.of("edc.dsp.well-known-path.enabled", "true"); - return ConfigFactory.fromMap(settings); - } - - @BeforeAll - static void beforeAll(@Runtime(CONSUMER_CP) TransferEndToEndParticipant consumer, - @Runtime(PROVIDER_CP) TransferEndToEndParticipant provider) { - consumer.setProtocol("dataspace-protocol-http:2024/1"); - provider.setProtocol("dataspace-protocol-http:2024/1"); - } - - } - - @Nested - @EndToEndTest - class InMemoryV2025Rev1 extends Tests { - - @RegisterExtension - static final RuntimeExtension CONSUMER_CONTROL_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(CONSUMER_CP) - .modules(Runtimes.ControlPlane.MODULES) - .endpoints(Runtimes.ControlPlane.ENDPOINTS.build()) - .configurationProvider(() -> Runtimes.ControlPlane.config(CONSUMER_ID)) - .paramProvider(TransferEndToEndParticipant.class, TransferEndToEndParticipant::forContext) - .build(); - - static final Endpoints PROVIDER_ENDPOINTS = Runtimes.ControlPlane.ENDPOINTS.build(); - - @RegisterExtension - static final RuntimeExtension PROVIDER_CONTROL_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(PROVIDER_CP) - .modules(Runtimes.ControlPlane.MODULES) - .endpoints(PROVIDER_ENDPOINTS) - .configurationProvider(() -> Runtimes.ControlPlane.config(PROVIDER_ID)) - .paramProvider(TransferEndToEndParticipant.class, TransferEndToEndParticipant::forContext) - .build(); - - @RegisterExtension - static final RuntimeExtension PROVIDER_DATA_PLANE = ComponentRuntimeExtension.Builder.newInstance() - .name(PROVIDER_DP) - .modules(Runtimes.DataPlane.IN_MEM_MODULES) - .endpoints(Runtimes.DataPlane.ENDPOINTS.build()) - .configurationProvider(Runtimes.DataPlane::config) - .configurationProvider(() -> Runtimes.ControlPlane.dataPlaneSelectorFor(PROVIDER_ENDPOINTS)) - .build() - .registerSystemExtension(ServiceExtension.class, new HttpProxyDataPlaneExtension()); - - - @BeforeAll - static void beforeAll(@Runtime(CONSUMER_CP) TransferEndToEndParticipant consumer, - @Runtime(CONSUMER_CP) JsonLd jsonLd, - @Runtime(PROVIDER_CP) TransferEndToEndParticipant provider) { - consumer.setJsonLd(jsonLd); - consumer.setProtocol("dataspace-protocol-http:2025-1", "/2025-1"); - provider.setProtocol("dataspace-protocol-http:2025-1", "/2025-1"); - } - - } - @Nested @EndToEndTest class EmbeddedDataPlane extends Tests { @@ -571,6 +427,7 @@ static void setup(@Runtime(PROVIDER_CP) Vault vault) { vault.storeSecret("private-key", privateKey); vault.storeSecret("public-key", publicKey); } + } @Nested