From 1e0551e830c74159460b64c34e718504b85d2f26 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Tue, 21 Mar 2023 17:03:14 +0100 Subject: [PATCH 01/14] refactor: refactor tests --- .github/workflows/build.yaml | 104 +++--------- .github/workflows/verify.yaml | 156 ++++++++++++++++++ ...usinessPartnerValidationExtensionTest.java | 107 ++++++------ .../control-plane-adapter/build.gradle.kts | 1 + ...ationServiceExtensionEdcExtensionTest.java | 7 +- .../hashicorpvault/AbstractHashicorpIT.java | 23 +-- .../TxObservabilityApiControllerTest.java | 4 +- .../TxObservabilityApiExtensionTest.java | 2 + ...ovisionAdditionalHeadersExtensionTest.java | 14 +- 9 files changed, 271 insertions(+), 147 deletions(-) create mode 100644 .github/workflows/verify.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 86162f6f9..7668f582a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,23 +2,33 @@ name: "Build" on: - push: - branches: - - main - - develop - tags: - - '[0-9]+.[0-9]+.[0-9]+' - release: - types: - - published - pull_request: +# push: +# branches: +# - main +# - develop +# tags: +# - '[0-9]+.[0-9]+.[0-9]+' +# release: +# types: +# - published +# pull_request: +# paths-ignore: +# - 'charts/**' +# - 'docs/**' +# - '**/*.md' +# branches: +# - '*' +# workflow_dispatch: + workflow_run: + workflows: ["Verify"] paths-ignore: - 'charts/**' - 'docs/**' - '**/*.md' branches: - '*' - workflow_dispatch: + types: + - completed concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -26,6 +36,7 @@ concurrency: jobs: secret-presence: + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest outputs: SONAR_TOKEN: ${{ steps.secret-presence.outputs.SONAR_TOKEN }} @@ -41,74 +52,9 @@ jobs: [ ! -z "${{ secrets.GPG_PASSPHRASE }}" ] && echo "::set-output name=GPG_PASSPHRASE::true" exit 0 - verify-formatting: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v3.3.0 - - - - name: Set up JDK 11 - uses: actions/setup-java@v3.10.0 - with: - java-version: '11' - distribution: 'adopt' - cache: 'gradle' - - - name: Verify proper formatting - run: ./gradlew spotlessCheck - - - name: Run Checkstyle - run: | - ./gradlew checkstyleMain checkstyleTest - echo "Running Checkstyle is currently a placeholder" - - sonar: - needs: [ secret-presence, verify-formatting ] - if: | - needs.secret-presence.outputs.SONAR_TOKEN - runs-on: ubuntu-latest - steps: - # Set-Up - - - name: Checkout - uses: actions/checkout@v3.3.0 - with: - fetch-depth: 0 - - - name: Set up JDK 11 - uses: actions/setup-java@v3.10.0 - with: - java-version: '11' - distribution: 'adopt' - cache: 'gradle' - - - name: Cache SonarCloud packages - uses: actions/cache@v3 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - # Analyse - - - name: Build with Maven and analyze with Sonar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - JACOCO: true - run: |- - ./gradlew sonar \ - -Pcoverage,failsafe \ - -Dsonar.projectKey=${GITHUB_REPOSITORY_OWNER}_product-edc \ - -Dsonar.organization=${GITHUB_REPOSITORY_OWNER} \ - -Dsonar.host.url=https://sonarcloud.io \ - -Dsonar.coverage.jacoco.xmlReportPaths=${GITHUB_WORKSPACE}/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml \ - -Dsonar.verbose=true - build-extensions: runs-on: ubuntu-latest - needs: [ secret-presence, verify-formatting ] + needs: [ secret-presence] steps: # Set-Up - @@ -135,7 +81,7 @@ jobs: permissions: contents: read packages: write - needs: [ secret-presence, verify-formatting ] + needs: [ secret-presence] strategy: fail-fast: false matrix: @@ -204,7 +150,7 @@ jobs: permissions: contents: read packages: write - needs: [ secret-presence, verify-formatting ] + needs: [ secret-presence] strategy: fail-fast: false matrix: diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml new file mode 100644 index 000000000..15f954e88 --- /dev/null +++ b/.github/workflows/verify.yaml @@ -0,0 +1,156 @@ +--- +name: "Verify" + +on: + push: + branches: + - main + - develop + tags: + - '[0-9]+.[0-9]+.[0-9]+' + release: + types: + - published + pull_request: + paths-ignore: + - 'charts/**' + - 'docs/**' + - '**/*.md' + branches: + - '*' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + secret-presence: + runs-on: ubuntu-latest + outputs: + SONAR_TOKEN: ${{ steps.secret-presence.outputs.SONAR_TOKEN }} + steps: + - + name: Check whether secrets exist + id: secret-presence + run: | + [ ! -z "${{ secrets.SONAR_TOKEN }}" ] && echo "::set-output name=SONAR_TOKEN::true" + exit 0 + + verify-formatting: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3.3.0 + + - + name: Set up JDK 11 + uses: actions/setup-java@v3.10.0 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + - + name: Verify proper formatting + run: ./gradlew spotlessCheck + + - name: Run Checkstyle + run: | + ./gradlew checkstyleMain checkstyleTest + echo "Running Checkstyle is currently a placeholder" + + unit-tests: + runs-on: ubuntu-latest + needs: [verify-formatting] + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + + - name: Set up JDK 11 + uses: actions/setup-java@v3.10.0 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + + - name: Run Unit tests + run: ./gradlew test + + integration-tests: + runs-on: ubuntu-latest + needs: [verify-formatting] + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + + - name: Set up JDK 11 + uses: actions/setup-java@v3.10.0 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + + - name: Run Integration tests + run: ./gradlew test -DincludeTags="ComponentTest" + + api-tests: + runs-on: ubuntu-latest + needs: [verify-formatting] + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + + - name: Set up JDK 11 + uses: actions/setup-java@v3.10.0 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + + - name: Run API tests + run: ./gradlew test -DincludeTags="ApiTest" + + sonar: + needs: [ secret-presence, verify-formatting ] + if: | + needs.secret-presence.outputs.SONAR_TOKEN + runs-on: ubuntu-latest + steps: + # Set-Up + - + name: Checkout + uses: actions/checkout@v3.3.0 + with: + fetch-depth: 0 + - + name: Set up JDK 11 + uses: actions/setup-java@v3.10.0 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + - + name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + # Analyse + - + name: Build with Maven and analyze with Sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + JACOCO: true + run: |- + ./gradlew sonar \ + -Pcoverage,failsafe \ + -Dsonar.projectKey=${GITHUB_REPOSITORY_OWNER}_product-edc \ + -Dsonar.organization=${GITHUB_REPOSITORY_OWNER} \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.coverage.jacoco.xmlReportPaths=${GITHUB_WORKSPACE}/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml \ + -Dsonar.verbose=true + + diff --git a/edc-extensions/business-partner-validation/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtensionTest.java b/edc-extensions/business-partner-validation/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtensionTest.java index 732379fc2..0240dc9ef 100644 --- a/edc-extensions/business-partner-validation/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtensionTest.java +++ b/edc-extensions/business-partner-validation/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtensionTest.java @@ -31,71 +31,78 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + class BusinessPartnerValidationExtensionTest { - private BusinessPartnerValidationExtension extension; + private BusinessPartnerValidationExtension extension; - // mocks - private ServiceExtensionContext serviceExtensionContext; - private PolicyEngine policyEngine; - private RuleBindingRegistry ruleBindingRegistry; + // mocks + private ServiceExtensionContext serviceExtensionContext; + private PolicyEngine policyEngine; + private RuleBindingRegistry ruleBindingRegistry; - @BeforeEach - void setup() { + @BeforeEach + void setup() { - policyEngine = Mockito.mock(PolicyEngine.class); - ruleBindingRegistry = Mockito.mock(RuleBindingRegistry.class); + policyEngine = mock(PolicyEngine.class); + ruleBindingRegistry = mock(RuleBindingRegistry.class); - final Monitor monitor = Mockito.mock(Monitor.class); - serviceExtensionContext = Mockito.mock(ServiceExtensionContext.class); + var monitor = mock(Monitor.class); + serviceExtensionContext = mock(ServiceExtensionContext.class); - Mockito.when(serviceExtensionContext.getMonitor()).thenReturn(monitor); + when(serviceExtensionContext.getMonitor()).thenReturn(monitor); - extension = new BusinessPartnerValidationExtension(ruleBindingRegistry, policyEngine); - } + extension = new BusinessPartnerValidationExtension(ruleBindingRegistry, policyEngine); + } - @Test - void testRegisterDutyFunction() { + @Test + void testRegisterDutyFunction() { - // invoke - extension.initialize(serviceExtensionContext); + // invoke + extension.initialize(serviceExtensionContext); - // verify - Mockito.verify(policyEngine, Mockito.times(1)) - .registerFunction( - Mockito.anyString(), - Mockito.eq(Duty.class), - Mockito.eq(BusinessPartnerValidationExtension.BUSINESS_PARTNER_CONSTRAINT_KEY), - Mockito.any()); - } + // verify + verify(policyEngine) + .registerFunction( + anyString(), + eq(Duty.class), + eq(BusinessPartnerValidationExtension.BUSINESS_PARTNER_CONSTRAINT_KEY), + any()); + } - @Test - void testRegisterPermissionFunction() { + @Test + void testRegisterPermissionFunction() { - // invoke - extension.initialize(serviceExtensionContext); + // invoke + extension.initialize(serviceExtensionContext); - // verify - Mockito.verify(policyEngine, Mockito.times(1)) - .registerFunction( - Mockito.anyString(), - Mockito.eq(Permission.class), - Mockito.eq(BusinessPartnerValidationExtension.BUSINESS_PARTNER_CONSTRAINT_KEY), - Mockito.any()); - } + // verify + verify(policyEngine, Mockito.times(1)) + .registerFunction( + anyString(), + eq(Permission.class), + eq(BusinessPartnerValidationExtension.BUSINESS_PARTNER_CONSTRAINT_KEY), + any()); + } - @Test - void testRegisterProhibitionFunction() { + @Test + void testRegisterProhibitionFunction() { - // invoke - extension.initialize(serviceExtensionContext); + // invoke + extension.initialize(serviceExtensionContext); - // verify - Mockito.verify(policyEngine, Mockito.times(1)) - .registerFunction( - Mockito.anyString(), - Mockito.eq(Prohibition.class), - Mockito.eq(BusinessPartnerValidationExtension.BUSINESS_PARTNER_CONSTRAINT_KEY), - Mockito.any()); - } + // verify + verify(policyEngine, Mockito.times(1)) + .registerFunction( + anyString(), + eq(Prohibition.class), + eq(BusinessPartnerValidationExtension.BUSINESS_PARTNER_CONSTRAINT_KEY), + any()); + } } diff --git a/edc-extensions/control-plane-adapter/build.gradle.kts b/edc-extensions/control-plane-adapter/build.gradle.kts index 715b5da74..02f7b0339 100644 --- a/edc-extensions/control-plane-adapter/build.gradle.kts +++ b/edc-extensions/control-plane-adapter/build.gradle.kts @@ -22,4 +22,5 @@ dependencies { implementation(edc.spi.aggregateservices) + testImplementation(libs.awaitility) } diff --git a/edc-extensions/dataplane-selector-configuration/src/test/java/org/eclipse/tractusx/edc/dataplane/selector/configuration/DataPlaneSelectorConfigurationServiceExtensionEdcExtensionTest.java b/edc-extensions/dataplane-selector-configuration/src/test/java/org/eclipse/tractusx/edc/dataplane/selector/configuration/DataPlaneSelectorConfigurationServiceExtensionEdcExtensionTest.java index fef84076a..278e2493e 100644 --- a/edc-extensions/dataplane-selector-configuration/src/test/java/org/eclipse/tractusx/edc/dataplane/selector/configuration/DataPlaneSelectorConfigurationServiceExtensionEdcExtensionTest.java +++ b/edc-extensions/dataplane-selector-configuration/src/test/java/org/eclipse/tractusx/edc/dataplane/selector/configuration/DataPlaneSelectorConfigurationServiceExtensionEdcExtensionTest.java @@ -20,9 +20,8 @@ package org.eclipse.tractusx.edc.dataplane.selector.configuration; -import java.util.HashMap; -import java.util.Map; import org.eclipse.edc.connector.dataplane.selector.spi.DataPlaneSelectorService; +import org.eclipse.edc.junit.annotations.ComponentTest; import org.eclipse.edc.junit.extensions.EdcExtension; import org.eclipse.edc.runtime.metamodel.annotation.Provides; import org.eclipse.edc.spi.system.ServiceExtension; @@ -33,6 +32,10 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; +import java.util.HashMap; +import java.util.Map; + +@ComponentTest @ExtendWith(EdcExtension.class) class DataPlaneSelectorConfigurationServiceExtensionEdcExtensionTest { diff --git a/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpIT.java b/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpIT.java index e196cd27d..084cc158a 100644 --- a/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpIT.java +++ b/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpIT.java @@ -20,17 +20,8 @@ package org.eclipse.tractusx.edc.hashicorpvault; -import static org.eclipse.tractusx.edc.hashicorpvault.HashicorpVaultClient.VAULT_DATA_ENTRY_NAME; -import static org.eclipse.tractusx.edc.hashicorpvault.HashicorpVaultVaultExtension.VAULT_TOKEN; -import static org.eclipse.tractusx.edc.hashicorpvault.HashicorpVaultVaultExtension.VAULT_URL; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; import lombok.Getter; +import org.eclipse.edc.junit.annotations.ComponentTest; import org.eclipse.edc.junit.extensions.EdcExtension; import org.eclipse.edc.spi.security.CertificateResolver; import org.eclipse.edc.spi.security.Vault; @@ -50,6 +41,18 @@ import org.testcontainers.utility.DockerImageName; import org.testcontainers.vault.VaultContainer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import static org.eclipse.tractusx.edc.hashicorpvault.HashicorpVaultClient.VAULT_DATA_ENTRY_NAME; +import static org.eclipse.tractusx.edc.hashicorpvault.HashicorpVaultVaultExtension.VAULT_TOKEN; +import static org.eclipse.tractusx.edc.hashicorpvault.HashicorpVaultVaultExtension.VAULT_URL; + +@ComponentTest @Testcontainers @ExtendWith(EdcExtension.class) class AbstractHashicorpIT { diff --git a/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java b/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java index 2b2ba0596..2d0c1f570 100644 --- a/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java +++ b/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java @@ -22,6 +22,7 @@ import org.eclipse.edc.connector.spi.contractnegotiation.ContractNegotiationService; import org.eclipse.edc.connector.spi.policydefinition.PolicyDefinitionService; import org.eclipse.edc.connector.spi.transferprocess.TransferProcessService; +import org.eclipse.edc.junit.annotations.ApiTest; import org.eclipse.edc.junit.extensions.EdcExtension; import org.eclipse.edc.spi.asset.DataAddressResolver; import org.junit.jupiter.api.BeforeEach; @@ -38,8 +39,7 @@ import static org.hamcrest.Matchers.notNullValue; import static org.mockito.Mockito.mock; -//todo: uncomment after test refactoring -//@ApiTest +@ApiTest @ExtendWith(EdcExtension.class) public class TxObservabilityApiControllerTest { diff --git a/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiExtensionTest.java b/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiExtensionTest.java index c6a2d2d7f..85a1dba77 100644 --- a/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiExtensionTest.java +++ b/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiExtensionTest.java @@ -14,6 +14,7 @@ package org.eclipse.tractusx.edc.api.observability; +import org.eclipse.edc.junit.annotations.ComponentTest; import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.health.HealthCheckService; @@ -32,6 +33,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; +@ComponentTest @ExtendWith(DependencyInjectionExtension.class) class TxObservabilityApiExtensionTest { diff --git a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java index 205b3c75c..72d68b631 100644 --- a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java +++ b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java @@ -20,14 +20,11 @@ package org.eclipse.tractusx.edc.provision.additionalheaders; -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.awaitility.Awaitility.await; -import static org.mockito.Mockito.*; - import org.eclipse.edc.connector.transfer.spi.TransferProcessManager; import org.eclipse.edc.connector.transfer.spi.flow.DataFlowController; import org.eclipse.edc.connector.transfer.spi.flow.DataFlowManager; import org.eclipse.edc.connector.transfer.spi.types.DataRequest; +import org.eclipse.edc.junit.annotations.ComponentTest; import org.eclipse.edc.junit.extensions.EdcExtension; import org.eclipse.edc.spi.asset.AssetIndex; import org.eclipse.edc.spi.response.StatusResult; @@ -37,6 +34,15 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.awaitility.Awaitility.await; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@ComponentTest @ExtendWith(EdcExtension.class) class ProvisionAdditionalHeadersExtensionTest { From 9e6b8d4618a0c0cb3440ba9a876c0b948e50c0f7 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Tue, 21 Mar 2023 18:00:42 +0100 Subject: [PATCH 02/14] workflow_run: workflows: ["Verify"] paths-ignore: - 'charts/**' - 'docs/**' - '**/*.md' branches: - '*' types: - completedstart build and verify simultaneously --- .github/workflows/build.yaml | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7668f582a..0c58c7b8a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,33 +2,24 @@ name: "Build" on: -# push: -# branches: -# - main -# - develop -# tags: -# - '[0-9]+.[0-9]+.[0-9]+' -# release: -# types: -# - published -# pull_request: -# paths-ignore: -# - 'charts/**' -# - 'docs/**' -# - '**/*.md' -# branches: -# - '*' -# workflow_dispatch: - workflow_run: - workflows: ["Verify"] + push: + branches: + - main + - develop + tags: + - '[0-9]+.[0-9]+.[0-9]+' + release: + types: + - published + pull_request: paths-ignore: - 'charts/**' - 'docs/**' - '**/*.md' branches: - '*' - types: - - completed + workflow_dispatch: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -36,7 +27,6 @@ concurrency: jobs: secret-presence: - if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest outputs: SONAR_TOKEN: ${{ steps.secret-presence.outputs.SONAR_TOKEN }} @@ -217,7 +207,7 @@ jobs: permissions: contents: read packages: write - needs: [secret-presence, verify-formatting, build-controlplane, build-dataplane, build-extensions] + needs: [secret-presence, build-controlplane, build-dataplane, build-extensions] # do not run on PR branches, do not run on main if: | From 6352436bf0a3177471b1804a1cce24a8015e36ab Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Wed, 22 Mar 2023 20:13:03 +0100 Subject: [PATCH 03/14] feat: refactor tests, introduce jvm-based e2e tests --- .github/workflows/business-tests.yaml | 10 +- build.gradle.kts | 7 + .../BusinessPartnerValidationExtension.java | 4 +- edc-tests/{ => cucumber}/README.md | 2 + edc-tests/{ => cucumber}/build.gradle.kts | 0 .../deployment/helm/omejdn/.helmignore | 0 .../deployment/helm/omejdn/Chart.yaml | 0 .../deployment/helm/omejdn/README.md | 0 .../helm/omejdn/templates/_helpers.tpl | 0 .../helm/omejdn/templates/configmap.yaml | 0 .../helm/omejdn/templates/deployment.yaml | 0 .../deployment/helm/omejdn/templates/hpa.yaml | 0 .../omejdn/templates/imagepullsecret.yaml | 0 .../helm/omejdn/templates/service.yaml | 0 .../helm/omejdn/templates/serviceaccount.yaml | 0 .../deployment/helm/omejdn/values.yaml | 0 .../helm/supporting-infrastructure/.gitignore | 0 .../supporting-infrastructure/.helmignore | 0 .../helm/supporting-infrastructure/Chart.yaml | 0 .../helm/supporting-infrastructure/README.md | 0 .../diagrams/deployed_components.png | Bin .../diagrams/deployed_components.puml | 0 .../supporting-infrastructure/values.yaml | 0 .../tractusx/edc/tests/AssetStepDefs.java | 0 .../edc/tests/BackendServiceBackendAPI.java | 0 .../edc/tests/BackendServiceSteps.java | 0 .../tractusx/edc/tests/CatalogStepDefs.java | 0 .../eclipse/tractusx/edc/tests/Connector.java | 0 .../tractusx/edc/tests/ConnectorFactory.java | 0 .../tractusx/edc/tests/ConnectorSteps.java | 0 .../eclipse/tractusx/edc/tests/Constants.java | 0 .../edc/tests/ContractDefinitionStepDefs.java | 0 .../edc/tests/ControlPlaneAdapterSteps.java | 0 .../tractusx/edc/tests/DataManagementAPI.java | 0 .../tractusx/edc/tests/Environment.java | 0 .../edc/tests/HttpProxyTransferSteps.java | 0 .../tractusx/edc/tests/NegotiationSteps.java | 0 .../tractusx/edc/tests/PolicyStepDefs.java | 0 .../edc/tests/S3FileTransferStepsDefs.java | 0 .../tractusx/edc/tests/data/Asset.java | 0 .../data/BusinessPartnerNumberConstraint.java | 0 .../tractusx/edc/tests/data/Constraint.java | 0 .../edc/tests/data/ContractDefinition.java | 0 .../edc/tests/data/ContractNegotiation.java | 0 .../tests/data/ContractNegotiationState.java | 0 .../edc/tests/data/ContractOffer.java | 0 .../tractusx/edc/tests/data/DataAddress.java | 0 .../tests/data/HttpProxySinkDataAddress.java | 0 .../data/HttpProxySourceDataAddress.java | 0 .../tractusx/edc/tests/data/Negotiation.java | 0 .../edc/tests/data/NullDataAddress.java | 0 .../tractusx/edc/tests/data/OrConstraint.java | 0 .../edc/tests/data/PayMeConstraint.java | 0 .../tractusx/edc/tests/data/Permission.java | 0 .../tractusx/edc/tests/data/Policy.java | 0 .../edc/tests/data/S3DataAddress.java | 0 .../tractusx/edc/tests/data/Transfer.java | 0 .../edc/tests/data/TransferProcess.java | 0 .../edc/tests/data/TransferProcessState.java | 0 .../edc/tests/features/ParameterTypes.java | 0 .../edc/tests/features/RunCucumberTest.java | 0 .../edc/tests/util/DatabaseCleaner.java | 0 .../tractusx/edc/tests/util/S3Client.java | 0 .../tractusx/edc/tests/util/Timeouts.java | 0 .../test/resources/junit-platform.properties | 0 .../src/test/resources/logback-test.xml | 0 .../features/ContractNegotiation.feature | 0 .../edc/tests/features/ContractOffers.feature | 0 .../tests/features/EndToEndTransfer.feature | 0 .../features/HttpProxyDataTransfer.feature | 0 .../edc/tests/features/S3FileTransfer.feature | 0 edc-tests/e2e-tests/README.md | 1 + edc-tests/e2e-tests/build.gradle.kts | 18 +++ .../edc/policy/PolicyHelperFunctions.java | 38 ++++++ .../tractusx/edc/tests/CatalogTest.java | 96 ++++++++++++++ .../tractusx/edc/tests/MultiRuntimeTest.java | 62 +++++++++ .../tractusx/edc/tests/Participant.java | 121 ++++++++++++++++++ .../edc/tests/TestRuntimeConfiguration.java | 38 ++++++ .../edc/token/TestIdentityService.java | 42 ++++++ edc-tests/runtime/README.md | 1 + edc-tests/runtime/build.gradle.kts | 42 ++++++ settings.gradle.kts | 11 +- 82 files changed, 485 insertions(+), 8 deletions(-) rename edc-tests/{ => cucumber}/README.md (85%) rename edc-tests/{ => cucumber}/build.gradle.kts (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/.helmignore (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/Chart.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/README.md (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/service.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/omejdn/values.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/README.md (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.png (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.puml (100%) rename edc-tests/{ => cucumber}/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceBackendAPI.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/Asset.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/BusinessPartnerNumberConstraint.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/Constraint.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractDefinition.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiation.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiationState.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractOffer.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/DataAddress.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySinkDataAddress.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySourceDataAddress.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/Negotiation.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/NullDataAddress.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/OrConstraint.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/PayMeConstraint.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/Permission.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/Policy.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/S3DataAddress.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/Transfer.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcess.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcessState.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/features/ParameterTypes.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/features/RunCucumberTest.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/util/DatabaseCleaner.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/util/S3Client.java (100%) rename edc-tests/{ => cucumber}/src/test/java/org/eclipse/tractusx/edc/tests/util/Timeouts.java (100%) rename edc-tests/{ => cucumber}/src/test/resources/junit-platform.properties (100%) rename edc-tests/{ => cucumber}/src/test/resources/logback-test.xml (100%) rename edc-tests/{ => cucumber}/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractNegotiation.feature (100%) rename edc-tests/{ => cucumber}/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractOffers.feature (100%) rename edc-tests/{ => cucumber}/src/test/resources/org/eclipse/tractusx/edc/tests/features/EndToEndTransfer.feature (100%) rename edc-tests/{ => cucumber}/src/test/resources/org/eclipse/tractusx/edc/tests/features/HttpProxyDataTransfer.feature (100%) rename edc-tests/{ => cucumber}/src/test/resources/org/eclipse/tractusx/edc/tests/features/S3FileTransfer.feature (100%) create mode 100644 edc-tests/e2e-tests/README.md create mode 100644 edc-tests/e2e-tests/build.gradle.kts create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java create mode 100644 edc-tests/runtime/README.md create mode 100644 edc-tests/runtime/build.gradle.kts diff --git a/.github/workflows/business-tests.yaml b/.github/workflows/business-tests.yaml index df433b648..236bfdca8 100644 --- a/.github/workflows/business-tests.yaml +++ b/.github/workflows/business-tests.yaml @@ -133,10 +133,10 @@ jobs: retry_on: error command: |- # Update helm dependencies - helm dependency update edc-tests/src/main/resources/deployment/helm/supporting-infrastructure + helm dependency update edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure # Install the all-in-one supporting infrastructure environment (daps, vault, pgsql, minio) - helm install infrastructure edc-tests/src/main/resources/deployment/helm/supporting-infrastructure \ + helm install infrastructure edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure \ --wait-for-jobs --timeout=120s # GH pipelines constrained by cpu, so give helm some time to register all resources \w k8s @@ -240,7 +240,7 @@ jobs: { "args": [ "-c", - "cd /product-edc && ./gradlew edc-tests:test -Dcucumber=true" + "cd /product-edc && ./gradlew edc-tests:cucumber:test -Dcucumber=true" ], "command": [ "/bin/sh" @@ -276,7 +276,7 @@ jobs: cat << EOF >> pod.json "image": "openjdk:11-jdk-slim", - "name": "edc-tests", + "name": "edc-tests-cucumber", "volumeMounts": [ { "mountPath": "/product-edc", @@ -309,7 +309,7 @@ jobs: } EOF - kubectl run -i --image=openjdk:11-jdk-slim --restart=Never --rm edc-tests --overrides="$(cat pod.json)" + kubectl run -i --image=openjdk:11-jdk-slim --restart=Never --rm edc-tests-cucumber --overrides="$(cat pod.json)" ################# ### Tear Down ### diff --git a/build.gradle.kts b/build.gradle.kts index 46e8a3b55..5b5bdc3d1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -120,6 +120,13 @@ allprojects { } } + // EdcRuntimeExtension uses this to determine the runtime classpath of the module to run. + tasks.register("printClasspath") { + doLast { + println(sourceSets["main"].runtimeClasspath.asPath) + } + } + } // the "dockerize" task is added to all projects that use the `shadowJar` plugin diff --git a/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtension.java b/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtension.java index f0edd6be2..ee076406f 100644 --- a/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtension.java +++ b/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/BusinessPartnerValidationExtension.java @@ -20,8 +20,6 @@ package org.eclipse.tractusx.edc.validation.businesspartner; -import static org.eclipse.edc.policy.engine.spi.PolicyEngine.ALL_SCOPES; - import org.eclipse.edc.policy.engine.spi.PolicyEngine; import org.eclipse.edc.policy.engine.spi.RuleBindingRegistry; import org.eclipse.edc.policy.model.Duty; @@ -35,6 +33,8 @@ import org.eclipse.tractusx.edc.validation.businesspartner.functions.BusinessPartnerPermissionFunction; import org.eclipse.tractusx.edc.validation.businesspartner.functions.BusinessPartnerProhibitionFunction; +import static org.eclipse.edc.policy.engine.spi.PolicyEngine.ALL_SCOPES; + public class BusinessPartnerValidationExtension implements ServiceExtension { /** diff --git a/edc-tests/README.md b/edc-tests/cucumber/README.md similarity index 85% rename from edc-tests/README.md rename to edc-tests/cucumber/README.md index afb62c89a..a9424a5b0 100644 --- a/edc-tests/README.md +++ b/edc-tests/cucumber/README.md @@ -1,5 +1,7 @@ # Invoke Business-Tests via Maven +THIS MODULE IS DEPRECATED AND WILL NOT BE MAINTAINED ANYMORE. + ```shell ./gradlew :edc-tests:test -Dcucumber=true ``` diff --git a/edc-tests/build.gradle.kts b/edc-tests/cucumber/build.gradle.kts similarity index 100% rename from edc-tests/build.gradle.kts rename to edc-tests/cucumber/build.gradle.kts diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/.helmignore b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/.helmignore similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/.helmignore rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/.helmignore diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/Chart.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/Chart.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/Chart.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/Chart.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/README.md b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/README.md similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/README.md rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/README.md diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/service.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/service.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/service.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/service.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/omejdn/values.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/values.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/omejdn/values.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/values.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/README.md b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/README.md similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/README.md rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/README.md diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.png b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.png similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.png rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.png diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.puml b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.puml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.puml rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.puml diff --git a/edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml similarity index 100% rename from edc-tests/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml rename to edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceBackendAPI.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceBackendAPI.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceBackendAPI.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceBackendAPI.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Asset.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Asset.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Asset.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Asset.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/BusinessPartnerNumberConstraint.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/BusinessPartnerNumberConstraint.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/BusinessPartnerNumberConstraint.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/BusinessPartnerNumberConstraint.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Constraint.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Constraint.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Constraint.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Constraint.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractDefinition.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractDefinition.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractDefinition.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractDefinition.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiation.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiation.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiation.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiation.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiationState.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiationState.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiationState.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiationState.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractOffer.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractOffer.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractOffer.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractOffer.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/DataAddress.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/DataAddress.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/DataAddress.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/DataAddress.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySinkDataAddress.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySinkDataAddress.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySinkDataAddress.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySinkDataAddress.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySourceDataAddress.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySourceDataAddress.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySourceDataAddress.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySourceDataAddress.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Negotiation.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Negotiation.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Negotiation.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Negotiation.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/NullDataAddress.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/NullDataAddress.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/NullDataAddress.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/NullDataAddress.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/OrConstraint.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/OrConstraint.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/OrConstraint.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/OrConstraint.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/PayMeConstraint.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/PayMeConstraint.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/PayMeConstraint.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/PayMeConstraint.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Permission.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Permission.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Permission.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Permission.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Policy.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Policy.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Policy.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Policy.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/S3DataAddress.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/S3DataAddress.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/S3DataAddress.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/S3DataAddress.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Transfer.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Transfer.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/Transfer.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Transfer.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcess.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcess.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcess.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcess.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcessState.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcessState.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcessState.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcessState.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/features/ParameterTypes.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/features/ParameterTypes.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/features/ParameterTypes.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/features/ParameterTypes.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/features/RunCucumberTest.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/features/RunCucumberTest.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/features/RunCucumberTest.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/features/RunCucumberTest.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/util/DatabaseCleaner.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/DatabaseCleaner.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/util/DatabaseCleaner.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/DatabaseCleaner.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/util/S3Client.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/S3Client.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/util/S3Client.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/S3Client.java diff --git a/edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/util/Timeouts.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/Timeouts.java similarity index 100% rename from edc-tests/src/test/java/org/eclipse/tractusx/edc/tests/util/Timeouts.java rename to edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/Timeouts.java diff --git a/edc-tests/src/test/resources/junit-platform.properties b/edc-tests/cucumber/src/test/resources/junit-platform.properties similarity index 100% rename from edc-tests/src/test/resources/junit-platform.properties rename to edc-tests/cucumber/src/test/resources/junit-platform.properties diff --git a/edc-tests/src/test/resources/logback-test.xml b/edc-tests/cucumber/src/test/resources/logback-test.xml similarity index 100% rename from edc-tests/src/test/resources/logback-test.xml rename to edc-tests/cucumber/src/test/resources/logback-test.xml diff --git a/edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractNegotiation.feature b/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractNegotiation.feature similarity index 100% rename from edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractNegotiation.feature rename to edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractNegotiation.feature diff --git a/edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractOffers.feature b/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractOffers.feature similarity index 100% rename from edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractOffers.feature rename to edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractOffers.feature diff --git a/edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/EndToEndTransfer.feature b/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/EndToEndTransfer.feature similarity index 100% rename from edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/EndToEndTransfer.feature rename to edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/EndToEndTransfer.feature diff --git a/edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/HttpProxyDataTransfer.feature b/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/HttpProxyDataTransfer.feature similarity index 100% rename from edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/HttpProxyDataTransfer.feature rename to edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/HttpProxyDataTransfer.feature diff --git a/edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/S3FileTransfer.feature b/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/S3FileTransfer.feature similarity index 100% rename from edc-tests/src/test/resources/org/eclipse/tractusx/edc/tests/features/S3FileTransfer.feature rename to edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/S3FileTransfer.feature diff --git a/edc-tests/e2e-tests/README.md b/edc-tests/e2e-tests/README.md new file mode 100644 index 000000000..d48ff7e93 --- /dev/null +++ b/edc-tests/e2e-tests/README.md @@ -0,0 +1 @@ +this module contains JUnit tests that spin up multiple runtimes in one JVM \ No newline at end of file diff --git a/edc-tests/e2e-tests/build.gradle.kts b/edc-tests/e2e-tests/build.gradle.kts new file mode 100644 index 000000000..980dd7370 --- /dev/null +++ b/edc-tests/e2e-tests/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + `java-library` +} + +dependencies { + testImplementation(libs.restAssured) + testImplementation(libs.postgres) + testImplementation(libs.awaitility) + testImplementation(libs.aws.s3) + testImplementation(edc.spi.core) + testImplementation(edc.junit) + testImplementation(edc.spi.policy) + testImplementation(edc.spi.contract) + testImplementation(edc.core.api) + testImplementation(edc.spi.catalog) + testImplementation(edc.api.catalog) + testImplementation(testFixtures(edc.junit)) +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java new file mode 100644 index 000000000..167162f89 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java @@ -0,0 +1,38 @@ +package org.eclipse.tractusx.edc.policy; + + +import org.eclipse.edc.connector.policy.spi.PolicyDefinition; +import org.eclipse.edc.policy.model.Action; +import org.eclipse.edc.policy.model.AtomicConstraint; +import org.eclipse.edc.policy.model.Constraint; +import org.eclipse.edc.policy.model.LiteralExpression; +import org.eclipse.edc.policy.model.Operator; +import org.eclipse.edc.policy.model.OrConstraint; +import org.eclipse.edc.policy.model.Permission; +import org.eclipse.edc.policy.model.Policy; + +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class PolicyHelperFunctions { + public static PolicyDefinition businessPartnerNumberPolicy(String id, String... bpns) { + + var bpnConstraints = Stream.of(bpns) + .map(bpn -> (Constraint) AtomicConstraint.Builder.newInstance() + .leftExpression(new LiteralExpression("BusinessPartnerNumber")) + .operator(Operator.EQ) + .rightExpression(new LiteralExpression(bpn)) + .build()) + .collect(Collectors.toList()); + + return PolicyDefinition.Builder.newInstance() + .id(id) + .policy(Policy.Builder.newInstance() + .permission(Permission.Builder.newInstance() + .action(Action.Builder.newInstance().type("USE").build()) + .constraint(OrConstraint.Builder.newInstance() + .constraints(bpnConstraints) + .build()) + .build()).build()).build(); + } +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java new file mode 100644 index 000000000..aeaca44f2 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java @@ -0,0 +1,96 @@ +package org.eclipse.tractusx.edc.tests; + + +import org.eclipse.edc.connector.policy.spi.PolicyDefinition; +import org.eclipse.edc.junit.annotations.EndToEndTest; +import org.eclipse.edc.policy.model.Action; +import org.eclipse.edc.policy.model.Permission; +import org.eclipse.edc.policy.model.Policy; +import org.eclipse.edc.policy.model.PolicyType; +import org.eclipse.edc.spi.iam.IdentityService; +import org.eclipse.tractusx.edc.token.TestIdentityService; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.eclipse.tractusx.edc.policy.PolicyHelperFunctions.businessPartnerNumberPolicy; + +@EndToEndTest +public class CatalogTest extends MultiRuntimeTest { + + + private static TestIdentityService sokratesIsMock; + private static TestIdentityService platoIsMock; + + @BeforeAll + static void setup() { + platoIsMock = new TestIdentityService("PLATOBPN"); + sokratesIsMock = new TestIdentityService("SOKRATESBPN"); + + sokrates.registerServiceMock(IdentityService.class, sokratesIsMock); + plato.registerServiceMock(IdentityService.class, platoIsMock); + } + + @Test + @Disabled + void requestCatalog_fulfillsPolicy_shouldReturnOffer() { + // arrange + sokrates.createAsset("test-asset", Map.of("fooprop", "fooval")); + var accessPolicy = noConstraintPolicy("test-ap1"); + var contractPolicy = noConstraintPolicy("test-cp1"); + sokrates.createPolicy(accessPolicy); + sokrates.createPolicy(contractPolicy); + sokrates.createContractDefinition("test-asset", "test-def", "test-ap1", "test-cp1", 60); + + // act + var catalog = plato.requestCatalog(sokrates); + + // assert + assertThat(catalog.getContractOffers()).isNotEmpty() + .hasSize(1) + .allSatisfy(co -> { + assertThat(co.getAsset().getId()).isEqualTo("test-asset"); + assertThat(co.getProvider().toString()).isEqualTo(sokrates.idsId()); + assertThat(co.getConsumer().toString()).isEqualTo(plato.idsId()); + }); + + } + + @Test + @DisplayName("Verify that Plato receives only the offers he is permitted to") + void requestCatalog_filteredByBpn_shouldReject() { + var bpnAccessPolicy = businessPartnerNumberPolicy("ap", "BPN1", "BPN2", "PLATOBPN"); + var noConstraintPolicyId = "no-constraint"; + + sokrates.createPolicy(bpnAccessPolicy); + sokrates.createPolicy(noConstraintPolicy(noConstraintPolicyId)); + + sokrates.createAsset("test-asset1", Map.of("canSee", "true")); + sokrates.createAsset("test-asset2", Map.of("canSee", "false")); + + sokrates.createContractDefinition("test-asset1", "def1", noConstraintPolicyId, noConstraintPolicyId, 60); + sokrates.createContractDefinition("test-asset2", "def2", "ap", noConstraintPolicyId, 60); + + + // act + var catalog = plato.requestCatalog(sokrates); + assertThat(catalog.getContractOffers()).hasSize(2); + } + + private PolicyDefinition noConstraintPolicy(String id) { + return PolicyDefinition.Builder.newInstance() + .id(id) + .policy(Policy.Builder.newInstance() + .permission(Permission.Builder.newInstance() + .action(Action.Builder.newInstance().type("USE").build()) + .build()) + .type(PolicyType.SET) + .build()) + .build(); + } +} + diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java new file mode 100644 index 000000000..a3c6aecb4 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java @@ -0,0 +1,62 @@ +package org.eclipse.tractusx.edc.tests; + + +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.util.Map; + +import static java.lang.String.format; +import static org.eclipse.edc.junit.testfixtures.TestUtils.tempDirectory; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.IDS_PATH; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_CONNECTOR_PATH; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_CONNECTOR_PORT; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_IDS_API; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_IDS_API_PORT; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_MANAGEMENT_PATH; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_MANAGEMENT_PORT; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_ASSET_FILE; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_CONNECTOR_PATH; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_CONNECTOR_PORT; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_IDS_API; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_IDS_API_PORT; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_MANAGEMENT_PATH; +import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_MANAGEMENT_PORT; + + +public class MultiRuntimeTest { + + public static final String SOKRATES_ASSET_PATH = format("%s/%s.txt", tempDirectory(), SOKRATES_ASSET_FILE); + + + @RegisterExtension + protected static Participant sokrates = new Participant( + ":edc-tests:runtime", + "SOKRATES", + Map.of( + "edc.ids.id", "urn:connector:sokrates", + "web.http.port", String.valueOf(SOKRATES_CONNECTOR_PORT), + "web.http.path", SOKRATES_CONNECTOR_PATH, + "edc.test.asset.path", SOKRATES_ASSET_PATH, + "web.http.management.port", String.valueOf(SOKRATES_MANAGEMENT_PORT), + "web.http.management.path", SOKRATES_MANAGEMENT_PATH, + "web.http.ids.port", String.valueOf(SOKRATES_IDS_API_PORT), + "web.http.ids.path", IDS_PATH, + "edc.api.auth.key", "testkey", + "ids.webhook.address", SOKRATES_IDS_API)); + @RegisterExtension + protected static Participant plato = new Participant( + ":edc-tests:runtime", + "PLATO", + Map.of( + "edc.ids.id", "urn:connector:plato", + "web.http.port", String.valueOf(PLATO_CONNECTOR_PORT), + "web.http.path", PLATO_CONNECTOR_PATH, + "web.http.management.port", String.valueOf(PLATO_MANAGEMENT_PORT), + "web.http.management.path", PLATO_MANAGEMENT_PATH, + "web.http.ids.port", String.valueOf(PLATO_IDS_API_PORT), + "web.http.ids.path", IDS_PATH, + "edc.api.auth.key", "testkey", + "ids.webhook.address", PLATO_IDS_API)); + + +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java new file mode 100644 index 000000000..16ef5ddae --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java @@ -0,0 +1,121 @@ +package org.eclipse.tractusx.edc.tests; + +import io.restassured.specification.RequestSpecification; +import org.eclipse.edc.catalog.spi.Catalog; +import org.eclipse.edc.connector.api.management.catalog.model.CatalogRequestDto; +import org.eclipse.edc.connector.policy.spi.PolicyDefinition; +import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; +import org.eclipse.edc.spi.asset.AssetSelectorExpression; +import org.eclipse.edc.spi.types.TypeManager; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import static io.restassured.RestAssured.given; +import static io.restassured.http.ContentType.JSON; +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThat; + +public class Participant extends EdcRuntimeExtension { + + private final String managementUrl; + private final String apiKey; + private final String idsEndpoint; + private final TypeManager typeManager = new TypeManager(); + private final String idsId; + + public Participant(String moduleName, String runtimeName, Map properties) { + super(moduleName, runtimeName, properties); + this.managementUrl = URI.create(format("http://localhost:%s%s", properties.get("web.http.management.port"), properties.get("web.http.management.path"))).toString(); + this.idsEndpoint = URI.create(format("http://localhost:%s%s", properties.get("web.http.ids.port"), properties.get("web.http.ids.path"))).toString(); + this.apiKey = properties.get("edc.api.auth.key"); + this.idsId = properties.get("edc.ids.id"); + } + + public void createAsset(String id, Map properties) { + properties = new HashMap<>(properties); + properties.put("asset:prop:id", id); + properties.put("asset:prop:description", "test description"); + + var asset = Map.of( + "asset", Map.of( + "id", id, + "properties", properties + ), + "dataAddress", Map.of( + "properties", Map.of("type", "test-type") + + ) + ); + + baseRequest() + .body(asset) + .when() + .post("/assets") + .then() + .statusCode(200) + .contentType(JSON); + + } + + public void createContractDefinition(String assetId, String definitionId, String accessPolicyId, String contractPolicyId, long contractValidityDurationSeconds) { + var contractDefinition = Map.of( + "id", definitionId, + "accessPolicyId", accessPolicyId, + "validity", String.valueOf(contractValidityDurationSeconds), + "contractPolicyId", contractPolicyId, + "criteria", AssetSelectorExpression.Builder.newInstance().constraint("asset:prop:id", "=", assetId).build().getCriteria() + ); + + baseRequest() + .body(contractDefinition) + .when() + .post("/contractdefinitions") + .then() + .statusCode(200) + .contentType(JSON).contentType(JSON); + } + + + public void createPolicy(PolicyDefinition policyDefinition) { + baseRequest() + .body(policyDefinition) + .when() + .post("/policydefinitions") + .then() + .statusCode(200) + .contentType(JSON).contentType(JSON); + } + + public Catalog requestCatalog(Participant other) { + + var response = baseRequest() + .when() + .body(CatalogRequestDto.Builder.newInstance().providerUrl(other.idsEndpoint()+"/data").build()) + .post("/catalog/request") + .then(); + + var code = response.extract().statusCode(); + var body = response.extract().body().asString(); + + // doing an assertJ style assertion will allow us to use the body as fail message if the return code != 200 + assertThat(code).withFailMessage(body).isEqualTo(200); + return typeManager.readValue(body, Catalog.class); + } + + public String idsId() { + return idsId; + } + + private String idsEndpoint() { + return idsEndpoint; + } + + private RequestSpecification baseRequest() { + return given() + .baseUri(managementUrl) + .header("x-api-key", apiKey) + .contentType(JSON); + } +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java new file mode 100644 index 000000000..076d695d3 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java @@ -0,0 +1,38 @@ +package org.eclipse.tractusx.edc.tests; + +import java.util.concurrent.TimeUnit; + +import static org.eclipse.edc.junit.testfixtures.TestUtils.getFreePort; + +public class TestRuntimeConfiguration { + + + public static final String IDS_PATH = "/api/v1/ids"; + + + public static final int PLATO_CONNECTOR_PORT = getFreePort(); + public static final int PLATO_MANAGEMENT_PORT = getFreePort(); + public static final String PLATO_CONNECTOR_PATH = "/api"; + public static final String PLATO_MANAGEMENT_PATH = "/api/v1/management"; + public static final String CONSUMER_CONNECTOR_MANAGEMENT_URL = "http://localhost:" + PLATO_MANAGEMENT_PORT + PLATO_MANAGEMENT_PATH; + public static final int PLATO_IDS_API_PORT = getFreePort(); + public static final String PLATO_IDS_API = "http://localhost:" + PLATO_IDS_API_PORT; + + public static final int SOKRATES_CONNECTOR_PORT = getFreePort(); + public static final int SOKRATES_MANAGEMENT_PORT = getFreePort(); + public static final String SOKRATES_CONNECTOR_PATH = "/api"; + public static final String SOKRATES_MANAGEMENT_PATH = "/api/v1/management"; + public static final int SOKRATES_IDS_API_PORT = getFreePort(); + public static final String SOKRATES_IDS_API = "http://localhost:" + SOKRATES_IDS_API_PORT; + + public static final String PROVIDER_IDS_API_DATA = "http://localhost:" + SOKRATES_IDS_API_PORT + IDS_PATH + "/data"; + + public static final String PROVIDER_ASSET_ID = "test-document"; + public static final long CONTRACT_VALIDITY = TimeUnit.HOURS.toSeconds(1); + + public static final String SOKRATES_ASSET_FILE = "text-document.txt"; + + public static final String PROVIDER_CONNECTOR_MANAGEMENT_URL = "http://localhost:" + SOKRATES_MANAGEMENT_PORT + SOKRATES_MANAGEMENT_PATH; + + +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java new file mode 100644 index 000000000..16b9b0123 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java @@ -0,0 +1,42 @@ +package org.eclipse.tractusx.edc.token; + +import org.eclipse.edc.spi.iam.ClaimToken; +import org.eclipse.edc.spi.iam.IdentityService; +import org.eclipse.edc.spi.iam.TokenParameters; +import org.eclipse.edc.spi.iam.TokenRepresentation; +import org.eclipse.edc.spi.result.Result; +import org.eclipse.edc.spi.types.TypeManager; + +import java.util.Map; + +public class TestIdentityService implements IdentityService { + + private static final String BUSINESS_PARTNER_NUMBER = "BusinessPartnerNumber"; + private final String businessPartnerNumber; + private TypeManager typeManager = new TypeManager(); + + public TestIdentityService(String businessPartnerNumber) { + this.businessPartnerNumber = businessPartnerNumber; + } + + @Override + public Result obtainClientCredentials(TokenParameters parameters) { + var token = Map.of(BUSINESS_PARTNER_NUMBER, businessPartnerNumber); + + TokenRepresentation tokenRepresentation = TokenRepresentation.Builder.newInstance() + .token(typeManager.writeValueAsString(token)) + .build(); + return Result.success(tokenRepresentation); + } + + @Override + public Result verifyJwtToken(TokenRepresentation tokenRepresentation, String audience) { + + var token = typeManager.readValue(tokenRepresentation.getToken(), Map.class); + if (token.containsKey(BUSINESS_PARTNER_NUMBER)) { + return Result.success(ClaimToken.Builder.newInstance().claim(BUSINESS_PARTNER_NUMBER, token.get(BUSINESS_PARTNER_NUMBER)).claim("referringConnector", token.get(BUSINESS_PARTNER_NUMBER)).build()); + } + return Result.failure("Expected businessPartnerNumber, but token did not contain the claim"); + } + +} diff --git a/edc-tests/runtime/README.md b/edc-tests/runtime/README.md new file mode 100644 index 000000000..db4e602c8 --- /dev/null +++ b/edc-tests/runtime/README.md @@ -0,0 +1 @@ +this module provides a very small, purely in-mem runtime to execute tests against. not intended for anything other than testing! \ No newline at end of file diff --git a/edc-tests/runtime/build.gradle.kts b/edc-tests/runtime/build.gradle.kts new file mode 100644 index 000000000..59be7a23a --- /dev/null +++ b/edc-tests/runtime/build.gradle.kts @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + +plugins { + `java-library` + id("application") + id("com.github.johnrengelman.shadow") version "8.0.0" +} + + +dependencies { + + runtimeOnly(project(":edc-controlplane:edc-controlplane-base")){ + exclude("org.eclipse.edc", "oauth2-core") + exclude("org.eclipse.edc", "oauth2-daps") + exclude(module= "data-encryption") + exclude(module= "control-plane-adapter") + } + + // mocked IdentityService +// runtimeOnly(edc.iam.mock) +} + +application { + mainClass.set("org.eclipse.edc.boot.system.runtime.BaseRuntime") +} + +tasks.withType { + mergeServiceFiles() + archiveFileName.set("app.jar") +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 3c465f3c5..35ea70b69 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,7 +12,9 @@ include(":edc-extensions:observability-api-customization") include(":edc-extensions:transferprocess-sftp-client") include(":edc-extensions:transferprocess-sftp-common") include(":edc-extensions:transferprocess-sftp-provisioner") -include(":edc-tests") +include(":edc-tests:e2e-tests") +include(":edc-tests:runtime") +include(":edc-tests:cucumber") // modules for controlplane artifacts include(":edc-controlplane") @@ -28,6 +30,9 @@ include(":edc-dataplane:edc-dataplane-azure-vault") include(":edc-dataplane:edc-dataplane-base") include(":edc-dataplane:edc-dataplane-hashicorp-vault") +// for testing +include(":launchers:simple") + // this is needed to have access to snapshot builds of plugins pluginManagement { repositories { @@ -62,6 +67,7 @@ dependencyResolutionManagement { library("spi-transfer", "org.eclipse.edc", "transfer-spi").versionRef("edc") library("spi-core", "org.eclipse.edc", "core-spi").versionRef("edc") library("spi-policy", "org.eclipse.edc", "policy-spi").versionRef("edc") + library("spi-contract", "org.eclipse.edc", "contract-spi").versionRef("edc") library("spi-policyengine", "org.eclipse.edc", "policy-engine-spi").versionRef("edc") library("spi-transaction-datasource", "org.eclipse.edc", "transaction-datasource-spi").versionRef("edc") library("spi-transactionspi", "org.eclipse.edc", "transaction-spi").versionRef("edc") @@ -72,13 +78,16 @@ dependencyResolutionManagement { library("util", "org.eclipse.edc", "util").versionRef("edc") library("boot", "org.eclipse.edc", "boot").versionRef("edc") library("config-filesystem", "org.eclipse.edc", "configuration-filesystem").versionRef("edc") + library("vault-filesystem", "org.eclipse.edc", "vault-filesystem").versionRef("edc") library("core-controlplane", "org.eclipse.edc", "control-plane-core").versionRef("edc") library("core-connector", "org.eclipse.edc", "connector-core").versionRef("edc") library("core-jetty", "org.eclipse.edc", "jetty-core").versionRef("edc") library("core-jersey", "org.eclipse.edc", "jersey-core").versionRef("edc") + library("core-api", "org.eclipse.edc", "api-core").versionRef("edc") library("junit", "org.eclipse.edc", "junit").versionRef("edc") library("api-management-config", "org.eclipse.edc", "management-api-configuration").versionRef("edc") library("api-management", "org.eclipse.edc", "management-api").versionRef("edc") + library("api-catalog", "org.eclipse.edc", "catalog-api").versionRef("edc") library("api-observability", "org.eclipse.edc", "api-observability").versionRef("edc") library("ext-http", "org.eclipse.edc", "http").versionRef("edc") library("spi-ids", "org.eclipse.edc", "ids-spi").versionRef("edc") From 9346d7eac9fc3739e1f916defc9d3d65e15ee5e5 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Wed, 22 Mar 2023 20:16:14 +0100 Subject: [PATCH 04/14] added verify job --- .github/workflows/verify.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 15f954e88..de2267512 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -111,6 +111,23 @@ jobs: - name: Run API tests run: ./gradlew test -DincludeTags="ApiTest" + end-to-end-tests: + runs-on: ubuntu-latest + needs: [verify-formatting] + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + + - name: Set up JDK 11 + uses: actions/setup-java@v3.10.0 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + + - name: Run E2E tests + run: ./gradlew test -DincludeTags="EndToEndTest" + sonar: needs: [ secret-presence, verify-formatting ] if: | From 753938e3b3a960549df342acada922ce28991f96 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Thu, 23 Mar 2023 11:57:34 +0100 Subject: [PATCH 05/14] rename test identity service --- build.gradle.kts | 3 +++ .../tractusx/edc/tests/CatalogTest.java | 12 +++++------- ...ntityService.java => MockDapsService.java} | 19 ++++++++++++------- 3 files changed, 20 insertions(+), 14 deletions(-) rename edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/{TestIdentityService.java => MockDapsService.java} (57%) diff --git a/build.gradle.kts b/build.gradle.kts index 5b5bdc3d1..04e7ff7cc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -59,6 +59,9 @@ allprojects { dependencies { implementation("org.projectlombok:lombok:1.18.26") implementation("org.slf4j:slf4j-api:2.0.5") + // this is used to counter version conflicts between the JUnit version pulled in by the plugin, + // and the one expected by IntelliJ + testImplementation(platform("org.junit:junit-bom:5.9.2")) } // configure which version of the annotation processor to use. defaults to the same version as the plugin diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java index aeaca44f2..df4d629b3 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java @@ -8,9 +8,8 @@ import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.policy.model.PolicyType; import org.eclipse.edc.spi.iam.IdentityService; -import org.eclipse.tractusx.edc.token.TestIdentityService; +import org.eclipse.tractusx.edc.token.MockDapsService; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -23,20 +22,19 @@ public class CatalogTest extends MultiRuntimeTest { - private static TestIdentityService sokratesIsMock; - private static TestIdentityService platoIsMock; + private static MockDapsService sokratesIsMock; + private static MockDapsService platoIsMock; @BeforeAll static void setup() { - platoIsMock = new TestIdentityService("PLATOBPN"); - sokratesIsMock = new TestIdentityService("SOKRATESBPN"); + platoIsMock = new MockDapsService("PLATOBPN"); + sokratesIsMock = new MockDapsService("SOKRATESBPN"); sokrates.registerServiceMock(IdentityService.class, sokratesIsMock); plato.registerServiceMock(IdentityService.class, platoIsMock); } @Test - @Disabled void requestCatalog_fulfillsPolicy_shouldReturnOffer() { // arrange sokrates.createAsset("test-asset", Map.of("fooprop", "fooval")); diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java similarity index 57% rename from edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java rename to edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java index 16b9b0123..f454675dd 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/TestIdentityService.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java @@ -9,19 +9,22 @@ import java.util.Map; -public class TestIdentityService implements IdentityService { +import static java.lang.String.format; - private static final String BUSINESS_PARTNER_NUMBER = "BusinessPartnerNumber"; +public class MockDapsService implements IdentityService { + + private static final String BUSINESS_PARTNER_NUMBER_CLAIM = "BusinessPartnerNumber"; + private static final String REFERRING_CONNECTOR_CLAIM = "referringConnector"; private final String businessPartnerNumber; private TypeManager typeManager = new TypeManager(); - public TestIdentityService(String businessPartnerNumber) { + public MockDapsService(String businessPartnerNumber) { this.businessPartnerNumber = businessPartnerNumber; } @Override public Result obtainClientCredentials(TokenParameters parameters) { - var token = Map.of(BUSINESS_PARTNER_NUMBER, businessPartnerNumber); + var token = Map.of(BUSINESS_PARTNER_NUMBER_CLAIM, businessPartnerNumber); TokenRepresentation tokenRepresentation = TokenRepresentation.Builder.newInstance() .token(typeManager.writeValueAsString(token)) @@ -33,10 +36,12 @@ public Result obtainClientCredentials(TokenParameters param public Result verifyJwtToken(TokenRepresentation tokenRepresentation, String audience) { var token = typeManager.readValue(tokenRepresentation.getToken(), Map.class); - if (token.containsKey(BUSINESS_PARTNER_NUMBER)) { - return Result.success(ClaimToken.Builder.newInstance().claim(BUSINESS_PARTNER_NUMBER, token.get(BUSINESS_PARTNER_NUMBER)).claim("referringConnector", token.get(BUSINESS_PARTNER_NUMBER)).build()); + if (token.containsKey(BUSINESS_PARTNER_NUMBER_CLAIM)) { + return Result.success(ClaimToken.Builder.newInstance() + .claim(BUSINESS_PARTNER_NUMBER_CLAIM, token.get(BUSINESS_PARTNER_NUMBER_CLAIM)) + .claim(REFERRING_CONNECTOR_CLAIM, token.get(BUSINESS_PARTNER_NUMBER_CLAIM)).build()); } - return Result.failure("Expected businessPartnerNumber, but token did not contain the claim"); + return Result.failure(format("Expected %s and %s claims, but token did not contain them", BUSINESS_PARTNER_NUMBER_CLAIM, REFERRING_CONNECTOR_CLAIM)); } } From f48d8b1faa5a2e01745c28ad2b420228123b6623 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Thu, 23 Mar 2023 14:01:44 +0100 Subject: [PATCH 06/14] only boot the runtime once, wipe data after each test --- .../tractusx/edc/tests/CatalogTest.java | 67 +++++++++++++++---- .../eclipse/tractusx/edc/tests/DataWiper.java | 42 ++++++++++++ .../tractusx/edc/tests/MultiRuntimeTest.java | 18 ++++- .../tractusx/edc/tests/Participant.java | 47 ++++++++++++- 4 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java index df4d629b3..bf83b2c64 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java @@ -1,20 +1,22 @@ package org.eclipse.tractusx.edc.tests; +import org.eclipse.edc.api.query.QuerySpecDto; import org.eclipse.edc.connector.policy.spi.PolicyDefinition; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.policy.model.Action; import org.eclipse.edc.policy.model.Permission; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.policy.model.PolicyType; -import org.eclipse.edc.spi.iam.IdentityService; -import org.eclipse.tractusx.edc.token.MockDapsService; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import java.util.Map; +import static java.util.stream.IntStream.range; import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.tractusx.edc.policy.PolicyHelperFunctions.businessPartnerNumberPolicy; @@ -22,16 +24,9 @@ public class CatalogTest extends MultiRuntimeTest { - private static MockDapsService sokratesIsMock; - private static MockDapsService platoIsMock; - @BeforeAll static void setup() { - platoIsMock = new MockDapsService("PLATOBPN"); - sokratesIsMock = new MockDapsService("SOKRATESBPN"); - sokrates.registerServiceMock(IdentityService.class, sokratesIsMock); - plato.registerServiceMock(IdentityService.class, platoIsMock); } @Test @@ -61,17 +56,20 @@ void requestCatalog_fulfillsPolicy_shouldReturnOffer() { @Test @DisplayName("Verify that Plato receives only the offers he is permitted to") void requestCatalog_filteredByBpn_shouldReject() { - var bpnAccessPolicy = businessPartnerNumberPolicy("ap", "BPN1", "BPN2", "PLATOBPN"); + var onlyPlatoPolicy = businessPartnerNumberPolicy("ap", "BPN1", "BPN2", "PLATOBPN"); + var onlyDiogenesPolicy = businessPartnerNumberPolicy("dp", "DIOGENESBPN"); var noConstraintPolicyId = "no-constraint"; - sokrates.createPolicy(bpnAccessPolicy); + sokrates.createPolicy(onlyPlatoPolicy); sokrates.createPolicy(noConstraintPolicy(noConstraintPolicyId)); sokrates.createAsset("test-asset1", Map.of("canSee", "true")); - sokrates.createAsset("test-asset2", Map.of("canSee", "false")); + sokrates.createAsset("test-asset2", Map.of("canSee", "true")); + sokrates.createAsset("test-asset3", Map.of("canSee", "false")); sokrates.createContractDefinition("test-asset1", "def1", noConstraintPolicyId, noConstraintPolicyId, 60); - sokrates.createContractDefinition("test-asset2", "def2", "ap", noConstraintPolicyId, 60); + sokrates.createContractDefinition("test-asset2", "def2", onlyPlatoPolicy.getId(), noConstraintPolicyId, 60); + sokrates.createContractDefinition("test-asset3", "def3", onlyDiogenesPolicy.getId(), noConstraintPolicyId, 60); // act @@ -79,6 +77,49 @@ void requestCatalog_filteredByBpn_shouldReject() { assertThat(catalog.getContractOffers()).hasSize(2); } + @Test + @DisplayName("Multiple ContractDefinitions exist for one Asset") + void requestCatalog_multipleOffersForAsset() { + sokrates.createAsset("asset-1", Map.of("test-key", "test-val")); + sokrates.createPolicy(noConstraintPolicy("policy-1")); + sokrates.createPolicy(businessPartnerNumberPolicy("policy-2", "PLATOBPN")); + + sokrates.createContractDefinition("asset-1", "def1", "policy-1", "policy-1", 60); + sokrates.createContractDefinition("asset-1", "def2", "policy-2", "policy-1", 60); + + var catalog = plato.requestCatalog(sokrates); + assertThat(catalog.getContractOffers()).hasSize(2) + .allSatisfy(cd -> assertThat(cd.getAsset().getId()).isEqualTo("asset-1")) + // .hasToString is advisable as it handles NPEs better: + .allSatisfy(cd -> assertThat(cd.getConsumer()).hasToString(plato.idsId())) + .allSatisfy(cd -> assertThat(cd.getProvider()).hasToString(sokrates.idsId())); + } + + @Test + @DisplayName("Catalog with 1000 offers") + void requestCatalog_of1000Assets_shouldContainAll() { + var policy = businessPartnerNumberPolicy("policy-1", "PLATOBPN"); + sokrates.createPolicy(policy); + sokrates.createPolicy(noConstraintPolicy("noconstraint")); + + range(0, 1000) + .forEach(i -> { + var assetId = "asset-" + i; + sokrates.createAsset(assetId, Map.of()); + sokrates.createContractDefinition(assetId, "def-" + i, policy.getId(), "noconstraint", 60); + }); + + // request all at once + var o = plato.requestCatalog(sokrates, QuerySpecDto.Builder.newInstance().limit(1000).offset(0).build()).getContractOffers(); + assertThat(o).hasSize(1000); + + // request in chunks + var o2 = plato.requestCatalog(sokrates, QuerySpecDto.Builder.newInstance().limit(500).offset(0).build()).getContractOffers(); + var o3 = plato.requestCatalog(sokrates, QuerySpecDto.Builder.newInstance().limit(500).offset(500).build()).getContractOffers(); + assertThat(o2).doesNotContainAnyElementsOf(o3); + + } + private PolicyDefinition noConstraintPolicy(String id) { return PolicyDefinition.Builder.newInstance() .id(id) diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java new file mode 100644 index 000000000..2f63b8e92 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java @@ -0,0 +1,42 @@ +package org.eclipse.tractusx.edc.tests; + +import org.eclipse.edc.connector.contract.spi.offer.store.ContractDefinitionStore; +import org.eclipse.edc.connector.policy.spi.store.PolicyDefinitionStore; +import org.eclipse.edc.spi.asset.AssetIndex; +import org.eclipse.edc.spi.query.QuerySpec; +import org.eclipse.edc.spi.system.ServiceExtensionContext; + +import java.util.stream.Collectors; + +public class DataWiper { + + private final ServiceExtensionContext context; + + public DataWiper(ServiceExtensionContext context) { + this.context = context; + } + + public void clearPersistence() { + clearAssetIndex(); + clearPolicies(); + clearContractDefinitions(); + } + + private void clearContractDefinitions() { + var cds = context.getService(ContractDefinitionStore.class); + cds.findAll(QuerySpec.none()) + .forEach(cd -> cds.deleteById(cd.getId())); + } + + private void clearPolicies() { + var ps = context.getService(PolicyDefinitionStore.class); + ps.findAll(QuerySpec.none()).collect(Collectors.toList()) + .forEach(p -> ps.deleteById(p.getId())); + } + + private void clearAssetIndex() { + var index = context.getService(AssetIndex.class); + index.queryAssets(QuerySpec.none()) + .forEach(asset -> index.deleteById(asset.getId())); + } +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java index a3c6aecb4..d317dd86b 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java @@ -1,6 +1,8 @@ package org.eclipse.tractusx.edc.tests; +import org.eclipse.edc.spi.iam.IdentityService; +import org.eclipse.tractusx.edc.token.MockDapsService; import org.junit.jupiter.api.extension.RegisterExtension; import java.util.Map; @@ -27,7 +29,8 @@ public class MultiRuntimeTest { public static final String SOKRATES_ASSET_PATH = format("%s/%s.txt", tempDirectory(), SOKRATES_ASSET_FILE); - + private static MockDapsService sokratesIsMock; + private static MockDapsService platoIsMock; @RegisterExtension protected static Participant sokrates = new Participant( ":edc-tests:runtime", @@ -49,8 +52,8 @@ public class MultiRuntimeTest { "PLATO", Map.of( "edc.ids.id", "urn:connector:plato", - "web.http.port", String.valueOf(PLATO_CONNECTOR_PORT), - "web.http.path", PLATO_CONNECTOR_PATH, + "web.http.default.port", String.valueOf(PLATO_CONNECTOR_PORT), + "web.http.default.path", PLATO_CONNECTOR_PATH, "web.http.management.port", String.valueOf(PLATO_MANAGEMENT_PORT), "web.http.management.path", PLATO_MANAGEMENT_PATH, "web.http.ids.port", String.valueOf(PLATO_IDS_API_PORT), @@ -58,5 +61,14 @@ public class MultiRuntimeTest { "edc.api.auth.key", "testkey", "ids.webhook.address", PLATO_IDS_API)); + // this needs to be in a static initializer block, because it must be invoked before + // the BeforeEach and BeforeAll callbacks of the participants + static { + platoIsMock = new MockDapsService("PLATOBPN"); + sokratesIsMock = new MockDapsService("SOKRATESBPN"); + + sokrates.registerServiceMock(IdentityService.class, sokratesIsMock); + plato.registerServiceMock(IdentityService.class, platoIsMock); + } } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java index 16ef5ddae..08febedb8 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java @@ -1,15 +1,23 @@ package org.eclipse.tractusx.edc.tests; import io.restassured.specification.RequestSpecification; +import org.eclipse.edc.api.query.QuerySpecDto; import org.eclipse.edc.catalog.spi.Catalog; import org.eclipse.edc.connector.api.management.catalog.model.CatalogRequestDto; import org.eclipse.edc.connector.policy.spi.PolicyDefinition; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; import org.eclipse.edc.spi.asset.AssetSelectorExpression; +import org.eclipse.edc.spi.system.ServiceExtension; +import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.eclipse.edc.spi.system.injection.InjectionContainer; import org.eclipse.edc.spi.types.TypeManager; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.ExtensionContext; import java.net.URI; import java.util.HashMap; +import java.util.List; import java.util.Map; import static io.restassured.RestAssured.given; @@ -17,13 +25,14 @@ import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; -public class Participant extends EdcRuntimeExtension { +public class Participant extends EdcRuntimeExtension implements BeforeAllCallback, AfterAllCallback { private final String managementUrl; private final String apiKey; private final String idsEndpoint; private final TypeManager typeManager = new TypeManager(); private final String idsId; + private DataWiper wiper; public Participant(String moduleName, String runtimeName, Map properties) { super(moduleName, runtimeName, properties); @@ -33,6 +42,22 @@ public Participant(String moduleName, String runtimeName, Map pr this.idsId = properties.get("edc.ids.id"); } + @Override + public void beforeTestExecution(ExtensionContext extensionContext) throws Exception { + //do nothing - we only want to start the runtime once + wiper.clearPersistence(); + } + + @Override + public void afterTestExecution(ExtensionContext context) throws Exception { + } + + @Override + protected void bootExtensions(ServiceExtensionContext context, List> serviceExtensions) { + super.bootExtensions(context, serviceExtensions); + wiper = new DataWiper(context); + } + public void createAsset(String id, Map properties) { properties = new HashMap<>(properties); properties.put("asset:prop:id", id); @@ -77,7 +102,6 @@ public void createContractDefinition(String assetId, String definitionId, String .contentType(JSON).contentType(JSON); } - public void createPolicy(PolicyDefinition policyDefinition) { baseRequest() .body(policyDefinition) @@ -89,10 +113,16 @@ public void createPolicy(PolicyDefinition policyDefinition) { } public Catalog requestCatalog(Participant other) { + return requestCatalog(other, QuerySpecDto.Builder.newInstance().build()); + } + public Catalog requestCatalog(Participant other, QuerySpecDto query) { var response = baseRequest() .when() - .body(CatalogRequestDto.Builder.newInstance().providerUrl(other.idsEndpoint()+"/data").build()) + .body(CatalogRequestDto.Builder.newInstance() + .providerUrl(other.idsEndpoint() + "/data") + .querySpec(query) + .build()) .post("/catalog/request") .then(); @@ -108,6 +138,17 @@ public String idsId() { return idsId; } + @Override + public void beforeAll(ExtensionContext context) throws Exception { + //only run this once + super.beforeTestExecution(context); + } + + @Override + public void afterAll(ExtensionContext context) throws Exception { + super.afterTestExecution(context); + } + private String idsEndpoint() { return idsEndpoint; } From 05e6d083fd941f14efeeb2460954068b25c56959 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Thu, 23 Mar 2023 15:08:43 +0100 Subject: [PATCH 07/14] fixed deletion leftovers --- .../java/org/eclipse/tractusx/edc/tests/DataWiper.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java index 2f63b8e92..18bc74776 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java @@ -24,19 +24,17 @@ public void clearPersistence() { private void clearContractDefinitions() { var cds = context.getService(ContractDefinitionStore.class); - cds.findAll(QuerySpec.none()) - .forEach(cd -> cds.deleteById(cd.getId())); + cds.findAll(QuerySpec.max()).forEach(cd -> cds.deleteById(cd.getId())); } private void clearPolicies() { var ps = context.getService(PolicyDefinitionStore.class); - ps.findAll(QuerySpec.none()).collect(Collectors.toList()) - .forEach(p -> ps.deleteById(p.getId())); + // must .collect() here, otherwise we'll get a ConcurrentModificationException + ps.findAll(QuerySpec.max()).collect(Collectors.toList()).forEach(p -> ps.deleteById(p.getId())); } private void clearAssetIndex() { var index = context.getService(AssetIndex.class); - index.queryAssets(QuerySpec.none()) - .forEach(asset -> index.deleteById(asset.getId())); + index.queryAssets(QuerySpec.max()).forEach(asset -> index.deleteById(asset.getId())); } } From 3bb6b72eb92594a6a3920a542cf05300f9a48366 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Thu, 23 Mar 2023 16:15:14 +0100 Subject: [PATCH 08/14] restructuring, added sourcedoc --- .../edc/{tests => lifecycle}/DataWiper.java | 11 ++- .../edc/lifecycle/MultiRuntimeTest.java | 61 +++++++++++++++ .../edc/{tests => lifecycle}/Participant.java | 38 ++++++++-- .../TestRuntimeConfiguration.java | 2 +- .../edc/policy/PolicyHelperFunctions.java | 4 + .../tractusx/edc/tests/CatalogTest.java | 11 ++- .../tractusx/edc/tests/MultiRuntimeTest.java | 74 ------------------- .../tractusx/edc/token/MockDapsService.java | 4 + 8 files changed, 114 insertions(+), 91 deletions(-) rename edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/{tests => lifecycle}/DataWiper.java (83%) create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java rename edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/{tests => lifecycle}/Participant.java (82%) rename edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/{tests => lifecycle}/TestRuntimeConfiguration.java (97%) delete mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java similarity index 83% rename from edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java rename to edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java index 18bc74776..bf63e5440 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/DataWiper.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java @@ -1,4 +1,4 @@ -package org.eclipse.tractusx.edc.tests; +package org.eclipse.tractusx.edc.lifecycle; import org.eclipse.edc.connector.contract.spi.offer.store.ContractDefinitionStore; import org.eclipse.edc.connector.policy.spi.store.PolicyDefinitionStore; @@ -8,6 +8,9 @@ import java.util.stream.Collectors; +/** + * Helper class to delete all objects from a runtime's data stores. + */ public class DataWiper { private final ServiceExtensionContext context; @@ -22,18 +25,18 @@ public void clearPersistence() { clearContractDefinitions(); } - private void clearContractDefinitions() { + public void clearContractDefinitions() { var cds = context.getService(ContractDefinitionStore.class); cds.findAll(QuerySpec.max()).forEach(cd -> cds.deleteById(cd.getId())); } - private void clearPolicies() { + public void clearPolicies() { var ps = context.getService(PolicyDefinitionStore.class); // must .collect() here, otherwise we'll get a ConcurrentModificationException ps.findAll(QuerySpec.max()).collect(Collectors.toList()).forEach(p -> ps.deleteById(p.getId())); } - private void clearAssetIndex() { + public void clearAssetIndex() { var index = context.getService(AssetIndex.class); index.queryAssets(QuerySpec.max()).forEach(asset -> index.deleteById(asset.getId())); } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java new file mode 100644 index 000000000..a95aa0d10 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java @@ -0,0 +1,61 @@ +package org.eclipse.tractusx.edc.lifecycle; + + +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.util.Map; + +import static java.lang.String.format; +import static org.eclipse.edc.junit.testfixtures.TestUtils.tempDirectory; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.IDS_PATH; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_CONNECTOR_PATH; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_CONNECTOR_PORT; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_IDS_API; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_IDS_API_PORT; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_MANAGEMENT_PATH; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_MANAGEMENT_PORT; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_ASSET_FILE; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_CONNECTOR_PATH; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_CONNECTOR_PORT; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_IDS_API; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_IDS_API_PORT; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_MANAGEMENT_PATH; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_MANAGEMENT_PORT; + + +public class MultiRuntimeTest { + + public static final String SOKRATES_ASSET_PATH = format("%s/%s.txt", tempDirectory(), SOKRATES_ASSET_FILE); + + @RegisterExtension + protected static Participant sokrates = new Participant( + ":edc-tests:runtime", + "SOKRATES", + Map.of( + "edc.ids.id", "urn:connector:sokrates", + "web.http.port", String.valueOf(SOKRATES_CONNECTOR_PORT), + "web.http.path", SOKRATES_CONNECTOR_PATH, + "edc.test.asset.path", SOKRATES_ASSET_PATH, + "web.http.management.port", String.valueOf(SOKRATES_MANAGEMENT_PORT), + "web.http.management.path", SOKRATES_MANAGEMENT_PATH, + "web.http.ids.port", String.valueOf(SOKRATES_IDS_API_PORT), + "web.http.ids.path", IDS_PATH, + "edc.api.auth.key", "testkey", + "ids.webhook.address", SOKRATES_IDS_API)); + @RegisterExtension + protected static Participant plato = new Participant( + ":edc-tests:runtime", + "PLATO", + Map.of( + "edc.ids.id", "urn:connector:plato", + "web.http.default.port", String.valueOf(PLATO_CONNECTOR_PORT), + "web.http.default.path", PLATO_CONNECTOR_PATH, + "web.http.management.port", String.valueOf(PLATO_MANAGEMENT_PORT), + "web.http.management.path", PLATO_MANAGEMENT_PATH, + "web.http.ids.port", String.valueOf(PLATO_IDS_API_PORT), + "web.http.ids.path", IDS_PATH, + "edc.api.auth.key", "testkey", + "ids.webhook.address", PLATO_IDS_API)); + + +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java similarity index 82% rename from edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java rename to edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java index 08febedb8..2af79344d 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/Participant.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java @@ -1,4 +1,4 @@ -package org.eclipse.tractusx.edc.tests; +package org.eclipse.tractusx.edc.lifecycle; import io.restassured.specification.RequestSpecification; import org.eclipse.edc.api.query.QuerySpecDto; @@ -7,10 +7,12 @@ import org.eclipse.edc.connector.policy.spi.PolicyDefinition; import org.eclipse.edc.junit.extensions.EdcRuntimeExtension; import org.eclipse.edc.spi.asset.AssetSelectorExpression; +import org.eclipse.edc.spi.iam.IdentityService; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.injection.InjectionContainer; import org.eclipse.edc.spi.types.TypeManager; +import org.eclipse.tractusx.edc.token.MockDapsService; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -33,6 +35,7 @@ public class Participant extends EdcRuntimeExtension implements BeforeAllCallbac private final TypeManager typeManager = new TypeManager(); private final String idsId; private DataWiper wiper; + private final String bpn; public Participant(String moduleName, String runtimeName, Map properties) { super(moduleName, runtimeName, properties); @@ -40,6 +43,8 @@ public Participant(String moduleName, String runtimeName, Map pr this.idsEndpoint = URI.create(format("http://localhost:%s%s", properties.get("web.http.ids.port"), properties.get("web.http.ids.path"))).toString(); this.apiKey = properties.get("edc.api.auth.key"); this.idsId = properties.get("edc.ids.id"); + this.bpn = runtimeName + "-BPN"; + this.registerServiceMock(IdentityService.class, new MockDapsService(getBpn())); } @Override @@ -58,6 +63,9 @@ protected void bootExtensions(ServiceExtensionContext context, List properties) { properties = new HashMap<>(properties); properties.put("asset:prop:id", id); @@ -84,6 +92,9 @@ public void createAsset(String id, Map properties) { } + /** + * Creates a {@link org.eclipse.edc.connector.contract.spi.types.offer.ContractDefinition} using the participant's Data Management API + */ public void createContractDefinition(String assetId, String definitionId, String accessPolicyId, String contractPolicyId, long contractValidityDurationSeconds) { var contractDefinition = Map.of( "id", definitionId, @@ -102,6 +113,9 @@ public void createContractDefinition(String assetId, String definitionId, String .contentType(JSON).contentType(JSON); } + /** + * Creates a {@link PolicyDefinition} using the participant's Data Management API + */ public void createPolicy(PolicyDefinition policyDefinition) { baseRequest() .body(policyDefinition) @@ -112,15 +126,21 @@ public void createPolicy(PolicyDefinition policyDefinition) { .contentType(JSON).contentType(JSON); } + /** + * Requests the {@link Catalog} from another participant using this participant's Data Management API + */ public Catalog requestCatalog(Participant other) { return requestCatalog(other, QuerySpecDto.Builder.newInstance().build()); } + /** + * Requests the {@link Catalog} from another participant using this participant's Data Management API + */ public Catalog requestCatalog(Participant other, QuerySpecDto query) { var response = baseRequest() .when() .body(CatalogRequestDto.Builder.newInstance() - .providerUrl(other.idsEndpoint() + "/data") + .providerUrl(other.idsEndpoint + "/data") .querySpec(query) .build()) .post("/catalog/request") @@ -134,10 +154,20 @@ public Catalog requestCatalog(Participant other, QuerySpecDto query) { return typeManager.readValue(body, Catalog.class); } + /** + * Returns this participant's IDS ID + */ public String idsId() { return idsId; } + /** + * Returns this participant's BusinessPartnerNumber (=BPN). This is constructed of the runtime name plus "-BPN" + */ + public String getBpn() { + return bpn; + } + @Override public void beforeAll(ExtensionContext context) throws Exception { //only run this once @@ -149,10 +179,6 @@ public void afterAll(ExtensionContext context) throws Exception { super.afterTestExecution(context); } - private String idsEndpoint() { - return idsEndpoint; - } - private RequestSpecification baseRequest() { return given() .baseUri(managementUrl) diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java similarity index 97% rename from edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java rename to edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java index 076d695d3..a30e09403 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/TestRuntimeConfiguration.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java @@ -1,4 +1,4 @@ -package org.eclipse.tractusx.edc.tests; +package org.eclipse.tractusx.edc.lifecycle; import java.util.concurrent.TimeUnit; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java index 167162f89..ae59d837b 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java @@ -15,6 +15,10 @@ import java.util.stream.Stream; public class PolicyHelperFunctions { + /** + * Creates a {@link PolicyDefinition} using the given ID, that contains equality constraints for each of the given BusinessPartnerNumbers: + * each BPN is converted into an {@link AtomicConstraint} {@code BusinessPartnerNumber EQ [BPN]}. + */ public static PolicyDefinition businessPartnerNumberPolicy(String id, String... bpns) { var bpnConstraints = Stream.of(bpns) diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java index bf83b2c64..16e34cb4a 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java @@ -8,11 +8,10 @@ import org.eclipse.edc.policy.model.Permission; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.policy.model.PolicyType; +import org.eclipse.tractusx.edc.lifecycle.MultiRuntimeTest; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; import java.util.Map; @@ -56,8 +55,8 @@ void requestCatalog_fulfillsPolicy_shouldReturnOffer() { @Test @DisplayName("Verify that Plato receives only the offers he is permitted to") void requestCatalog_filteredByBpn_shouldReject() { - var onlyPlatoPolicy = businessPartnerNumberPolicy("ap", "BPN1", "BPN2", "PLATOBPN"); - var onlyDiogenesPolicy = businessPartnerNumberPolicy("dp", "DIOGENESBPN"); + var onlyPlatoPolicy = businessPartnerNumberPolicy("ap", "BPN1", "BPN2", plato.getBpn()); + var onlyDiogenesPolicy = businessPartnerNumberPolicy("dp", "ARISTOTELES-BPN"); var noConstraintPolicyId = "no-constraint"; sokrates.createPolicy(onlyPlatoPolicy); @@ -82,7 +81,7 @@ void requestCatalog_filteredByBpn_shouldReject() { void requestCatalog_multipleOffersForAsset() { sokrates.createAsset("asset-1", Map.of("test-key", "test-val")); sokrates.createPolicy(noConstraintPolicy("policy-1")); - sokrates.createPolicy(businessPartnerNumberPolicy("policy-2", "PLATOBPN")); + sokrates.createPolicy(businessPartnerNumberPolicy("policy-2", plato.getBpn())); sokrates.createContractDefinition("asset-1", "def1", "policy-1", "policy-1", 60); sokrates.createContractDefinition("asset-1", "def2", "policy-2", "policy-1", 60); @@ -98,7 +97,7 @@ void requestCatalog_multipleOffersForAsset() { @Test @DisplayName("Catalog with 1000 offers") void requestCatalog_of1000Assets_shouldContainAll() { - var policy = businessPartnerNumberPolicy("policy-1", "PLATOBPN"); + var policy = businessPartnerNumberPolicy("policy-1", plato.getBpn()); sokrates.createPolicy(policy); sokrates.createPolicy(noConstraintPolicy("noconstraint")); diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java deleted file mode 100644 index d317dd86b..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/MultiRuntimeTest.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.tractusx.edc.tests; - - -import org.eclipse.edc.spi.iam.IdentityService; -import org.eclipse.tractusx.edc.token.MockDapsService; -import org.junit.jupiter.api.extension.RegisterExtension; - -import java.util.Map; - -import static java.lang.String.format; -import static org.eclipse.edc.junit.testfixtures.TestUtils.tempDirectory; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.IDS_PATH; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_CONNECTOR_PATH; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_CONNECTOR_PORT; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_IDS_API; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_IDS_API_PORT; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_MANAGEMENT_PATH; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PLATO_MANAGEMENT_PORT; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_ASSET_FILE; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_CONNECTOR_PATH; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_CONNECTOR_PORT; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_IDS_API; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_IDS_API_PORT; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_MANAGEMENT_PATH; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.SOKRATES_MANAGEMENT_PORT; - - -public class MultiRuntimeTest { - - public static final String SOKRATES_ASSET_PATH = format("%s/%s.txt", tempDirectory(), SOKRATES_ASSET_FILE); - - private static MockDapsService sokratesIsMock; - private static MockDapsService platoIsMock; - @RegisterExtension - protected static Participant sokrates = new Participant( - ":edc-tests:runtime", - "SOKRATES", - Map.of( - "edc.ids.id", "urn:connector:sokrates", - "web.http.port", String.valueOf(SOKRATES_CONNECTOR_PORT), - "web.http.path", SOKRATES_CONNECTOR_PATH, - "edc.test.asset.path", SOKRATES_ASSET_PATH, - "web.http.management.port", String.valueOf(SOKRATES_MANAGEMENT_PORT), - "web.http.management.path", SOKRATES_MANAGEMENT_PATH, - "web.http.ids.port", String.valueOf(SOKRATES_IDS_API_PORT), - "web.http.ids.path", IDS_PATH, - "edc.api.auth.key", "testkey", - "ids.webhook.address", SOKRATES_IDS_API)); - @RegisterExtension - protected static Participant plato = new Participant( - ":edc-tests:runtime", - "PLATO", - Map.of( - "edc.ids.id", "urn:connector:plato", - "web.http.default.port", String.valueOf(PLATO_CONNECTOR_PORT), - "web.http.default.path", PLATO_CONNECTOR_PATH, - "web.http.management.port", String.valueOf(PLATO_MANAGEMENT_PORT), - "web.http.management.path", PLATO_MANAGEMENT_PATH, - "web.http.ids.port", String.valueOf(PLATO_IDS_API_PORT), - "web.http.ids.path", IDS_PATH, - "edc.api.auth.key", "testkey", - "ids.webhook.address", PLATO_IDS_API)); - - // this needs to be in a static initializer block, because it must be invoked before - // the BeforeEach and BeforeAll callbacks of the participants - static { - platoIsMock = new MockDapsService("PLATOBPN"); - sokratesIsMock = new MockDapsService("SOKRATESBPN"); - - sokrates.registerServiceMock(IdentityService.class, sokratesIsMock); - plato.registerServiceMock(IdentityService.class, platoIsMock); - } - -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java index f454675dd..5206428b4 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java @@ -11,6 +11,10 @@ import static java.lang.String.format; +/** + * An {@link IdentityService} that will mimic the behaviour of DAPS by inserting the "referringConnector" claim into any token. + * Please only use in testing scenarios! + */ public class MockDapsService implements IdentityService { private static final String BUSINESS_PARTNER_NUMBER_CLAIM = "BusinessPartnerNumber"; From ac26b5242eb912edce0530c73f86f1a6d455e098 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Thu, 23 Mar 2023 16:19:29 +0100 Subject: [PATCH 09/14] add copyright headers --- .../eclipse/tractusx/edc/lifecycle/DataWiper.java | 14 ++++++++++++++ .../tractusx/edc/lifecycle/MultiRuntimeTest.java | 14 ++++++++++++++ .../tractusx/edc/lifecycle/Participant.java | 14 ++++++++++++++ .../edc/lifecycle/TestRuntimeConfiguration.java | 14 ++++++++++++++ .../tractusx/edc/policy/PolicyHelperFunctions.java | 14 ++++++++++++++ .../eclipse/tractusx/edc/tests/CatalogTest.java | 14 ++++++++++++++ .../tractusx/edc/token/MockDapsService.java | 14 ++++++++++++++ 7 files changed, 98 insertions(+) diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java index bf63e5440..e99cf0989 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.lifecycle; import org.eclipse.edc.connector.contract.spi.offer.store.ContractDefinitionStore; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java index a95aa0d10..e007a824d 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/MultiRuntimeTest.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.lifecycle; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java index 2af79344d..7f17696ba 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.lifecycle; import io.restassured.specification.RequestSpecification; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java index a30e09403..145ae476f 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.lifecycle; import java.util.concurrent.TimeUnit; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java index ae59d837b..b255aa078 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/policy/PolicyHelperFunctions.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.policy; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java index 16e34cb4a..b7812ae4a 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/CatalogTest.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.tests; diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java index 5206428b4..c833b5c8a 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/token/MockDapsService.java @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + package org.eclipse.tractusx.edc.token; import org.eclipse.edc.spi.iam.ClaimToken; From 79a87848af307515cf747e931dca1e9473833460 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Mon, 27 Mar 2023 07:03:00 +0200 Subject: [PATCH 10/14] trigger ci From bf71a5c08c266360c8afaeaf1b7e60230c28a953 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger <43503240+paullatzelsperger@users.noreply.github.com> Date: Mon, 27 Mar 2023 11:56:11 +0200 Subject: [PATCH 11/14] Apply suggestions from code review Co-authored-by: Florian Rusch (ZF Friedrichshafen AG) --- edc-tests/e2e-tests/README.md | 4 +++- edc-tests/runtime/README.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/edc-tests/e2e-tests/README.md b/edc-tests/e2e-tests/README.md index d48ff7e93..cdde986b0 100644 --- a/edc-tests/e2e-tests/README.md +++ b/edc-tests/e2e-tests/README.md @@ -1 +1,3 @@ -this module contains JUnit tests that spin up multiple runtimes in one JVM \ No newline at end of file +# E2E-Tests + +This module contains JUnit tests that spin up multiple runtimes in one JVM. \ No newline at end of file diff --git a/edc-tests/runtime/README.md b/edc-tests/runtime/README.md index db4e602c8..703963687 100644 --- a/edc-tests/runtime/README.md +++ b/edc-tests/runtime/README.md @@ -1 +1,3 @@ -this module provides a very small, purely in-mem runtime to execute tests against. not intended for anything other than testing! \ No newline at end of file +# In-Memory Runtime for Testing Purposes + +This module provides a very small, purely in-mem runtime to execute tests against. Not intended for anything other than testing! \ No newline at end of file From ae208f10d369355f8531388270e3141cf53bcf4d Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Mon, 27 Mar 2023 11:56:48 +0200 Subject: [PATCH 12/14] pr remarks --- edc-tests/runtime/build.gradle.kts | 3 --- 1 file changed, 3 deletions(-) diff --git a/edc-tests/runtime/build.gradle.kts b/edc-tests/runtime/build.gradle.kts index 59be7a23a..b18b123ef 100644 --- a/edc-tests/runtime/build.gradle.kts +++ b/edc-tests/runtime/build.gradle.kts @@ -27,9 +27,6 @@ dependencies { exclude(module= "data-encryption") exclude(module= "control-plane-adapter") } - - // mocked IdentityService -// runtimeOnly(edc.iam.mock) } application { From d98038e6aee3a87f45d31fc5d058d02fbeb05886 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Mon, 27 Mar 2023 12:19:01 +0200 Subject: [PATCH 13/14] trigger ci From af90dec64608d6c40642ce6cfc9dfb196d12cd1c Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Mon, 27 Mar 2023 14:41:15 +0200 Subject: [PATCH 14/14] added copyright headers --- .github/workflows/build.yaml | 22 ++++++++++++++++++++++ .github/workflows/business-tests.yaml | 22 ++++++++++++++++++++++ .github/workflows/verify.yaml | 20 ++++++++++++++++++++ edc-tests/e2e-tests/build.gradle.kts | 14 ++++++++++++++ 4 files changed, 78 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0c58c7b8a..78b91b6f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,3 +1,25 @@ +# +# Copyright (c) 2023 ZF Friedrichshafen AG +# Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH +# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# 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 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + --- name: "Build" diff --git a/.github/workflows/business-tests.yaml b/.github/workflows/business-tests.yaml index 236bfdca8..f55d3d6ba 100644 --- a/.github/workflows/business-tests.yaml +++ b/.github/workflows/business-tests.yaml @@ -1,3 +1,25 @@ +# +# Copyright (c) 2023 ZF Friedrichshafen AG +# Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH +# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# 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 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + --- name: "Business Tests" diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index de2267512..adfeb5558 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -1,3 +1,23 @@ +# +# Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH +# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# 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 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + --- name: "Verify" diff --git a/edc-tests/e2e-tests/build.gradle.kts b/edc-tests/e2e-tests/build.gradle.kts index 980dd7370..b456d3e59 100644 --- a/edc-tests/e2e-tests/build.gradle.kts +++ b/edc-tests/e2e-tests/build.gradle.kts @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * 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: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + plugins { `java-library` }