diff --git a/.github/workflows/verify-dim.yaml b/.github/workflows/verify-dim.yaml deleted file mode 100644 index 091c788f8..000000000 --- a/.github/workflows/verify-dim.yaml +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################# -# Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - -name: "Verify DIM" - -on: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -jobs: - dim-integration-tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: ./.github/actions/setup-java - - - name: Run DIM Integration tests - run: ./gradlew test -DincludeTags="DimIntegrationTest" \ No newline at end of file diff --git a/edc-tests/e2e-tests/README.md b/edc-tests/e2e-tests/README.md deleted file mode 100644 index f204147c3..000000000 --- a/edc-tests/e2e-tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# E2E-Tests - -This module contains JUnit tests that spin up multiple runtimes in one JVM. diff --git a/edc-tests/e2e-tests/build.gradle.kts b/edc-tests/e2e-tests/build.gradle.kts deleted file mode 100644 index 5897084e1..000000000 --- a/edc-tests/e2e-tests/build.gradle.kts +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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` - `java-test-fixtures` -} - -dependencies { - testImplementation(libs.restAssured) - testImplementation(libs.nimbus.jwt) - testImplementation(libs.awaitility) - testImplementation(libs.edc.lib.boot) - testImplementation(testFixtures(libs.edc.sql.core)) - testImplementation(testFixtures(libs.edc.api.management.test.fixtures)) - testImplementation(project(":edc-extensions:bpn-validation:bpn-validation-spi")) - testImplementation(project(":spi:core-spi")) - testImplementation(testFixtures(project(":edc-tests:edc-controlplane:fixtures"))) - - testCompileOnly(project(":edc-tests:runtime:extensions")) - testCompileOnly(project(":edc-tests:runtime:iatp:runtime-memory-iatp-dim")) - -} - -// do not publish -edcBuild { - publish.set(false) -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/DimHelper.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/DimHelper.java deleted file mode 100644 index 08c0d1210..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/DimHelper.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.helpers; - -import org.eclipse.tractusx.edc.lifecycle.DimParticipant; - -import java.net.URI; -import java.util.Objects; - -import static java.lang.String.format; -import static java.lang.System.getenv; - -public interface DimHelper { - - /** - * Configure a {@link DimParticipant} from env variables - * - * @param name The participant name - * @return The composed {@link DimParticipant} - */ - static DimParticipant configureParticipant(String name, String bdrsUrl) { - var bpn = getEnv(format("DIM_%s_BPN", name)); - var dimUrl = getEnv(format("DIM_%s_DIM_URL", name)); - var stsUrl = getEnv(format("DIM_%s_STS_URL", name)); - var stsClientId = getEnv(format("DIM_%s_STS_CLIENT_ID", name)); - var stsClientSecret = getEnv(format("DIM_%s_STS_CLIENT_SECRET", name)); - var did = getEnv(format("DIM_%s_DID", name)); - var trustedIssuer = getEnv("DIM_TRUSTED_ISSUER"); - return DimParticipant.Builder.newInstance().id(bpn) - .name(name) - .stsUri(URI.create(stsUrl)) - .stsClientId(stsClientId) - .stsClientSecret(stsClientSecret) - .dimUri(URI.create(dimUrl)) - .trustedIssuer(trustedIssuer) - .did(did) - .bdrsUri(URI.create(bdrsUrl)) - .build(); - } - - private static String getEnv(String env) { - return Objects.requireNonNull(getenv(env), "%s env variable not present".formatted(env)); - } - -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java deleted file mode 100644 index 74ba5535d..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DataWiper.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.lifecycle; - -import org.eclipse.edc.connector.controlplane.asset.spi.index.AssetIndex; -import org.eclipse.edc.connector.controlplane.contract.spi.offer.store.ContractDefinitionStore; -import org.eclipse.edc.connector.controlplane.policy.spi.store.PolicyDefinitionStore; -import org.eclipse.edc.edr.spi.store.EndpointDataReferenceStore; -import org.eclipse.edc.spi.query.QuerySpec; -import org.eclipse.edc.spi.system.ServiceExtensionContext; -import org.eclipse.tractusx.edc.validation.businesspartner.spi.BusinessPartnerStore; - -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.CONSUMER_BPN; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PROVIDER_BPN; - -/** - * Helper class to delete all objects from a runtime's data stores. - */ -public class DataWiper { - - private final ServiceExtensionContext context; - - public DataWiper(ServiceExtensionContext context) { - this.context = context; - } - - public void clearPersistence() { - clearAssetIndex(); - clearPolicies(); - clearContractDefinitions(); - clearEdrCache(); - clearBusinessPartnerStore(); - } - - public void clearBusinessPartnerStore() { - var bps = context.getService(BusinessPartnerStore.class); - bps.delete(CONSUMER_BPN); - bps.delete(PROVIDER_BPN); - } - - public void clearContractDefinitions() { - var cds = context.getService(ContractDefinitionStore.class); - cds.findAll(QuerySpec.max()).forEach(cd -> cds.deleteById(cd.getId())); - } - - public void clearPolicies() { - var ps = context.getService(PolicyDefinitionStore.class); - // must .collect() here, otherwise we'll get a ConcurrentModificationException - ps.findAll(QuerySpec.max()).toList().forEach(p -> ps.delete(p.getId())); - } - - public void clearAssetIndex() { - var index = context.getService(AssetIndex.class); - index.queryAssets(QuerySpec.max()).forEach(asset -> index.deleteById(asset.getId())); - } - - public void clearEdrCache() { - var edrCache = context.getService(EndpointDataReferenceStore.class); - edrCache.query(QuerySpec.max()).getContent().forEach(entry -> { - try { - edrCache.delete(entry.getTransferProcessId()); - } catch (Exception e) { - context.getMonitor().warning("Failed to clean up the cache", e); - } - }); - } -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DimParticipant.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DimParticipant.java deleted file mode 100644 index d1effe29e..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/DimParticipant.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.lifecycle; - -import org.eclipse.tractusx.edc.tests.participant.TractusxIatpParticipantBase; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Extension of {@link TractusxIatpParticipantBase} with DIM specific configuration - */ -public class DimParticipant extends TractusxIatpParticipantBase { - - protected URI dimUri; - - protected URI bdrsUri; - - @Override - public Map iatpConfiguration(TractusxIatpParticipantBase... others) { - var config = new HashMap<>(super.iatpConfiguration(others)); - config.put("tx.edc.iam.sts.dim.url", dimUri.toString()); - config.put("tx.edc.iam.iatp.bdrs.server.url", bdrsUri.toString()); - config.put("edc.transfer.proxy.token.verifier.publickey.alias", getKeyId()); - return config; - } - - public static class Builder extends TractusxIatpParticipantBase.Builder { - - protected Builder() { - super(new DimParticipant()); - } - - public static Builder newInstance() { - return new Builder(); - } - - public Builder dimUri(URI dimUri) { - participant.dimUri = dimUri; - return self(); - } - - public Builder bdrsUri(URI bdrsUri) { - participant.bdrsUri = bdrsUri; - return self(); - } - - @Override - public DimParticipant build() { - super.build(); - Objects.requireNonNull(participant.dimUri, "DIM URI should not be null"); - Objects.requireNonNull(participant.bdrsUri, "BDRS URI should not be null"); - return participant; - } - } -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/ParticipantRuntime.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/ParticipantRuntime.java deleted file mode 100644 index 24639addc..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/ParticipantRuntime.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.lifecycle; - -import com.nimbusds.jose.JOSEException; -import com.nimbusds.jose.jwk.Curve; -import com.nimbusds.jose.jwk.gen.ECKeyGenerator; -import org.eclipse.edc.junit.extensions.EmbeddedRuntime; -import org.eclipse.edc.junit.extensions.RuntimePerMethodExtension; -import org.eclipse.edc.spi.security.Vault; -import org.junit.jupiter.api.extension.ExtensionContext; - -import java.util.Map; - -public class ParticipantRuntime extends RuntimePerMethodExtension { - - private final Map properties; - - public ParticipantRuntime(String runtimeName, Map properties, String... modules) { - super(new EmbeddedRuntime(runtimeName, properties, modules)); - this.properties = properties; - } - - - @Override - public void beforeTestExecution(ExtensionContext extensionContext) { - registerConsumerPullKeys(properties); - } - - @Override - public void afterTestExecution(ExtensionContext context) { - var wiper = new DataWiper(runtime.getContext()); - wiper.clearPersistence(); - } - - private void registerConsumerPullKeys(Map properties) { - var privateAlias = properties.get("edc.transfer.proxy.token.signer.privatekey.alias"); - var publicAlias = properties.get("edc.transfer.proxy.token.verifier.publickey.alias"); - if (privateAlias != null && publicAlias != null) { - try { - var ecKey = new ECKeyGenerator(Curve.P_256).keyID(publicAlias).generate(); - var vault = getService(Vault.class); - vault.storeSecret(privateAlias, ecKey.toJSONString()); - vault.storeSecret(publicAlias, ecKey.toPublicJWK().toJSONString()); - } catch (JOSEException e) { - throw new RuntimeException(e); - } - - } - } - -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Runtimes.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Runtimes.java deleted file mode 100644 index 3a7b6375f..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Runtimes.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.lifecycle; - -import java.util.Map; - -public interface Runtimes { - - static ParticipantRuntime dimRuntime(String name, Map configuration) { - return new ParticipantRuntime(name, configuration, ":edc-tests:runtime:iatp:runtime-memory-iatp-dim"); - } -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tag/DimIntegrationTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tag/DimIntegrationTest.java deleted file mode 100644 index 267814b79..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tag/DimIntegrationTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.tag; - -import org.eclipse.edc.junit.annotations.IntegrationTest; -import org.junit.jupiter.api.Tag; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.RUNTIME) -@IntegrationTest -@Tag("DimIntegrationTest") -public @interface DimIntegrationTest { -} - diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/DimCatalogIntegrationTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/DimCatalogIntegrationTest.java deleted file mode 100644 index 486981db1..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/DimCatalogIntegrationTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.catalog; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.tractusx.edc.lifecycle.DimParticipant; -import org.eclipse.tractusx.edc.lifecycle.ParticipantRuntime; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.mockserver.integration.ClientAndServer; -import org.mockserver.model.HttpResponse; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Map; -import java.util.zip.GZIPOutputStream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.connector.controlplane.test.system.utils.PolicyFixtures.noConstraintPolicy; -import static org.eclipse.edc.util.io.Ports.getFreePort; -import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.CX_POLICY_NS; -import static org.eclipse.tractusx.edc.helpers.DimHelper.configureParticipant; -import static org.eclipse.tractusx.edc.lifecycle.Runtimes.dimRuntime; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.CONSUMER_NAME; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PROVIDER_NAME; -import static org.eclipse.tractusx.edc.tests.helpers.CatalogHelperFunctions.getDatasetAssetId; -import static org.eclipse.tractusx.edc.tests.helpers.PolicyHelperFunctions.frameworkPolicy; -import static org.mockserver.model.HttpRequest.request; - -//@DimIntegrationTest -//@Disabled -public class DimCatalogIntegrationTest { - - private static final ObjectMapper MAPPER = new ObjectMapper(); - private static final Integer BDRS_PORT = getFreePort(); - private static final String BDRS_URL = "http://localhost:%s/api".formatted(BDRS_PORT); - - protected static final DimParticipant CONSUMER = configureParticipant(CONSUMER_NAME, BDRS_URL); - protected static final DimParticipant PROVIDER = configureParticipant(PROVIDER_NAME, BDRS_URL); - - @RegisterExtension - protected static final ParticipantRuntime PROVIDER_RUNTIME = dimRuntime(PROVIDER.getName(), PROVIDER.iatpConfiguration(CONSUMER)); - - @RegisterExtension - protected static final ParticipantRuntime CONSUMER_RUNTIME = dimRuntime(CONSUMER.getName(), CONSUMER.iatpConfiguration(PROVIDER)); - private static ClientAndServer bdrsServer; - - @BeforeAll - static void beforeAll() { - bdrsServer = ClientAndServer.startClientAndServer(BDRS_PORT); - bdrsServer.when(request() - .withMethod("GET") - .withPath("/api/bpn-directory")) - .respond(HttpResponse.response() - .withHeader("Content-Encoding", "gzip") - .withBody(createGzipStream()) - .withStatusCode(200)); - - } - - private static byte[] createGzipStream() { - var data = Map.of(CONSUMER.getBpn(), CONSUMER.getDid(), - PROVIDER.getBpn(), PROVIDER.getDid()); - - var bas = new ByteArrayOutputStream(); - try (var gzip = new GZIPOutputStream(bas)) { - gzip.write(MAPPER.writeValueAsBytes(data)); - } catch (IOException e) { - throw new RuntimeException(e); - } - return bas.toByteArray(); - } - - @AfterAll - static void afterAll() { - bdrsServer.stop(); - } - - //@Test - @DisplayName("Verify that the consumer receives only the offers he is permitted to") - void requestCatalog_filteredByDismantler_shouldReturnOffer() { - // arrange - PROVIDER.createAsset("test-asset"); - PROVIDER.createAsset("test-asset-1"); - - var bpnAccessPolicy = frameworkPolicy(Map.of(CX_POLICY_NS + "Membership", "active")); - var dismantlerAccessPolicy = frameworkPolicy(Map.of(CX_POLICY_NS + "Dismantler", "active")); - - var bpnAccessId = PROVIDER.createPolicyDefinition(bpnAccessPolicy); - var contractPolicyId = PROVIDER.createPolicyDefinition(noConstraintPolicy()); - var dismantlerAccessPolicyId = PROVIDER.createPolicyDefinition(dismantlerAccessPolicy); - - PROVIDER.createContractDefinition("test-asset", "test-def", bpnAccessId, contractPolicyId); - PROVIDER.createContractDefinition("test-asset-1", "test-def-2", dismantlerAccessPolicyId, contractPolicyId); - - // act - var catalog = CONSUMER.getCatalogDatasets(PROVIDER); - - // assert - assertThat(catalog).isNotEmpty() - .hasSize(1) - .allSatisfy(co -> { - assertThat(getDatasetAssetId(co.asJsonObject())).isEqualTo("test-asset"); - }); - - } - -} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpPullTransferIntegrationTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpPullTransferIntegrationTest.java deleted file mode 100644 index 5b7ea0587..000000000 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpPullTransferIntegrationTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * 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.transfer; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.tractusx.edc.lifecycle.DimParticipant; -import org.eclipse.tractusx.edc.lifecycle.ParticipantRuntime; -import org.eclipse.tractusx.edc.tag.DimIntegrationTest; -import org.eclipse.tractusx.edc.tests.participant.TractusxParticipantBase; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.mockserver.integration.ClientAndServer; -import org.mockserver.model.HttpResponse; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Map; -import java.util.zip.GZIPOutputStream; - -import static org.eclipse.edc.util.io.Ports.getFreePort; -import static org.eclipse.tractusx.edc.helpers.DimHelper.configureParticipant; -import static org.eclipse.tractusx.edc.lifecycle.Runtimes.dimRuntime; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.CONSUMER_NAME; -import static org.eclipse.tractusx.edc.tests.TestRuntimeConfiguration.PROVIDER_NAME; -import static org.mockserver.model.HttpRequest.request; - -@DimIntegrationTest -@Disabled -public class DimHttpPullTransferIntegrationTest extends HttpConsumerPullBaseTest { - - private static final ObjectMapper MAPPER = new ObjectMapper(); - private static final Integer BDRS_PORT = getFreePort(); - private static final String BDRS_URL = "http://localhost:%s/api".formatted(BDRS_PORT); - protected static final DimParticipant CONSUMER = configureParticipant(CONSUMER_NAME, BDRS_URL); - protected static final DimParticipant PROVIDER = configureParticipant(PROVIDER_NAME, BDRS_URL); - @RegisterExtension - protected static final ParticipantRuntime PROVIDER_RUNTIME = dimRuntime(PROVIDER.getName(), PROVIDER.iatpConfiguration(CONSUMER)); - @RegisterExtension - protected static final ParticipantRuntime CONSUMER_RUNTIME = dimRuntime(CONSUMER.getName(), CONSUMER.iatpConfiguration(PROVIDER)); - private static ClientAndServer bdrsServer; - - @BeforeAll - static void beforeAll() { - bdrsServer = ClientAndServer.startClientAndServer(BDRS_PORT); - bdrsServer.when(request() - .withMethod("GET") - .withPath("/api/bpn-directory")) - .respond(HttpResponse.response() - .withHeader("Content-Encoding", "gzip") - .withBody(createGzipStream()) - .withStatusCode(200)); - - } - - private static byte[] createGzipStream() { - var data = Map.of(CONSUMER.getBpn(), CONSUMER.getDid(), - PROVIDER.getBpn(), PROVIDER.getDid()); - - var bas = new ByteArrayOutputStream(); - try (var gzip = new GZIPOutputStream(bas)) { - gzip.write(MAPPER.writeValueAsBytes(data)); - } catch (IOException e) { - throw new RuntimeException(e); - } - return bas.toByteArray(); - } - - @AfterAll - static void afterAll() { - bdrsServer.stop(); - } - - @Override - public TractusxParticipantBase provider() { - return PROVIDER; - } - - @Override - public TractusxParticipantBase consumer() { - return CONSUMER; - } -} diff --git a/edc-tests/e2e-tests/src/test/resources/framework-policy.json b/edc-tests/e2e-tests/src/test/resources/framework-policy.json deleted file mode 100644 index 321aecbe5..000000000 --- a/edc-tests/e2e-tests/src/test/resources/framework-policy.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "@context": [ - "https://w3id.org/edc/v0.0.1", - "https://w3id.org/tractusx/edc/v0.0.1", - "http://www.w3.org/ns/odrl.jsonld" - ], - "@type": "PolicyDefinitionRequest", - "@id": "${POLICY_ID}", - "policy": { - "@type": "Set", - "permission": [ - { - "action": "use", - "constraint": [ - { - "leftOperand": "${FRAMEWORK_CREDENTIAL}", - "operator": "eq", - "rightOperand": "active" - } - ] - } - ] - } -} diff --git a/edc-tests/edc-dataplane/cloud-transfer-tests/build.gradle.kts b/edc-tests/edc-dataplane/cloud-transfer-tests/build.gradle.kts index bf924af48..1e2f924d9 100644 --- a/edc-tests/edc-dataplane/cloud-transfer-tests/build.gradle.kts +++ b/edc-tests/edc-dataplane/cloud-transfer-tests/build.gradle.kts @@ -25,7 +25,6 @@ plugins { dependencies { - testImplementation(project(":edc-tests:e2e-tests")) testImplementation(libs.edc.junit) testImplementation(libs.restAssured) diff --git a/edc-tests/edc-dataplane/edc-dataplane-tokenrefresh-tests/build.gradle.kts b/edc-tests/edc-dataplane/edc-dataplane-tokenrefresh-tests/build.gradle.kts index cd5b341a9..bcd94d93e 100644 --- a/edc-tests/edc-dataplane/edc-dataplane-tokenrefresh-tests/build.gradle.kts +++ b/edc-tests/edc-dataplane/edc-dataplane-tokenrefresh-tests/build.gradle.kts @@ -24,7 +24,6 @@ plugins { dependencies { testImplementation(project(":spi:tokenrefresh-spi")) - testImplementation(project(":edc-tests:e2e-tests")) testImplementation(libs.edc.junit) testImplementation(libs.restAssured) diff --git a/samples/edc-dast/edc-dast-extensions/src/main/java/org/eclipse/tractusx/edc/dast/DastSeedExtension.java b/samples/edc-dast/edc-dast-extensions/src/main/java/org/eclipse/tractusx/edc/dast/DastSeedExtension.java index 714c440d0..1a8a30321 100644 --- a/samples/edc-dast/edc-dast-extensions/src/main/java/org/eclipse/tractusx/edc/dast/DastSeedExtension.java +++ b/samples/edc-dast/edc-dast-extensions/src/main/java/org/eclipse/tractusx/edc/dast/DastSeedExtension.java @@ -79,6 +79,7 @@ public class DastSeedExtension implements ServiceExtension { private static final String DID = "did:example:participant"; private static final String KEY = "key1"; private static final String METHOD_ID = DID + "#" + KEY; + private static final String PRIVATE_METHOD_ID = "private." + DID + "#" + KEY; @Inject private ParticipantContextService participantContextService; @Inject @@ -108,10 +109,10 @@ private static JsonArray types(String type) { public void initialize(ServiceExtensionContext context) { ServiceExtension.super.initialize(context); var keyPair = generateKeyPair(); - var jwkString = getJwkAsString(keyPair); var participantKey = getKeyPairAsJwk(keyPair, METHOD_ID); - vault.storeSecret(METHOD_ID, jwkString); + vault.storeSecret(METHOD_ID, participantKey.toPublicJWK().toJSONString()); + vault.storeSecret(PRIVATE_METHOD_ID, participantKey.toJSONString()); vault.storeSecret("public_key_alias", participantKey.toPublicJWK().toJSONString()); var exampleResolver = new DidExampleResolver(); @@ -162,7 +163,7 @@ private DidDocument boostrap(ParticipantContextService participantContextService var key = KeyDescriptor.Builder.newInstance() .keyId(KEY) .publicKeyJwk(participantKey.toPublicJWK().toJSONObject()) - .privateKeyAlias(METHOD_ID) + .privateKeyAlias(PRIVATE_METHOD_ID) .build(); var participantManifest = ParticipantManifest.Builder.newInstance() @@ -205,11 +206,7 @@ private DidDocument generateDidDocument(JWK jwk) { private String toBase64(String s) { return Base64.getUrlEncoder().encodeToString(s.getBytes()); } - - private String getJwkAsString(KeyPair keyPair) { - return CryptoConverter.createJwk(keyPair).toJSONString(); - } - + private KeyPair generateKeyPair() { try { KeyPairGenerator gen = KeyPairGenerator.getInstance("EC", new BouncyCastleProvider()); diff --git a/samples/edc-dast/edc-dast-runtime/configuration.properties b/samples/edc-dast/edc-dast-runtime/configuration.properties index 0c884464b..2208e61ff 100644 --- a/samples/edc-dast/edc-dast-runtime/configuration.properties +++ b/samples/edc-dast/edc-dast-runtime/configuration.properties @@ -3,20 +3,24 @@ edc.iam.issuer.id=did:example:participant edc.ih.iam.id=did:example:participant edc.iam.publickey.alias=public_key_alias edc.ih.iam.publickey.alias=public_key_alias -edc.iam.sts.privatekey.alias=did:example:participant#key1 +edc.iam.sts.privatekey.alias=private.did:example:participant#key1 edc.iam.sts.publickey.id=did:example:participant#key1 edc.iam.sts.clients.participant.name=participant edc.iam.sts.clients.participant.id=participant edc.iam.sts.clients.participant.client_id=participant edc.iam.sts.clients.participant.did=did:example:participant edc.iam.sts.clients.participant.secret.alias=client_secret_alias -edc.iam.sts.clients.participant.private-key.alias=did:example:participant#key1 +edc.iam.sts.clients.participant.private-key.alias=private.did:example:participant#key1 edc.iam.sts.clients.participant.public-key.reference=did:example:participant#key1 edc.iam.trusted-issuer.participant.id=did:example:participant web.http.resolution.port=8989 web.http.resolution.path=/api/resolution web.http.default.port=8181 web.http.default.path=/api +web.http.management.port=8182 +web.http.management.path=/management +web.http.control.port=8183 +web.http.control.path=/control web.http.sts.port=8990 web.http.sts.path=/v1/sts edc.api.auth.key=password diff --git a/settings.gradle.kts b/settings.gradle.kts index a316a8afd..a71c70a96 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -58,7 +58,6 @@ include(":edc-extensions:dataplane:dataplane-token-refresh:token-refresh-core") include(":edc-extensions:dataplane:dataplane-token-refresh:token-refresh-api") // test modules -include(":edc-tests:e2e-tests") include(":edc-tests:edc-controlplane:edr-api-tests") include(":edc-tests:edc-controlplane:catalog-tests") include(":edc-tests:edc-controlplane:transfer-tests")