From 9a028413a63295ec25fbc20893a579b8e85a443e Mon Sep 17 00:00:00 2001 From: hamidonos Date: Fri, 27 Oct 2023 09:24:48 +0200 Subject: [PATCH] fix: resolving pr comments --- ....java => Advanced01openTelemetryTest.java} | 24 ++++++++--------- .../FileTransferCommon.java | 3 ++- .../NegotiationCommon.java | 26 +++++++++--------- .../PrerequisitesCommon.java | 9 ++----- .../Transfer00prerequisitesTest.java | 10 +++---- .../Transfer01negotiationTest.java | 20 +++++++------- .../Transfer02consumerPullTest.java | 27 ++++++++++--------- .../Transfer03providerPushTest.java | 21 ++++++++------- .../Transfer04eventConsumerTest.java | 19 ++++++------- .../streaming/Streaming01httpToHttpTest.java | 4 +-- .../streaming/Streaming02KafkaToHttpTest.java | 4 +-- .../HttpRequestLoggerConsumer.java | 2 +- .../HttpRequestLoggerUtil.java | 4 +-- .../{transfer => util}/TransferUtil.java | 8 +++--- transfer/transfer-00-prerequisites/README.md | 11 -------- transfer/transfer-04-event-consumer/README.md | 18 +++---------- 16 files changed, 92 insertions(+), 118 deletions(-) rename system-tests/src/test/java/org/eclipse/edc/samples/advanced/{advanced00opentelemetry/Advanced00openTelemetryTest.java => Advanced01openTelemetryTest.java} (71%) rename system-tests/src/test/java/org/eclipse/edc/samples/{transfer => common}/FileTransferCommon.java (98%) rename system-tests/src/test/java/org/eclipse/edc/samples/{transfer/transfer01negotiation => common}/NegotiationCommon.java (64%) rename system-tests/src/test/java/org/eclipse/edc/samples/{transfer/transfer00prerequisites => common}/PrerequisitesCommon.java (93%) rename system-tests/src/test/java/org/eclipse/edc/samples/transfer/{transfer00prerequisites => }/Transfer00prerequisitesTest.java (62%) rename system-tests/src/test/java/org/eclipse/edc/samples/transfer/{transfer01negotiation => }/Transfer01negotiationTest.java (55%) rename system-tests/src/test/java/org/eclipse/edc/samples/transfer/{transfer02consumerpull => }/Transfer02consumerPullTest.java (70%) rename system-tests/src/test/java/org/eclipse/edc/samples/transfer/{transfer03providerpush => }/Transfer03providerPushTest.java (69%) rename system-tests/src/test/java/org/eclipse/edc/samples/transfer/{transfer04eventconsumer => }/Transfer04eventConsumerTest.java (73%) rename system-tests/src/test/java/org/eclipse/edc/samples/{transfer => util}/HttpRequestLoggerConsumer.java (95%) rename system-tests/src/test/java/org/eclipse/edc/samples/{transfer => util}/HttpRequestLoggerUtil.java (91%) rename system-tests/src/test/java/org/eclipse/edc/samples/{transfer => util}/TransferUtil.java (92%) diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/advanced/advanced00opentelemetry/Advanced00openTelemetryTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/advanced/Advanced01openTelemetryTest.java similarity index 71% rename from system-tests/src/test/java/org/eclipse/edc/samples/advanced/advanced00opentelemetry/Advanced00openTelemetryTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/advanced/Advanced01openTelemetryTest.java index b46422e1..8a4ae1ab 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/advanced/advanced00opentelemetry/Advanced00openTelemetryTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/advanced/Advanced01openTelemetryTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.advanced.advanced00opentelemetry; +package org.eclipse.edc.samples.advanced; import org.apache.http.HttpStatus; import org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates; @@ -30,20 +30,20 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileFromRelativePath; -import static org.eclipse.edc.samples.transfer.TransferUtil.checkTransferStatus; -import static org.eclipse.edc.samples.transfer.TransferUtil.startTransfer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.runPrerequisites; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.createAsset; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.createContractDefinition; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.createPolicy; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.getContractAgreementId; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.negotiateContract; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath; +import static org.eclipse.edc.samples.common.NegotiationCommon.createAsset; +import static org.eclipse.edc.samples.common.NegotiationCommon.createContractDefinition; +import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; +import static org.eclipse.edc.samples.common.NegotiationCommon.getContractAgreementId; +import static org.eclipse.edc.samples.common.NegotiationCommon.negotiateContract; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites; +import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus; +import static org.eclipse.edc.samples.util.TransferUtil.startTransfer; @EndToEndTest @Testcontainers -public class Advanced00openTelemetryTest { +public class Advanced01openTelemetryTest { private static final String DOCKER_COMPOSE_YAML = "advanced/advanced-01-open-telemetry/docker-compose.yaml"; private static final String NEGOTIATE_CONTRACT_FILE_PATH = "advanced/advanced-01-open-telemetry/resources/negotiate-contract.json"; diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/FileTransferCommon.java b/system-tests/src/test/java/org/eclipse/edc/samples/common/FileTransferCommon.java similarity index 98% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/FileTransferCommon.java rename to system-tests/src/test/java/org/eclipse/edc/samples/common/FileTransferCommon.java index 201dcd48..0e79a98b 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/FileTransferCommon.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/common/FileTransferCommon.java @@ -9,10 +9,11 @@ * * Contributors: * Microsoft Corporation - initial test implementation for sample + * Mercedes-Benz Tech Innovation GmbH - refactor test cases * */ -package org.eclipse.edc.samples.transfer; +package org.eclipse.edc.samples.common; import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.http.ContentType; diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer01negotiation/NegotiationCommon.java b/system-tests/src/test/java/org/eclipse/edc/samples/common/NegotiationCommon.java similarity index 64% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer01negotiation/NegotiationCommon.java rename to system-tests/src/test/java/org/eclipse/edc/samples/common/NegotiationCommon.java index 506b1421..d8780312 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer01negotiation/NegotiationCommon.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/common/NegotiationCommon.java @@ -12,20 +12,18 @@ * */ -package org.eclipse.edc.samples.transfer.transfer01negotiation; +package org.eclipse.edc.samples.common; import java.util.Objects; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.TransferUtil.POLL_INTERVAL; -import static org.eclipse.edc.samples.transfer.TransferUtil.TIMEOUT; -import static org.eclipse.edc.samples.transfer.TransferUtil.get; -import static org.eclipse.edc.samples.transfer.TransferUtil.post; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.CONSUMER_MANAGEMENT_URL; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.PROVIDER_MANAGEMENT_URL; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.util.TransferUtil.POLL_INTERVAL; +import static org.eclipse.edc.samples.util.TransferUtil.TIMEOUT; +import static org.eclipse.edc.samples.util.TransferUtil.get; +import static org.eclipse.edc.samples.util.TransferUtil.post; public class NegotiationCommon { @@ -43,23 +41,23 @@ public class NegotiationCommon { private static final String CONTRACT_AGREEMENT_ID = "'edc:contractAgreementId'"; public static void createAsset() { - post(PROVIDER_MANAGEMENT_URL + V2_ASSETS_PATH, getFileContentFromRelativePath(CREATE_ASSET_FILE_PATH)); + post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V2_ASSETS_PATH, getFileContentFromRelativePath(CREATE_ASSET_FILE_PATH)); } public static void createPolicy() { - post(PROVIDER_MANAGEMENT_URL + V2_POLICY_DEFINITIONS_PATH, getFileContentFromRelativePath(CREATE_POLICY_FILE_PATH)); + post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V2_POLICY_DEFINITIONS_PATH, getFileContentFromRelativePath(CREATE_POLICY_FILE_PATH)); } public static void createContractDefinition() { - post(PROVIDER_MANAGEMENT_URL + V2_CONTRACT_DEFINITIONS_PATH, getFileContentFromRelativePath(CREATE_CONTRACT_DEFINITION_FILE_PATH)); + post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V2_CONTRACT_DEFINITIONS_PATH, getFileContentFromRelativePath(CREATE_CONTRACT_DEFINITION_FILE_PATH)); } public static void fetchCatalog() { - post(CONSUMER_MANAGEMENT_URL + V2_CATALOG_REQUEST_PATH, getFileContentFromRelativePath(FETCH_CATALOG_FILE_PATH)); + post(PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CATALOG_REQUEST_PATH, getFileContentFromRelativePath(FETCH_CATALOG_FILE_PATH)); } public static String negotiateContract(String negotiateContractFilePath) { - var contractNegotiationId = post(CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH, getFileContentFromRelativePath(negotiateContractFilePath), CONTRACT_NEGOTIATION_ID); + var contractNegotiationId = post(PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH, getFileContentFromRelativePath(negotiateContractFilePath), CONTRACT_NEGOTIATION_ID); assertThat(contractNegotiationId).isNotEmpty(); return contractNegotiationId; } @@ -72,7 +70,7 @@ public static String getContractAgreementId(String contractNegotiationId) { return await() .atMost(TIMEOUT) .pollInterval(POLL_INTERVAL) - .until(() -> get(CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH + contractNegotiationId, CONTRACT_AGREEMENT_ID), Objects::nonNull); + .until(() -> get(PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH + contractNegotiationId, CONTRACT_AGREEMENT_ID), Objects::nonNull); } public static String runNegotiation() { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer00prerequisites/PrerequisitesCommon.java b/system-tests/src/test/java/org/eclipse/edc/samples/common/PrerequisitesCommon.java similarity index 93% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer00prerequisites/PrerequisitesCommon.java rename to system-tests/src/test/java/org/eclipse/edc/samples/common/PrerequisitesCommon.java index 6824882e..a799da83 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer00prerequisites/PrerequisitesCommon.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/common/PrerequisitesCommon.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.transfer.transfer00prerequisites; +package org.eclipse.edc.samples.common; import io.restassured.http.ContentType; import org.apache.http.HttpStatus; @@ -21,7 +21,7 @@ import java.util.Map; import static io.restassured.RestAssured.given; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath; public class PrerequisitesCommon { public static final String API_KEY_HEADER_KEY = "X-Api-Key"; @@ -65,13 +65,8 @@ public static void registerDataPlaneProvider() { registerDataPlane(PROVIDER_MANAGEMENT_URL, REGISTER_DATA_PLANE_PROVIDER_JSON); } - public static void registerDataPlaneConsumer() { - registerDataPlane(CONSUMER_MANAGEMENT_URL, REGISTER_DATA_PLANE_CONSUMER_JSON); - } - public static void runPrerequisites() { registerDataPlaneProvider(); - registerDataPlaneConsumer(); } private static EdcRuntimeExtension getConnector( diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer00prerequisites/Transfer00prerequisitesTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer00prerequisitesTest.java similarity index 62% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer00prerequisites/Transfer00prerequisitesTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer00prerequisitesTest.java index 79577669..b05bb404 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer00prerequisites/Transfer00prerequisitesTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer00prerequisitesTest.java @@ -12,17 +12,16 @@ * */ -package org.eclipse.edc.samples.transfer.transfer00prerequisites; +package org.eclipse.edc.samples.transfer; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getConsumer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getProvider; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.registerDataPlaneConsumer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.registerDataPlaneProvider; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.registerDataPlaneProvider; @EndToEndTest public class Transfer00prerequisitesTest { @@ -36,6 +35,5 @@ public class Transfer00prerequisitesTest { @Test void runSampleSteps() { registerDataPlaneProvider(); - registerDataPlaneConsumer(); } } diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer01negotiation/Transfer01negotiationTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer01negotiationTest.java similarity index 55% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer01negotiation/Transfer01negotiationTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer01negotiationTest.java index 64ac6b01..b9b10f15 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer01negotiation/Transfer01negotiationTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer01negotiationTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.transfer.transfer01negotiation; +package org.eclipse.edc.samples.transfer; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; @@ -20,15 +20,15 @@ import org.junit.jupiter.api.extension.RegisterExtension; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getConsumer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getProvider; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.runPrerequisites; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.createAsset; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.createContractDefinition; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.createPolicy; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.fetchCatalog; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.getContractAgreementId; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.negotiateContract; +import static org.eclipse.edc.samples.common.NegotiationCommon.createAsset; +import static org.eclipse.edc.samples.common.NegotiationCommon.createContractDefinition; +import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; +import static org.eclipse.edc.samples.common.NegotiationCommon.fetchCatalog; +import static org.eclipse.edc.samples.common.NegotiationCommon.getContractAgreementId; +import static org.eclipse.edc.samples.common.NegotiationCommon.negotiateContract; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites; @EndToEndTest public class Transfer01negotiationTest { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer02consumerpull/Transfer02consumerPullTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer02consumerPullTest.java similarity index 70% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer02consumerpull/Transfer02consumerPullTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer02consumerPullTest.java index e474b45a..f3d897ce 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer02consumerpull/Transfer02consumerPullTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer02consumerPullTest.java @@ -9,16 +9,17 @@ * * Contributors: * Microsoft Corporation - initial test implementation for sample + * Mercedes-Benz Tech Innovation GmbH - refactor test cases * */ -package org.eclipse.edc.samples.transfer.transfer02consumerpull; +package org.eclipse.edc.samples.transfer; import org.apache.http.HttpStatus; import org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; -import org.eclipse.edc.samples.transfer.HttpRequestLoggerConsumer; +import org.eclipse.edc.samples.util.HttpRequestLoggerConsumer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -29,17 +30,17 @@ import static io.restassured.RestAssured.given; import static org.apache.http.HttpHeaders.AUTHORIZATION; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.HttpRequestLoggerUtil.getHttpRequestLoggerContainer; -import static org.eclipse.edc.samples.transfer.TransferUtil.checkTransferStatus; -import static org.eclipse.edc.samples.transfer.TransferUtil.startTransfer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.API_KEY_HEADER_KEY; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.API_KEY_HEADER_VALUE; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.CONSUMER_PUBLIC_URL; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getConsumer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getProvider; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.runPrerequisites; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.runNegotiation; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.NegotiationCommon.runNegotiation; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_KEY; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_VALUE; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.CONSUMER_PUBLIC_URL; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites; +import static org.eclipse.edc.samples.util.HttpRequestLoggerUtil.getHttpRequestLoggerContainer; +import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus; +import static org.eclipse.edc.samples.util.TransferUtil.startTransfer; import static org.hamcrest.Matchers.emptyString; import static org.hamcrest.Matchers.not; diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer03providerpush/Transfer03providerPushTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer03providerPushTest.java similarity index 69% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer03providerpush/Transfer03providerPushTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer03providerPushTest.java index 49b27bef..5e8c6a8d 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer03providerpush/Transfer03providerPushTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer03providerPushTest.java @@ -9,15 +9,16 @@ * * Contributors: * Microsoft Corporation - initial test implementation for sample + * Mercedes-Benz Tech Innovation GmbH - refactor test cases * */ -package org.eclipse.edc.samples.transfer.transfer03providerpush; +package org.eclipse.edc.samples.transfer; import org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; -import org.eclipse.edc.samples.transfer.HttpRequestLoggerConsumer; +import org.eclipse.edc.samples.util.HttpRequestLoggerConsumer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -26,14 +27,14 @@ import org.testcontainers.junit.jupiter.Testcontainers; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.HttpRequestLoggerUtil.getHttpRequestLoggerContainer; -import static org.eclipse.edc.samples.transfer.TransferUtil.checkTransferStatus; -import static org.eclipse.edc.samples.transfer.TransferUtil.startTransfer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getConsumer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getProvider; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.runPrerequisites; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.runNegotiation; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.NegotiationCommon.runNegotiation; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites; +import static org.eclipse.edc.samples.util.HttpRequestLoggerUtil.getHttpRequestLoggerContainer; +import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus; +import static org.eclipse.edc.samples.util.TransferUtil.startTransfer; @EndToEndTest @Testcontainers diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer04eventconsumer/Transfer04eventConsumerTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04eventConsumerTest.java similarity index 73% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer04eventconsumer/Transfer04eventConsumerTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04eventConsumerTest.java index 9817dd51..aa200722 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/transfer04eventconsumer/Transfer04eventConsumerTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04eventConsumerTest.java @@ -9,10 +9,11 @@ * * Contributors: * Microsoft Corporation - initial test implementation for sample + * Mercedes-Benz Tech Innovation GmbH - refactor test cases * */ -package org.eclipse.edc.samples.transfer.transfer04eventconsumer; +package org.eclipse.edc.samples.transfer; import org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates; import org.eclipse.edc.junit.annotations.EndToEndTest; @@ -27,14 +28,14 @@ import java.io.PrintStream; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.HttpRequestLoggerUtil.getHttpRequestLoggerContainer; -import static org.eclipse.edc.samples.transfer.TransferUtil.checkTransferStatus; -import static org.eclipse.edc.samples.transfer.TransferUtil.startTransfer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getConsumer; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.getProvider; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.runPrerequisites; -import static org.eclipse.edc.samples.transfer.transfer01negotiation.NegotiationCommon.runNegotiation; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.NegotiationCommon.runNegotiation; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites; +import static org.eclipse.edc.samples.util.HttpRequestLoggerUtil.getHttpRequestLoggerContainer; +import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus; +import static org.eclipse.edc.samples.util.TransferUtil.startTransfer; @EndToEndTest public class Transfer04eventConsumerTest { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming01httpToHttpTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming01httpToHttpTest.java index 7c0cbd06..12b70552 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming01httpToHttpTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming01httpToHttpTest.java @@ -37,8 +37,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; import static org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates.STARTED; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath; @EndToEndTest public class Streaming01httpToHttpTest { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming02KafkaToHttpTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming02KafkaToHttpTest.java index ac1334d1..de876440 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming02KafkaToHttpTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/transfer/streaming/Streaming02KafkaToHttpTest.java @@ -44,8 +44,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; import static org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates.STARTED; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileContentFromRelativePath; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath; @Testcontainers @EndToEndTest diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/HttpRequestLoggerConsumer.java b/system-tests/src/test/java/org/eclipse/edc/samples/util/HttpRequestLoggerConsumer.java similarity index 95% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/HttpRequestLoggerConsumer.java rename to system-tests/src/test/java/org/eclipse/edc/samples/util/HttpRequestLoggerConsumer.java index a6f3e7fc..687612d7 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/HttpRequestLoggerConsumer.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/util/HttpRequestLoggerConsumer.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.transfer; +package org.eclipse.edc.samples.util; import org.testcontainers.containers.output.ToStringConsumer; diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/HttpRequestLoggerUtil.java b/system-tests/src/test/java/org/eclipse/edc/samples/util/HttpRequestLoggerUtil.java similarity index 91% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/HttpRequestLoggerUtil.java rename to system-tests/src/test/java/org/eclipse/edc/samples/util/HttpRequestLoggerUtil.java index 3cd22531..23a55532 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/HttpRequestLoggerUtil.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/util/HttpRequestLoggerUtil.java @@ -12,13 +12,13 @@ * */ -package org.eclipse.edc.samples.transfer; +package org.eclipse.edc.samples.util; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.output.ToStringConsumer; import org.testcontainers.containers.wait.strategy.Wait; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.getFileFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath; public class HttpRequestLoggerUtil { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/TransferUtil.java b/system-tests/src/test/java/org/eclipse/edc/samples/util/TransferUtil.java similarity index 92% rename from system-tests/src/test/java/org/eclipse/edc/samples/transfer/TransferUtil.java rename to system-tests/src/test/java/org/eclipse/edc/samples/util/TransferUtil.java index 545ed8ec..34189abe 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/transfer/TransferUtil.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/util/TransferUtil.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.transfer; +package org.eclipse.edc.samples.util; import io.restassured.http.ContentType; import org.apache.http.HttpStatus; @@ -22,9 +22,9 @@ import static io.restassured.RestAssured.given; import static org.awaitility.Awaitility.await; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.API_KEY_HEADER_KEY; -import static org.eclipse.edc.samples.transfer.FileTransferCommon.API_KEY_HEADER_VALUE; -import static org.eclipse.edc.samples.transfer.transfer00prerequisites.PrerequisitesCommon.CONSUMER_MANAGEMENT_URL; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_KEY; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_VALUE; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.CONSUMER_MANAGEMENT_URL; import static org.hamcrest.Matchers.emptyString; import static org.hamcrest.Matchers.not; diff --git a/transfer/transfer-00-prerequisites/README.md b/transfer/transfer-00-prerequisites/README.md index 2cfb19f7..4e8a968d 100644 --- a/transfer/transfer-00-prerequisites/README.md +++ b/transfer/transfer-00-prerequisites/README.md @@ -16,7 +16,6 @@ This sample will go through: * Running the provider connector * Running the consumer connector * Registering data plane instance for the provider connector -* Registering data plane instance for the consumer connector ## Run the sample @@ -92,16 +91,6 @@ curl -H 'Content-Type: application/json' \ -X POST "http://localhost:19193/management/v2/dataplanes" | -s | jq ``` -### 4. Register data plane instance for consumer - -The same thing that is done for the provider must be done for the consumer - -```bash -curl -H 'Content-Type: application/json' \ - -d @transfer/transfer-00-prerequisites/resources/dataplane/register-data-plane-consumer.json \ - -X POST "http://localhost:29193/management/v2/dataplanes" -``` - The connectors have been configured successfully and are ready to be used. [Next Chapter](../transfer-01-negotiation/README.md) \ No newline at end of file diff --git a/transfer/transfer-04-event-consumer/README.md b/transfer/transfer-04-event-consumer/README.md index e82295a8..85952ce9 100644 --- a/transfer/transfer-04-event-consumer/README.md +++ b/transfer/transfer-04-event-consumer/README.md @@ -67,17 +67,7 @@ Run this to build and launch the consumer with listener extension: java -Dedc.keystore=transfer/transfer-00-prerequisites/resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.vault=transfer/transfer-00-prerequisites/resources/configuration/consumer-vault.properties -Dedc.fs.config=transfer/transfer-00-prerequisites/resources/configuration/consumer-configuration.properties -jar transfer/transfer-04-event-consumer/consumer-with-listener/build/libs/connector.jar ```` -### 2. Register data plane instance for consumer - -The data plane has to be registered again for the consumer connector. - -```bash -curl -H 'Content-Type: application/json' \ - -d @transfer/transfer-00-prerequisites/resources/dataplane/register-data-plane-consumer.json \ - -X POST "http://localhost:29193/management/v2/dataplanes" -``` - -### 3. Negotiate a new contract +### 2. Negotiate a new contract ```bash curl -d @transfer/transfer-01-negotiation/resources/negotiate-contract.json \ @@ -85,7 +75,7 @@ curl -d @transfer/transfer-01-negotiation/resources/negotiate-contract.json \ -s | jq ``` -### 4. Get the contract agreement id +### 3. Get the contract agreement id ```bash curl -X GET "http://localhost:29193/management/v2/contractnegotiations/" \ @@ -93,7 +83,7 @@ curl -X GET "http://localhost:29193/management/v2/contractnegotiations/