diff --git a/.github/workflows/business-tests.yaml b/.github/workflows/business-tests.yaml deleted file mode 100644 index d3f2aaab1..000000000 --- a/.github/workflows/business-tests.yaml +++ /dev/null @@ -1,327 +0,0 @@ -# -# 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" - -on: - pull_request: - paths-ignore: - - 'docs/**' - - '**/*.md' - branches: - - releases - - release/** - - main - - previews/** - workflow_dispatch: - -concurrency: - # cancel only running jobs on pull requests - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - business-test: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - ############## - ### Set-Up ### - ############## - - uses: actions/checkout@v3.5.2 - - uses: ./.github/actions/setup-java - - name: Cache ContainerD Image Layers - uses: actions/cache@v3 - with: - path: /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs - key: ${{ runner.os }}-io.containerd.snapshotter.v1.overlayfs - - name: Set-Up Kubectl - uses: azure/setup-kubectl@v3.2 - - name: Helm Set-Up - uses: azure/setup-helm@v3.5 - with: - version: v3.8.1 - - name: Create k8s Kind Cluster configuration (kind.config.yaml) - run: |- - export MAVEN_REPOSITORY=${{ github.workspace }}/.m2/repository - cat << EOF > kind.config.yaml - --- - kind: Cluster - apiVersion: kind.x-k8s.io/v1alpha4 - nodes: - - role: control-plane - extraMounts: - - hostPath: ${PWD} - containerPath: /srv/tractusx-edc - - hostPath: ${MAVEN_REPOSITORY} - containerPath: /srv/m2-repository - - hostPath: /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs - containerPath: /var/lib/containerd/io.containerd.snapshotter.v1.overlayfs - EOF - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.6.0 - with: - config: kind.config.yaml - - ############################################## - ### Build and load recent images into KinD ### - ############################################## - - name: Build edc-controlplane-postgresql-hashicorp-vault - run: |- - ./gradlew :edc-controlplane:edc-controlplane-postgresql-hashicorp-vault:dockerize - env: - GITHUB_PACKAGE_USERNAME: ${{ github.actor }} - GITHUB_PACKAGE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Build edc-dataplane-hashicorp-vault - run: |- - ./gradlew :edc-dataplane:edc-dataplane-hashicorp-vault:dockerize - env: - GITHUB_PACKAGE_USERNAME: ${{ github.actor }} - GITHUB_PACKAGE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Load images into KinD - run: |- - docker tag edc-controlplane-postgresql-hashicorp-vault:latest edc-controlplane-postgresql-hashicorp-vault:business-test - docker tag edc-dataplane-hashicorp-vault:latest edc-dataplane-hashicorp-vault:business-test - kind get clusters | xargs -n1 kind load docker-image edc-controlplane-postgresql-hashicorp-vault:business-test edc-dataplane-hashicorp-vault:business-test --name - - ############################################ - ### Prepare And Install Test Environment ### - ############################################ - - name: Define test environment variables - run: |- - # Define endpoints - echo "SOKRATES_DATA_MANAGEMENT_API_AUTH_KEY=password" | tee -a ${GITHUB_ENV} - echo "SOKRATES_DATA_MANAGEMENT_URL=http://sokrates-controlplane:8081/management" | tee -a ${GITHUB_ENV} - echo "SOKRATES_IDS_URL=http://sokrates-controlplane:8084/api/v1/ids" | tee -a ${GITHUB_ENV} - echo "SOKRATES_DATA_PLANE_URL=http://sokrates-dataplane:8081/api/public/" | tee -a ${GITHUB_ENV} - echo "SOKRATES_DATABASE_URL=jdbc:postgresql://plato-postgresql:5432/edc" | tee -a ${GITHUB_ENV} - echo "SOKRATES_DATABASE_USER=user" | tee -a ${GITHUB_ENV} - echo "SOKRATES_DATABASE_PASSWORD=password" | tee -a ${GITHUB_ENV} - echo "PLATO_DATA_MANAGEMENT_API_AUTH_KEY=password" | tee -a ${GITHUB_ENV} - echo "PLATO_DATA_MANAGEMENT_URL=http://plato-controlplane:8081/management" | tee -a ${GITHUB_ENV} - echo "PLATO_IDS_URL=http://plato-controlplane:8084/api/v1/ids" | tee -a ${GITHUB_ENV} - echo "PLATO_DATA_PLANE_URL=http://plato-dataplane:8081/api/public/" | tee -a ${GITHUB_ENV} - echo "PLATO_DATABASE_URL=jdbc:postgresql://plato-postgresql:5432/edc" | tee -a ${GITHUB_ENV} - echo "PLATO_DATABASE_USER=user" | tee -a ${GITHUB_ENV} - echo "PLATO_DATABASE_PASSWORD=password" | tee -a ${GITHUB_ENV} - echo "EDC_AWS_ENDPOINT_OVERRIDE=http://minio:9000" | tee -a ${GITHUB_ENV} - echo "PLATO_AWS_SECRET_ACCESS_KEY=platoqwerty123" | tee -a ${GITHUB_ENV} - echo "PLATO_AWS_ACCESS_KEY_ID=platoqwerty123" | tee -a ${GITHUB_ENV} - echo "SOKRATES_AWS_SECRET_ACCESS_KEY=sokratesqwerty123" | tee -a ${GITHUB_ENV} - echo "SOKRATES_AWS_ACCESS_KEY_ID=sokratesqwerty123" | tee -a ${GITHUB_ENV} - - name: Install infrastructure components via Helm - uses: nick-fields/retry@v2 - with: - timeout_minutes: 10 - max_attempts: 3 - retry_on: error - command: |- - # Update helm dependencies - 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/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 - sleep 5s - - # Wait for supporting infrastructure to become ready (control-/data-plane, backend service) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=idsdaps --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=idsdaps --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=vault --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=vault --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=sokrates-postgresql --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=sokrates-postgresql --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=plato-postgresql --timeout=120s || ( kubectl logs -l app.kubernetes.io/name=plato-postgresql --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app=minio --timeout=120s || ( kubectl logs -l app=minio --tail 500 && exit 1 ) - - # Install Plato - helm install plato charts/tractusx-connector \ - --set fullnameOverride=plato \ - --set controlplane.service.type=NodePort \ - --set controlplane.endpoints.management.authKey=password \ - --set controlplane.image.tag=business-test \ - --set controlplane.image.pullPolicy=Never \ - --set controlplane.image.repository=docker.io/library/edc-controlplane-postgresql-hashicorp-vault \ - --set dataplane.image.tag=business-test \ - --set dataplane.image.pullPolicy=Never \ - --set dataplane.image.repository=docker.io/library/edc-dataplane-hashicorp-vault \ - --set controlplane.debug.enabled=true \ - --set controlplane.suspendOnStart=false \ - --set controlplane.businesspartnervalidation.log.agreement.validation=true \ - --set postgresql.enabled=true \ - --set postgresql.username=user \ - --set postgresql.password=password \ - --set postgresql.jdbcUrl=jdbc:postgresql://plato-postgresql:5432/edc \ - --set vault.hashicorp.enabled=true \ - --set vault.hashicorp.url=http://vault:8200 \ - --set vault.hashicorp.token=root \ - --set vault.secretNames.transferProxyTokenSignerPublicKey=plato/daps/my-plato-daps-crt \ - --set vault.secretNames.transferProxyTokenSignerPrivateKey=plato/daps/my-plato-daps-key \ - --set vault.secretNames.transferProxyTokenEncryptionAesKey=plato/data-encryption-aes-keys \ - --set vault.secretNames.dapsPrivateKey=plato/daps/my-plato-daps-key \ - --set vault.secretNames.dapsPublicKey=plato/daps/my-plato-daps-crt \ - --set daps.url=http://ids-daps:4567 \ - --set daps.clientId=99:83:A7:17:86:FF:98:93:CE:A0:DD:A1:F1:36:FA:F6:0F:75:0A:23:keyid:99:83:A7:17:86:FF:98:93:CE:A0:DD:A1:F1:36:FA:F6:0F:75:0A:23 \ - --set dataplane.aws.endpointOverride=http://minio:9000 \ - --set dataplane.aws.secretAccessKey=platoqwerty123 \ - --set dataplane.aws.accessKeyId=platoqwerty123 \ - --set backendService.httpProxyTokenReceiverUrl=http://backend:8080 \ - --wait-for-jobs --timeout=120s - - # Install Sokrates - helm install sokrates charts/tractusx-connector \ - --set fullnameOverride=sokrates \ - --set controlplane.service.type=NodePort \ - --set controlplane.endpoints.management.authKey=password \ - --set controlplane.image.tag=business-test \ - --set controlplane.image.pullPolicy=Never \ - --set controlplane.image.repository=docker.io/library/edc-controlplane-postgresql-hashicorp-vault \ - --set dataplane.image.tag=business-test \ - --set dataplane.image.pullPolicy=Never \ - --set dataplane.image.repository=docker.io/library/edc-dataplane-hashicorp-vault \ - --set controlplane.debug.enabled=true \ - --set controlplane.suspendOnStart=false \ - --set controlplane.businesspartnervalidation.log.agreement.validation=true \ - --set postgresql.enabled=true \ - --set postgresql.username=user \ - --set postgresql.password=password \ - --set postgresql.jdbcUrl=jdbc:postgresql://sokrates-postgresql:5432/edc \ - --set vault.hashicorp.enabled=true \ - --set vault.hashicorp.url=http://vault:8200 \ - --set vault.hashicorp.token=root \ - --set vault.secretNames.transferProxyTokenSignerPublicKey=sokrates/daps/my-sokrates-daps-crt \ - --set vault.secretNames.transferProxyTokenSignerPrivateKey=sokrates/daps/my-sokrates-daps-key \ - --set vault.secretNames.transferProxyTokenEncryptionAesKey=sokrates/data-encryption-aes-keys \ - --set vault.secretNames.dapsPrivateKey=sokrates/daps/my-sokrates-daps-key \ - --set vault.secretNames.dapsPublicKey=sokrates/daps/my-sokrates-daps-crt \ - --set daps.url=http://ids-daps:4567 \ - --set daps.clientId=E7:07:2D:74:56:66:31:F0:7B:10:EA:B6:03:06:4C:23:7F:ED:A6:65:keyid:E7:07:2D:74:56:66:31:F0:7B:10:EA:B6:03:06:4C:23:7F:ED:A6:65 \ - --set dataplane.aws.endpointOverride=http://minio:9000 \ - --set dataplane.aws.secretAccessKey=sokratesqwerty123 \ - --set dataplane.aws.accessKeyId=sokratesqwerty123 \ - --set backendService.httpProxyTokenReceiverUrl=http://backend:8080 \ - --wait-for-jobs --timeout=120s - - # GH pipelines constrained by cpu, so give helm some time to register all resources \w k8s - sleep 5s - - # Wait for Control-/DataPlane and backend-service to become ready - kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=sokrates-controlplane --timeout=600s || ( kubectl logs -l app.kubernetes.io/instance=sokrates-controlplane --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=sokrates-dataplane --timeout=600s || ( kubectl logs -l app.kubernetes.io/instance=sokrates-dataplane --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=plato-controlplane --timeout=600s || ( kubectl logs -l app.kubernetes.io/instance=plato-controlplane --tail 500 && exit 1 ) - kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=plato-dataplane --timeout=600s || ( kubectl logs -l app.kubernetes.io/instance=plato-dataplane --tail 500 && exit 1 ) - - ############################################## - ### Run Business Tests inside kind cluster ### - ############################################## - - name: Run Business Tests - continue-on-error: true - run: |- - cat << EOF >> pod.json - { - "apiVersion": "v1", - "kind": "Pod", - "spec": { - "containers": [ - { - "args": [ - "-c", - "cd /tractusx-edc && ./gradlew edc-tests:cucumber:test -Dcucumber=true" - ], - "command": [ - "/bin/sh" - ], - EOF - - # Ugly hack to get env vars passed into the k8s-run - if '--overrides' defined '--env' is ignored :( - cat << EOF >> pod.json - "env": [ - {"name": "SOKRATES_DATA_MANAGEMENT_API_AUTH_KEY", "value": "${SOKRATES_DATA_MANAGEMENT_API_AUTH_KEY}"}, - {"name": "PLATO_DATA_MANAGEMENT_API_AUTH_KEY", "value": "${PLATO_DATA_MANAGEMENT_API_AUTH_KEY}"}, - {"name": "SOKRATES_DATA_MANAGEMENT_URL", "value": "${SOKRATES_DATA_MANAGEMENT_URL}"}, - {"name": "SOKRATES_IDS_URL", "value": "${SOKRATES_IDS_URL}"}, - {"name": "SOKRATES_DATA_PLANE_URL", "value": "${SOKRATES_DATA_PLANE_URL}"}, - {"name": "SOKRATES_BACKEND_SERVICE_BACKEND_API_URL", "value": "http://backend:8081" }, - {"name": "SOKRATES_DATABASE_URL", "value": "${SOKRATES_DATABASE_URL}"}, - {"name": "SOKRATES_DATABASE_USER", "value": "${SOKRATES_DATABASE_USER}"}, - {"name": "SOKRATES_DATABASE_PASSWORD", "value": "${SOKRATES_DATABASE_PASSWORD}"}, - {"name": "PLATO_DATA_MANAGEMENT_URL", "value": "${PLATO_DATA_MANAGEMENT_URL}"}, - {"name": "PLATO_IDS_URL", "value": "${PLATO_IDS_URL}"}, - {"name": "PLATO_DATA_PLANE_URL", "value": "${PLATO_DATA_PLANE_URL}"}, - {"name": "PLATO_BACKEND_SERVICE_BACKEND_API_URL", "value": "http://backend:8081"}, - {"name": "PLATO_DATABASE_URL", "value": "${PLATO_DATABASE_URL}"}, - {"name": "PLATO_DATABASE_USER", "value": "${PLATO_DATABASE_USER}"}, - {"name": "PLATO_DATABASE_PASSWORD", "value": "${PLATO_DATABASE_PASSWORD}"}, - {"name": "EDC_AWS_ENDPOINT_OVERRIDE", "value": "${EDC_AWS_ENDPOINT_OVERRIDE}"}, - {"name": "PLATO_AWS_SECRET_ACCESS_KEY", "value": "${PLATO_AWS_SECRET_ACCESS_KEY}"}, - {"name": "PLATO_AWS_ACCESS_KEY_ID", "value": "${PLATO_AWS_ACCESS_KEY_ID}"}, - {"name": "SOKRATES_AWS_SECRET_ACCESS_KEY", "value": "${SOKRATES_AWS_SECRET_ACCESS_KEY}"}, - {"name": "SOKRATES_AWS_ACCESS_KEY_ID", "value": "${SOKRATES_AWS_ACCESS_KEY_ID}"} - ], - EOF - - cat << EOF >> pod.json - "image": "openjdk:11-jdk-slim", - "name": "edc-tests-cucumber", - "volumeMounts": [ - { - "mountPath": "/tractusx-edc", - "name": "tractusx-edc" - }, - { - "mountPath": "/root/.m2/repository", - "name": "m2-repository" - } - ] - } - ], - "dnsPolicy": "ClusterFirst", - "restartPolicy": "Never", - "volumes": [ - { - "hostPath": { - "path": "/srv/tractusx-edc" - }, - "name": "tractusx-edc" - }, - { - "hostPath": { - "path": "/srv/m2-repository" - }, - "name": "m2-repository" - } - ] - } - } - EOF - - kubectl run -i --image=openjdk:11-jdk-slim --restart=Never --rm edc-tests-cucumber --overrides="$(cat pod.json)" - - ################# - ### Tear Down ### - ################# - - name: Destroy the kind cluster - if: always() - run: >- - kind get clusters | xargs -n1 kind delete cluster --name diff --git a/docs/development/Run-business-tests-local.md b/docs/development/Run-business-tests-local.md deleted file mode 100644 index cab17c6c2..000000000 --- a/docs/development/Run-business-tests-local.md +++ /dev/null @@ -1,161 +0,0 @@ -# Run and debug Business-Tests local within IDE - -Prerequisites: - -- You need a local kubernetes cluster to install the services (Docker Desktop is recommended). -- You need kubectl and helm command line tools installed. - -## 1. Build all modules with maven and produce docker images - -```shell -./gradlew dockerize -``` - -## 2. Install the all-in-one supporting infrastructure environment (Daps, Vault, PostgreSql, Minio, Backend-Service) - -```shel -helm install infrastructure edc-tests/src/main/resources/deployment/helm/supporting-infrastructure -n business-tests --dependency-update --create-namespace -``` - -To access the PostgreSql databases you could use following kubectl port forwardings: - -```shell -kubectl port-forward plato-postgresql-0 -n business-tests 5555:5432 -kubectl port-forward sokrates-postgresql-0 -n business-tests 6666:5432 -``` - -Please use the same ports later for your environment variables. - -## 3. Install Plato as provider EDC - -```shell -helm install plato charts/tractusx-connector -n business-tests --create-namespace \ - --set fullnameOverride=plato \ - --set controlplane.service.type=NodePort \ - --set controlplane.endpoints.data.authKey=password \ - --set controlplane.image.pullPolicy=Never \ - --set controlplane.image.tag=latest \ - --set controlplane.image.repository=edc-controlplane-postgresql-hashicorp-vault \ - --set dataplane.image.tag=latest \ - --set dataplane.image.pullPolicy=Never \ - --set dataplane.image.repository=edc-dataplane-hashicorp-vault \ - --set controlplane.debug.enabled=true \ - --set controlplane.suspendOnStart=false \ - --set postgresql.enabled=true \ - --set postgresql.username=user \ - --set postgresql.password=password \ - --set postgresql.jdbcUrl=jdbc:postgresql://plato-postgresql:5432/edc \ - --set vault.hashicorp.enabled=true \ - --set vault.hashicorp.url=http://vault:8200 \ - --set vault.hashicorp.token=root \ - --set vault.secretNames.transferProxyTokenSignerPublicKey=plato/daps/my-plato-daps-crt \ - --set vault.secretNames.transferProxyTokenSignerPrivateKey=plato/daps/my-plato-daps-key \ - --set vault.secretNames.transferProxyTokenEncryptionAesKey=plato/data-encryption-aes-keys \ - --set vault.secretNames.dapsPrivateKey=plato/daps/my-plato-daps-key \ - --set vault.secretNames.dapsPublicKey=plato/daps/my-plato-daps-crt \ - --set daps.url=http://ids-daps:4567 \ - --set daps.clientId=99:83:A7:17:86:FF:98:93:CE:A0:DD:A1:F1:36:FA:F6:0F:75:0A:23:keyid:99:83:A7:17:86:FF:98:93:CE:A0:DD:A1:F1:36:FA:F6:0F:75:0A:23 \ - --set dataplane.aws.endpointOverride=http://minio:9000 \ - --set dataplane.aws.secretAccessKey=platoqwerty123 \ - --set dataplane.aws.accessKeyId=platoqwerty123 \ - --set backendService.httpProxyTokenReceiverUrl=http://backend:8080 \ - --wait-for-jobs --timeout=120s -``` - -## 4. Install Socrates as consumer EDC - -```shell -helm install sokrates charts/tractusx-connector -n business-tests --create-namespace \ - --set fullnameOverride=sokrates \ - --set controlplane.service.type=NodePort \ - --set controlplane.endpoints.data.authKey=password \ - --set controlplane.image.pullPolicy=Never \ - --set controlplane.image.tag=latest \ - --set controlplane.image.repository=edc-controlplane-postgresql-hashicorp-vault \ - --set dataplane.image.tag=latest \ - --set dataplane.image.pullPolicy=Never \ - --set dataplane.image.repository=edc-dataplane-hashicorp-vault \ - --set controlplane.debug.enabled=true \ - --set controlplane.suspendOnStart=false \ - --set postgresql.enabled=true \ - --set postgresql.username=user \ - --set postgresql.password=password \ - --set postgresql.jdbcUrl=jdbc:postgresql://sokrates-postgresql:5432/edc \ - --set vault.hashicorp.enabled=true \ - --set vault.hashicorp.url=http://vault:8200 \ - --set vault.hashicorp.token=root \ - --set vault.secretNames.transferProxyTokenSignerPublicKey=sokrates/daps/my-sokrates-daps-crt \ - --set vault.secretNames.transferProxyTokenSignerPrivateKey=sokrates/daps/my-sokrates-daps-key \ - --set vault.secretNames.transferProxyTokenEncryptionAesKey=sokrates/data-encryption-aes-keys \ - --set vault.secretNames.dapsPrivateKey=sokrates/daps/my-sokrates-daps-key \ - --set vault.secretNames.dapsPublicKey=sokrates/daps/my-sokrates-daps-crt \ - --set daps.url=http://ids-daps:4567 \ - --set daps.clientId=E7:07:2D:74:56:66:31:F0:7B:10:EA:B6:03:06:4C:23:7F:ED:A6:65:keyid:E7:07:2D:74:56:66:31:F0:7B:10:EA:B6:03:06:4C:23:7F:ED:A6:65 \ - --set dataplane.aws.endpointOverride=http://minio:9000 \ - --set dataplane.aws.secretAccessKey=sokratesqwerty123 \ - --set dataplane.aws.accessKeyId=sokratesqwerty123 \ - --set backendService.httpProxyTokenReceiverUrl=http://backend:8080 \ - --wait-for-jobs --timeout=120s -``` - -## 5. Set environment variables and run configuration in IDE - -You can create a run configuration in IntelliJ like bellow screenshot and copy/paste the whole set of environments variables if you use ";" after each line. - -![Example run config](run-config.png) - -```shell -PLATO_BACKEND_SERVICE_BACKEND_API_URL=http://localhost:; -PLATO_DATA_MANAGEMENT_API_AUTH_KEY=password; -PLATO_DATA_MANAGEMENT_URL=http://localhost:/data; -PLATO_DATA_PLANE_URL=foo; -PLATO_DATABASE_PASSWORD=password; -PLATO_DATABASE_URL=jdbc:postgresql://localhost:5555/edc; -PLATO_DATABASE_USER=user; -PLATO_IDS_URL=http://plato-controlplane:8084/api/v1/ids; -PLATO_AWS_SECRET_ACCESS_KEY=platoqwerty123; -PLATO_AWS_ACCESS_KEY_ID=platoqwerty123; -SOKRATES_BACKEND_SERVICE_BACKEND_API_URL=http://localhost:; -SOKRATES_BACKEND_URL=http://localhost:; -SOKRATES_DATA_MANAGEMENT_API_AUTH_KEY=password; -SOKRATES_DATA_MANAGEMENT_URL=http://localhost:/data; -SOKRATES_DATA_PLANE_URL=foo; -SOKRATES_DATABASE_PASSWORD=password; -SOKRATES_DATABASE_URL=jdbc:postgresql://localhost:6666/edc; -SOKRATES_DATABASE_USER=user; -SOKRATES_IDS_URL=http://sokrates-controlplane:8084/api/v1/ids; -SOKRATES_AWS_SECRET_ACCESS_KEY=sokratesqwerty123; -SOKRATES_AWS_ACCESS_KEY_ID=sokratesqwerty123; -EDC_AWS_ENDPOINT_OVERRIDE=http://localhost:32000 -``` - -The services are using NodePort to expose the endpoints therefore the ports are not fix and needs to be determined after each deployment. -To determine the current ports you can use the following kubectl command: - -```shell -kubectl get svc -n business-tests -o go-template='{{range .items}}{{ $save := . }}{{range.spec.ports}}{{if .nodePort}}{{$save.metadata.namespace}}{{"/"}}{{$save.metadata.name}}{{" - "}}{{.name}}{{": "}}{{.nodePort}}{{"("}}{{.port}}{{")"}}{{"\n"}}{{end}}{{end}}{{end}}' -``` - -This will return all NodePorts which are available in business-tests namespace where you can pick the ports to use in your environment variables. -Now you are able to run it in IDE either as normal "Run" mode or in "Debug" mode where you can debug the business-tests by setting debugging points. - -Example of mapping to environment variables needed for the business tests: - -```shell -business-tests/plato-controlplane - data: 30955(8081) -> PLATO_DATA_MANAGEMENT_URL=http://localhost:30955/data; -business-tests/sokrates-controlplane - data: 30538(8081) -> SOKRATES_DATA_MANAGEMENT_URL=http://localhost:30538/data; -business-tests/backend - backend: 30556(8081) -> SOKRATES_BACKEND_SERVICE_BACKEND_API_URL= http://localhost:30556 -``` - -## 6. Update your components - -Once everything is installed you just need to update your services when you have a new image. - -```shell -helm upgrade plato charts/tractusx-connector --recreate-pods -helm upgrade sokrates charts/tractusx-connector --recreate-pods -``` - -## 7. Tips - -If you use the kubernetes within Docker Desktop you have direct access to the images which you have created with Docker Desktop they are using the same docker daemon. So you don't need to transfer it in your k8s cluster. diff --git a/edc-tests/cucumber/README.md b/edc-tests/cucumber/README.md deleted file mode 100644 index db14876f7..000000000 --- a/edc-tests/cucumber/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Invoke Business-Tests via Maven - -THIS MODULE IS DEPRECATED AND WILL NOT BE MAINTAINED ANYMORE. - -```shell -./gradlew :edc-tests:test -Dcucumber=true -``` - -## Test locally using Act Tool - -> "Think globally, [`act`](https://github.com/nektos/act) locally" - -```shell -act -j business-test -``` - -## Run and debug Business-Tests local within IDE - -Please refer to [run-local documentation in docs](../docs/development/Run-business-tests-local.md) diff --git a/edc-tests/cucumber/build.gradle.kts b/edc-tests/cucumber/build.gradle.kts deleted file mode 100644 index cfdf0b480..000000000 --- a/edc-tests/cucumber/build.gradle.kts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 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 - */ - -plugins { - `java-library` -} - -dependencies { - implementation(project(":edc-extensions:business-partner-validation")) - implementation(project(":edc-extensions:control-plane-adapter")) - implementation(project(":edc-extensions:cx-oauth2")) - implementation(project(":edc-extensions:data-encryption")) - implementation(project(":edc-extensions:dataplane-selector-configuration")) - implementation(project(":edc-extensions:hashicorp-vault")) - implementation(project(":edc-extensions:postgresql-migration")) - implementation(project(":edc-extensions:provision-additional-headers")) - implementation(project(":edc-extensions:transferprocess-sftp-client")) - implementation(project(":edc-extensions:transferprocess-sftp-common")) - implementation(project(":edc-extensions:transferprocess-sftp-provisioner")) - - - testImplementation("com.google.code.gson:gson:2.10.1") - testImplementation("org.apache.httpcomponents:httpclient:4.5.14") - testImplementation("org.junit.platform:junit-platform-suite:1.9.3") - testImplementation("io.cucumber:cucumber-java:7.12.0") - testImplementation("io.cucumber:cucumber-junit-platform-engine:7.12.0") - testImplementation(libs.slf4j.api) - testImplementation(libs.restAssured) - testImplementation(libs.postgres) - testImplementation(libs.awaitility) - testImplementation(libs.aws.s3) - testImplementation(libs.edc.spi.core) -} - -tasks.withType(Test::class) { - onlyIf { - System.getProperty("cucumber") == "true" - } -} - -// do not publish -edcBuild { - publish.set(false) -} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/.helmignore b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/.helmignore deleted file mode 100644 index 0e8a0eb36..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/Chart.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/Chart.yaml deleted file mode 100644 index 0fd769a8f..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/Chart.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# 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 -# -# - ---- -apiVersion: v2 -name: ids-daps -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.1 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "0.0.1" diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/README.md b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/README.md deleted file mode 100644 index f85a94889..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Omejdn DAPS - -This chart deployes an [IDS Omejdn DAPS](https://github.com/Fraunhofer-AISEC/omejdn-server). - -Two Eclipse Dataspace Connectors need to be registered at the same DAPS instance, to be able to talk to each other. Each connector is registered in the DAPS by an unique client ID and a correpsonding client certificate. - -New connectors are configured in the omejdn _values.yaml_. - -In each Eclipse Dataspace Connector configure the following properties to use the DAPS. - -```properties - edc.oauth.client.id= - - edc.oauth.provider.jwks.url="http://:4567/.well-known/jwks.json" - edc.oauth.token.url="http://:4567/token" - - edc.oauth.private.key.alias= - edc.oauth.public.key.alias= - - edc.oauth.provider.audience=idsc:IDS_CONNECTORS_ALL -``` diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl deleted file mode 100644 index ec025d4f9..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/_helpers.tpl +++ /dev/null @@ -1,64 +0,0 @@ - - -{{/* -Expand the name of the chart. -*/}} -{{- define "omejdn.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "omejdn.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "omejdn.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "omejdn.labels" -}} -helm.sh/chart: {{ include "omejdn.chart" . }} -{{ include "omejdn.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "omejdn.selectorLabels" -}} -app.kubernetes.io/name: {{ include "omejdn.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "omejdn.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "omejdn.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml deleted file mode 100644 index dc57c6055..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/configmap.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# - # Copyright (c) 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 - # - ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "omejdn.fullname" . }} - labels: - {{- include "omejdn.labels" . | nindent 4 }} -data: - scope_mapping.yml: |- - --- - idsc:IDS_CONNECTOR_ATTRIBUTES_ALL: - - referringConnector - - omejdn.yml: |- - --- - host: http://ids-daps:4567/ - path_prefix: '' - bind_to: 0.0.0.0 - allow_origin: "*" - app_env: debug - openid: false - user_backend: - - yaml - user_backend_default: yaml - accept_audience: idsc:IDS_CONNECTORS_ALL - issuer: http://ids-daps:4567/ - environment: development - default_audience: - - idsc:IDS_CONNECTORS_ALL - access_token: - expiration: 3600 - algorithm: RS256 - id_token: - expiration: 3600 - algorithm: RS256 - - plugins.yml: |- - --- - plugins: - token_user_attributes: - - clients.yml: |- - --- - - client_id: data-plane-oauth2 - client_secret: supersecret - name: provision oauth2 - grant_types: - - client_credentials - token_endpoint_auth_method: client_secret_post - scope: openid -{{- range $i, $val := .Values.connectors }} - - client_id: {{ quote $val.id }} - name: {{ quote $val.name }} - token_endpoint_auth_method: private_key_jwt - grant_types: - - client_credentials - scope: - - idsc:IDS_CONNECTOR_ATTRIBUTES_ALL - attributes: - - key: idsc - value: IDS_CONNECTOR_ATTRIBUTES_ALL - - key: securityProfile - value: idsc:BASE_SECURITY_PROFILE - {{- range $key, $value := $val.attributes }} - - key: {{ $key }} - value: {{ $value }} - {{- end }} - redirect_uri: http://localhost:4200 -{{ end -}} - - -{{- range $i, $val := .Values.connectors }} - {{ $val.name }}: {{ quote $val.certificate | toString }} -{{ end -}} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml deleted file mode 100644 index 5353b8035..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/deployment.yaml +++ /dev/null @@ -1,164 +0,0 @@ -# - # 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 - # - # - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "omejdn.fullname" . }} - labels: - {{- include "omejdn.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "omejdn.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "omejdn.selectorLabels" . | nindent 8 }} - spec: - {{- if .Values.imagePullSecret.dockerconfigjson }} - imagePullSecrets: - - name: {{ include "omejdn.fullname" . }}-imagepullsecret - {{- else }} - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- end }} - serviceAccountName: {{ include "omejdn.serviceAccountName" . }} - automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - initContainers: - - name: init-daps-pvc - image: alpine - command: - - "sh" - - "-c" - args: - - | - cp /opt/config/omejdn.yml /etc/daps/omejdn.yml - cp /opt/config/clients.yml /etc/daps/clients.yml - cp /opt/config/plugins.yml /etc/daps/plugins.yml - cp /opt/config/scope_mapping.yml /etc/daps/scope_mapping.yml - apk add --update openssl - openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /etc/keys/omejdn/omejdn.key \ - -subj "/C=DE/ST=Berlin/L=Berlin/O=Tractus-X-EDC-Test, Inc./OU=DE" - volumeMounts: - - mountPath: /etc/daps - name: config-dir - - mountPath: /etc/keys/omejdn - name: omejdn-key-dir - - mountPath: /opt/config/omejdn.yml - name: omejdn-config - subPath: omejdn.yml - - mountPath: /opt/config/scope_mapping.yml - name: scope-mapping - subPath: scope_mapping.yml - - mountPath: /opt/config/clients.yml - name: clients-config - subPath: clients.yml - - mountPath: /opt/config/plugins.yml - name: plugins-config - subPath: plugins.yml - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - volumeMounts: - - mountPath: /opt/config/ - name: config-dir - - mountPath: /opt/keys/omejdn/omejdn.key - name: omejdn-key-dir - subPath: omejdn.key - - mountPath: /opt/keys/clients/ - name: client-certificates - ports: - - name: http - containerPort: 4567 - protocol: TCP - livenessProbe: - httpGet: - path: /jwks.json - port: http - readinessProbe: - httpGet: - path: /jwks.json - port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - env: - - name: OMEJDN_JWT_AUD_OVERRIDE - value: "idsc:IDS_CONNECTORS_ALL" - - name: OMEJDN_PLUGINS - value: "config/plugins.yml" - volumes: - - name: config-dir - emptyDir: { } - - name: omejdn-key-dir - emptyDir: { } - - name: omejdn-config - configMap: - name: {{ include "omejdn.fullname" . }} - items: - - key: omejdn.yml - path: omejdn.yml - - name: scope-mapping - configMap: - name: {{ include "omejdn.fullname" . }} - items: - - key: scope_mapping.yml - path: scope_mapping.yml - - name: clients-config - configMap: - name: {{ include "omejdn.fullname" . }} - items: - - key: clients.yml - path: clients.yml - - name: plugins-config - configMap: - name: {{ include "omejdn.fullname" . }} - items: - - key: plugins.yml - path: plugins.yml - - name: client-certificates - configMap: - name: {{ include "omejdn.fullname" . }} - items: - {{- range $i, $val := .Values.connectors }} - - key: {{ $val.name }} - path: {{ $val.id }}.cert - {{- end }} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml deleted file mode 100644 index cf5eb97d0..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/hpa.yaml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 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 -# - -{{- if .Values.autoscaling.enabled }} ---- -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "omejdn.fullname" . }} - labels: - {{- include "omejdn.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "omejdn.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml deleted file mode 100644 index 44f573e0f..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/imagepullsecret.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 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 - # - -{{- if .Values.imagePullSecret.dockerconfigjson }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "edc-dataplane.fullname" . }}-imagepullsecret - namespace: {{ .Release.Namespace | default "default" | quote }} - labels: - {{- include "edc-dataplane.labels" . | nindent 4 }} -data: - .dockerconfigjson: {{ .Values.imagePullSecret.dockerconfigjson }} -type: kubernetes.io/dockerconfigjson -{{- end }} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/service.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/service.yaml deleted file mode 100644 index 947e69742..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/service.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 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 -# - ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "omejdn.fullname" . }} - labels: - {{- include "omejdn.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "omejdn.selectorLabels" . | nindent 4 }} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml deleted file mode 100644 index 536f31871..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/templates/serviceaccount.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 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 -# - -{{- if .Values.serviceAccount.create -}} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "omejdn.serviceAccountName" . }} - labels: - {{- include "omejdn.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/values.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/values.yaml deleted file mode 100644 index f411b8774..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/omejdn/values.yaml +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) 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 -# - ---- -# Default values for omejdn. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -# -- Specifies how many replicas of a deployed pod shall be created during the deployment -# Note: If horizontal pod autoscaling is enabled this setting has no effect -replicaCount: 1 - -image: - # -- Which omjedn container image to use - repository: ghcr.io/fraunhofer-aisec/omejdn-server - # -- [Kubernetes image pull policy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy) to use - pullPolicy: IfNotPresent - # -- Overrides the image tag whose default is the chart appVersion - tag: "1.7.1" - -imagePullSecret: - # -- Image pull secret to create to [obtain the container image from private registries](https://kubernetes.io/docs/concepts/containers/images/#using-a-private-registry) - # Note: This value needs to adhere to the [(base64 encoded) .dockerconfigjson format](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#registry-secret-existing-credentials). - # Furthermore, if 'imagePullSecret.dockerconfigjson' is defined, it takes precedence over 'imagePullSecrets'. - dockerconfigjson: "" - -# -- Overrides the charts name -nameOverride: "" - -# -- Overrides the releases full name -fullnameOverride: "" - -serviceAccount: - # -- Specifies whether a [service account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) should be created per release - create: true - # -- [Annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) to add to the service account - annotations: {} - # -- The name of the service account to use. If not set and create is true, a name is generated using the release's fullname template - name: "" - -# -- Whether to [automount kubernetes API credentials](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server) into the pod -automountServiceAccountToken: false - -# -- [Annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) added to deployed [pods](https://kubernetes.io/docs/concepts/workloads/pods/) -podAnnotations: {} - -# The [pod security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) defines privilege and access control settings for a Pod within the deployment -podSecurityContext: {} - -# The [container security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) defines privilege and access control settings for a Container within a pod -securityContext: {} - -service: - # -- [Service type](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) to expose the running application on a set of Pods as a network service. - type: ClusterIP - # -- [Service type](https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service) to expose the running application on a set of Pods as a network service. - port: 4567 - -# -- [Resource management](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) applied to the deployed pod -resources: {} - -autoscaling: - # -- Enables [horizontal pod autoscaling](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) - enabled: false - # -- Minimal replicas if resource consumption falls below resource threshholds - minReplicas: 1 - # -- Maximum replicas if resource consumption exceeds resource threshholds - maxReplicas: 100 - # -- targetAverageUtilization of cpu provided to a pod - targetCPUUtilizationPercentage: 80 - # -- targetAverageUtilization of memory provided to a pod - targetMemoryUtilizationPercentage: 80 - -# -- [Node-Selector](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) to constrain the Pod to nodes with specific labels. -nodeSelector: {} - -# -- [Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) are applied to Pods to schedule onto nodes with matching taints. -tolerations: [] - -# -- [Affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) constrains which nodes the Pod can be scheduled on based on node labels. -affinity: {} - -# List of connector clients. Certificate and Client-ID must be configured in parallel. -#
-# Example Connector: -# - id: grMsEz3EcsS3ENYJufNgUIeg4QsaL49M0gWxSexPdC4pon96Nvju90D8RlvAJB21 -# name: my-connector -# attributes: -# issuerConnector: http://localhost:8080/ -# certificate: |- -# -----BEGIN CERTIFICATE----- -# foo -# -----END CERTIFICATE----- -connectors: [] diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore deleted file mode 100644 index 8681aba50..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# ignore downloaded helm depdencies -charts/ - -Chart.lock diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore deleted file mode 100644 index 8c60d7821..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/.helmignore +++ /dev/null @@ -1,24 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ -docs diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml deleted file mode 100644 index c445d4a36..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/Chart.yaml +++ /dev/null @@ -1,74 +0,0 @@ -# -# 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 -# -# - ---- -apiVersion: v2 -name: all-in-one -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" - -dependencies: - # IDS Dynamic Attribute Provisioning Service (IAM) - - name: ids-daps - version: 0.0.1 - repository: "file://../omejdn" - alias: idsdaps - condition: install.daps - - # HashiCorp Vault - - name: vault - alias: vault - version: 0.20.0 - repository: https://helm.releases.hashicorp.com - condition: install.vault - - # PostgreSQL - - name: postgresql - alias: plato-postgresql - version: 12.1.6 - repository: https://charts.bitnami.com/bitnami - condition: install.postgresql - - - name: postgresql - alias: sokrates-postgresql - version: 12.1.6 - repository: https://charts.bitnami.com/bitnami - condition: install.postgresql - - # MinIo - - name: minio - alias: minio - repository: https://charts.min.io - version: 4.1.0 - condition: install.minio diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/README.md b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/README.md deleted file mode 100644 index 89cadb1aa..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# Supporting Infrastructure Deployment - -The Supporting Infrastructure Deployment creates a complete, independent and already configured EDC test environment. -During the automated business tests, these infrastructure components are deployed together with two connectors (Plato & Sokrates). - -This deployment could also be used as - -- reference setup for teams, that want to create their own connector -- standalone infrastructure to try things out - -This deployment should **never** be used - -- in **any** production or near production environments -- in **any** long living internet facing connector setups - -## Components - -Overview of the installed components. - -![Deployed Components](diagrams/deployed_components.png) - -### Omejdn DAPS - -The Dynamic Attribute Provisioning Service (DAPS) is a component of the IDS Ecosystem. -The Fraunhofer Institute has created a DAPS reference implementation, the Omejdn -DAPS ([link](https://github.com/Fraunhofer-AISEC/omejdn-server)). This deplyoment configures and deployes a instance of -this reference implementation. - -Definition of DAPS from the IDS Reference architecture v3.0 -> The Identity Provider acts as an agent for the International -> Data Spaces Association. It is responsible for issuing technical identities to parties that have been approved to become -> Participants in the International Data Spaces. The Identity -> Provider is instructed to issue identities based on approved -> roles (e.g., App Store or App Provider). Only if equipped with -> such an identity, an entity is allowed to participate in the International Data Spaces - -Also, please note, that the Omejdn DAPS is meant as research sandbox and should not be used in anq -productive environment. - -> **IMPORTANT:** Omejdn is meant to be a research sandbox in which we can (re)implement standard protocols and -> potentially extend and modify functionality under the hood to support research projects. Use at your own -> risk! ([source](https://github.com/Fraunhofer-AISEC/omejdn-server)) - -### HashiCorp Vault - -The Control- and Data Plane persist confidential in the vault and persist and communicate using only the secret -names. Hence, it is not possible to run a connector without an instance of a vault. - -### Backend Application - -After a Data Transfer is successfully prepared the control plane will contact the a configurable endpoint with the -information it needs to initiate the data transfer. This transfer flow, where something like a Backend Application is -required, is unique to the HTTP Proxy data transfer flow. - -The Backend Application has an API endpoint, that is configured in the control plane. After it gets called with the data -transfer information, it will do the actual data transfer and store the data on disk. - -### PostgreSQL - -This database is used to persist the state of the Control Plane. - -## Setup - -Follow these steps to get a fully functional EDC demo environment out of the box. - -### Requirements - -Install on your machine: - -- Minikube - - Documentation -- Helm - - Documentation - -## Start Demo Environment - -Update Helm Dependencies: - -```bash -helm dependency update -``` - -Install Demo Chart: - -```bash -helm install tx-infrastructure --namespace tx --create-namespace . -``` - -## Stop Demo Environment - -Uninstall Demo Chart: - -```bash -helm uninstall tx-infrastructure --namespace tx -``` diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 443b739f8..000000000 Binary files a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.png and /dev/null differ diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 9f3dfdd94..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/diagrams/deployed_components.puml +++ /dev/null @@ -1,20 +0,0 @@ -@startuml - -node Infrastructure as "Tractus-X Connector\nSupporting Infrastructure" { - node SokratesSetup as "Persistence / PostgreSQL" { - database SokratesPsql as "Sokrates PSQL" - database PlatoPsql as "Plato PSQL" - } - node SharedComponents as "Additional Components" { - component Vault as "HashiCorp Vault" - component BackendService as "Backend Application" - } - node IdentityProvider as "Identity Provider" { - component OmejdnDaps as "Omejdn DAPS" - } -} - -IdentityProvider -[hidden]down- SharedComponents -IdentityProvider -[hidden]right- SokratesSetup - -@enduml diff --git a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml b/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml deleted file mode 100644 index 287fc9975..000000000 --- a/edc-tests/cucumber/src/main/resources/deployment/helm/supporting-infrastructure/values.yaml +++ /dev/null @@ -1,309 +0,0 @@ -# -# 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 -# -# - ---- - -########### -# Install # -########### -install: - daps: true - postgresql: true - vault: true - minio: true - - -######## -# DAPS # -######## -idsdaps: - fullnameOverride: "ids-daps" - connectors: - - id: E7:07:2D:74:56:66:31:F0:7B:10:EA:B6:03:06:4C:23:7F:ED:A6:65:keyid:E7:07:2D:74:56:66:31:F0:7B:10:EA:B6:03:06:4C:23:7F:ED:A6:65 - name: sokrates - attributes: - referringConnector: http://sokrates-controlplane/BPNSOKRATES - # Must be the same certificate that is stores in section 'sokrates-vault' - certificate: |- - -----BEGIN CERTIFICATE----- - MIIEAzCCAuugAwIBAgIULy0aTdGiGkyvVp7l5Ccoq7DQREgwDQYJKoZIhvcNAQEL - BQAwgZAxCzAJBgNVBAYTAkRFMQ8wDQYDVQQIDAZCZXJsaW4xDzANBgNVBAcMBkJl - cmxpbjEMMAoGA1UECgwDQk1XMSAwHgYDVQQLDBdlZGMtcGxheWdyb3VuZC1wYXJ0 - bmVyMTEvMC0GA1UEAwwmc29rcmF0ZXMtZWRjLmRlbW8uY2F0ZW5hLXgubmV0L0JQ - TjEyMzQwHhcNMjMwNDI2MTI1OTE5WhcNMzMwNDIzMTI1OTE5WjCBkDELMAkGA1UE - BhMCREUxDzANBgNVBAgMBkJlcmxpbjEPMA0GA1UEBwwGQmVybGluMQwwCgYDVQQK - DANCTVcxIDAeBgNVBAsMF2VkYy1wbGF5Z3JvdW5kLXBhcnRuZXIxMS8wLQYDVQQD - DCZzb2tyYXRlcy1lZGMuZGVtby5jYXRlbmEteC5uZXQvQlBOMTIzNDCCASIwDQYJ - KoZIhvcNAQEBBQADggEPADCCAQoCggEBALCr0h3vT5kNnwWhAmGRvEEo38nKyiXB - Gx0GlepYToKklMgtGIX25OkOrXJqq4BzybxN27DoWvU9DEixylkCbhwmwmpI3IhF - 8w6cV/odaYdQ3tEeZ6zWYXqKx+MVWTHQ8A4Njy64PWNDWBZmaGvxeE48i7EJnnrM - M5CGDAKbA/Jd1nlFxaq9hGiaCHa2kCNKdfrJ6ZUda5rPlLJk5at3VPxvRIpT50Gp - 3P4PtdwpwIHwa7y1xTBc43bEfcD1lmR9VkkxCX8lg4V1OBLx1GVwoUZBkN8P4POT - t+gQq7FbDbBEeOSmKELC3Tc8D8JCGv94sEg6o+4yzgpvyIvMyV8uGcECAwEAAaNT - MFEwHQYDVR0OBBYEFIxEsuJTl+5V8vTCUhMGhWsmdQShMB8GA1UdIwQYMBaAFIxE - suJTl+5V8vTCUhMGhWsmdQShMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL - BQADggEBAJHOKmFNZDk5xebzBARgcIrYrmRb5pIU4gNCWh/q1TF0+CFnnK8RTFTZ - 12pTbid6v5knn/f9bsilnudhxBzBQ4bukiI8Be0nzYfZU2dTU+w1cl/JnJfkGirt - 8Nwqv3fiUXfFBl8nE0RduAk9XF/UBIZXPapE6u1zR29jvuV+ppmhQrFFeJufeBGd - Wwn6XGK4fzENGDyjdk4QB/dg3/heM5h330vIGO4hVvlQBfJhNbC7Iikkr5ulytfd - deuZIfa7hG6WgIgGhg3YL1p/TTpJamBDS860PWyI7RH3o53VPphu/y2Rpud5AECV - xcrqaSGUTZPVyTUB8BxE32LqFDbpZb4= - -----END CERTIFICATE----- - - id: 99:83:A7:17:86:FF:98:93:CE:A0:DD:A1:F1:36:FA:F6:0F:75:0A:23:keyid:99:83:A7:17:86:FF:98:93:CE:A0:DD:A1:F1:36:FA:F6:0F:75:0A:23 - name: plato - attributes: - referringConnector: http://plato-controlplane/BPNPLATO - # Must be the same certificate that is stores in section 'plato-vault' - certificate: |- - -----BEGIN CERTIFICATE----- - MIID7TCCAtWgAwIBAgIUJv9K1yHIGf/crrkLHtKlYUd06OwwDQYJKoZIhvcNAQEL - BQAwgYUxCzAJBgNVBAYTAkRFMQ8wDQYDVQQIDAZCZXJsaW4xDzANBgNVBAcMBkJl - cmxpbjEMMAoGA1UECgwDQk1XMSAwHgYDVQQLDBdlZGMtcGxheWdyb3VuZC1wYXJ0 - bmVyMjEkMCIGA1UEAwwbcGxhdG8tZWRjLmRlbW8uY2F0ZW5hLXgubmV0MB4XDTIz - MDQyNjEyNTQxNFoXDTMzMDQyMzEyNTQxNFowgYUxCzAJBgNVBAYTAkRFMQ8wDQYD - VQQIDAZCZXJsaW4xDzANBgNVBAcMBkJlcmxpbjEMMAoGA1UECgwDQk1XMSAwHgYD - VQQLDBdlZGMtcGxheWdyb3VuZC1wYXJ0bmVyMjEkMCIGA1UEAwwbcGxhdG8tZWRj - LmRlbW8uY2F0ZW5hLXgubmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC - AQEAwajlhy7Uf6V5P7UNmb5fSL0uJLt1EIeqEuLMTc8J6VhAgv7WGtRJiZySIFfQ - VBcwizO0C+pzyHXY957HJKFWhuiiACmO1NBOQuF5TCe/X9MHUOfK1l52mDu6zXhV - pPRn8ZY7CBul/94Wb/SS0+SJ6ogkdB8nwI++3ET166Wuv1aSdGKAc2daseQ1Ynau - fPL2ziVQDfPh51+9VUG8tuwGrwagFrawDk5FkZB7Z+nPZ0WpmLN2Q+oVRFaSgDRu - cTx6ejMs2tMSKzJIJjIVzgHRIULyPSMS3AlwHub3FwZp2TrXolczDJWL+XIbfHfw - 6KKNWGR80/RM457AhNzApd0GYQIDAQABo1MwUTAdBgNVHQ4EFgQU4TU1BUk881qd - H+g1I2jAuL+jAyAwHwYDVR0jBBgwFoAU4TU1BUk881qdH+g1I2jAuL+jAyAwDwYD - VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAEOkReVM7644reZoPIWEP - 4XVyXKwoIk/zxVPedtcCoXWdG2zVXULvjIc0vf65Ih1e9b65rz+v6yn0isZ5zfSm - mFOsVMg0vL9I4QQtOSx9tL5MXq+zPeRLVpeRvvUD67+wKkf9n+e1DByqCVfaF68U - DDq0L0VQgp3fRNEzLjcXlOOIQ4W/qc1lnxoxVCzQuLJwkZejokV9cj5JDBojmAuK - g+IDL1aArzzKMD5iAAqm0rDbDnMhn0Km+AshDEWgAqtnsVEBRlt+GDAc+d0nplLY - BR8UsaLdtAVHaivXCaZGpjiOsvdOpTwWOaU9HOkuf/1uX5DTaxtClt2BXAnxF3Ug - iQ== - -----END CERTIFICATE----- - -############## -# PostgreSQL # -############## -plato-postgresql: - fullnameOverride: "plato-postgresql" - primary: - persistence: - enabled: false - readReplicas: - persistence: - enabled: false - auth: - database: "edc" - username: "user" - password: "password" -sokrates-postgresql: - fullnameOverride: "sokrates-postgresql" - primary: - persistence: - enabled: false - readReplicas: - persistence: - enabled: false - auth: - database: "edc" - username: "user" - password: "password" - -######### -# MINIO # -######### -minio: - fullnameOverride: minio - replicas: 2 - drivesPerNode: 0 - serviceAccount: - create: false - persistence: - size: 128Mi - resources: - requests: - memory: 128Mi - service: - type: NodePort - control: - port: 9000 - users: - - accessKey: platoqwerty123 - secretKey: platoqwerty123 - policy: customBucketPolicy - - accessKey: sokratesqwerty123 - secretKey: sokratesqwerty123 - policy: customBucketPolicy - buckets: - # in some cases the minio API acts strange if there exists no bucket at all - - name: dummybucket - policy: none - purge: true - policies: - - name: customBucketPolicy - statements: - - resources: - - 'arn:aws:s3:::*' - actions: - - "s3:PutObject" - - "s3:ListBucket" - - "s3:CreateBucket" - - "s3:GetObject" - - "s3:DeleteObject" - - "s3:DeleteBucket" - -######### -# VAULT # -######### -vault: - fullnameOverride: "vault" - injector: - enabled: false - server: - dev: - enabled: true - devRootToken: "root" - # Must be the same certificate that is configured in section 'ids-daps' - postStart: - - "sh" - - "-c" - - | - { - - sleep 5 - - /bin/vault kv put secret/plato/data-encryption-aes-keys content=H7j47H6vVQQOv/hbdAYz+w== - - cat << EOF | /bin/vault kv put secret/plato/daps/my-plato-daps-key content=- - -----BEGIN PRIVATE KEY----- - MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDBqOWHLtR/pXk/ - tQ2Zvl9IvS4ku3UQh6oS4sxNzwnpWECC/tYa1EmJnJIgV9BUFzCLM7QL6nPIddj3 - nsckoVaG6KIAKY7U0E5C4XlMJ79f0wdQ58rWXnaYO7rNeFWk9GfxljsIG6X/3hZv - 9JLT5InqiCR0HyfAj77cRPXrpa6/VpJ0YoBzZ1qx5DVidq588vbOJVAN8+HnX71V - Qby27AavBqAWtrAOTkWRkHtn6c9nRamYs3ZD6hVEVpKANG5xPHp6Myza0xIrMkgm - MhXOAdEhQvI9IxLcCXAe5vcXBmnZOteiVzMMlYv5cht8d/Dooo1YZHzT9EzjnsCE - 3MCl3QZhAgMBAAECggEBAKR/RphRWwciE5/dtrPFVUKAD1X8NS/ZTMnGBCyDlLO0 - 1vduZ4dakyxk5mq6rKcBG6biQClu+PJpx+Zt5FJlCQ6HRDRHGKAEYLXGuDXL/W7z - 3d8HRPBaRPqCoeYuNPFs+W3oYjQ86AAzMXPfl2iNU+j3w58vZ6DVeRW5LfsAPTMg - Z8Sooa1jD2a/7uDN4lC0FGkTWif//Dio5tbijqeG8xqBnS8iKi4hgxcQA9azd0KB - 6uwvbX/izq4sVR2ZjxtT9WPX1cpOcXjUZBM9px9eAwLPmsM/AUAOHkKkd1DPYLjX - yyB0qvz+LmUQdJv11yGagsW7lrrvsBsro4ZMp0Ot1wECgYEA5j2XFCKNUcX/8OFm - 8E9q6DXyrd9T3rMxPYWR9nRwV0upN9Zd9mnvOKnl5MYQSgP0XJgwwyHawmG3wIcx - 0puf3uWi2lSpt6aafMCW6JEJbK/49XSPAjrptwkZUcCT3XJv1tMZuXzhv/p4t24o - hw9/EtzVxK7thGGZD6sDsQtbOlkCgYEA11OUofuD1VWN5YwFciPv0RhyfDyYYK7e - nPMXEoiBMQJnGkp3eaUzUgej/V93VtJcg9h0Tqn6NpI4rWUfUdi5ihZ6+hcvUIO4 - Roh+Oxpmu0yBfuBo7Uwf5XMpoQu74Z+cr24Pv32YtEUshUZidMuvOMaBXNJGlKiG - DjbCUV0CG0kCgYAVHvlJA5JrOfqsokDLMr3f53MHuED9YPrXZfVp4myb1XkEgknE - XRtw20UXo4PDBnHYPK3ceLKUuloc80oCw/v6ep5h4PpguovZfeFaHFP9AHeaLMMh - tT3TaKZF9aCa4/CWiG8HsQkUj2mbiiN1oFpL5K5HiLSJPFrKMSn5h80qoQKBgQC2 - obt1UEDXFwONaJ/N2dE0RkoEOdj8WBWUhVJSc9kv2lvcnsCLOqU2tChRZUFxMGcr - pNGxTtZcptTPrO9NmkZ0avDPYg7NeYs4t9hpBNGRlyhWlrwoWOLM2Eq8v5kRmzFo - Ui+lOT/l1q4WNEaZzZDG1Qcv1WHsAKwDLkrOe9ankQKBgQDM1fdqraKN2lCkDSPU - /Uw5nmFA7gNJQ9ta6CVITlDMWFb+e2OcDK7pKT1iEhJAfGndtQ0lwK6I5VDDxhXY - DGcU2UIWMAiJOZILDVjkny9brrIQ/fTwZps2qWNJ0bmYsmwPCe9QskNWz8sYAY6p - eBB+WUqNNqBb25p2CmcwqoT7Tg== - -----END PRIVATE KEY----- - EOF - - cat << EOF | /bin/vault kv put secret/plato/daps/my-plato-daps-crt content=- - -----BEGIN CERTIFICATE----- - MIID7TCCAtWgAwIBAgIUJv9K1yHIGf/crrkLHtKlYUd06OwwDQYJKoZIhvcNAQEL - BQAwgYUxCzAJBgNVBAYTAkRFMQ8wDQYDVQQIDAZCZXJsaW4xDzANBgNVBAcMBkJl - cmxpbjEMMAoGA1UECgwDQk1XMSAwHgYDVQQLDBdlZGMtcGxheWdyb3VuZC1wYXJ0 - bmVyMjEkMCIGA1UEAwwbcGxhdG8tZWRjLmRlbW8uY2F0ZW5hLXgubmV0MB4XDTIz - MDQyNjEyNTQxNFoXDTMzMDQyMzEyNTQxNFowgYUxCzAJBgNVBAYTAkRFMQ8wDQYD - VQQIDAZCZXJsaW4xDzANBgNVBAcMBkJlcmxpbjEMMAoGA1UECgwDQk1XMSAwHgYD - VQQLDBdlZGMtcGxheWdyb3VuZC1wYXJ0bmVyMjEkMCIGA1UEAwwbcGxhdG8tZWRj - LmRlbW8uY2F0ZW5hLXgubmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC - AQEAwajlhy7Uf6V5P7UNmb5fSL0uJLt1EIeqEuLMTc8J6VhAgv7WGtRJiZySIFfQ - VBcwizO0C+pzyHXY957HJKFWhuiiACmO1NBOQuF5TCe/X9MHUOfK1l52mDu6zXhV - pPRn8ZY7CBul/94Wb/SS0+SJ6ogkdB8nwI++3ET166Wuv1aSdGKAc2daseQ1Ynau - fPL2ziVQDfPh51+9VUG8tuwGrwagFrawDk5FkZB7Z+nPZ0WpmLN2Q+oVRFaSgDRu - cTx6ejMs2tMSKzJIJjIVzgHRIULyPSMS3AlwHub3FwZp2TrXolczDJWL+XIbfHfw - 6KKNWGR80/RM457AhNzApd0GYQIDAQABo1MwUTAdBgNVHQ4EFgQU4TU1BUk881qd - H+g1I2jAuL+jAyAwHwYDVR0jBBgwFoAU4TU1BUk881qdH+g1I2jAuL+jAyAwDwYD - VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAEOkReVM7644reZoPIWEP - 4XVyXKwoIk/zxVPedtcCoXWdG2zVXULvjIc0vf65Ih1e9b65rz+v6yn0isZ5zfSm - mFOsVMg0vL9I4QQtOSx9tL5MXq+zPeRLVpeRvvUD67+wKkf9n+e1DByqCVfaF68U - DDq0L0VQgp3fRNEzLjcXlOOIQ4W/qc1lnxoxVCzQuLJwkZejokV9cj5JDBojmAuK - g+IDL1aArzzKMD5iAAqm0rDbDnMhn0Km+AshDEWgAqtnsVEBRlt+GDAc+d0nplLY - BR8UsaLdtAVHaivXCaZGpjiOsvdOpTwWOaU9HOkuf/1uX5DTaxtClt2BXAnxF3Ug - iQ== - -----END CERTIFICATE----- - EOF - - /bin/vault kv put secret/sokrates/data-encryption-aes-keys content=OcvxzWCK8ETSjt1jmZw3RA== - - cat << EOF | /bin/vault kv put secret/sokrates/daps/my-sokrates-daps-key content=- - -----BEGIN PRIVATE KEY----- - MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCwq9Id70+ZDZ8F - oQJhkbxBKN/JysolwRsdBpXqWE6CpJTILRiF9uTpDq1yaquAc8m8Tduw6Fr1PQxI - scpZAm4cJsJqSNyIRfMOnFf6HWmHUN7RHmes1mF6isfjFVkx0PAODY8uuD1jQ1gW - Zmhr8XhOPIuxCZ56zDOQhgwCmwPyXdZ5RcWqvYRomgh2tpAjSnX6yemVHWuaz5Sy - ZOWrd1T8b0SKU+dBqdz+D7XcKcCB8Gu8tcUwXON2xH3A9ZZkfVZJMQl/JYOFdTgS - 8dRlcKFGQZDfD+Dzk7foEKuxWw2wRHjkpihCwt03PA/CQhr/eLBIOqPuMs4Kb8iL - zMlfLhnBAgMBAAECggEAVYco1mMXRsIoXQJAc9moqGbQSBGLYVGl/ZxFkUik4Wwp - turV92y6DvWTFFP9qNblL+sFUxR5jEW8n6iqjAK4KZq9/dQ+Jx6t90HK+YOppd+J - rvUoPa0fTcLH1/Bq2MoMnNEFoxmAZoCgsV9sZ+1jT4TSH6fHeC1JPUsXn19KPtdO - 0b0XvRCVU4sPpzXeaRypnwTsDMgHUoGvxoHQ7Pif5iTnEdgvc7V3ACWOanp/bEuM - 9hoHquggrO/F8SDC4wjn4BlwsxedQZyVF4a76iGS3D/CFrYd8cUKJyCtGySEl7jS - kIwDoG4oQV5mLFSLaq1BDOo8W5ku9JXAW2DZiEgkPQKBgQDav9QTSOp+gqfCDMhT - c45wxYfLfR5QCS5BLufdMmlocL/DzTHTsVddGnOGLoDr8Dbm9nL/vcPmgRtZ0crD - aGqn7sgmbpN6jMsnXhGuOhPZt7Folfbkhv6EFfyjeTZdY4vacrINp97rdVbRvNLs - pDJiHE7PjDTCJh8q2gcWqgc+vwKBgQDOwaJ8NvnnUwrBGzkUHdM4bGunxlK3VV0s - r1BFkmLXbF0qr8sTaUtBj3rbfvMe9R/5hGcuAyDWo+MyVoHc0nzkU1jQwqObLUZB - kg9ZJj4qmnGKnd39TfhDoEluBnl+iYhbXav/2F5eB2UpR0c+DHPrsreGdI3s7O9O - aLL+x5FHfwKBgQCNDwhdyzZTkENHkeCYV7rxo58WrD8g01q9c9bWv8xTKemvBKHt - 5bz1b7oxO8ms24E73I55tdAe0wBlIjDDY5Dra8IrbkCx1Rqn7zQtiowEaD0BuTq1 - UQvM9zSr4d0ZybiEjFOfFLJeWZM7uqy1JojK1YBIvBvFWrnccy4BAnGblwKBgQC5 - GHLNfy4koJw9GpDz6GuC1NVgAtVkWaCrc1uKnS2tq86Qe4ZzH02HKNsVC8a9jTcN - 2zG/6H8KiPfJxdZGiY3TnqYhZk6vik2eQBNLfUgkPdWuAfyNW7MJX8K9JEC6Pof7 - O5XS2rJIvZgb5zrpWp6ggIN6dHfmhosKiALOwnzWIwKBgBsvToOVMzL/7IL4VtSj - u9P+g2shtg9w1dpnscHxUVi2fbKeRRmv2AT140lVpSznIPUmw6FVFUhqE1OTnu1c - qS53otAdwiHAfmYz8u0dZeO0Hc5g4K9geB/BsSthXo3u10HuIVLxefKq2M+3zfJj - ZvNovy5dPYu82VTfm3gUX+Ca - -----END PRIVATE KEY----- - EOF - - cat << EOF | /bin/vault kv put secret/sokrates/daps/my-sokrates-daps-crt content=- - -----BEGIN CERTIFICATE----- - MIIEAzCCAuugAwIBAgIULy0aTdGiGkyvVp7l5Ccoq7DQREgwDQYJKoZIhvcNAQEL - BQAwgZAxCzAJBgNVBAYTAkRFMQ8wDQYDVQQIDAZCZXJsaW4xDzANBgNVBAcMBkJl - cmxpbjEMMAoGA1UECgwDQk1XMSAwHgYDVQQLDBdlZGMtcGxheWdyb3VuZC1wYXJ0 - bmVyMTEvMC0GA1UEAwwmc29rcmF0ZXMtZWRjLmRlbW8uY2F0ZW5hLXgubmV0L0JQ - TjEyMzQwHhcNMjMwNDI2MTI1OTE5WhcNMzMwNDIzMTI1OTE5WjCBkDELMAkGA1UE - BhMCREUxDzANBgNVBAgMBkJlcmxpbjEPMA0GA1UEBwwGQmVybGluMQwwCgYDVQQK - DANCTVcxIDAeBgNVBAsMF2VkYy1wbGF5Z3JvdW5kLXBhcnRuZXIxMS8wLQYDVQQD - DCZzb2tyYXRlcy1lZGMuZGVtby5jYXRlbmEteC5uZXQvQlBOMTIzNDCCASIwDQYJ - KoZIhvcNAQEBBQADggEPADCCAQoCggEBALCr0h3vT5kNnwWhAmGRvEEo38nKyiXB - Gx0GlepYToKklMgtGIX25OkOrXJqq4BzybxN27DoWvU9DEixylkCbhwmwmpI3IhF - 8w6cV/odaYdQ3tEeZ6zWYXqKx+MVWTHQ8A4Njy64PWNDWBZmaGvxeE48i7EJnnrM - M5CGDAKbA/Jd1nlFxaq9hGiaCHa2kCNKdfrJ6ZUda5rPlLJk5at3VPxvRIpT50Gp - 3P4PtdwpwIHwa7y1xTBc43bEfcD1lmR9VkkxCX8lg4V1OBLx1GVwoUZBkN8P4POT - t+gQq7FbDbBEeOSmKELC3Tc8D8JCGv94sEg6o+4yzgpvyIvMyV8uGcECAwEAAaNT - MFEwHQYDVR0OBBYEFIxEsuJTl+5V8vTCUhMGhWsmdQShMB8GA1UdIwQYMBaAFIxE - suJTl+5V8vTCUhMGhWsmdQShMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL - BQADggEBAJHOKmFNZDk5xebzBARgcIrYrmRb5pIU4gNCWh/q1TF0+CFnnK8RTFTZ - 12pTbid6v5knn/f9bsilnudhxBzBQ4bukiI8Be0nzYfZU2dTU+w1cl/JnJfkGirt - 8Nwqv3fiUXfFBl8nE0RduAk9XF/UBIZXPapE6u1zR29jvuV+ppmhQrFFeJufeBGd - Wwn6XGK4fzENGDyjdk4QB/dg3/heM5h330vIGO4hVvlQBfJhNbC7Iikkr5ulytfd - deuZIfa7hG6WgIgGhg3YL1p/TTpJamBDS860PWyI7RH3o53VPphu/y2Rpud5AECV - xcrqaSGUTZPVyTUB8BxE32LqFDbpZb4= - -----END CERTIFICATE----- - EOF - } - - ui: - enabled: true - externalPort: 8200 - targetPort: 8200 diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java deleted file mode 100644 index 0405bf646..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/AssetStepDefs.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.en.Given; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.eclipse.tractusx.edc.tests.data.Asset; -import org.eclipse.tractusx.edc.tests.data.NullDataAddress; - -public class AssetStepDefs { - - @Given("'{connector}' has the following assets") - public void hasAssets(Connector connector, DataTable table) throws Exception { - final DataManagementAPI api = connector.getDataManagementAPI(); - final List assets = parseDataTable(table); - - for (Asset asset : assets) api.createAsset(asset); - } - - @Given("'{connector}' has '{int}' assets") - public void hasAssets(Connector connector, int assetCount) throws Exception { - final DataManagementAPI api = connector.getDataManagementAPI(); - - for (var i = 0; i < assetCount; i++) - api.createAsset( - new Asset( - UUID.randomUUID().toString(), i + 1 + " / " + assetCount, NullDataAddress.INSTANCE)); - } - - private List parseDataTable(DataTable table) { - final List assets = new ArrayList<>(); - - for (Map map : table.asMaps()) { - String id = map.get("id"); - String description = map.get("description"); - assets.add(new Asset(id, description, NullDataAddress.INSTANCE)); - } - - return assets; - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendDataService.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendDataService.java deleted file mode 100644 index 21beba150..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendDataService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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; - - -import java.io.InputStream; -import java.util.List; - -public interface BackendDataService { - List list(String path); - - boolean exists(String path); - - byte[] get(String path); - - void post(String path, InputStream inputStream, long length); - - void post(String path, InputStream inputStream); - - void post(String path, byte[] content); - - void delete(String path); -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java deleted file mode 100644 index f6773d7c0..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/BackendServiceSteps.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 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 - */ - - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.java.en.Given; - -public class BackendServiceSteps { - - @Given("'{connector}' has an empty backend-service") - public void cleanBackendService(Connector connector) { - var backendServiceBackendAPI = connector.getBackendServiceBackendAPI(); - - backendServiceBackendAPI.list("/").forEach(backendServiceBackendAPI::delete); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java deleted file mode 100644 index 3bb8e9c5a..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/CatalogStepDefs.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import org.eclipse.tractusx.edc.tests.data.ContractOffer; -import org.junit.jupiter.api.Assertions; - -public class CatalogStepDefs { - - private List lastRequestedOffers; - - @When("'{connector}' requests the catalog from '{connector}'") - public void requestCatalog(Connector sender, Connector receiver) throws IOException { - - final DataManagementAPI dataManagementAPI = sender.getDataManagementAPI(); - final String receiverIdsUrl = receiver.getEnvironment().getIdsUrl() + "/data"; - - lastRequestedOffers = dataManagementAPI.requestCatalogFrom(receiverIdsUrl); - } - - @Then("the catalog contains the following offers") - public void verifyCatalogContains(DataTable table) { - for (Map map : table.asMaps()) { - final String sourceContractDefinitionId = map.get("source definition"); - final String assetId = map.get("asset"); - - final boolean isInCatalog = isInCatalog(assetId, sourceContractDefinitionId); - - Assertions.assertTrue( - isInCatalog, - String.format( - "Expected the catalog to contain offer for definition '%s' and asset '%s' ", - sourceContractDefinitionId, assetId)); - } - } - - @Then("the catalog does not contain the following offers") - public void verifyCatalogContainsNot(DataTable table) { - for (Map map : table.asMaps()) { - final String sourceContractDefinitionId = map.get("source definition"); - final String assetId = map.get("asset"); - - final boolean isInCatalog = isInCatalog(assetId, sourceContractDefinitionId); - - Assertions.assertFalse( - isInCatalog, - String.format( - "Expected the catalog to not contain offer for definition '%s' and asset '%s' ", - sourceContractDefinitionId, assetId)); - } - } - - @Then("the catalog contains '{int}' offers") - public void verifyCatalogContainsXOffers(int offerCount) { - - Assertions.assertEquals( - offerCount, - lastRequestedOffers.size(), - String.format( - "Expected the catalog to contain '%s' offers, but got '%s'.", - offerCount, lastRequestedOffers.size())); - } - - private boolean isInCatalog(String assetId, String definitionId) { - return lastRequestedOffers.stream() - .anyMatch(c -> c.getAssetId().equals(assetId) && c.getId().startsWith(definitionId)); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java deleted file mode 100644 index d4e2ea7a8..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Connector.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - - -import org.eclipse.tractusx.edc.tests.util.DatabaseCleaner; -import org.eclipse.tractusx.edc.tests.util.S3Client; - -import static org.mockito.Mockito.mock; - -public class Connector { - - private final String name; - - private final Environment environment; - - private final DataManagementAPI dataManagementAPI; - - private final DatabaseCleaner databaseCleaner; - - - private final S3Client s3Client; - - public Connector(String name, Environment environment) { - this.name = name; - this.environment = environment; - dataManagementAPI = loadDataManagementAPI(); - databaseCleaner = loadDatabaseCleaner(); - s3Client = createS3Client(); - } - - public BackendDataService getBackendServiceBackendAPI() { - return mock(BackendDataService.class); - } - - public DatabaseCleaner getDatabaseCleaner() { - return databaseCleaner; - } - - public DataManagementAPI getDataManagementAPI() { - return dataManagementAPI; - } - - public Environment getEnvironment() { - return environment; - } - - public S3Client getS3Client() { - return s3Client; - } - - public String getName() { - return name; - } - - private DataManagementAPI loadDataManagementAPI() { - return new DataManagementAPI( - environment.getDataManagementUrl(), environment.getDataManagementAuthKey()); - } - - private DatabaseCleaner loadDatabaseCleaner() { - return new DatabaseCleaner( - environment.getDatabaseUrl(), - environment.getDatabaseUser(), - environment.getDatabasePassword()); - } - - - private S3Client createS3Client() { - return new S3Client(environment); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java deleted file mode 100644 index 364e266f3..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; - - -public class ConnectorFactory { - private static final Map CONNECTOR_CACHE = new ConcurrentHashMap<>(); - - public static Connector byName(String name) { - Objects.requireNonNull(name); - return CONNECTOR_CACHE.computeIfAbsent( - name.toUpperCase(Locale.ROOT), k -> createConnector(name)); - } - - private static Connector createConnector(String name) { - Objects.requireNonNull(name); - Environment environment = Environment.byName(name); - - return new Connector(name, environment); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java deleted file mode 100644 index cde597521..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ConnectorSteps.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.java.en.Given; -import java.sql.SQLException; - -public class ConnectorSteps { - - @Given("'{connector}' has an empty database") - public void cleanDatabase(Connector connector) throws SQLException { - connector.getDatabaseCleaner().run(); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java deleted file mode 100644 index 6a7de2ceb..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Constants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -public final class Constants { - public static final String DATA_MANAGEMENT_URL = "DATA_MANAGEMENT_URL"; - public static final String DATA_MANAGEMENT_API_AUTH_KEY = "DATA_MANAGEMENT_API_AUTH_KEY"; - public static final String IDS_URL = "IDS_URL"; - public static final String DATA_PLANE_URL = "DATA_PLANE_URL"; - public static final String BACKEND_SERVICE_BACKEND_API_URL = "BACKEND_SERVICE_BACKEND_API_URL"; - public static final String DATABASE_URL = "DATABASE_URL"; - public static final String DATABASE_USER = "DATABASE_USER"; - public static final String DATABASE_PASSWORD = "DATABASE_PASSWORD"; - public static final String EDC_AWS_ENDPOINT_OVERRIDE = "EDC_AWS_ENDPOINT_OVERRIDE"; - public static final String AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID"; - public static final String AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"; -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java deleted file mode 100644 index 634a845ff..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ContractDefinitionStepDefs.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.en.Given; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import org.eclipse.tractusx.edc.tests.data.ContractDefinition; - -public class ContractDefinitionStepDefs { - - @Given("'{connector}' has the following contract definitions") - public void hasPolicies(Connector connector, DataTable table) throws Exception { - final DataManagementAPI api = connector.getDataManagementAPI(); - final List contractDefinitions = parseDataTable(table); - - for (ContractDefinition contractDefinition : contractDefinitions) - api.createContractDefinition(contractDefinition); - } - - private List parseDataTable(DataTable table) { - final List contractDefinitions = new ArrayList<>(); - - for (Map map : table.asMaps()) { - String id = map.get("id"); - String accessPolicyId = map.get("access policy"); - String contractPolicyId = map.get("contract policy"); - String assetId = map.get("asset"); - List assetIds = assetId == null ? new ArrayList<>() : List.of(assetId); - - String mapValidity = map.get("validity"); - Long validity = mapValidity == null ? null : Long.parseLong(mapValidity); - - contractDefinitions.add( - new ContractDefinition(id, contractPolicyId, accessPolicyId, assetIds, validity)); - } - - return contractDefinitions; - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java deleted file mode 100644 index e786c789a..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/ControlPlaneAdapterSteps.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2023 ZF Friedrichshafen AG - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import com.google.gson.Gson; -import io.cucumber.datatable.DataTable; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.HttpClientBuilder; -import org.eclipse.edc.spi.system.health.HealthStatus; -import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; -import org.junit.jupiter.api.Assertions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.Map; - -public class ControlPlaneAdapterSteps { - - private static final Logger log = LoggerFactory.getLogger(ControlPlaneAdapterSteps.class); - private EndpointDataReference endpointDataReference; - - /* - * TODO: see of EndToEndTransfer.feature - * the current Bussinnes test is not running, because of a possible rare condition in the CI pipeline - * regarding the contract validity: see https://github.com/eclipse-edc/Connector/issues/2514 - */ - - // @When("'{connector}' gets a request endpoint from '{connector}'") - public void getEndPointFromGetRequest(Connector consumer, Connector receiver, DataTable table) - throws IOException { - - DataManagementAPI dataManagementAPI = consumer.getDataManagementAPI(); - String receiverIdsUrl = receiver.getEnvironment().getIdsUrl() + "/data"; - - for (Map map : table.asMaps()) { - String assetId = map.get("asset id"); - - endpointDataReference = dataManagementAPI.getEdcEndpoint(assetId, receiverIdsUrl); - - log.debug("endpointDataReference in controlplane" + endpointDataReference.toString()); - } - } - - /* - * TODO: see EndToEndTransfer.feature - * the current Bussinnes test is not running, because of a possible rare condition in the CI pipeline - * regarding the contract validity: see https://github.com/eclipse-edc/Connector/issues/2514 - */ - - // @Then("'{connector}' asks for the asset from the endpoint") - public void receiveEndpoint(Connector consumer) throws IOException { - - var requestUrl = endpointDataReference.getEndpoint(); - var key = endpointDataReference.getAuthKey(); - var value = endpointDataReference.getAuthCode(); - var httpClient = HttpClientBuilder.create().build(); - var get = new HttpGet(requestUrl); - get.addHeader(key, value); - CloseableHttpResponse response = httpClient.execute(get); - var bytes = response.getEntity().getContent().readAllBytes(); - var result = new String(bytes); - var resultTransformed = new Gson().fromJson(result, HealthStatus.class); - - Assertions.assertTrue(resultTransformed.isHealthy()); - Assertions.assertFalse(resultTransformed.getComponentResults().isEmpty()); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java deleted file mode 100644 index d67dc77ca..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/DataManagementAPI.java +++ /dev/null @@ -1,739 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import com.google.gson.Gson; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.message.BasicHeader; -import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; -import org.eclipse.tractusx.edc.tests.data.Asset; -import org.eclipse.tractusx.edc.tests.data.BusinessPartnerNumberConstraint; -import org.eclipse.tractusx.edc.tests.data.Constraint; -import org.eclipse.tractusx.edc.tests.data.ContractDefinition; -import org.eclipse.tractusx.edc.tests.data.ContractNegotiation; -import org.eclipse.tractusx.edc.tests.data.ContractNegotiationState; -import org.eclipse.tractusx.edc.tests.data.ContractOffer; -import org.eclipse.tractusx.edc.tests.data.DataAddress; -import org.eclipse.tractusx.edc.tests.data.HttpProxySinkDataAddress; -import org.eclipse.tractusx.edc.tests.data.HttpProxySourceDataAddress; -import org.eclipse.tractusx.edc.tests.data.Negotiation; -import org.eclipse.tractusx.edc.tests.data.NullDataAddress; -import org.eclipse.tractusx.edc.tests.data.OrConstraint; -import org.eclipse.tractusx.edc.tests.data.PayMeConstraint; -import org.eclipse.tractusx.edc.tests.data.Permission; -import org.eclipse.tractusx.edc.tests.data.Policy; -import org.eclipse.tractusx.edc.tests.data.S3DataAddress; -import org.eclipse.tractusx.edc.tests.data.Transfer; -import org.eclipse.tractusx.edc.tests.data.TransferProcess; -import org.eclipse.tractusx.edc.tests.data.TransferProcessState; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -public class DataManagementAPI { - - private static final Logger log = LoggerFactory.getLogger(DataManagementAPI.class); - private static final String ASSET_PATH = "/assets"; - private static final String POLICY_PATH = "/policydefinitions"; - private static final String CONTRACT_DEFINITIONS_PATH = "/contractdefinitions"; - private static final String CATALOG_PATH = "/catalog"; - private static final String NEGOTIATIONS_PATH = "/contractnegotiations"; - private static final String TRANSFER_PATH = "/transferprocess"; - private static final String ADAPTER_PATH = "/adapter/asset/sync/"; - - private final String dataMgmtUrl; - private final String dataMgmtAuthKey; - private final CloseableHttpClient httpClient; - - public DataManagementAPI(String dataManagementUrl, String dataMgmtAuthKey) { - httpClient = HttpClientBuilder.create().build(); - dataMgmtUrl = dataManagementUrl; - this.dataMgmtAuthKey = dataMgmtAuthKey; - } - - public List requestCatalogFrom(String receivingConnectorUrl) throws IOException { - String encodedUrl = URLEncoder.encode(receivingConnectorUrl, StandardCharsets.UTF_8); - ManagementApiContractOfferCatalog catalog = - get( - CATALOG_PATH, - "providerUrl=" + encodedUrl, - new TypeToken() { - }); - - log.debug("Received " + catalog.contractOffers.size() + " offers"); - - return catalog.contractOffers.stream().map(this::mapOffer).collect(Collectors.toList()); - } - - public Negotiation initiateNegotiation( - String receivingConnectorUrl, String definitionId, String assetId, Policy policy) - throws IOException { - ManagementApiOffer offer = new ManagementApiOffer(); - offer.offerId = definitionId + ":foo"; - offer.assetId = assetId; - offer.policy = mapPolicy(policy); - offer.policy.permissions.forEach(p -> p.target = assetId); - - ManagementApiNegotiationPayload negotiationPayload = - new ManagementApiNegotiationPayload(); - negotiationPayload.connectorAddress = receivingConnectorUrl; - negotiationPayload.offer = offer; - - ManagementApiNegotiationResponse response = - post( - NEGOTIATIONS_PATH, - negotiationPayload, - new TypeToken() { - }); - - if (response == null) { - throw new RuntimeException( - "Initiated negotiation. Connector did not answer with negotiation ID."); - } - - log.info(String.format("Initiated negotiation (id=%s)", response.getId())); - - String negotiationId = response.getId(); - return new Negotiation(negotiationId); - } - - public Transfer initiateTransferProcess( - String receivingConnectorUrl, - String contractAgreementId, - String assetId, - DataAddress dataAddress) - throws IOException { - ManagementApiTransfer transfer = new ManagementApiTransfer(); - - transfer.connectorAddress = receivingConnectorUrl; - transfer.contractId = contractAgreementId; - transfer.assetId = assetId; - transfer.transferType = new ManagementApiTransferType(); - transfer.managedResources = false; - transfer.dataDestination = mapDataAddress(dataAddress); - transfer.protocol = "ids-multipart"; - - return initiateTransferProcess(transfer); - } - - public Transfer initiateTransferProcess( - String receivingConnectorUrl, - String contractAgreementId, - String assetId, - DataAddress dataAddress, - String receiverEndpoint) - throws IOException { - ManagementApiTransfer transfer = new ManagementApiTransfer(); - - transfer.connectorAddress = receivingConnectorUrl; - transfer.contractId = contractAgreementId; - transfer.assetId = assetId; - transfer.transferType = new ManagementApiTransferType(); - transfer.managedResources = false; - transfer.dataDestination = mapDataAddress(dataAddress); - transfer.protocol = "ids-multipart"; - transfer.properties = new ManagementApiProperties(receiverEndpoint); - - return initiateTransferProcess(transfer); - } - - public Asset initiateTransferProcess( - String endpointUrl, String endpointAuthKey, String endpointAuthCode) throws IOException { - Header header = new BasicHeader(endpointAuthKey, endpointAuthCode); - return get(endpointUrl, header, new TypeToken() { - }); - } - - public TransferProcess getTransferProcess(String id) throws IOException { - ManagementApiTransferProcess transferProcess = - get(TRANSFER_PATH + "/" + id, new TypeToken() { - }); - return mapTransferProcess(transferProcess); - } - - public ContractNegotiation getNegotiation(String id) throws IOException { - ManagementApiNegotiation negotiation = - get(NEGOTIATIONS_PATH + "/" + id, new TypeToken() { - }); - return mapNegotiation(negotiation); - } - - public List getNegotiations() throws IOException { - List negotiations = - get(NEGOTIATIONS_PATH + "/", new TypeToken>() { - }); - return negotiations.stream().map(this::mapNegotiation).collect(Collectors.toList()); - } - - public void createAsset(Asset asset) throws IOException { - ManagementApiAssetCreate assetCreate = new ManagementApiAssetCreate(); - - assetCreate.asset = mapAsset(asset); - assetCreate.dataAddress = mapDataAddress(asset.getDataAddress()); - - post(ASSET_PATH, assetCreate); - } - - public void createPolicy(Policy policy) throws IOException { - post(POLICY_PATH, mapPolicyDefinition(policy)); - } - - public void createContractDefinition(ContractDefinition contractDefinition) throws IOException { - post(CONTRACT_DEFINITIONS_PATH, mapContractDefinition(contractDefinition)); - } - - public EndpointDataReference getEdcEndpoint(String assetId, String receivingConnectorUrl) - throws IOException { - String encodedUrl = ADAPTER_PATH + assetId + "?providerUrl=" + receivingConnectorUrl; - - EndpointDataReference endpoint = - get(encodedUrl, new TypeToken() { - }); - - return endpoint; - } - - private Transfer initiateTransferProcess(ManagementApiTransfer transfer) throws IOException { - ManagementApiTransferResponse response = - post(TRANSFER_PATH, transfer, new TypeToken() { - }); - - if (response == null) { - throw new RuntimeException( - "Initiated transfer process. Connector did not answer with transfer process ID."); - } - - log.info(String.format("Initiated transfer process (id=%s)", response.getId())); - - String transferId = response.getId(); - return new Transfer(transferId); - } - - private T get(String path, String params, TypeToken typeToken) throws IOException { - return get(path + "?" + params, typeToken); - } - - private T get(String path, TypeToken typeToken) throws IOException { - - HttpGet get = new HttpGet(dataMgmtUrl + path); - HttpResponse response = sendRequest(get); - byte[] json = response.getEntity().getContent().readAllBytes(); - - log.debug("Received response: {}", new String(json, StandardCharsets.UTF_8)); - return new Gson().fromJson(new String(json, StandardCharsets.UTF_8), typeToken.getType()); - } - - private T get(String path, Header header, TypeToken typeToken) throws IOException { - - HttpGet get = new HttpGet(path); - get.addHeader(header); - HttpResponse response = sendRequest(get); - byte[] json = response.getEntity().getContent().readAllBytes(); - - log.debug("Received response: {}", new String(json, StandardCharsets.UTF_8)); - return new Gson().fromJson(new String(json, StandardCharsets.UTF_8), typeToken.getType()); - } - - private void post(String path, Object object) throws IOException { - post(path, object, new TypeToken() { - }); - } - - private T post(String path, Object object, TypeToken typeToken) throws IOException { - String url = String.format("%s%s", dataMgmtUrl, path); - HttpPost post = new HttpPost(url); - post.addHeader("Content-Type", "application/json"); - - var json = new Gson().toJson(object); - - log.debug("POST Payload: " + json); - - post.setEntity(new StringEntity(json)); - CloseableHttpResponse response = sendRequest(post); - - T responseJson = null; - if (!typeToken.equals(new TypeToken() { - })) { - byte[] responseBytes = response.getEntity().getContent().readAllBytes(); - responseJson = - new Gson() - .fromJson(new String(responseBytes, StandardCharsets.UTF_8), typeToken.getType()); - } - - response.close(); - - return responseJson; - } - - private CloseableHttpResponse sendRequest(HttpRequestBase request) throws IOException { - request.addHeader("X-Api-Key", dataMgmtAuthKey); - - log.debug(String.format("Send %-6s %s", request.getMethod(), request.getURI())); - - CloseableHttpResponse response = httpClient.execute(request); - if (200 > response.getStatusLine().getStatusCode() - || response.getStatusLine().getStatusCode() >= 300) { - throw new RuntimeException( - String.format("Unexpected response: %s", response.getStatusLine())); - } - - return response; - } - - private ContractNegotiation mapNegotiation(ManagementApiNegotiation negotiation) { - - ContractNegotiationState state; - - switch (negotiation.state) { - case "ERROR": - state = ContractNegotiationState.ERROR; - break; - case "INITIAL": - state = ContractNegotiationState.INITIAL; - break; - case "DECLINED": - state = ContractNegotiationState.DECLINED; - break; - case "CONFIRMED": - state = ContractNegotiationState.CONFIRMED; - break; - default: - state = ContractNegotiationState.UNKNOWN; - } - - return new ContractNegotiation(negotiation.id, state, negotiation.contractAgreementId); - } - - private TransferProcess mapTransferProcess(ManagementApiTransferProcess transferProcess) { - - TransferProcessState state; - - switch (transferProcess.state) { - case "COMPLETED": - state = TransferProcessState.COMPLETED; - break; - case "ERROR": - state = TransferProcessState.ERROR; - break; - default: - state = TransferProcessState.UNKNOWN; - } - - return new TransferProcess(transferProcess.id, state); - } - - private ManagementApiDataAddress mapDataAddress(DataAddress dataAddress) { - Objects.requireNonNull(dataAddress); - ManagementApiDataAddress apiObject = new ManagementApiDataAddress(); - - if (dataAddress instanceof HttpProxySourceDataAddress) { - var address = (HttpProxySourceDataAddress) dataAddress; - var properties = new HashMap(); - properties.put("type", "HttpData"); - properties.put("baseUrl", address.getBaseUrl()); - var oauth2Provision = address.getOauth2Provision(); - if (oauth2Provision != null) { - properties.put("oauth2:tokenUrl", oauth2Provision.getTokenUrl()); - properties.put("oauth2:clientId", oauth2Provision.getClientId()); - properties.put("oauth2:clientSecret", oauth2Provision.getClientSecret()); - properties.put("oauth2:scope", oauth2Provision.getScope()); - } - apiObject.setProperties(properties); - } else if (dataAddress instanceof HttpProxySinkDataAddress) { - apiObject.setProperties(Map.of("type", "HttpProxy")); - } else if (dataAddress instanceof S3DataAddress) { - S3DataAddress a = (S3DataAddress) dataAddress; - apiObject.setProperties( - Map.of( - "type", - "AmazonS3", - "bucketName", - a.getBucketName(), - "region", - a.getRegion(), - "keyName", - a.getKeyName())); - } else if (dataAddress instanceof NullDataAddress) { - // set something that passes validation - apiObject.setProperties(Map.of("type", "HttpData", "baseUrl", "http://localhost")); - } else { - throw new UnsupportedOperationException( - String.format( - "Cannot map data address of type %s to EDC domain", dataAddress.getClass())); - } - - return apiObject; - } - - private ManagementApiAsset mapAsset(Asset asset) { - Map properties = - Map.of( - ManagementApiAsset.ID, asset.getId(), - ManagementApiAsset.DESCRIPTION, asset.getDescription()); - - ManagementApiAsset apiObject = new ManagementApiAsset(); - apiObject.setProperties(properties); - return apiObject; - } - - private Policy mapPolicy(ManagementApiPolicy managementApiPolicy) { - String id = managementApiPolicy.uid; - List permissions = - managementApiPolicy.permissions.stream() - .map(this::mapPermission) - .collect(Collectors.toList()); - - return new Policy(id, permissions); - } - - private ManagementApiPolicy mapPolicy(Policy policy) { - List permissions = - policy.getPermission().stream().map(this::mapPermission).collect(Collectors.toList()); - ManagementApiPolicy managementApiPolicy = new ManagementApiPolicy(); - managementApiPolicy.permissions = permissions; - - return managementApiPolicy; - } - - private ManagementApiPolicyDefinition mapPolicyDefinition(Policy policy) { - ManagementApiPolicyDefinition apiObject = new ManagementApiPolicyDefinition(); - apiObject.id = policy.getId(); - apiObject.policy = mapPolicy(policy); - return apiObject; - } - - private Permission mapPermission(ManagementApiPermission managementApiPermission) { - String target = managementApiPermission.target; - String action = managementApiPermission.action.type; - return new Permission(action, new ArrayList<>(), target); - } - - private ManagementApiPermission mapPermission(Permission permission) { - String target = permission.getTarget(); - String action = permission.getAction(); - - ManagementApiRuleAction apiAction = new ManagementApiRuleAction(); - apiAction.type = action; - - var constraints = - permission.getConstraints().stream().map(this::mapConstraint).collect(Collectors.toList()); - - ManagementApiPermission apiObject = new ManagementApiPermission(); - apiObject.target = target; - apiObject.action = apiAction; - apiObject.constraints = constraints; - return apiObject; - } - - private ManagementConstraint mapConstraint(Constraint constraint) { - if (OrConstraint.class.equals(constraint.getClass())) { - return mapConstraint((OrConstraint) constraint); - } else if (BusinessPartnerNumberConstraint.class.equals(constraint.getClass())) { - return mapConstraint((BusinessPartnerNumberConstraint) constraint); - } else if (PayMeConstraint.class.equals(constraint.getClass())) { - return mapConstraint((PayMeConstraint) constraint); - } else { - throw new UnsupportedOperationException( - "Unsupported constraint type: " + constraint.getClass().getName()); - } - } - - private ManagementAtomicConstraint mapConstraint(PayMeConstraint constraint) { - ManagementApiLiteralExpression leftExpression = new ManagementApiLiteralExpression(); - leftExpression.value = "PayMe"; - - ManagementApiLiteralExpression rightExpression = new ManagementApiLiteralExpression(); - rightExpression.value = String.valueOf(constraint.getAmount()); - - ManagementAtomicConstraint dataManagementApiConstraint = new ManagementAtomicConstraint(); - dataManagementApiConstraint.leftExpression = leftExpression; - dataManagementApiConstraint.rightExpression = rightExpression; - dataManagementApiConstraint.operator = "EQ"; - - return dataManagementApiConstraint; - } - - private ManagementAtomicConstraint mapConstraint(BusinessPartnerNumberConstraint constraint) { - ManagementApiLiteralExpression leftExpression = new ManagementApiLiteralExpression(); - leftExpression.value = "BusinessPartnerNumber"; - - ManagementApiLiteralExpression rightExpression = new ManagementApiLiteralExpression(); - rightExpression.value = constraint.getBusinessPartnerNumber(); - - ManagementAtomicConstraint dataManagementApiConstraint = new ManagementAtomicConstraint(); - dataManagementApiConstraint.leftExpression = leftExpression; - dataManagementApiConstraint.rightExpression = rightExpression; - dataManagementApiConstraint.operator = "EQ"; - - return dataManagementApiConstraint; - } - - private ManagementOrConstraint mapConstraint(OrConstraint constraint) { - var orConstraint = new ManagementOrConstraint(); - orConstraint.constraints = - constraint.getConstraints().stream().map(this::mapConstraint).collect(Collectors.toList()); - return orConstraint; - } - - private ContractOffer mapOffer(ManagementApiContractOffer managementApiContractOffer) { - String id = managementApiContractOffer.id; - String assetId = - managementApiContractOffer.assetId != null - ? managementApiContractOffer.assetId - : (String) managementApiContractOffer.asset.getProperties().get(ManagementApiAsset.ID); - - Policy policy = mapPolicy(managementApiContractOffer.getPolicy()); - - return new ContractOffer(id, policy, assetId); - } - - private ManagementApiContractDefinition mapContractDefinition( - ContractDefinition contractDefinition) { - - ManagementApiContractDefinition apiObject = new ManagementApiContractDefinition(); - apiObject.id = contractDefinition.getId(); - apiObject.accessPolicyId = contractDefinition.getAcccessPolicyId(); - apiObject.contractPolicyId = contractDefinition.getContractPolicyId(); - apiObject.criteria = new ArrayList<>(); - - for (String assetId : contractDefinition.getAssetIds()) { - ManagementApiCriterion criterion = new ManagementApiCriterion(); - criterion.operandLeft = ManagementApiAsset.ID; - criterion.operator = "="; - criterion.operandRight = assetId; - - apiObject.criteria.add(criterion); - } - - return apiObject; - } - - private interface ManagementConstraint { - } - - - private static class ManagementApiNegotiationResponse { - private String id; - - - public String getId() { - return id; - } - } - - - private static class ManagementApiNegotiationPayload { - private final String connectorId = "foo"; - private String connectorAddress; - private ManagementApiOffer offer; - } - - private static class ManagementApiNegotiation { - private String id; - private String state; - private String contractAgreementId; - } - - private static class ManagementApiTransferProcess { - private String id; - private String state; - } - - - private static class ManagementApiOffer { - private String offerId; - private String assetId; - private ManagementApiPolicy policy; - } - - - private static class ManagementApiTransfer { - private final String connectorId = "foo"; - private String connectorAddress; - private String contractId; - private String assetId; - private String protocol; - private ManagementApiDataAddress dataDestination; - private boolean managedResources; - private ManagementApiTransferType transferType; - private ManagementApiProperties properties; - } - - - private static class ManagementApiTransferType { - private final String contentType = "application/octet-stream"; - private final boolean isFinite = true; - } - - - private static class ManagementApiTransferResponse { - private String id; - - - public String getId() { - return id; - } - } - - private static class ManagementApiAssetCreate { - private ManagementApiAsset asset; - private ManagementApiDataAddress dataAddress; - } - - private static class ManagementApiAsset { - public static final String ID = "asset:prop:id"; - public static final String DESCRIPTION = "asset:prop:description"; - - private Map properties; - - - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - } - - - private static class ManagementApiDataAddress { - public static final String TYPE = "type"; - private Map properties; - - - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - } - - - private static class ManagementApiProperties { - @SerializedName(value = "receiver.http.endpoint") - private final String receiverHttpEndpoint; - - private ManagementApiProperties(String receiverHttpEndpoint) { - this.receiverHttpEndpoint = receiverHttpEndpoint; - } - } - - - private static class ManagementApiPolicyDefinition { - private String id; - private ManagementApiPolicy policy; - } - - - private static class ManagementApiPolicy { - private String uid; - private List permissions = new ArrayList<>(); - } - - - private static class ManagementApiPermission { - private final String edctype = "dataspaceconnector:permission"; - private ManagementApiRuleAction action; - private String target; - private List constraints = new ArrayList<>(); - } - - - private static class ManagementAtomicConstraint implements ManagementConstraint { - private final String edctype = "AtomicConstraint"; - private ManagementApiLiteralExpression leftExpression; - private ManagementApiLiteralExpression rightExpression; - private String operator; - } - - - private static class ManagementOrConstraint implements ManagementConstraint { - private final String edctype = "dataspaceconnector:orconstraint"; - private List constraints; - } - - - private static class ManagementApiLiteralExpression { - private final String edctype = "dataspaceconnector:literalexpression"; - private String value; - } - - - private static class ManagementApiRuleAction { - private String type; - } - - - private static class ManagementApiContractDefinition { - private String id; - private String accessPolicyId; - private String contractPolicyId; - private List criteria = new ArrayList<>(); - } - - - private static class ManagementApiCriterion { - private Object operandLeft; - private String operator; - private Object operandRight; - } - - - private static class ManagementApiContractOffer { - private String id; - private ManagementApiPolicy policy; - private ManagementApiAsset asset; - private String assetId; - - - public ManagementApiPolicy getPolicy() { - return policy; - } - } - - - private static class ManagementApiContractOfferCatalog { - private final List contractOffers = new ArrayList<>(); - private String id; - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java deleted file mode 100644 index 49a2353d1..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/Environment.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import java.util.Locale; -import java.util.Objects; - -import static org.eclipse.tractusx.edc.tests.Constants.AWS_ACCESS_KEY_ID; -import static org.eclipse.tractusx.edc.tests.Constants.AWS_SECRET_ACCESS_KEY; -import static org.eclipse.tractusx.edc.tests.Constants.BACKEND_SERVICE_BACKEND_API_URL; -import static org.eclipse.tractusx.edc.tests.Constants.DATABASE_PASSWORD; -import static org.eclipse.tractusx.edc.tests.Constants.DATABASE_URL; -import static org.eclipse.tractusx.edc.tests.Constants.DATABASE_USER; -import static org.eclipse.tractusx.edc.tests.Constants.DATA_MANAGEMENT_API_AUTH_KEY; -import static org.eclipse.tractusx.edc.tests.Constants.DATA_MANAGEMENT_URL; -import static org.eclipse.tractusx.edc.tests.Constants.DATA_PLANE_URL; -import static org.eclipse.tractusx.edc.tests.Constants.EDC_AWS_ENDPOINT_OVERRIDE; -import static org.eclipse.tractusx.edc.tests.Constants.IDS_URL; - -public class Environment { - - private String awsEndpointOverride; - private String awsAccessKey; - private String awsSecretAccessKey; - private String dataManagementAuthKey; - private String dataManagementUrl; - private String idsUrl; - private String dataPlaneUrl; - private String backendServiceBackendApiUrl; - private String databaseUrl; - private String databaseUser; - private String databasePassword; - - private Environment() { - - } - - - public static Environment byName(String name) { - var upperName = name.toUpperCase(Locale.ROOT); - - return Environment.Builder.newInstance() - .dataManagementUrl(System.getenv(String.join("_", upperName, DATA_MANAGEMENT_URL))) - .dataManagementAuthKey(System.getenv(String.join("_", upperName, DATA_MANAGEMENT_API_AUTH_KEY))) - .idsUrl(System.getenv(String.join("_", upperName, IDS_URL))) - .dataPlaneUrl(System.getenv(String.join("_", upperName, DATA_PLANE_URL))) - .backendServiceBackendApiUrl( - System.getenv(String.join("_", upperName, BACKEND_SERVICE_BACKEND_API_URL))) - .databaseUrl(System.getenv(String.join("_", upperName, DATABASE_URL))) - .databaseUser(System.getenv(String.join("_", upperName, DATABASE_USER))) - .databasePassword(System.getenv(String.join("_", upperName, DATABASE_PASSWORD))) - .awsEndpointOverride(System.getenv(EDC_AWS_ENDPOINT_OVERRIDE)) - .awsAccessKey(System.getenv(String.join("_", upperName, AWS_ACCESS_KEY_ID))) - .awsSecretAccessKey(System.getenv(String.join("_", upperName, AWS_SECRET_ACCESS_KEY))) - .build(); - } - - public String getIdsUrl() { - return idsUrl; - } - - public String getAwsEndpointOverride() { - return awsEndpointOverride; - } - - public String getAwsSecretAccessKey() { - return awsSecretAccessKey; - } - - public String getAwsAccessKey() { - return awsAccessKey; - } - - public String getBackendServiceBackendApiUrl() { - return backendServiceBackendApiUrl; - } - - public String getDatabasePassword() { - return databasePassword; - } - - public String getDatabaseUrl() { - return databaseUrl; - } - - public String getDatabaseUser() { - return databaseUser; - } - - public String getDataManagementAuthKey() { - return dataManagementAuthKey; - } - - public String getDataManagementUrl() { - return dataManagementUrl; - } - - private static class Builder { - - - private final Environment environment; - - private Builder() { - environment = new Environment(); - } - - public static Builder newInstance() { - return new Builder(); - } - - public Builder awsEndpointOverride(String val) { - environment.awsEndpointOverride = val; - return this; - } - - public Builder awsAccessKey(String val) { - environment.awsAccessKey = val; - return this; - } - - public Builder awsSecretAccessKey(String val) { - environment.awsSecretAccessKey = val; - return this; - } - - public Builder dataManagementAuthKey(String val) { - environment.dataManagementAuthKey = val; - return this; - } - - public Builder dataManagementUrl(String val) { - environment.dataManagementUrl = val; - return this; - } - - public Builder idsUrl(String val) { - environment.idsUrl = val; - return this; - } - - public Builder dataPlaneUrl(String val) { - environment.dataPlaneUrl = val; - return this; - } - - public Builder backendServiceBackendApiUrl(String val) { - environment.backendServiceBackendApiUrl = val; - return this; - } - - public Builder databaseUrl(String val) { - environment.databaseUrl = val; - return this; - } - - public Builder databaseUser(String val) { - environment.databaseUser = val; - return this; - } - - public Builder databasePassword(String val) { - environment.databasePassword = val; - return this; - } - - public Environment build() { - Objects.requireNonNull(environment.awsAccessKey); - Objects.requireNonNull(environment.awsEndpointOverride); - Objects.requireNonNull(environment.awsSecretAccessKey); - Objects.requireNonNull(environment.backendServiceBackendApiUrl); - Objects.requireNonNull(environment.databaseUrl); - Objects.requireNonNull(environment.databasePassword); - Objects.requireNonNull(environment.databaseUser); - Objects.requireNonNull(environment.dataManagementUrl); - Objects.requireNonNull(environment.dataPlaneUrl); - Objects.requireNonNull(environment.dataManagementAuthKey); - Objects.requireNonNull(environment.idsUrl); - return environment; - } - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java deleted file mode 100644 index eee6e6497..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/HttpProxyTransferSteps.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.eclipse.tractusx.edc.tests.data.Asset; -import org.eclipse.tractusx.edc.tests.data.DataAddress; -import org.eclipse.tractusx.edc.tests.data.HttpProxySinkDataAddress; -import org.eclipse.tractusx.edc.tests.data.HttpProxySourceDataAddress; -import org.junit.jupiter.api.Assertions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.time.Duration; -import java.util.Arrays; -import java.util.List; - -import static org.awaitility.Awaitility.await; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; - -public class HttpProxyTransferSteps { - - private static final Logger log = LoggerFactory.getLogger(HttpProxyTransferSteps.class); - - private static final String ID = "id"; - private static final String DESCRIPTION = "description"; - private static final String BASE_URL = "baseUrl"; - private static final String ASSET_ID = "asset id"; - private static final String RECEIVER_HTTP_ENDPOINT = "receiverHttpEndpoint"; - - @Given("'{connector}' has a http proxy assets") - public void hasAssets(Connector connector, DataTable table) throws Exception { - final DataManagementAPI api = connector.getDataManagementAPI(); - - for (var map : table.asMaps()) { - final String id = map.get(ID); - final String description = map.get(DESCRIPTION); - final String baseUrl = map.get(BASE_URL); - - var oauth2Provision = - Arrays.stream(Oauth2DataAddressFields.values()) - .map(it -> it.text) - .anyMatch(map::containsKey) - ? new HttpProxySourceDataAddress.Oauth2Provision( - map.get(Oauth2DataAddressFields.TOKEN_URL.text), - map.get(Oauth2DataAddressFields.CLIENT_ID.text), - map.get(Oauth2DataAddressFields.CLIENT_SECRET.text), - map.get(Oauth2DataAddressFields.SCOPE.text)) - : null; - - final DataAddress address = new HttpProxySourceDataAddress(baseUrl, oauth2Provision); - final Asset asset = new Asset(id, description, address); - - api.createAsset(asset); - } - } - - @When("'{connector}' initiates HttpProxy transfer from '{connector}'") - public void sokratesInitiateHttpProxyTransferProcessFromPlato( - Connector consumer, Connector provider, DataTable dataTable) throws IOException { - var api = consumer.getDataManagementAPI(); - var receiverUrl = provider.getEnvironment().getIdsUrl() + "/data"; - - var negotiation = api.getNegotiations(); - var agreementId = negotiation.get(0).getAgreementId(); - var dataAddress = new HttpProxySinkDataAddress(); - - for (var map : dataTable.asMaps()) { - final String assetId = map.get(ASSET_ID); - final String receiverHttpEndpoint = map.get(RECEIVER_HTTP_ENDPOINT); - var transfer = api.initiateTransferProcess(receiverUrl, agreementId, assetId, dataAddress, receiverHttpEndpoint); - - transfer.waitUntilComplete(api); - } - } - - @Then("the backend application of '{connector}' has received data") - public void theBackendApplicationOfSocratesHasReceivedData(Connector consumer) { - var api = consumer.getBackendServiceBackendAPI(); - when(api.list(eq("/"))).thenReturn(List.of("item1", "item2")); - await() - .atMost(Duration.ofSeconds(20)) - .pollInterval(Duration.ofSeconds(1)) - .untilAsserted(() -> { - final List transferredData = api.list("/"); - Assertions.assertNotEquals(0, transferredData.size()); - }); - } - - private enum Oauth2DataAddressFields { - TOKEN_URL("oauth2 token url"), - CLIENT_ID("oauth2 client id"), - CLIENT_SECRET("oauth2 client secret"), - SCOPE("oauth2 scope"); - - private final String text; - - Oauth2DataAddressFields(String text) { - this.text = text; - } - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java deleted file mode 100644 index 7a713ff1b..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/NegotiationSteps.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.eclipse.tractusx.edc.tests.data.ContractNegotiation; -import org.eclipse.tractusx.edc.tests.data.ContractNegotiationState; -import org.eclipse.tractusx.edc.tests.data.Negotiation; -import org.eclipse.tractusx.edc.tests.data.Permission; -import org.eclipse.tractusx.edc.tests.data.Policy; -import org.junit.jupiter.api.Assertions; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - - -public class NegotiationSteps { - - - private static final String DEFINITION_ID = "definition id"; - private static final String ASSET_ID = "asset id"; - - private ContractNegotiation lastInitiatedNegotiation; - - @When("'{connector}' sends '{connector}' an offer without constraints") - public void sendAnOfferWithoutConstraints(Connector sender, Connector receiver, DataTable table) - throws IOException { - - DataManagementAPI dataManagementAPI = sender.getDataManagementAPI(); - String receiverIdsUrl = receiver.getEnvironment().getIdsUrl() + "/data"; - - for (Map map : table.asMaps()) { - String definitionId = map.get(DEFINITION_ID); - String assetId = map.get(ASSET_ID); - - Permission permission = new Permission("USE", new ArrayList<>(), null); - Policy policy = new Policy("foo", List.of(permission)); - - Negotiation negotiation = - dataManagementAPI.initiateNegotiation(receiverIdsUrl, definitionId, assetId, policy); - - // wait for negotiation to complete - negotiation.waitUntilComplete(dataManagementAPI); - - lastInitiatedNegotiation = dataManagementAPI.getNegotiation(negotiation.getId()); - } - } - - @When("'{connector}' successfully negotiation a contract agreement with '{connector}'") - public void sokratesSuccessfullyNegotiationAContractAgreementPlatoFor( - Connector consumer, Connector provider, DataTable table) throws IOException { - DataManagementAPI api = consumer.getDataManagementAPI(); - - Map map = table.asMap(); - String definitionId = map.get(DEFINITION_ID); - String assetId = map.get(ASSET_ID); - - // as default always the "allow all" policy is used. So we can assume this here, too. - Permission permission = new Permission("USE", new ArrayList<>(), null); - Policy policy = new Policy("policy-id", List.of(permission)); - - String receiverUrl = provider.getEnvironment().getIdsUrl(); - Negotiation negotiation = - api.initiateNegotiation(receiverUrl, assetId, definitionId, policy); - - negotiation.waitUntilComplete(api); - } - - @Then("the negotiation is declined") - public void assertLastNegotiationDeclined() { - Assertions.assertEquals(ContractNegotiationState.DECLINED, lastInitiatedNegotiation.getState()); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java deleted file mode 100644 index d8bac4466..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/PolicyStepDefs.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.en.Given; -import org.eclipse.tractusx.edc.tests.data.BusinessPartnerNumberConstraint; -import org.eclipse.tractusx.edc.tests.data.Constraint; -import org.eclipse.tractusx.edc.tests.data.OrConstraint; -import org.eclipse.tractusx.edc.tests.data.PayMeConstraint; -import org.eclipse.tractusx.edc.tests.data.Permission; -import org.eclipse.tractusx.edc.tests.data.Policy; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toList; - -public class PolicyStepDefs { - - @Given("'{connector}' has the following policies") - public void hasPolicies(Connector connector, DataTable table) throws Exception { - var api = connector.getDataManagementAPI(); - var policies = table.asMaps().stream().map(this::parseRow).collect(toList()); - - for (var policy : policies) { - api.createPolicy(policy); - } - } - - private Policy parseRow(Map row) { - var id = row.get("id"); - var action = row.get("action"); - var constraints = new ArrayList(); - - var businessPartnerNumber = row.get("businessPartnerNumber"); - if (businessPartnerNumber != null && !businessPartnerNumber.isBlank()) { - var bpnConstraints = - stream(businessPartnerNumber.split(",")) - .map(BusinessPartnerNumberConstraint::new) - .collect(toList()); - constraints.add(new OrConstraint(bpnConstraints)); - } - - var payMe = row.get("payMe"); - if (payMe != null && !payMe.isBlank()) { - constraints.add(new PayMeConstraint(Double.parseDouble(payMe))); - } - - var permission = new Permission(action, constraints, null); - return new Policy(id, List.of(permission)); - } -} diff --git a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java b/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java deleted file mode 100644 index 05f5f1242..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/S3FileTransferStepsDefs.java +++ /dev/null @@ -1,178 +0,0 @@ -/* Copyright (c) 2022 ZF Friedrichshafen AG - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests; - -import io.cucumber.datatable.DataTable; -import io.cucumber.java.AfterAll; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import org.eclipse.tractusx.edc.tests.data.Asset; -import org.eclipse.tractusx.edc.tests.data.DataAddress; -import org.eclipse.tractusx.edc.tests.data.Negotiation; -import org.eclipse.tractusx.edc.tests.data.Permission; -import org.eclipse.tractusx.edc.tests.data.Policy; -import org.eclipse.tractusx.edc.tests.data.S3DataAddress; -import org.eclipse.tractusx.edc.tests.data.Transfer; -import org.eclipse.tractusx.edc.tests.util.S3Client; -import org.eclipse.tractusx.edc.tests.util.Timeouts; -import org.junit.jupiter.api.Assertions; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.time.Duration; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.awaitility.Awaitility.await; -import static org.junit.jupiter.api.Assertions.fail; - -public class S3FileTransferStepsDefs { - - private static final String COMPLETION_MARKER = ".complete"; - private File fileToTransfer; - private String assetId; - private String agreementId; - - @AfterAll - public static void bucketsCleanup() { - S3Client s3 = new S3Client(Environment.byName("Sokrates")); - s3.deleteAllBuckets(); - } - - @Given("'{connector}' has an empty storage bucket called {string}") - public void hasEmptyStorageBucket(Connector connector, String bucketName) { - S3Client s3 = connector.getS3Client(); - - s3.createBucket(bucketName); - - Assertions.assertTrue(s3.listBuckets().contains(bucketName)); - Assertions.assertEquals(0, s3.listBucketContent(bucketName).size()); - } - - @Given("'{connector}' has a storage bucket called {string} with the file called {string}") - public void hasAStorageBucketWithTheFile(Connector connector, String bucketName, String fileName) - throws IOException { - - S3Client s3 = connector.getS3Client(); - s3.createBucket(bucketName); - fileToTransfer = s3.uploadFile(bucketName, fileName); - - Set bucketContent = s3.listBucketContent(bucketName); - - Assertions.assertEquals(1, bucketContent.size()); - Assertions.assertTrue(bucketContent.contains(fileName)); - } - - @Given("'{connector}' has the following S3 assets") - public void hasAssets(Connector connector, DataTable table) { - DataManagementAPI api = connector.getDataManagementAPI(); - - parseDataTable(table) - .forEach( - asset -> { - try { - api.createAsset(asset); - } catch (IOException e) { - fail(e.getMessage()); - } - }); - } - - @Then("'{connector}' negotiates the contract successfully with '{connector}'") - public void negotiateContract(Connector sender, Connector receiver, DataTable dataTable) - throws IOException { - - String definitionId = dataTable.asMaps().get(0).get("contract offer id"); - assetId = dataTable.asMaps().get(0).get("asset id"); - String policyId = dataTable.asMaps().get(0).get("policy id"); - - Policy policy = - new Policy(policyId, List.of(new Permission("USE", new ArrayList<>(), null))); - - DataManagementAPI dataManagementAPI = sender.getDataManagementAPI(); - String receiverIdsUrl = receiver.getEnvironment().getIdsUrl() + "/data"; - - Negotiation negotiation = - dataManagementAPI.initiateNegotiation(receiverIdsUrl, definitionId, assetId, policy); - negotiation.waitUntilComplete(dataManagementAPI); - - agreementId = dataManagementAPI.getNegotiation(negotiation.getId()).getAgreementId(); - } - - @Then("'{connector}' initiate S3 transfer process from '{connector}'") - public void initiateTransferProcess(Connector sender, Connector receiver, DataTable dataTable) - throws IOException { - DataAddress dataAddress = createDataAddress(dataTable.asMaps().get(0)); - - DataManagementAPI dataManagementAPI = sender.getDataManagementAPI(); - String receiverIdsUrl = receiver.getEnvironment().getIdsUrl() + "/data"; - - Transfer transferProcess = - dataManagementAPI.initiateTransferProcess( - receiverIdsUrl, agreementId, assetId, dataAddress); - transferProcess.waitUntilComplete(dataManagementAPI); - - Assertions.assertNotNull(transferProcess.getId()); - } - - @Then("'{connector}' has a storage bucket called {string} with transferred file called {string}") - public void consumerHasAStorageBucketWithFileTransferred( - Connector connector, String bucketName, String fileName) throws IOException { - S3Client s3 = connector.getS3Client(); - await() - .pollDelay(Duration.ofMillis(500)) - .atMost(Timeouts.FILE_TRANSFER) - .until(() -> isFilePresent(s3, bucketName, fileName + COMPLETION_MARKER)); - - Set bucketContent = s3.listBucketContent(bucketName); - - Assertions.assertEquals(2, bucketContent.size()); - Assertions.assertTrue(bucketContent.contains(fileName)); - Assertions.assertArrayEquals( - Files.readAllBytes(fileToTransfer.toPath()), - Files.readAllBytes(s3.downloadFile(bucketName, fileName).toPath())); - } - - private boolean isFilePresent(S3Client s3, String bucketName, String fileName) { - return s3.listBucketContent(bucketName).contains(fileName); - } - - private List parseDataTable(DataTable table) { - List assetsWithDataAddresses = new ArrayList<>(); - - for (Map map : table.asMaps()) { - String id = map.get("id"); - String description = map.get("description"); - assetsWithDataAddresses.add(new Asset(id, description, createDataAddress(map))); - } - - return assetsWithDataAddresses; - } - - private DataAddress createDataAddress(Map map) { - String bucketName = map.get("data_address_s3_bucket_name"); - String region = map.get("data_address_s3_region"); - String keyName = map.get("data_address_s3_key_name"); - return new S3DataAddress(bucketName, region, keyName); - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 47142d0e9..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Asset.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ -package org.eclipse.tractusx.edc.tests.data; - -import java.util.Objects; - -public class Asset { - private final String id; - private final String description; - private final DataAddress dataAddress; - - public Asset(String id, String description, DataAddress dataAddress) { - this.id = Objects.requireNonNull(id); - this.description = Objects.requireNonNull(description); - this.dataAddress = Objects.requireNonNull(dataAddress); - } - - public String getId() { - return id; - } - - public String getDescription() { - return description; - } - - public DataAddress getDataAddress() { - return dataAddress; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index a103313ee..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/BusinessPartnerNumberConstraint.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import java.util.Objects; - -public class BusinessPartnerNumberConstraint implements Constraint { - - private final String businessPartnerNumber; - - public BusinessPartnerNumberConstraint(String businessPartnerNumber) { - this.businessPartnerNumber = Objects.requireNonNull(businessPartnerNumber); - } - - public String getBusinessPartnerNumber() { - return businessPartnerNumber; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 73bccde7a..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Constraint.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -public interface Constraint { -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index c90fe1788..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ -package org.eclipse.tractusx.edc.tests.data; - -import java.util.List; -import java.util.Objects; - - -public class ContractDefinition { - - private final String id; - - private final String contractPolicyId; - private final String acccessPolicyId; - - private final List assetIds; - private final Long validity; - - public ContractDefinition(String id, String contractPolicyId, String acccessPolicyId, List assetIds, Long validity) { - this.id = Objects.requireNonNull(id); - this.contractPolicyId = Objects.requireNonNull(contractPolicyId); - this.acccessPolicyId = Objects.requireNonNull(acccessPolicyId); - this.assetIds = assetIds; - this.validity = validity; - } - - public String getId() { - return id; - } - - public String getContractPolicyId() { - return contractPolicyId; - } - - public String getAcccessPolicyId() { - return acccessPolicyId; - } - - public List getAssetIds() { - return assetIds; - } - - -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 67f9dafb0..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import java.util.Objects; - -public class ContractNegotiation { - private final String id; - private final ContractNegotiationState state; - private final String agreementId; - - - public ContractNegotiation(String id, ContractNegotiationState state, String agreementId) { - this.id = Objects.requireNonNull(id); - this.state = Objects.requireNonNull(state); - this.agreementId = agreementId; - } - - public String getId() { - return id; - } - - public ContractNegotiationState getState() { - return state; - } - - public String getAgreementId() { - return agreementId; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 9acd4368f..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractNegotiationState.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -public enum ContractNegotiationState { - UNKNOWN, - INITIAL, - DECLINED, - CONFIRMED, - ERROR -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 7ac87cb9a..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/ContractOffer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ -package org.eclipse.tractusx.edc.tests.data; - -import java.util.Objects; - -public class ContractOffer { - private final String id; - private final Policy policy; - private final String assetId; - - public ContractOffer(String id, Policy policy, String assetId) { - this.id = Objects.requireNonNull(id); - this.policy = policy; - this.assetId = assetId; - } - - public String getId() { - return id; - } - - public Policy getPolicy() { - return policy; - } - - public String getAssetId() { - return assetId; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 16815827f..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/DataAddress.java +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2022 ZF Friedrichshafen AG - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -public interface DataAddress {} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 2466438be..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySinkDataAddress.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -public class HttpProxySinkDataAddress implements DataAddress { -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index b9e92a4e5..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/HttpProxySourceDataAddress.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import java.util.Objects; - - -public class HttpProxySourceDataAddress implements DataAddress { - private final String baseUrl; - private final Oauth2Provision oauth2Provision; - - public HttpProxySourceDataAddress(String baseUrl, Oauth2Provision oauth2Provision) { - this.baseUrl = Objects.requireNonNull(baseUrl); - this.oauth2Provision = oauth2Provision; - } - - public String getBaseUrl() { - return baseUrl; - } - - public Oauth2Provision getOauth2Provision() { - return oauth2Provision; - } - - public static class Oauth2Provision { - private final String tokenUrl; - private final String clientId; - private final String clientSecret; - private final String scope; - - public Oauth2Provision(String tokenUrl, String clientId, String clientSecret, String scope) { - this.tokenUrl = Objects.requireNonNull(tokenUrl); - this.clientId = Objects.requireNonNull(clientId); - this.clientSecret = Objects.requireNonNull(clientSecret); - this.scope = scope; - } - - public String getTokenUrl() { - return tokenUrl; - } - - public String getScope() { - return scope; - } - - public String getClientId() { - return clientId; - } - - public String getClientSecret() { - return clientSecret; - } - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index eb650139f..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Negotiation.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import org.eclipse.tractusx.edc.tests.DataManagementAPI; -import org.eclipse.tractusx.edc.tests.util.Timeouts; - -import java.io.IOException; -import java.time.Duration; -import java.util.Objects; -import java.util.stream.Stream; - -import static org.awaitility.Awaitility.await; - - -public class Negotiation { - - - private final String id; - - public Negotiation(String id) { - this.id = Objects.requireNonNull(id); - } - - public void waitUntilComplete(DataManagementAPI dataManagementAPI) { - await() - .pollDelay(Duration.ofMillis(5000)) - .atMost(Timeouts.CONTRACT_NEGOTIATION) - .until(() -> isComplete(dataManagementAPI)); - } - - public boolean isComplete(DataManagementAPI dataManagementAPI) throws IOException { - var negotiation = dataManagementAPI.getNegotiation(id); - return negotiation != null - && Stream.of( - ContractNegotiationState.ERROR, - ContractNegotiationState.CONFIRMED, - ContractNegotiationState.DECLINED) - .anyMatch((l) -> l.equals(negotiation.getState())); - } - - public String getId() { - return id; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 0757fa4cd..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/NullDataAddress.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -public class NullDataAddress implements DataAddress { - - private static final NullDataAddress _instance = new NullDataAddress(); - - public static DataAddress INSTANCE = new NullDataAddress(); - - private NullDataAddress() { - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 14d135f18..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/OrConstraint.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import java.util.List; -import java.util.Objects; - - -public class OrConstraint implements Constraint { - - private final List constraints; - - public OrConstraint(List constraints) { - this.constraints = Objects.requireNonNull(constraints); - } - - public List getConstraints() { - return constraints; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 1412b8d76..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/PayMeConstraint.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -/** - * The PayMe constraint should be used when no constraint validation/enforcement in the EDC is - * intended. - */ - -public class PayMeConstraint implements Constraint { - private final double amount; - - public PayMeConstraint(double amount) { - this.amount = amount; - } - - public double getAmount() { - return amount; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index e90cbfaf0..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Permission.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ -package org.eclipse.tractusx.edc.tests.data; - -import java.util.List; -import java.util.Objects; - - -public class Permission { - private final String action; - private final List constraints; - private final String target; - - - public Permission(String action, List constraints, String target) { - this.action = Objects.requireNonNull(action); - this.constraints = Objects.requireNonNull(constraints); - this.target = target; - } - - public String getAction() { - return action; - } - - public List getConstraints() { - return constraints; - } - - public String getTarget() { - return target; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index c58c79206..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Policy.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import java.util.List; -import java.util.Objects; - - -public class Policy { - private final String id; - private final List Permission; - - public Policy(String id, List permission) { - this.id = id; - Permission = Objects.requireNonNull(permission); - } - - public String getId() { - return id; - } - - public List getPermission() { - return Permission; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index d46b51ea0..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/S3DataAddress.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.data; - -import java.util.Objects; - -public class S3DataAddress implements DataAddress { - - private final String bucketName; - private final String region; - private final String keyName; - - public S3DataAddress(String bucketName, String region, String keyName) { - this.bucketName = Objects.requireNonNull(bucketName); - this.region = Objects.requireNonNull(region); - this.keyName = Objects.requireNonNull(keyName); - } - - public String getBucketName() { - return bucketName; - } - - public String getRegion() { - return region; - } - - public String getKeyName() { - return keyName; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index de409252d..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/Transfer.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import org.eclipse.tractusx.edc.tests.DataManagementAPI; -import org.eclipse.tractusx.edc.tests.util.Timeouts; - -import java.io.IOException; -import java.time.Duration; - -import static org.awaitility.Awaitility.await; - - -public class Transfer { - - private final String id; - - public Transfer(String id) { - this.id = id; - } - - public void waitUntilComplete(DataManagementAPI dataManagementAPI) { - await() - .pollDelay(Duration.ofMillis(2000)) - .atMost(Timeouts.FILE_TRANSFER) - .until(() -> isComplete(dataManagementAPI)); - } - - public boolean isComplete(DataManagementAPI dataManagementAPI) throws IOException { - var transferProcess = dataManagementAPI.getTransferProcess(id); - if (transferProcess == null) { - return false; - } - - var state = transferProcess.getState(); - - return state == TransferProcessState.COMPLETED || state == TransferProcessState.ERROR; - } - - public String getId() { - return id; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 1c00e86c3..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcess.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2022 ZF Friedrichshafen AG - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -import java.util.Objects; - -public class TransferProcess { - private final String id; - private final TransferProcessState state; - - public TransferProcess(String id, TransferProcessState state) { - this.id = Objects.requireNonNull(id); - this.state = Objects.requireNonNull(state); - } - - public String getId() { - return id; - } - - public TransferProcessState getState() { - return state; - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 4f5612334..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/data/TransferProcessState.java +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2022 ZF Friedrichshafen AG - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.data; - -public enum TransferProcessState { - COMPLETED, - ERROR, - UNKNOWN -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index c353ec2fb..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/features/ParameterTypes.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.features; - -import io.cucumber.java.ParameterType; -import org.eclipse.tractusx.edc.tests.Connector; -import org.eclipse.tractusx.edc.tests.ConnectorFactory; - -public class ParameterTypes { - - @ParameterType("Plato|Sokrates") - public Connector connector(String name) { - return ConnectorFactory.byName(name); - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index d9ab3254c..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/features/RunCucumberTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.features; - -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; - -@Suite -@SelectClasspathResource("org/eclipse/tractusx/edc/tests/features") -public class RunCucumberTest {} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index e03f38e98..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/DatabaseCleaner.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.util; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - - -public class DatabaseCleaner { - - private static final String SQL = - "DELETE FROM edc_contract_negotiation;\n" - + "DELETE FROM edc_contract_agreement;\n" - + "DELETE FROM edc_transfer_process;\n" - + "DELETE FROM edc_contract_definitions;\n" - + "DELETE FROM edc_policydefinitions;\n" - + "DELETE FROM edc_asset;\n" - + "DELETE FROM edc_lease;"; - - private final String url; - private final String user; - private final String password; - - public DatabaseCleaner(String url, String user, String password) { - this.url = url; - this.user = user; - this.password = password; - } - - public void run() throws SQLException { - try (Connection con = DriverManager.getConnection(url, user, password)) { - Statement st = con.createStatement(); - st.executeUpdate(SQL); - } - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 63ab60324..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/S3Client.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (c) 2022 ZF Friedrichshafen AG - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.util; - -import org.eclipse.tractusx.edc.tests.Environment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.core.ResponseBytes; -import software.amazon.awssdk.core.sync.RequestBody; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.s3.model.Bucket; -import software.amazon.awssdk.services.s3.model.BucketAlreadyOwnedByYouException; -import software.amazon.awssdk.services.s3.model.CreateBucketRequest; -import software.amazon.awssdk.services.s3.model.DeleteBucketRequest; -import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; -import software.amazon.awssdk.services.s3.model.GetObjectRequest; -import software.amazon.awssdk.services.s3.model.GetObjectResponse; -import software.amazon.awssdk.services.s3.model.ListObjectsRequest; -import software.amazon.awssdk.services.s3.model.PutObjectRequest; -import software.amazon.awssdk.services.s3.model.S3Object; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - - -public class S3Client { - private static final Logger log = LoggerFactory.getLogger(S3Client.class); - private final software.amazon.awssdk.services.s3.S3Client s3; - - public S3Client(Environment environment) { - - s3 = - software.amazon.awssdk.services.s3.S3Client.builder() - .region(Region.US_EAST_1) - .forcePathStyle(true) - .endpointOverride(URI.create(environment.getAwsEndpointOverride())) - .credentialsProvider( - StaticCredentialsProvider.create( - AwsBasicCredentials.create( - environment.getAwsAccessKey(), environment.getAwsSecretAccessKey()))) - .build(); - } - - public void createBucket(String bucketName) { - try { - s3.createBucket(CreateBucketRequest.builder().bucket(bucketName).build()); - } catch (BucketAlreadyOwnedByYouException e) { - log.info("'{}' bucket already owned - skipped bucket creation", bucketName); - } - } - - public File uploadFile(String bucketName, String fileName) throws IOException { - File tempFile = File.createTempFile(fileName, null); - Files.write( - tempFile.toPath(), "Will fail if the file has no content".getBytes(StandardCharsets.UTF_8)); - - s3.putObject( - PutObjectRequest.builder().bucket(bucketName).key(fileName).build(), - RequestBody.fromFile(tempFile)); - - return tempFile; - } - - public List listBuckets() { - return s3.listBuckets().buckets().stream().map(Bucket::name).collect(Collectors.toList()); - } - - public Set listBucketContent(String bucketName) { - return s3 - .listObjects(ListObjectsRequest.builder().bucket(bucketName).build()) - .contents() - .stream() - .map(S3Object::key) - .collect(Collectors.toSet()); - } - - public File downloadFile(String bucketName, String fileName) throws IOException { - ResponseBytes objectAsBytes = - s3.getObjectAsBytes(GetObjectRequest.builder().bucket(bucketName).key(fileName).build()); - - return Files.write(File.createTempFile(fileName, null).toPath(), objectAsBytes.asByteArray()) - .toFile(); - } - - public void deleteAllBuckets() { - List buckets = s3.listBuckets().buckets(); - buckets.forEach(this::clearBucket); - buckets.forEach( - bucket -> s3.deleteBucket(DeleteBucketRequest.builder().bucket(bucket.name()).build())); - } - - private void clearBucket(Bucket bucket) { - String bucketName = bucket.name(); - s3.listObjects(ListObjectsRequest.builder().bucket(bucketName).build()) - .contents() - .forEach( - s3Object -> - s3.deleteObject( - DeleteObjectRequest.builder().bucket(bucketName).key(s3Object.key()).build())); - } -} diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 0d67c0e5a..000000000 --- a/edc-tests/cucumber/src/test/java/org/eclipse/tractusx/edc/tests/util/Timeouts.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 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 - */ - -package org.eclipse.tractusx.edc.tests.util; - -import java.time.Duration; - -public class Timeouts { - private Timeouts() {} - - public static final Duration CONTRACT_NEGOTIATION = Duration.ofSeconds(90); - public static final Duration FILE_TRANSFER = Duration.ofSeconds(90); -} diff --git a/edc-tests/cucumber/src/test/resources/junit-platform.properties b/edc-tests/cucumber/src/test/resources/junit-platform.properties deleted file mode 100644 index 215cb0967..000000000 --- a/edc-tests/cucumber/src/test/resources/junit-platform.properties +++ /dev/null @@ -1,3 +0,0 @@ -cucumber.publish.quiet=true -cucumber.publish.enabled=false -cucumber.plugin=json:target/cucumber-reports/,pretty diff --git a/edc-tests/cucumber/src/test/resources/logback-test.xml b/edc-tests/cucumber/src/test/resources/logback-test.xml deleted file mode 100644 index d8c11cbef..000000000 --- a/edc-tests/cucumber/src/test/resources/logback-test.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 623384d93..000000000 --- a/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractNegotiation.feature +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH -# Copyright (c) 2021,2022 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 -# - -Feature: Contract Negotiation - - Background: The Connector State - Given 'Plato' has an empty database - Given 'Sokrates' has an empty database - - Scenario: Counter Offers are rejected - Given 'Plato' has the following assets - | id | description | - | asset-1 | Example Asset | - And 'Plato' has the following policies - | id | action | payMe | - | policy-1 | USE | | - | policy-pay-me | USE | 1000 | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | - | contract-definition-1 | policy-1 | policy-pay-me | asset-1 | - When 'Sokrates' sends 'Plato' an offer without constraints - | definition id | asset id | - | contract-definition-1 | asset-1 | - Then the negotiation is declined - - - Scenario: An offer is rejected - Given 'Plato' has the following assets - | id | description | - | asset-1 | Example Asset | - And 'Plato' has the following policies - | id | action | payMe | - | policy-1 | USE | | - | policy-pay-me | USE | 1000 | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | validity | - | contract-definition-1 | policy-1 | policy-pay-me | asset-1 | 1 | - When 'Sokrates' sends 'Plato' an offer without constraints - | definition id | asset id | - | contract-definition-1 | asset-1 | - Then the negotiation is declined \ No newline at end of file diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 3a07016aa..000000000 --- a/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/ContractOffers.feature +++ /dev/null @@ -1,97 +0,0 @@ -# -# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH -# Copyright (c) 2021,2022 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 -# - -Feature: Contract Offers - - Background: The Connector State - Given 'Plato' has an empty database - Given 'Sokrates' has an empty database - - Scenario: Catalog Request - Given 'Plato' has the following assets - | id | description | - | asset-1 | Example Asset | - | asset-2 | Example Asset | - And 'Plato' has the following policies - | id | action | - | policy-1 | USE | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | - | contract-definition-1 | policy-1 | policy-1 | asset-1 | - | contract-definition-2 | policy-1 | policy-1 | asset-2 | - When 'Sokrates' requests the catalog from 'Plato' - Then the catalog contains the following offers - | source definition | asset | - | contract-definition-1 | asset-1 | - | contract-definition-2 | asset-2 | - - Scenario: EQ Business Partner Constrain for Catalog - Given 'Plato' has the following assets - | id | description | - | asset-1 | Example Asset | - | asset-2 | Example Asset | - | asset-3 | Example Asset | - And 'Plato' has the following policies - | id | action | businessPartnerNumber | - | policy-1 | USE | | - | policy-2 | USE | BPNFOO | - | policy-3 | USE | BPNSOKRATES,BPNF00 | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | - | contract-definition-1 | policy-1 | policy-1 | asset-1 | - | contract-definition-2 | policy-2 | policy-1 | asset-2 | - | contract-definition-3 | policy-3 | policy-1 | asset-3 | - When 'Sokrates' requests the catalog from 'Plato' - Then the catalog contains the following offers - | source definition | asset | - | contract-definition-1 | asset-1 | - | contract-definition-3 | asset-3 | - Then the catalog does not contain the following offers - | source definition | asset | - | contract-definition-2 | asset-2 | - - Scenario: Multiple Contract Offers for same Asset - Given 'Plato' has the following assets - | id | description | - | asset-1 | Example Asset | - And 'Plato' has the following policies - | id | action | businessPartnerNumber | - | policy-1 | USE | | - | policy-2 | USE | BPNSOKRATES | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | - | contract-definition-1 | policy-1 | policy-1 | asset-1 | - | contract-definition-2 | policy-2 | policy-1 | asset-1 | - When 'Sokrates' requests the catalog from 'Plato' - Then the catalog contains the following offers - | source definition | asset | - | contract-definition-2 | asset-1 | - #| contract-definition-1 | asset-1 | # Issue https://github.com/eclipse-edc/Connector/issues/1764 - - Scenario: Catalog with 1000 Contract Offers - Given 'Plato' has '1000' assets - And 'Plato' has the following policies - | id | action | - | policy-1 | USE | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | - | contract-definition-1 | policy-1 | policy-1 | - When 'Sokrates' requests the catalog from 'Plato' -#Then the catalog contains '1000' offers # Issue https://github.com/eclipse-edc/Connector/issues/2064 diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index 263d41149..000000000 --- a/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/EndToEndTransfer.feature +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 2023 ZF Friedrichshafen AG -# Copyright (c) 2021,2022 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 -# - -#TODO: the current Bussinnes test is not running, because of a possible condition in the CI pipeline - # regarding the contract validity: see https://github.com/eclipse-edc/Connector/issues/2514 - -#Feature: API-Wrapper Extension - - #Background: The Connector State - #Given 'Plato' has an empty database - #Given 'Sokrates' has an empty database - - #Scenario: Connector asks for an endpoint connector from another one - #Given 'Plato' has a http proxy assets - # | id | description | baseUrl | - # | asset-1 | http proxy transfer asset | http://localhost:8080/api/check/liveness | - #And 'Plato' has the following policies - # | id | action | - # | policy-1 | USE | - #And 'Plato' has the following contract definitions - # | id | access policy | contract policy | asset | - # | contract-definition-1 | policy-1 | policy-1 | asset-1 | - #When 'Sokrates' gets a request endpoint from 'Plato' - # | asset id | - # | asset-1 | - #Then 'Sokrates' asks for the asset from the endpoint \ No newline at end of file diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index b04970ec7..000000000 --- a/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/HttpProxyDataTransfer.feature +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH -# Copyright (c) 2021,2022 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 -# - -Feature: HttpProxy Data Transfer - - Background: The Connector State - Given 'Plato' has an empty database - Given 'Sokrates' has an empty database - - Scenario: Connector transfers data via HttpProxy, data on provider side requires oauth2 authentication - Given 'Plato' has a http proxy assets - | id | description | baseUrl | oauth2 token url | oauth2 client id | oauth2 client secret | oauth2 scope | - | asset-1 | http proxy transfer asset | http://localhost:8081/api/check/liveness | http://ids-daps:4567 | data-plane-oauth2 | supersecret | openid | - And 'Plato' has the following policies - | id | action | - | policy-1 | USE | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | - | contract-definition-1 | policy-1 | policy-1 | asset-1 | - When 'Sokrates' negotiates the contract successfully with 'Plato' - | contract offer id | asset id | policy id | - | contract-definition-1 | asset-1 | policy-1 | - And 'Sokrates' initiates HttpProxy transfer from 'Plato' - | asset id | - | asset-1 | - Then the backend application of 'Sokrates' has received data diff --git a/edc-tests/cucumber/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 deleted file mode 100644 index fa96f9a8f..000000000 --- a/edc-tests/cucumber/src/test/resources/org/eclipse/tractusx/edc/tests/features/S3FileTransfer.feature +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2022 ZF Friedrichshafen AG -# Copyright (c) 2021,2022 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 -# - -Feature: S3 File Transfer - - Background: The Connector State - Given 'Plato' has an empty database - Given 'Sokrates' has an empty database - Given 'Sokrates' has an empty storage bucket called 'destinationbucket' - Given 'Plato' has a storage bucket called 'sourcebucket' with the file called 'testfile' - - Scenario: Request file transfer via S3 - Given 'Plato' has the following S3 assets - | id | description | data_address_type | data_address_s3_bucket_name | data_address_s3_key_name | data_address_s3_region | - | asset-1 | Example Asset | AmazonS3 | sourcebucket | testfile | us-east-1 | - And 'Plato' has the following policies - | id | action | payMe | - | policy-1 | USE | | - And 'Plato' has the following contract definitions - | id | access policy | contract policy | asset | - | contract-definition-1 | policy-1 | policy-1 | asset-1 | - When 'Sokrates' requests the catalog from 'Plato' - Then the catalog contains the following offers - | source definition | asset | - | contract-definition-1 | asset-1 | - Then 'Sokrates' negotiates the contract successfully with 'Plato' - | contract offer id | asset id | policy id | - | contract-definition-1 | asset-1 | policy-1 | - Then 'Sokrates' initiate S3 transfer process from 'Plato' - | data_address_s3_bucket_name | data_address_s3_key_name | data_address_s3_region | - | destinationbucket | testfile | us-east-1 | - Then 'Sokrates' has a storage bucket called 'destinationbucket' with transferred file called 'testfile'