-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: working sample 04 * test: added test for docker compose sample * style: cosmetic changes * test: temporarily disable progress checking of transfer * docs: added explanation for commented line * test: download OpenTelemetry Jar before test execution * gradle: download OpenTelemetry before build step * removing container name from prometheus as it's not supported by testcontainers * fixed typo in libs.versions.toml * copy opentelemetry jar from gradle cache * fixed default sample tests for sample 04 * fixed build process * asserting Jaeger state OK in telemetry test * fix: fixing wrong testcontainer reference in .toml file * fix: running gradle build before test * fix: removing gradle build before test for github action --------- Co-authored-by: Matthias De Geyter <[email protected]>
- Loading branch information
1 parent
cd92e2f
commit 7d09846
Showing
12 changed files
with
212 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
system-tests/src/test/java/org/eclipse/edc/samples/transfer/Transfer04openTelemetryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Mercedes-Benz Tech Innovation GmbH - Sample workflow test | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.samples.transfer; | ||
|
||
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.Testcontainers; | ||
|
||
import java.io.IOException; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.fail; | ||
|
||
@EndToEndTest | ||
@Testcontainers | ||
public class Transfer04openTelemetryTest { | ||
|
||
private static final String SAMPLE_FOLDER = "transfer/transfer-04-open-telemetry"; | ||
private static final String DOCKER_COMPOSE_YAML = "/docker-compose.yaml"; | ||
private static final String SAMPLE_ASSET_FILE_PATH = SAMPLE_FOLDER + "/README.md"; | ||
private static final String DESTINATION_FILE_PATH = SAMPLE_FOLDER + "/README_transferred.md"; | ||
private static final String CONTRACT_OFFER_FILE_PATH = SAMPLE_FOLDER + "/contractoffer.json"; | ||
private static final String FILE_TRANSFER_FILE_PATH = SAMPLE_FOLDER + "/filetransfer.json"; | ||
private static final String JAEGER_URL = "http://localhost:16686"; | ||
|
||
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)) | ||
.withLocalCompose(true) | ||
.waitingFor("consumer", Wait.forLogMessage(".*ready.*", 1)); | ||
|
||
@BeforeAll | ||
static void setUp() { | ||
environment.start(); | ||
} | ||
|
||
@Test | ||
void runSampleSteps() throws Exception { | ||
testUtils.assertTestPrerequisites(); | ||
testUtils.initiateContractNegotiation(CONTRACT_OFFER_FILE_PATH); | ||
testUtils.lookUpContractAgreementId(); | ||
var transferProcessId = testUtils.requestTransferFile(FILE_TRANSFER_FILE_PATH); | ||
testUtils.assertDestinationFileContent(); | ||
testUtils.assertTransferProcessStatusConsumerSide(transferProcessId); | ||
assertJaegerState(); | ||
} | ||
|
||
private void assertJaegerState() { | ||
try { | ||
var url = new URL(JAEGER_URL); | ||
var huc = (HttpURLConnection) url.openConnection(); | ||
assertThat(huc.getResponseCode()).isEqualTo(HttpStatus.SC_OK); | ||
} catch (IOException e) { | ||
fail("Unable to assert Jaeger state", e); | ||
} | ||
} | ||
|
||
@AfterEach | ||
protected void tearDown() { | ||
testUtils.cleanTemporaryTestFiles(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,24 @@ | ||
{ | ||
"@context": { | ||
"edc": "https://w3id.org/edc/v0.0.1/ns/", | ||
"odrl": "http://www.w3.org/ns/odrl/2/" | ||
}, | ||
"@type": "NegotiationInitiateRequestDto", | ||
"connectorId": "provider", | ||
"consumerId": "consumer", | ||
"providerId": "provider", | ||
"connectorAddress": "http://provider:8282/protocol", | ||
"protocol": "dataspace-protocol-http", | ||
"offer": { | ||
"offerId": "1:3a75736e-001d-4364-8bd4-9888490edb58", | ||
"offerId": "1:test-document:3a75736e-001d-4364-8bd4-9888490edb58", | ||
"assetId": "test-document", | ||
"policy": { | ||
"uid": "956e172f-2de1-4501-8881-057a57fd0e69", | ||
"permissions": [ | ||
{ | ||
"edctype": "dataspaceconnector:permission", | ||
"uid": null, | ||
"target": "test-document", | ||
"action": { | ||
"type": "USE", | ||
"includedIn": null, | ||
"constraint": null | ||
}, | ||
"assignee": null, | ||
"assigner": null, | ||
"constraints": [], | ||
"duties": [] | ||
} | ||
], | ||
"prohibitions": [], | ||
"obligations": [], | ||
"extensibleProperties": {}, | ||
"inheritsFrom": null, | ||
"assigner": null, | ||
"assignee": null, | ||
"target": null, | ||
"@type": { | ||
"@policytype": "set" | ||
} | ||
}, | ||
"asset": { | ||
"properties": { | ||
"asset:prop:id": "test-document" | ||
} | ||
"@id": "1:test-document:13dce0f1-52ed-4554-a194-e83e92733ee5", | ||
"@type": "set", | ||
"odrl:permission": [], | ||
"odrl:prohibition": [], | ||
"odrl:obligation": [], | ||
"odrl:target": "test-document" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{ | ||
"@context": { | ||
"edc": "https://w3id.org/edc/v0.0.1/ns/" | ||
}, | ||
"@type": "TransferRequestDto", | ||
"dataDestination": { | ||
"type": "File", | ||
"path": "/samples/transfer-04-open-telemetry/README_transferred.md", | ||
"keyName": "keyName" | ||
}, | ||
"protocol": "dataspace-protocol-http", | ||
"assetId": "test-document", | ||
"contractId": "{agreement ID}", | ||
"dataDestination": { | ||
"path": "/samples/output-file.txt", | ||
"keyName": "keyName", | ||
"type": "File" | ||
}, | ||
"transferType": { | ||
"contentType": "application/octet-stream", | ||
"isFinite": true | ||
}, | ||
"connectorId": "provider", | ||
"connectorAddress": "http://provider:8282/protocol", | ||
"connectorId": "consumer" | ||
"privateProperties": {} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.