diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d467c6a0..1f28269e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ format.version = "1.1" [versions] assertj = "3.24.2" awaitility = "4.2.0" -edc = "0.3.0" +edc = "0.3.1" jakarta-json = "2.0.1" junit-pioneer = "2.1.0" jupiter = "5.10.0" @@ -26,6 +26,7 @@ edc-build-plugin = { module = "org.eclipse.edc.edc-build:org.eclipse.edc.edc-bui edc-configuration-filesystem = { module = "org.eclipse.edc:configuration-filesystem", version.ref = "edc" } edc-connector-core = { module = "org.eclipse.edc:connector-core", version.ref = "edc" } edc-control-plane-api-client = { module = "org.eclipse.edc:control-plane-api-client", version.ref = "edc" } +edc-control-plane-api = { module = "org.eclipse.edc:control-plane-api", version.ref = "edc" } edc-control-plane-core = { module = "org.eclipse.edc:control-plane-core", version.ref = "edc" } edc-control-plane-spi = { module = "org.eclipse.edc:control-plane-spi", version.ref = "edc" } edc-data-plane-api = { module = "org.eclipse.edc:data-plane-api", version.ref = "edc" } diff --git a/settings.gradle.kts b/settings.gradle.kts index dbcb5126..9e09f05c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -37,7 +37,6 @@ include(":basic:basic-03-configuration") include(":transfer:transfer-01-file-transfer:file-transfer-consumer") include(":transfer:transfer-01-file-transfer:file-transfer-provider") include(":transfer:transfer-01-file-transfer:transfer-file-local") -include(":transfer:transfer-01-file-transfer:status-checker") include(":transfer:transfer-02-file-transfer-listener:file-transfer-listener-consumer") include(":transfer:transfer-02-file-transfer-listener:listener") diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04openTelemetryTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04openTelemetryTest.java index eb3d7029..e562cb12 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04openTelemetryTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04openTelemetryTest.java @@ -16,12 +16,12 @@ import org.apache.http.HttpStatus; import org.eclipse.edc.junit.annotations.EndToEndTest; -import org.junit.ClassRule; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import java.io.IOException; @@ -45,9 +45,9 @@ public class Transfer04openTelemetryTest { private final FileTransferSampleTestCommon testUtils = new FileTransferSampleTestCommon(SAMPLE_ASSET_FILE_PATH, DESTINATION_FILE_PATH); - @ClassRule - public static DockerComposeContainer environment = - new DockerComposeContainer(FileTransferSampleTestCommon.getFileFromRelativePath(SAMPLE_FOLDER + DOCKER_COMPOSE_YAML)) + @Container + public static DockerComposeContainer environment = + new DockerComposeContainer<>(FileTransferSampleTestCommon.getFileFromRelativePath(SAMPLE_FOLDER + DOCKER_COMPOSE_YAML)) .withLocalCompose(true) .waitingFor("consumer", Wait.forLogMessage(".*ready.*", 1)); diff --git a/transfer/transfer-01-file-transfer/README.md b/transfer/transfer-01-file-transfer/README.md index c74b4d6d..043fe1b3 100644 --- a/transfer/transfer-01-file-transfer/README.md +++ b/transfer/transfer-01-file-transfer/README.md @@ -152,13 +152,6 @@ authentication. Therefore, we add the property `edc.api.auth.key` and set it to to configure the consumer's webhook address. We expose the DSP API endpoints on a different port and path than other endpoints, so the property `edc.dsp.callback.address` is adjusted to match the DSP API port. -The consumer connector also needs the `status-checker` extension for marking the transfer as completed on the consumer -side. - -```kotlin -implementation(project(":transfer:transfer-01-file-transfer:status-checker")) -``` - ## Run the sample Running this sample consists of multiple steps, that are executed one by one. diff --git a/transfer/transfer-01-file-transfer/file-transfer-consumer/build.gradle.kts b/transfer/transfer-01-file-transfer/file-transfer-consumer/build.gradle.kts index b35e0ec2..5d9ff687 100644 --- a/transfer/transfer-01-file-transfer/file-transfer-consumer/build.gradle.kts +++ b/transfer/transfer-01-file-transfer/file-transfer-consumer/build.gradle.kts @@ -34,8 +34,6 @@ dependencies { implementation(libs.edc.dsp) - implementation(project(":transfer:transfer-01-file-transfer:status-checker")) - } application { diff --git a/transfer/transfer-01-file-transfer/file-transfer-provider/build.gradle.kts b/transfer/transfer-01-file-transfer/file-transfer-provider/build.gradle.kts index 58aa47d4..d1a7776c 100644 --- a/transfer/transfer-01-file-transfer/file-transfer-provider/build.gradle.kts +++ b/transfer/transfer-01-file-transfer/file-transfer-provider/build.gradle.kts @@ -22,6 +22,7 @@ plugins { dependencies { implementation(libs.edc.control.plane.api.client) + implementation(libs.edc.control.plane.api) implementation(libs.edc.control.plane.core) implementation(libs.edc.data.plane.selector.core) implementation(libs.edc.api.observability) diff --git a/transfer/transfer-01-file-transfer/file-transfer-provider/config.properties b/transfer/transfer-01-file-transfer/file-transfer-provider/config.properties index 22d007cf..2383072c 100644 --- a/transfer/transfer-01-file-transfer/file-transfer-provider/config.properties +++ b/transfer/transfer-01-file-transfer/file-transfer-provider/config.properties @@ -4,7 +4,10 @@ web.http.management.port=8182 web.http.management.path=/management web.http.protocol.port=8282 web.http.protocol.path=/protocol +web.http.control.port=8283 +web.http.control.path=/control edc.samples.transfer.01.asset.path=/path/to/file edc.dsp.callback.address=http://localhost:8282/protocol edc.participant.id=provider edc.ids.id=urn:connector:provider +edc.control.endpoint=http://localhost:8283/control diff --git a/transfer/transfer-01-file-transfer/status-checker/build.gradle.kts b/transfer/transfer-01-file-transfer/status-checker/build.gradle.kts deleted file mode 100644 index 9c3cc3c6..00000000 --- a/transfer/transfer-01-file-transfer/status-checker/build.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2020-2022 Microsoft Corporation - * - * 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: - * Microsoft Corporation - initial API and implementation - * - */ - -plugins { - `java-library` -} - -dependencies { - api(libs.edc.control.plane.spi) -} diff --git a/transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleFileStatusChecker.java b/transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleFileStatusChecker.java deleted file mode 100644 index 9eb5268a..00000000 --- a/transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleFileStatusChecker.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2020 - 2022 Microsoft Corporation - * - * 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: - * Microsoft Corporation - initial API and implementation - * - */ - -package org.eclipse.edc.sample.extension.checker; - -import org.eclipse.edc.connector.transfer.spi.types.ProvisionedResource; -import org.eclipse.edc.connector.transfer.spi.types.StatusChecker; -import org.eclipse.edc.connector.transfer.spi.types.TransferProcess; - -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import java.util.Optional; - -public class SampleFileStatusChecker implements StatusChecker { - @Override - public boolean isComplete(TransferProcess transferProcess, List resources) { - var destination = transferProcess.getDataRequest().getDataDestination(); - var path = destination.getStringProperty("path"); - return Optional.ofNullable(path) - .map(this::checkPath) - .orElse(false); - } - - private boolean checkPath(String path) { - return Files.exists(Paths.get(path)); - } -} diff --git a/transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleStatusCheckerExtension.java b/transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleStatusCheckerExtension.java deleted file mode 100644 index 5e364c98..00000000 --- a/transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleStatusCheckerExtension.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020 - 2022 Microsoft Corporation - * - * 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: - * Microsoft Corporation - initial API and implementation - * - */ - -package org.eclipse.edc.sample.extension.checker; - -import org.eclipse.edc.connector.transfer.spi.status.StatusCheckerRegistry; -import org.eclipse.edc.runtime.metamodel.annotation.Extension; -import org.eclipse.edc.runtime.metamodel.annotation.Inject; -import org.eclipse.edc.spi.system.ServiceExtension; -import org.eclipse.edc.spi.system.ServiceExtensionContext; - -@Extension(value = SampleStatusCheckerExtension.NAME) -public class SampleStatusCheckerExtension implements ServiceExtension { - - public static final String NAME = "Sample status checker"; - - @Inject - private StatusCheckerRegistry checkerRegistry; - - @Override - public String name() { - return NAME; - } - - - @Override - public void initialize(ServiceExtensionContext context) { - checkerRegistry.register("File", new SampleFileStatusChecker()); - } -} diff --git a/transfer/transfer-01-file-transfer/status-checker/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension b/transfer/transfer-01-file-transfer/status-checker/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension deleted file mode 100644 index 9e20e172..00000000 --- a/transfer/transfer-01-file-transfer/status-checker/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2020-2022 Microsoft Corporation -# -# 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: -# Microsoft Corporation - initial API and implementation -# -# - -org.eclipse.edc.sample.extension.checker.SampleStatusCheckerExtension diff --git a/transfer/transfer-02-file-transfer-listener/listener/src/main/java/org/eclipse/edc/sample/extension/listener/TransferListenerExtension.java b/transfer/transfer-02-file-transfer-listener/listener/src/main/java/org/eclipse/edc/sample/extension/listener/TransferListenerExtension.java index 6534e2d0..df2cf070 100644 --- a/transfer/transfer-02-file-transfer-listener/listener/src/main/java/org/eclipse/edc/sample/extension/listener/TransferListenerExtension.java +++ b/transfer/transfer-02-file-transfer-listener/listener/src/main/java/org/eclipse/edc/sample/extension/listener/TransferListenerExtension.java @@ -15,36 +15,17 @@ package org.eclipse.edc.sample.extension.listener; import org.eclipse.edc.connector.transfer.spi.observe.TransferProcessObservable; -import org.eclipse.edc.connector.transfer.spi.status.StatusCheckerRegistry; -import org.eclipse.edc.connector.transfer.spi.types.ProvisionedResource; -import org.eclipse.edc.connector.transfer.spi.types.StatusChecker; -import org.eclipse.edc.connector.transfer.spi.types.TransferProcess; -import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; -import java.io.File; -import java.util.List; - public class TransferListenerExtension implements ServiceExtension { - @Inject - private StatusCheckerRegistry statusCheckerRegistry; - @Override public void initialize(ServiceExtensionContext context) { var transferProcessObservable = context.getService(TransferProcessObservable.class); var monitor = context.getMonitor(); transferProcessObservable.registerListener(new MarkerFileCreator(monitor)); - statusCheckerRegistry.register("File", new FileStatusChecker()); } - private static class FileStatusChecker implements StatusChecker { - @Override - public boolean isComplete(TransferProcess transferProcess, List resources) { - var path = transferProcess.getDataDestination().getStringProperty("path"); - return path != null && new File(path).exists(); - } - } } diff --git a/transfer/transfer-03-modify-transferprocess/simulator/src/main/java/org/eclipse/edc/sample/extension/transfer/TransferSimulationExtension.java b/transfer/transfer-03-modify-transferprocess/simulator/src/main/java/org/eclipse/edc/sample/extension/transfer/TransferSimulationExtension.java index b58416ea..eb071a9d 100644 --- a/transfer/transfer-03-modify-transferprocess/simulator/src/main/java/org/eclipse/edc/sample/extension/transfer/TransferSimulationExtension.java +++ b/transfer/transfer-03-modify-transferprocess/simulator/src/main/java/org/eclipse/edc/sample/extension/transfer/TransferSimulationExtension.java @@ -14,7 +14,6 @@ package org.eclipse.edc.sample.extension.transfer; -import org.eclipse.edc.connector.transfer.spi.status.StatusCheckerRegistry; import org.eclipse.edc.connector.transfer.spi.store.TransferProcessStore; import org.eclipse.edc.connector.transfer.spi.types.DataRequest; import org.eclipse.edc.connector.transfer.spi.types.ProvisionedDataDestinationResource; @@ -37,15 +36,11 @@ public class TransferSimulationExtension implements ServiceExtension { @Inject private TransferProcessStore store; - @Inject - private StatusCheckerRegistry statusCheckerRegistry; - @Inject private Clock clock; @Override public void initialize(ServiceExtensionContext context) { - statusCheckerRegistry.register(TEST_TYPE, (transferProcess, resources) -> false); //never completes //Insert a test TP after a delay to simulate a zombie transfer new Timer().schedule( new TimerTask() { diff --git a/transfer/transfer-04-open-telemetry/docker-compose.yaml b/transfer/transfer-04-open-telemetry/docker-compose.yaml index e5a99b6b..b3ad0fca 100644 --- a/transfer/transfer-04-open-telemetry/docker-compose.yaml +++ b/transfer/transfer-04-open-telemetry/docker-compose.yaml @@ -23,6 +23,9 @@ services: WEB_HTTP_MANAGEMENT_PATH: /management WEB_HTTP_PROTOCOL_PORT: 9292 WEB_HTTP_PROTOCOL_PATH: /protocol + WEB_HTTP_CONTROL_PORT: 9193 + WEB_HTTP_CONTROL_PATH: /control + EDC_CONTROL_ENDPOINT: http://consumer:9193/control EDC_DSP_CALLBACK_ADDRESS: http://consumer:9292/protocol EDC_PARTICIPANT_ID: consumer EDC_API_AUTH_KEY: password @@ -51,6 +54,9 @@ services: WEB_HTTP_MANAGEMENT_PATH: /management WEB_HTTP_PROTOCOL_PORT: 8282 WEB_HTTP_PROTOCOL_PATH: /protocol + WEB_HTTP_CONTROL_PORT: 8183 + WEB_HTTP_CONTROL_PATH: /control + EDC_CONTROL_ENDPOINT: http://provider:8183/control EDC_DSP_CALLBACK_ADDRESS: http://provider:8282/protocol EDC_PARTICIPANT_ID: provider EDC_SAMPLES_TRANSFER_01_ASSET_PATH: /resources/README.md diff --git a/transfer/transfer-04-open-telemetry/open-telemetry-consumer/build.gradle.kts b/transfer/transfer-04-open-telemetry/open-telemetry-consumer/build.gradle.kts index 3b466313..03fd684a 100644 --- a/transfer/transfer-04-open-telemetry/open-telemetry-consumer/build.gradle.kts +++ b/transfer/transfer-04-open-telemetry/open-telemetry-consumer/build.gradle.kts @@ -36,8 +36,6 @@ dependencies { implementation(libs.edc.management.api) implementation(libs.edc.dsp) - implementation(project(":transfer:transfer-01-file-transfer:status-checker")) - runtimeOnly(libs.opentelemetry) runtimeOnly(libs.edc.jersey.micrometer) runtimeOnly(libs.edc.jetty.micrometer) @@ -74,4 +72,4 @@ tasks.register("copyOpenTelemetryJar") { tasks.build { finalizedBy("copyOpenTelemetryJar") -} \ No newline at end of file +} diff --git a/transfer/transfer-04-open-telemetry/open-telemetry-provider/build.gradle.kts b/transfer/transfer-04-open-telemetry/open-telemetry-provider/build.gradle.kts index 29fc03bf..f6f67b14 100644 --- a/transfer/transfer-04-open-telemetry/open-telemetry-provider/build.gradle.kts +++ b/transfer/transfer-04-open-telemetry/open-telemetry-provider/build.gradle.kts @@ -25,6 +25,7 @@ plugins { dependencies { implementation(libs.edc.control.plane.api.client) + implementation(libs.edc.control.plane.api) implementation(libs.edc.control.plane.core) implementation(libs.edc.data.plane.selector.core) @@ -74,4 +75,4 @@ tasks.register("copyOpenTelemetryJar") { tasks.build { finalizedBy("copyOpenTelemetryJar") -} \ No newline at end of file +}