From 1a7733d4d54efbd6b243d84f3035fdca36a17dc6 Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Fri, 6 Oct 2023 11:48:54 +0200 Subject: [PATCH] Fix compilation and tests --- .github/workflows/verify.yaml | 3 +- gradle/libs.versions.toml | 1 + settings.gradle.kts | 1 - transfer/transfer-01-file-transfer/README.md | 7 ---- .../file-transfer-consumer/build.gradle.kts | 2 - .../file-transfer-provider/build.gradle.kts | 1 + .../file-transfer-provider/config.properties | 3 ++ .../status-checker/build.gradle.kts | 21 ---------- .../checker/SampleFileStatusChecker.java | 39 ------------------ .../checker/SampleStatusCheckerExtension.java | 41 ------------------- ...rg.eclipse.edc.spi.system.ServiceExtension | 15 ------- .../listener/TransferListenerExtension.java | 19 --------- .../transfer/TransferSimulationExtension.java | 5 --- .../open-telemetry-consumer/build.gradle.kts | 4 +- 14 files changed, 7 insertions(+), 155 deletions(-) delete mode 100644 transfer/transfer-01-file-transfer/status-checker/build.gradle.kts delete mode 100644 transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleFileStatusChecker.java delete mode 100644 transfer/transfer-01-file-transfer/status-checker/src/main/java/org/eclipse/edc/sample/extension/checker/SampleStatusCheckerExtension.java delete mode 100644 transfer/transfer-01-file-transfer/status-checker/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 27141139..b6ee42e3 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -46,8 +46,7 @@ jobs: - name: End to End Integration Tests uses: ./.github/actions/run-tests with: - command: - - ./gradlew test -DincludeTags="EndToEndTest" + command: ./gradlew test -DincludeTags="EndToEndTest" Upload-Test-Report: needs: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 829cb79f..1f28269e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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/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/open-telemetry-consumer/build.gradle.kts b/transfer/transfer-04-open-telemetry/open-telemetry-consumer/build.gradle.kts index b5c53191..51306141 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.edc.jersey.micrometer) runtimeOnly(libs.edc.jetty.micrometer) runtimeOnly(libs.edc.monitor.jdk.logger) @@ -74,4 +72,4 @@ tasks.register("copyOpenTelemetryJar") { tasks.compileJava { finalizedBy("copyOpenTelemetryJar") -} \ No newline at end of file +}