From bda341ee12f9ee00c4a37ed7ceda823c9e414222 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Tue, 27 Feb 2024 16:12:27 +0100 Subject: [PATCH] add e2e tests, add generator service impl --- .../DataPlaneDefaultServicesExtension.java | 7 +++ .../DataPlaneFrameworkExtension.java | 14 +----- .../PublicEndpointGeneratorServiceImpl.java | 46 ++++++++++++++++++ .../DataPlaneAuthorizationServiceImpl.java | 6 +-- ...efaultDataPlaneAccessTokenServiceImpl.java | 8 ++-- .../manager/DataPlaneManagerImpl.java | 8 ---- ...ublicEndpointGeneratorServiceImplTest.java | 47 +++++++++++++++++++ ...DataPlaneAuthorizationServiceImplTest.java | 4 +- .../edc/connector/dataplane/spi/Endpoint.java | 20 ++++++++ ...va => PublicEndpointGeneratorService.java} | 13 ++++- .../tests/build.gradle.kts | 10 +--- .../edc/test/e2e/DataplaneEndToEndTest.java | 20 ++++---- .../e2e/participant/DataPlaneParticipant.java | 6 +-- 13 files changed, 161 insertions(+), 48 deletions(-) create mode 100644 core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImpl.java create mode 100644 core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImplTest.java rename spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/{PublicEndpointGenerator.java => PublicEndpointGeneratorService.java} (69%) diff --git a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneDefaultServicesExtension.java b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneDefaultServicesExtension.java index dcba2d1570f..b74ab3123cf 100644 --- a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneDefaultServicesExtension.java +++ b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneDefaultServicesExtension.java @@ -18,6 +18,7 @@ import org.eclipse.edc.connector.dataplane.framework.registry.TransferServiceSelectionStrategy; import org.eclipse.edc.connector.dataplane.framework.store.InMemoryAccessTokenDataStore; import org.eclipse.edc.connector.dataplane.framework.store.InMemoryDataPlaneStore; +import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService; import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService; import org.eclipse.edc.connector.dataplane.spi.store.AccessTokenDataStore; import org.eclipse.edc.connector.dataplane.spi.store.DataPlaneStore; @@ -63,4 +64,10 @@ public AccessTokenDataStore defaultAccessTokenDataStore() { public PipelineService pipelineService(ServiceExtensionContext context) { return new PipelineServiceImpl(context.getMonitor()); } + + // todo: should this be a default service? + @Provider(isDefault = true) + public PublicEndpointGeneratorService publicEndpointGenerator() { + return new PublicEndpointGeneratorServiceImpl(); + } } diff --git a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneFrameworkExtension.java b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneFrameworkExtension.java index 3208522e72d..3a8b3b3fa56 100644 --- a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneFrameworkExtension.java +++ b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/DataPlaneFrameworkExtension.java @@ -19,11 +19,10 @@ import org.eclipse.edc.connector.dataplane.framework.manager.DataPlaneManagerImpl; import org.eclipse.edc.connector.dataplane.framework.registry.TransferServiceRegistryImpl; import org.eclipse.edc.connector.dataplane.framework.registry.TransferServiceSelectionStrategy; -import org.eclipse.edc.connector.dataplane.spi.Endpoint; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAccessControlService; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAccessTokenService; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAuthorizationService; -import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGenerator; +import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService; import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager; import org.eclipse.edc.connector.dataplane.spi.pipeline.DataTransferExecutorServiceContainer; import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService; @@ -34,13 +33,11 @@ import org.eclipse.edc.runtime.metamodel.annotation.Provider; import org.eclipse.edc.runtime.metamodel.annotation.Provides; import org.eclipse.edc.runtime.metamodel.annotation.Setting; -import org.eclipse.edc.spi.result.Result; import org.eclipse.edc.spi.retry.ExponentialWaitStrategy; import org.eclipse.edc.spi.system.ExecutorInstrumentation; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.telemetry.Telemetry; -import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.statemachine.retry.EntityRetryProcessConfiguration; import org.jetbrains.annotations.NotNull; @@ -102,7 +99,7 @@ public class DataPlaneFrameworkExtension implements ServiceExtension { @Inject private DataPlaneAccessControlService accessControlService; @Inject - private DataPlaneAuthorizationService dataPlaneAuthService; + private PublicEndpointGeneratorService endpointGenerator; @Override public String name() { @@ -135,7 +132,6 @@ public void initialize(ServiceExtensionContext context) { .transferServiceRegistry(transferServiceRegistry) .store(store) .transferProcessClient(transferProcessApiClient) - .authorizationService(dataPlaneAuthService) .monitor(monitor) .telemetry(telemetry) .build(); @@ -157,12 +153,6 @@ public void shutdown() { @Provider public DataPlaneAuthorizationService authorizationService(ServiceExtensionContext context) { - var endpointGenerator = new PublicEndpointGenerator() { - @Override - public Result generateFor(DataAddress sourceDataAddress) { - return Result.success(null); - } - }; return new DataPlaneAuthorizationServiceImpl(accessTokenService, endpointGenerator, accessControlService, context.getParticipantId(), clock); } diff --git a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImpl.java b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImpl.java new file mode 100644 index 00000000000..c7668c8dfd4 --- /dev/null +++ b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Metaform Systems, Inc. + * + * 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: + * Metaform Systems, Inc. - initial API and implementation + * + */ + +package org.eclipse.edc.connector.dataplane.framework; + +import org.eclipse.edc.connector.dataplane.spi.Endpoint; +import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService; +import org.eclipse.edc.spi.result.Result; +import org.eclipse.edc.spi.types.domain.DataAddress; + +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +class PublicEndpointGeneratorServiceImpl implements PublicEndpointGeneratorService { + private final Map> generatorFunctions = new ConcurrentHashMap<>(); + + @Override + public Result generateFor(DataAddress sourceDataAddress) { + Objects.requireNonNull(sourceDataAddress); + Objects.requireNonNull(sourceDataAddress.getType()); + + return Optional.ofNullable(generatorFunctions.get(sourceDataAddress.getType())) + .map(function -> function.apply(sourceDataAddress)) + .map(Result::success) + .orElseGet(() -> Result.failure("No Endpoint generator function registered for source data type '%s'".formatted(sourceDataAddress.getType()))); + } + + @Override + public void addGeneratorFunction(String destinationType, Function generatorFunction) { + generatorFunctions.put(destinationType, generatorFunction); + } +} diff --git a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImpl.java b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImpl.java index 326f484bd8d..2b23c93cb13 100644 --- a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImpl.java +++ b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImpl.java @@ -18,7 +18,7 @@ import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAccessControlService; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAccessTokenService; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAuthorizationService; -import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGenerator; +import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService; import org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames; import org.eclipse.edc.spi.iam.TokenParameters; import org.eclipse.edc.spi.iam.TokenRepresentation; @@ -38,13 +38,13 @@ public class DataPlaneAuthorizationServiceImpl implements DataPlaneAuthorization public static final String CLAIM_PROCESS_ID = "process_id"; public static final String CLAIM_TRANSFER_TYPE = "transfer_type"; private final DataPlaneAccessTokenService accessTokenService; - private final PublicEndpointGenerator endpointGenerator; + private final PublicEndpointGeneratorService endpointGenerator; private final DataPlaneAccessControlService accessControlService; private final String ownParticipantId; private final Clock clock; public DataPlaneAuthorizationServiceImpl(DataPlaneAccessTokenService accessTokenService, - PublicEndpointGenerator endpointGenerator, + PublicEndpointGeneratorService endpointGenerator, DataPlaneAccessControlService accessControlService, String ownParticipantId, Clock clock) { diff --git a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DefaultDataPlaneAccessTokenServiceImpl.java b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DefaultDataPlaneAccessTokenServiceImpl.java index 2ff74cd5e6b..d576f19993c 100644 --- a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DefaultDataPlaneAccessTokenServiceImpl.java +++ b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/iam/DefaultDataPlaneAccessTokenServiceImpl.java @@ -72,8 +72,8 @@ public DefaultDataPlaneAccessTokenServiceImpl(TokenGenerationService tokenGenera * Generates JWT tokens based on the {@link TokenParameters}. A representation of the claims and the data address is stored for subsequent use, using the token ID ("jti") * as correlation id. * - * @param parameters Headers and claims that are to be included in the token. If the claims do not contain a "jti" claim, one is generated randomly and inserted into the claims. - * @param backendDataAddress Information about the data resource for which the token is to be generated. May contain additional information about the token, such as an {@code authType} + * @param parameters Headers and claims that are to be included in the token. If the claims do not contain a "jti" claim, one is generated randomly and inserted into the claims. + * @param backendDataAddress Information about the data resource for which the token is to be generated. May contain additional information about the token, such as an {@code authType} * @return A token representation in serialized JWT format (signed). The JWTs "kid" header contains the ID of the public key that can be used to verify the token. */ @Override @@ -104,7 +104,9 @@ public Result obtainToken(TokenParameters parameters, DataA var accessTokenData = new AccessTokenData(id, claimToken, backendDataAddress); var storeResult = accessTokenDataStore.store(accessTokenData); - return storeResult.succeeded() ? Result.success(tokenResult.getContent()) : Result.failure(storeResult.getFailureMessages()); + var content = tokenResult.getContent(); + content.getAdditional().put("authType", "bearer"); + return storeResult.succeeded() ? Result.success(content) : Result.failure(storeResult.getFailureMessages()); } diff --git a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/manager/DataPlaneManagerImpl.java b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/manager/DataPlaneManagerImpl.java index 78b48feb29a..275d019b186 100644 --- a/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/manager/DataPlaneManagerImpl.java +++ b/core/data-plane/data-plane-core/src/main/java/org/eclipse/edc/connector/dataplane/framework/manager/DataPlaneManagerImpl.java @@ -18,7 +18,6 @@ import org.eclipse.edc.connector.core.entity.AbstractStateEntityManager; import org.eclipse.edc.connector.dataplane.spi.DataFlow; import org.eclipse.edc.connector.dataplane.spi.DataFlowStates; -import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAuthorizationService; import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager; import org.eclipse.edc.connector.dataplane.spi.registry.TransferServiceRegistry; import org.eclipse.edc.connector.dataplane.spi.store.DataPlaneStore; @@ -50,7 +49,6 @@ public class DataPlaneManagerImpl extends AbstractStateEntityManager validate(DataFlowStartMessage dataRequest) { @Override public void initiate(DataFlowStartMessage dataRequest) { - var result = authorizationService.createEndpointDataReference(dataRequest); var dataFlow = DataFlow.Builder.newInstance() .id(dataRequest.getProcessId()) .source(dataRequest.getSourceDataAddress()) @@ -217,11 +214,6 @@ public Builder transferProcessClient(TransferProcessApiClient transferProcessCli manager.transferProcessClient = transferProcessClient; return this; } - - public Builder authorizationService(DataPlaneAuthorizationService service) { - manager.authorizationService = service; - return this; - } } } diff --git a/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImplTest.java b/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImplTest.java new file mode 100644 index 00000000000..5c77672baac --- /dev/null +++ b/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/PublicEndpointGeneratorServiceImplTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Metaform Systems, Inc. + * + * 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: + * Metaform Systems, Inc. - initial API and implementation + * + */ + +package org.eclipse.edc.connector.dataplane.framework; + +import org.eclipse.edc.connector.dataplane.spi.Endpoint; +import org.eclipse.edc.spi.types.domain.DataAddress; +import org.junit.jupiter.api.Test; + +import java.util.Map; + +import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat; + + +class PublicEndpointGeneratorServiceImplTest { + + private final PublicEndpointGeneratorServiceImpl generatorService = new PublicEndpointGeneratorServiceImpl(); + + @Test + void generateFor() { + var endpoint = new Endpoint(Map.of("fizz", "buzz"), "bar-type"); + generatorService.addGeneratorFunction("testtype", dataAddress -> endpoint); + + assertThat(generatorService.generateFor(DataAddress.Builder.newInstance().type("testtype").build())).isSucceeded() + .isEqualTo(endpoint); + } + + @Test + void generateFor_noFunction() { + assertThat(generatorService.generateFor(DataAddress.Builder.newInstance().type("testtype").build())) + .isFailed() + .detail() + .isEqualTo("No Endpoint generator function registered for source data type 'testtype'"); + } + +} \ No newline at end of file diff --git a/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImplTest.java b/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImplTest.java index 3632ed6d956..407fc0f014f 100644 --- a/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImplTest.java +++ b/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/iam/DataPlaneAuthorizationServiceImplTest.java @@ -18,7 +18,7 @@ import org.eclipse.edc.connector.dataplane.spi.Endpoint; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAccessControlService; import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAccessTokenService; -import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGenerator; +import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService; import org.eclipse.edc.spi.iam.ClaimToken; import org.eclipse.edc.spi.iam.TokenRepresentation; import org.eclipse.edc.spi.result.Result; @@ -50,7 +50,7 @@ class DataPlaneAuthorizationServiceImplTest { public static final String OWN_PARTICIPANT_ID = "test-ownParticipantId"; private final DataPlaneAccessTokenService accessTokenService = mock(); - private final PublicEndpointGenerator endpointGenerator = mock(); + private final PublicEndpointGeneratorService endpointGenerator = mock(); private final DataPlaneAccessControlService accessControlService = mock(); private final DataPlaneAuthorizationServiceImpl authorizationService = new DataPlaneAuthorizationServiceImpl(accessTokenService, endpointGenerator, accessControlService, OWN_PARTICIPANT_ID, Clock.systemUTC()); diff --git a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/Endpoint.java b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/Endpoint.java index 9b56cfa490a..c8a455e4bce 100644 --- a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/Endpoint.java +++ b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/Endpoint.java @@ -16,5 +16,25 @@ import java.util.Map; +/** + * Representation of a publicly accessible data egress point. This indicates to consumers the type of data (denoted by the {@code endpointType}) + * and an object containing fields describing the endpoint. + * For HTTP this could be as simple as a {@code "url" -> "http://foo.bar"} entry, where for other protocols there could be + * formatted and structured data. + * + * @param endpoint An object describing the endpoint + * @param endpointType A string uniquely identifying the type of endpoint + */ public record Endpoint(Map endpoint, String endpointType) { + + /** + * Convenience factory method to create a HTTP endpoint. + * + * @param url A URL containing the HTTP endpoint + * @return the endpoint. + */ + public static Endpoint url(String url) { + return new Endpoint(Map.of("url", url), "https://w3id.org/idsa/v4.1/HTTP"); + } + } diff --git a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/PublicEndpointGenerator.java b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/PublicEndpointGeneratorService.java similarity index 69% rename from spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/PublicEndpointGenerator.java rename to spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/PublicEndpointGeneratorService.java index f396b82b8fe..5cabc84112e 100644 --- a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/PublicEndpointGenerator.java +++ b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/iam/PublicEndpointGeneratorService.java @@ -18,11 +18,13 @@ import org.eclipse.edc.spi.result.Result; import org.eclipse.edc.spi.types.domain.DataAddress; +import java.util.function.Function; + /** * Determines the public endpoint at which the data for a particular data transfer is exposed. * For example, for HTTP transfers this would likely return the internet-facing HTTP URL of the data plane ("public url"). */ -public interface PublicEndpointGenerator { +public interface PublicEndpointGeneratorService { /** * Generates an endpoint for a particular resource (={@link DataAddress}). * @@ -30,4 +32,13 @@ public interface PublicEndpointGenerator { * @return The public {@link Endpoint} where the data is made available, or a failure if the endpoint could not be generated. */ Result generateFor(DataAddress sourceDataAddress); + + /** + * Adds a function that can generate a {@link Endpoint} for particular source data address. Typically, the source data address + * is not directly exposed publicly. + * + * @param destinationType The type of the source {@link DataAddress} + * @param generatorFunction the generator function + */ + void addGeneratorFunction(String destinationType, Function generatorFunction); } diff --git a/system-tests/e2e-dataplane-tests/tests/build.gradle.kts b/system-tests/e2e-dataplane-tests/tests/build.gradle.kts index d3979d56e70..96a311292eb 100644 --- a/system-tests/e2e-dataplane-tests/tests/build.gradle.kts +++ b/system-tests/e2e-dataplane-tests/tests/build.gradle.kts @@ -18,27 +18,21 @@ plugins { } dependencies { - testImplementation(project(":spi:control-plane:transfer-spi")) - testImplementation(project(":extensions:common:sql:sql-core")) + + testImplementation(project(":spi:data-plane:data-plane-spi")) testImplementation(project(":core:common:junit")) - testImplementation(testFixtures(project(":extensions:common:sql:sql-core"))) testImplementation(testFixtures(project(":extensions:control-plane:api:management-api:management-api-test-fixtures"))) testImplementation(project(":core:common:junit")) testImplementation(project(":extensions:common:json-ld")) testImplementation(libs.jakartaJson) - testImplementation(libs.postgres) testImplementation(libs.restAssured) testImplementation(libs.assertj) testImplementation(libs.awaitility) testImplementation(libs.junit.jupiter.api) testImplementation(libs.mockserver.netty) testImplementation(libs.mockserver.client) - testImplementation(libs.kafkaClients) - - testCompileOnly(project(":system-tests:e2e-transfer-test:backend-service")) - testCompileOnly(project(":system-tests:e2e-transfer-test:control-plane")) testCompileOnly(project(":system-tests:e2e-transfer-test:data-plane")) } diff --git a/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/DataplaneEndToEndTest.java b/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/DataplaneEndToEndTest.java index 4f69854b44a..66762c904df 100644 --- a/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/DataplaneEndToEndTest.java +++ b/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/DataplaneEndToEndTest.java @@ -14,8 +14,9 @@ package org.eclipse.edc.test.e2e; +import org.eclipse.edc.connector.dataplane.spi.Endpoint; +import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService; import org.eclipse.edc.junit.annotations.EndToEndTest; -import org.eclipse.edc.junit.extensions.EdcClassRuntimesExtension; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; @@ -25,6 +26,8 @@ import java.time.Duration; +import static org.eclipse.edc.spi.CoreConstants.EDC_NAMESPACE; + @EndToEndTest public class DataplaneEndToEndTest { @@ -33,23 +36,24 @@ public class DataplaneEndToEndTest { .id("urn:connector:provider") .build(); @RegisterExtension - static EdcClassRuntimesExtension runtimes = new EdcClassRuntimesExtension( + static EdcRuntimeExtension runtime = new EdcRuntimeExtension( ":system-tests:e2e-dataplane-tests:runtimes:data-plane", - "provider-data-plane", + "data-plane", DATAPLANE.dataPlaneConfiguration() - ) - ); + ); protected final Duration timeout = Duration.ofSeconds(60); @Test - void foobar() { + void placeHolder() { // no impl yet, we don't have a DataPlaneSignalingApiController yet + var generator = runtime.getContext().getService(PublicEndpointGeneratorService.class); + generator.addGeneratorFunction("HttpData", dataAddress -> Endpoint.url("http//fizz.buzz.com/bar")); var flowMessage = DataFlowStartMessage.Builder.newInstance() .processId("test-processId") - .sourceDataAddress(DataAddress.Builder.newInstance().type("Http").build()) - .destinationDataAddress(DataAddress.Builder.newInstance().type("Http").build()) + .sourceDataAddress(DataAddress.Builder.newInstance().type("HttpData").property(EDC_NAMESPACE + "baseUrl", "http://foo.bar/").build()) + .destinationDataAddress(DataAddress.Builder.newInstance().type("HttpData").property(EDC_NAMESPACE + "baseUrl", "http://fizz.buzz").build()) .assetId("test-asset") .agreementId("test-agreement") .build(); diff --git a/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/participant/DataPlaneParticipant.java b/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/participant/DataPlaneParticipant.java index 70c24f63d55..ca66be3ae76 100644 --- a/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/participant/DataPlaneParticipant.java +++ b/system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/participant/DataPlaneParticipant.java @@ -16,7 +16,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.restassured.http.ContentType; -import jakarta.json.JsonObject; import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; import org.eclipse.edc.test.system.utils.Participant; import org.hamcrest.Matchers; @@ -55,6 +54,7 @@ public Map dataPlaneConfiguration() { put("edc.keystore.password", "123456"); put("edc.dataplane.token.validation.endpoint", controlPlaneControl + "/token"); put("edc.dataplane.http.sink.partition.size", "1"); + put("edc.transfer.proxy.token.signer.privatekey.alias", "1"); } }; } @@ -62,14 +62,14 @@ public Map dataPlaneConfiguration() { /** * Uses the data plane's control API to initiate a transfer */ - public JsonObject initiateTransfer(DataFlowStartMessage startMessage) { + public String initiateTransfer(DataFlowStartMessage startMessage) { return dataplaneControlApi.baseRequest() .contentType(ContentType.JSON) .body(startMessage) .post("/transfer") .then() .body(Matchers.notNullValue()) - .extract().body().as(JsonObject.class); + .extract().body().asString(); } @NotNull