From e23086f884e55ba9798d78b4782eb59a7c0e8e4a Mon Sep 17 00:00:00 2001 From: farhin23 Date: Tue, 19 Nov 2024 15:49:24 +0100 Subject: [PATCH 1/9] Add federated catalog samples for embedded and standalone FC --- federated-catalog/README.md | 54 ++++++++ federated-catalog/fc-00-basic/README.md | 98 ++++++++++++++ .../federated-catalog-base/build.gradle.kts | 26 ++++ .../fixed-node-resolver/build.gradle.kts | 23 ++++ .../extension/fc/CatalogNodeDirectory.java | 43 ++++++ .../fc/CatalogNodeDirectoryExtension.java | 33 +++++ ...rg.eclipse.edc.spi.system.ServiceExtension | 1 + federated-catalog/fc-01-embedded/README.md | 123 ++++++++++++++++++ .../fc-connector/build.gradle.kts | 47 +++++++ .../fc-connector/config.properties | 33 +++++ .../fc-01-embedded/resources/empty-query.json | 6 + federated-catalog/fc-02-standalone/README.md | 107 +++++++++++++++ .../standalone-fc/build.gradle.kts | 47 +++++++ .../standalone-fc/config.properties | 14 ++ .../fc-03-static-node-directory/README.md | 1 + gradle/libs.versions.toml | 6 + settings.gradle.kts | 7 + 17 files changed, 669 insertions(+) create mode 100644 federated-catalog/README.md create mode 100644 federated-catalog/fc-00-basic/README.md create mode 100644 federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts create mode 100644 federated-catalog/fc-00-basic/fixed-node-resolver/build.gradle.kts create mode 100644 federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java create mode 100644 federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java create mode 100644 federated-catalog/fc-00-basic/fixed-node-resolver/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension create mode 100644 federated-catalog/fc-01-embedded/README.md create mode 100644 federated-catalog/fc-01-embedded/fc-connector/build.gradle.kts create mode 100644 federated-catalog/fc-01-embedded/fc-connector/config.properties create mode 100644 federated-catalog/fc-01-embedded/resources/empty-query.json create mode 100644 federated-catalog/fc-02-standalone/README.md create mode 100644 federated-catalog/fc-02-standalone/standalone-fc/build.gradle.kts create mode 100644 federated-catalog/fc-02-standalone/standalone-fc/config.properties create mode 100644 federated-catalog/fc-03-static-node-directory/README.md diff --git a/federated-catalog/README.md b/federated-catalog/README.md new file mode 100644 index 00000000..9fac7ba3 --- /dev/null +++ b/federated-catalog/README.md @@ -0,0 +1,54 @@ +# Federated Catalog Samples + +The samples in this section focus on the topic of Federated Catalogs. + +The Federated Catalog (FC) functions as an aggregated repository of +catalogs obtained from multiple +participants in the dataspace. To accomplish this, the FC utilizes crawlers +that periodically crawl the catalogs from each participant and store this list +of catalogs in a local cache. +By maintaining this locally cached version of catalogs, it eliminates the need to query +each participant individually, resulting in faster and more reliable queries. + + +The following samples shows how to +* implement, build and run different versions of FC e.g. + * standalone, + * embedded. +* implement TargetNodeDirectory and resolve Target Nodes, + * from a static file containing all participants' DSP endpoints, + + + +## Samples + +### [FC sample 00](./fc-00-basic/README.md): Federated Catalog Prerequisites +The purpose of this example is to make preparations for implementing Federated Catalog (FC). +We'll set up a basic federated catalog that includes necessary dependencies for triggering the FC, +along with some other modules to demonstrate FC functionalities. + +--- + +### Implement Different Versions of FC +### [FC sample 01](./fc-01-embedded/README.md): Implement an embedded federated catalog +This sample demonstrates how we can implement a federated catalog which is embedded in a connector. +The connector exposes a catalog endpoint that serves the consolidated list of catalogs. +### [FC sample 02](./fc-02-standalone/README.md): Implement a standalone federated catalog + +In this sample we focus on the implementation of +a standalone federated catalog. Unlike the previous sample, +a standalone federated catalog will not have the added functionalities of a connector. However, it also +exposes a catalog API that serves the list of catalogs. + +--- + +### Different Implementations of Node Resolver + + +In the following samples you will learn how to implement a TargetNodeDirectory depending on different use cases. + +### [FC sample 03](): Resolve Target Catalog Nodes from static participant file +This sample demonstrates a Catalog Node resolver, that implements TargetNodeDirectory. It resolves the Target Catalog +Nodes from a static participant file containing the DSP endpoints of the participants. + + diff --git a/federated-catalog/fc-00-basic/README.md b/federated-catalog/fc-00-basic/README.md new file mode 100644 index 00000000..4f701801 --- /dev/null +++ b/federated-catalog/fc-00-basic/README.md @@ -0,0 +1,98 @@ +# Federated Catalog Prerequisites + +The purpose of this example is to make preparations for implementing Federated Catalog (FC) +and set up additional requirements for testing the FC functionalities. +For this purpose, we will be covering the following in this scope. +* `federated-catalog-base`: A basic federated catalog that includes necessary dependencies for triggering the FC. +* `participant-connector`: A connector with a contract offer. We will require this for testing the functionalities of the FCs in our later samples. +* `fixed-node-resolver`: A mock node directory resolver. +It provides a fixed Target Catalog Node, which represents the `participant-connector`. + + + +### federated-catalog-base +The [federated-catalog-base](../../fc/fc-00-basic/federated-catalog-base) will be used as a foundational module in our upcoming samples to trigger the FC. +It provides a [build.gradle.kts](./federated-catalog-base/build.gradle.kts) file that includes only the dependencies +essential for FC, without any additional functionality. +```shell +... +dependencies { + implementation(libs.edc.fc.spi.crawler) + runtimeOnly(libs.fc.core) + runtimeOnly(libs.fc.ext.api) +} +... +``` +Any further dependencies will be added in the later samples based on their use cases. + + +### fixed-node-resolver +The Federated Catalog requires a list of Target Catalog Nodes, which are essentially the DSP endpoints of the dataspace participants. +The catalog crawler then crawls these listed endpoints to collect their offered catalogs. +This list of Target Nodes is resolved by a Catalog Node Resolver which implements the [TargetNodeDirectory](https://github.com/eclipse-edc/FederatedCatalog/blob/main/spi/crawler-spi/src/main/java/org/eclipse/edc/crawler/spi/TargetNodeDirectory.java). +Check out [eclipse-edc/FederatedCatalog](https://github.com/eclipse-edc/FederatedCatalog/tree/main) for further information on this topic. + + +In this module, we've included a fixed Node Resolver, [fixed-node-resolver](./fixed-node-resolver) +that simply returns a hard-coded Target Node of the `participant-connector`. +However, we will not cover the implementation of the resolver in this sample; that will be explained in detail later in +[fc-03-static-node-directory](../fc-03-static-node-directory/README.md). + + +The purpose of including this [`fixed-node-resolver`](./fixed-node-resolver) +as a prerequisite, is the fact that we need to have some form of Target Node Resolver to demonstrate the functionality +of the federated catalogs that we are going to build in sample +[fc-01-embedded](../fc-01-embedded) and [fc-02-standalone](../fc-02-standalone). + +### participant connector + +When the federated catalog boots up, the crawler begins periodically invoking the Target Nodes returned by the +Node Resolver and collecting the catalogs offered by these nodes. To test whether our federated catalogs +(which we will build in later samples: [fc-01-embedded](../../fc/fc-01-embedded) and [fc-02-standalone](../../fc/fc-02-standalone)) can successfully request and retrieve these catalogs, we need at least one connector with a contract offer. + +Therefore, in this section, we will start a connector and then create a contract +for this connector. In the future samples, we will refer to it as `participant-connector`. +This `participant-connector` will function as a provider. +We will use the resources from the [transfer](../../transfer) sample to set up this connector. In the rest of this section we will, +* run the `participant-connector` +* create an asset for this `participant-connector` +* create a policy +* create a contract offer + +Although these topics were covered in the [transfer](../../transfer) section, we’ll document all the necessary commands here for easier execution. + + +#### Build connector jar +Use the following command to build a connector jar. +```shell +./gradlew transfer:transfer-00-prerequisites:connector:build +``` +#### Run the connector +Execute the following to run the connector jar. +```shell +java -Dedc.keystore=transfer/transfer-00-prerequisites/resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.fs.config=transfer/transfer-00-prerequisites/resources/configuration/provider-configuration.properties -jar transfer/transfer-00-prerequisites/connector/build/libs/connector.jar +``` + +--- + +Once the connector is running, carry out the commands below in sequence. +#### Create an asset +```shell +curl -d @transfer/transfer-01-negotiation/resources/create-asset.json \ + -H 'content-type: application/json' http://localhost:19193/management/v3/assets \ + -s | jq +``` + +#### Create a policy +```bash +curl -d @transfer/transfer-01-negotiation/resources/create-policy.json \ + -H 'content-type: application/json' http://localhost:19193/management/v3/policydefinitions \ + -s | jq +``` + +#### Create a contract definition +```bash +curl -d @transfer/transfer-01-negotiation/resources/create-contract-definition.json \ + -H 'content-type: application/json' http://localhost:19193/management/v3/contractdefinitions \ + -s | jq +``` \ No newline at end of file diff --git a/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts b/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts new file mode 100644 index 00000000..a3367149 --- /dev/null +++ b/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +plugins { + `java-library` + id("application") +} + +dependencies { + implementation(libs.edc.fc.spi.crawler) + runtimeOnly(libs.fc.core) + runtimeOnly(libs.fc.ext.api) +} + + diff --git a/federated-catalog/fc-00-basic/fixed-node-resolver/build.gradle.kts b/federated-catalog/fc-00-basic/fixed-node-resolver/build.gradle.kts new file mode 100644 index 00000000..7985a3f1 --- /dev/null +++ b/federated-catalog/fc-00-basic/fixed-node-resolver/build.gradle.kts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +plugins { + `java-library` + id("application") +} + +dependencies { + implementation(libs.edc.fc.spi.crawler) +} + diff --git a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java new file mode 100644 index 00000000..a949d55b --- /dev/null +++ b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +package org.eclipse.edc.sample.extension.fc; + +import org.eclipse.edc.crawler.spi.TargetNode; +import org.eclipse.edc.crawler.spi.TargetNodeDirectory; + +import java.util.ArrayList; +import java.util.List; + +public class CatalogNodeDirectory implements TargetNodeDirectory { + + @Override + public List getAll() { + List protocolList = new ArrayList<>(); + protocolList.add("dataspace-protocol-http"); + + TargetNode participantNode = new TargetNode("https://w3id.org/edc/v0.0.1/ns/", + "provider", + "http://localhost:19194/protocol", protocolList); + + List targetNodes = new ArrayList<>(); + targetNodes.add(participantNode); + return targetNodes; + } + + @Override + public void insert(TargetNode targetNode) { + + } +} diff --git a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java new file mode 100644 index 00000000..2f9c65aa --- /dev/null +++ b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +package org.eclipse.edc.sample.extension.fc; + +import org.eclipse.edc.crawler.spi.TargetNodeDirectory; +import org.eclipse.edc.runtime.metamodel.annotation.Provider; +import org.eclipse.edc.spi.system.ServiceExtension; + +public class CatalogNodeDirectoryExtension implements ServiceExtension { + private TargetNodeDirectory nodeDirectory; + + + @Provider + public TargetNodeDirectory federatedCacheNodeDirectory() { + if (nodeDirectory == null) { + nodeDirectory = new CatalogNodeDirectory(); + } + return nodeDirectory; + } + +} diff --git a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension new file mode 100644 index 00000000..df3d2d3d --- /dev/null +++ b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension @@ -0,0 +1 @@ +org.eclipse.edc.sample.extension.fc.CatalogNodeDirectoryExtension \ No newline at end of file diff --git a/federated-catalog/fc-01-embedded/README.md b/federated-catalog/fc-01-embedded/README.md new file mode 100644 index 00000000..7e6d3e1e --- /dev/null +++ b/federated-catalog/fc-01-embedded/README.md @@ -0,0 +1,123 @@ +# Embedded Federated Catalog + + +This sample demonstrates how we can implement a federated catalog which is embedded in a connector. +We will build one connector of such type and will call it `fc-connector`. +As discussed in the prerequisite sample [fc-00-basic](../fc-00-basic/README.md), +we will be using the Node Resolver +[fixed-node-resolver](../fc-00-basic/fixed-node-resolver) as a dependency in our embedded federated catalog. +Also, the `participant-connector` we set up in the previous sample should still be running. +This `participant-connector` will act as a provider, while the new `fc-connector` will act as a consumer. + + + +This sample will go through: + +* Implementation of an embedded FC +* Set up of the embedded FC, `fc-connector` +* Test catalog API endpoint of the `fc-connector` + + +### 1. Implementation the fc-connector +The [build.gradle.kts](../fc-01-embedded/fc-connector/build.gradle.kts) +file located in the [fc-01-embedded/fc-connector](../fc-01-embedded/fc-connector) +directory includes all the necessary dependencies for creating a connector, along with the `fc-00-basic:federated-catalog-base` +needed to trigger the FC. Additionally, we need to add `fc-00-basic:federated-catalog-base` as a dependency to enable the Catalog Node Resolver. + +```kotlin +dependencies { + runtimeOnly(project(":federated-catalog:fc-00-basic:federated-catalog-base")) + runtimeOnly(project(":federated-catalog:fc-00-basic:static-node-resolver")) +} +``` + +The [config.properties](../fc-01-embedded/fc-connector/config.properties) +file contains the necessary configurations +for this `fc-connector`, including the standard settings for a regular connector, along with additional configurations for a +federated catalog, such as catalog api endpoint and crawler execution interval. + +```properties +web.http.catalog.path=/api/catalog +web.http.catalog.port=29195 + +edc.catalog.cache.execution.delay.seconds=5 +edc.catalog.cache.execution.period.seconds=5 +edc.catalog.cache.partition.num.crawlers=5 +``` + +### 2. Start the fc-connector +#### Build the fc-connector JAR +Execute this command in project root to build the `fc-connector` JAR file: + +```bash +./gradlew federated-catalog:fc-01-embedded:fc-connector:build +``` + + +#### Run the fc-connector + +To run the connector, execute the following command + +```shell +java -Dedc.fs.config=federated-catalog/fc-01-embedded/fc-connector/config.properties -jar federated-catalog/fc-01-embedded/fc-connector/build/libs/fc-connector.jar +``` + +If the execution is successful, then the Catalog API of our `fc-connector` will listen on port `29195`. + +If you observe the logs, you can see the following recurring lines, + +> DEBUG 2024-11-14T13:53:48.472700883 [ExecutionManager] Run pre-execution task +> +>DEBUG 2024-11-14T13:53:48.494149928 [ExecutionManager] Loaded 1 work items from storage +> +>DEBUG 2024-11-14T13:53:48.495574504 [ExecutionManager] Crawler parallelism is 1, based on config and number of work items +> +>DEBUG 2024-11-14T13:53:48.497891576 [ExecutionManager] Crawler-f81f5514-5c7f-44aa-94bb-16998861789b: WorkItem acquired +> +>DEBUG 2024-11-14T13:53:48.790873233 [ExecutionManager] Crawler [Crawler-f81f5514-5c7f-44aa-94bb-16998861789b] is done + + +This means our FC crawler is running, and the crawler found one node, which is the `participant-connector` we had set up before. + + + +### 3. Test catalog query API + +To query the catalogs from `fc-connector` side, we can now call the catalog API of our embedded federated catalog. +Use the following request to invoke the catalog API: + +```http request +curl -d @federated-catalog/fc-01-embedded/resources/empty-query.json \ + -H 'content-type: application/json' http://localhost:29195/api/catalog/v1alpha/catalog/query \ + -s | jq +``` + +Sample output: +```json +[ + { + "@id": "a8a8cd64-269d-485c-8857-74d08b13ae3c", + "@type": "dcat:Catalog", + "dcat:dataset": { + "@id": "assetId", + "@type": "dcat:Dataset", + "odrl:hasPolicy": { + "@id": "MQ==:YXNzZXRJZA==:MjJmNDlhYTAtM2I3YS00ODkzLTkwZDctNTU5MTZhNmViOWJk" + }, + "dcat:distribution": [ + ], + "name": "product description", + "id": "assetId", + "contenttype": "application/json" + }, + "dcat:distribution": [], + "dcat:service": { + + }, + "dspace:participantId": "provider", + "originator": "http://localhost:19194/protocol", + "@context": { + } + } +] +``` \ No newline at end of file diff --git a/federated-catalog/fc-01-embedded/fc-connector/build.gradle.kts b/federated-catalog/fc-01-embedded/fc-connector/build.gradle.kts new file mode 100644 index 00000000..6c2d63b5 --- /dev/null +++ b/federated-catalog/fc-01-embedded/fc-connector/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +plugins { + `java-library` + id("application") + alias(libs.plugins.shadow) +} + +dependencies { + runtimeOnly(project(":federated-catalog:fc-00-basic:federated-catalog-base")) + runtimeOnly(project(":federated-catalog:fc-00-basic:fixed-node-resolver")) + + implementation(libs.edc.connector.core) + implementation(libs.edc.control.plane.core) + implementation(libs.edc.configuration.filesystem) + implementation(libs.edc.management.api) + implementation(libs.edc.dsp) + implementation(libs.edc.iam.mock) + implementation(libs.edc.http) + implementation(libs.edc.edr.store.core) + +} + +application { + mainClass.set("org.eclipse.edc.boot.system.runtime.BaseRuntime") +} + +var distTar = tasks.getByName("distTar") +var distZip = tasks.getByName("distZip") + +tasks.withType { + mergeServiceFiles() + archiveFileName.set("fc-connector.jar") + dependsOn(distTar, distZip) +} diff --git a/federated-catalog/fc-01-embedded/fc-connector/config.properties b/federated-catalog/fc-01-embedded/fc-connector/config.properties new file mode 100644 index 00000000..38349e9d --- /dev/null +++ b/federated-catalog/fc-01-embedded/fc-connector/config.properties @@ -0,0 +1,33 @@ +edc.participant.id=fc-connector +edc.dsp.callback.address=http://localhost:19194/protocol +web.http.port=29191 +web.http.path=/api +web.http.management.port=29193 +web.http.management.path=/management +web.http.protocol.port=29194 +web.http.protocol.path=/protocol +edc.transfer.proxy.token.signer.privatekey.alias=private-key +edc.transfer.proxy.token.verifier.publickey.alias=public-key +web.http.public.port=29291 +web.http.public.path=/public +web.http.control.port=29192 +web.http.control.path=/control +edc.dataplane.api.public.baseurl=http://localhost:29291/public + + +edc.api.auth.key=password +edc.ids.id=urn:connector:provider +edc.mock.region=us + + +web.http.catalog.path=/api/catalog +web.http.catalog.port=29195 + +edc.catalog.cache.execution.delay.seconds=5 +edc.catalog.cache.execution.period.seconds=5 +edc.catalog.cache.partition.num.crawlers=5 + + + + + diff --git a/federated-catalog/fc-01-embedded/resources/empty-query.json b/federated-catalog/fc-01-embedded/resources/empty-query.json new file mode 100644 index 00000000..a03a6a87 --- /dev/null +++ b/federated-catalog/fc-01-embedded/resources/empty-query.json @@ -0,0 +1,6 @@ +{ + "@context": { + "@vocab": "https://w3id.org/edc/v0.0.1/ns/" + }, + "@type": "QuerySpec" +} \ No newline at end of file diff --git a/federated-catalog/fc-02-standalone/README.md b/federated-catalog/fc-02-standalone/README.md new file mode 100644 index 00000000..0e141bfc --- /dev/null +++ b/federated-catalog/fc-02-standalone/README.md @@ -0,0 +1,107 @@ +# Standalone Federated Catalog + + +In this sample we focus on the implementation of a standalone federated catalog. +Similar to the previous sample [fc-01-embedded](../fc-01-embedded), +the [standalone-fc](./standalone-fc) also builds on the +functionalities of the federated catalog. However, unlike the previous one, it does not +include the additional features of a connector. + +This sample will go through: + +* Implementation of a standalone FC +* Set up of the standalone FC +* Test catalog API endpoint of the standalone FC + + +### 1. Implementation a standalone FC +The [build.gradle.kts](../fc-02-standalone/standalone-fc/build.gradle.kts) +file located in the [fc-02-standalone/standalone-fc](./standalone-fc) +directory includes all the necessary dependencies for creating a standalone federated catalog. This includes the `fc-00-basic:federated-catalog-base`, +and `fc-00-basic:federated-catalog-base` to enable the Catalog Node Resolver. + +```kotlin +dependencies { + runtimeOnly(project(":federated-catalog:fc-00-basic:federated-catalog-base")) + runtimeOnly(project(":federated-catalog:fc-00-basic:static-node-resolver")) +} +``` + +Since we are using `fc-00-basic:federated-catalog-base` as our Catalog Node Resolver here +as well, it will return only +a single target catalog node; the `participant-connector` that we had set up in [fc-00-basic](../fc-00-basic/README.md). +Querying the catalog API will therefore yield just one catalog, which is the contract offered by this connector. + +The [config.properties](./standalone-fc/config.properties) file contains the necessary configurations, +like the `web.http.catalog.path`, which is the catalog API endpoint of this standalone FC. + +```properties +web.http.catalog.path=/api/catalog +web.http.catalog.port=39195 +``` + +### 2. Start the fc-connector +#### Build the fc-connector JAR +Execute this command in project root to build the `standalone-fc` JAR file: + +```bash +./gradlew federated-catalog:fc-02-standalone:standalone-fc:build +``` + + +#### Run the fc-connector + +To run the federated catalog, execute the following command + +```shell +java -Dedc.fs.config=federated-catalog/fc-02-standalone/standalone-fc/config.properties -jar federated-catalog/fc-02-standalone/standalone-fc/build/libs/standalone-fc.jar +``` + +If the execution is successful, then the Catalog API of our standalone FC will listen on port `39195`. + + + +## Test catalog query API +Before requesting the catalog API, make sure the `partcipant-connector` that we have set up in the +[fc-00-basic](../fc-00-basic) is running, and it has a contract offer. + +To get the combined set of catalogs, use the following request: + +```http request +curl -d @federated-catalog/fc-01-embedded/resources/empty-query.json \ + -H 'content-type: application/json' http://localhost:39195/api/catalog/v1alpha/catalog/query \ + -s | jq +``` + +Sample output: +```json +[ + { + "@id": "a8a8cd64-269d-485c-8857-74d08b13ae3c", + "@type": "dcat:Catalog", + "dcat:dataset": { + "@id": "assetId", + "@type": "dcat:Dataset", + "odrl:hasPolicy": { + "@id": "MQ==:YXNzZXRJZA==:MjJmNDlhYTAtM2I3YS00ODkzLTkwZDctNTU5MTZhNmViOWJk" + + }, + "dcat:distribution": [ + + ], + "name": "product description", + "id": "assetId", + "contenttype": "application/json" + }, + "dcat:distribution": [], + "dcat:service": { + + }, + "dspace:participantId": "provider", + "originator": "http://localhost:19194/protocol", + "@context": { + + } + } +] +``` \ No newline at end of file diff --git a/federated-catalog/fc-02-standalone/standalone-fc/build.gradle.kts b/federated-catalog/fc-02-standalone/standalone-fc/build.gradle.kts new file mode 100644 index 00000000..5a585fa5 --- /dev/null +++ b/federated-catalog/fc-02-standalone/standalone-fc/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +plugins { + `java-library` + id("application") + alias(libs.plugins.shadow) +} + +dependencies { + runtimeOnly(project(":federated-catalog:fc-00-basic:federated-catalog-base")) + runtimeOnly(project(":federated-catalog:fc-00-basic:fixed-node-resolver")) + + implementation(libs.edc.connector.core) + runtimeOnly(libs.edc.boot) + runtimeOnly(libs.edc.control.plane.core) + implementation(libs.edc.configuration.filesystem) + runtimeOnly(libs.edc.token.core) + implementation(libs.edc.http) + runtimeOnly(libs.edc.dsp) + implementation(libs.edc.iam.mock) + +} + +application { + mainClass.set("org.eclipse.edc.boot.system.runtime.BaseRuntime") +} + +var distTar = tasks.getByName("distTar") +var distZip = tasks.getByName("distZip") + +tasks.withType { + mergeServiceFiles() + archiveFileName.set("standalone-fc.jar") + dependsOn(distTar, distZip) +} diff --git a/federated-catalog/fc-02-standalone/standalone-fc/config.properties b/federated-catalog/fc-02-standalone/standalone-fc/config.properties new file mode 100644 index 00000000..79629c11 --- /dev/null +++ b/federated-catalog/fc-02-standalone/standalone-fc/config.properties @@ -0,0 +1,14 @@ +web.http.port=39191 +web.http.path=/api + +web.http.catalog.path=/api/catalog +web.http.catalog.port=39195 + +edc.catalog.cache.execution.delay.seconds=10 +edc.catalog.cache.execution.period.seconds=10 +edc.catalog.cache.partition.num.crawlers=10 + + + + + diff --git a/federated-catalog/fc-03-static-node-directory/README.md b/federated-catalog/fc-03-static-node-directory/README.md new file mode 100644 index 00000000..80d21657 --- /dev/null +++ b/federated-catalog/fc-03-static-node-directory/README.md @@ -0,0 +1 @@ +# Catalog Node Resolver - Static Node Directory \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c39f014a..04c948ae 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -74,5 +74,11 @@ testcontainers-hashicorp-vault = { module = "org.testcontainers:vault", version. azure-storage-blob = { module = "com.azure:azure-storage-blob", version = "12.29.0" } minio-io = { module = "io.minio:minio", version = "8.5.13" } +# federated catalog modules +fc-spi-core = { module = "org.eclipse.edc:federated-catalog-spi", version.ref = "edc" } +fc-core = { module = "org.eclipse.edc:federated-catalog-core", version.ref = "edc" } +fc-ext-api = { module = "org.eclipse.edc:federated-catalog-api", version.ref = "edc" } +edc-fc-spi-crawler = { module = "org.eclipse.edc:crawler-spi", version.ref = "edc" } + [plugins] shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 90c0d9cb..88da6243 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -52,6 +52,13 @@ include(":policy:policy-01-policy-enforcement:policy-enforcement-provider") include(":policy:policy-01-policy-enforcement:policy-enforcement-consumer") include(":policy:policy-01-policy-enforcement:policy-functions") +// federated catalog +include(":federated-catalog:fc-00-basic:federated-catalog-base") +include(":federated-catalog:fc-00-basic:fixed-node-resolver") +include(":federated-catalog:fc-01-embedded:fc-connector") +include(":federated-catalog:fc-02-standalone:standalone-fc") + + // modules for code samples ------------------------------------------------------------------------ include(":advanced:advanced-02-custom-runtime") From 2509abdc9ca152eb11979ef6dd562cc08f1976cf Mon Sep 17 00:00:00 2001 From: farhin23 Date: Tue, 19 Nov 2024 15:55:02 +0100 Subject: [PATCH 2/9] Add federated catalog samples for embedded and standalone FC --- federated-catalog/fc-00-basic/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/federated-catalog/fc-00-basic/README.md b/federated-catalog/fc-00-basic/README.md index 4f701801..0a848f62 100644 --- a/federated-catalog/fc-00-basic/README.md +++ b/federated-catalog/fc-00-basic/README.md @@ -11,7 +11,7 @@ It provides a fixed Target Catalog Node, which represents the `participant-conne ### federated-catalog-base -The [federated-catalog-base](../../fc/fc-00-basic/federated-catalog-base) will be used as a foundational module in our upcoming samples to trigger the FC. +The [federated-catalog-base](../fc-00-basic/federated-catalog-base) will be used as a foundational module in our upcoming samples to trigger the FC. It provides a [build.gradle.kts](./federated-catalog-base/build.gradle.kts) file that includes only the dependencies essential for FC, without any additional functionality. ```shell @@ -48,7 +48,7 @@ of the federated catalogs that we are going to build in sample When the federated catalog boots up, the crawler begins periodically invoking the Target Nodes returned by the Node Resolver and collecting the catalogs offered by these nodes. To test whether our federated catalogs -(which we will build in later samples: [fc-01-embedded](../../fc/fc-01-embedded) and [fc-02-standalone](../../fc/fc-02-standalone)) can successfully request and retrieve these catalogs, we need at least one connector with a contract offer. +(which we will build in later samples: [fc-01-embedded](../fc-01-embedded) and [fc-02-standalone](../../fc/fc-02-standalone)) can successfully request and retrieve these catalogs, we need at least one connector with a contract offer. Therefore, in this section, we will start a connector and then create a contract for this connector. In the future samples, we will refer to it as `participant-connector`. From b3f5be9290191515ca6890e676620d91f1dc6cd8 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 29 Nov 2024 12:20:33 +0100 Subject: [PATCH 3/9] Add tests for federated catalog samples 01 and 02 --- system-tests/build.gradle.kts | 4 + .../common/FederatedCatalogCommon.java | 115 ++++++++++++++++++ .../FederatedCatalog01embeddedTest.java | 63 ++++++++++ .../FederatedCatalog02standaloneTest.java | 62 ++++++++++ 4 files changed, 244 insertions(+) create mode 100644 system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java create mode 100644 system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java create mode 100644 system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java diff --git a/system-tests/build.gradle.kts b/system-tests/build.gradle.kts index 03370623..25420dda 100644 --- a/system-tests/build.gradle.kts +++ b/system-tests/build.gradle.kts @@ -9,6 +9,7 @@ * * Contributors: * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * Fraunhofer-Gesellschaft - dependencies for Federated Catalog Tests * */ @@ -55,6 +56,9 @@ dependencies { testCompileOnly(project(":transfer:transfer-05-file-transfer-cloud:cloud-transfer-provider")) testCompileOnly(project(":transfer:transfer-05-file-transfer-cloud:cloud-transfer-consumer")) testCompileOnly(project(":transfer:transfer-05-file-transfer-cloud:transfer-file-cloud")) + + testCompileOnly(project(":federated-catalog:fc-01-embedded:fc-connector")) + testCompileOnly(project(":federated-catalog:fc-02-standalone:standalone-fc")) } tasks.compileJava { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java b/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java new file mode 100644 index 00000000..d8c1125e --- /dev/null +++ b/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +package org.eclipse.edc.samples.common; + +import com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.HttpStatus; +import io.restassured.http.ContentType; +import org.eclipse.edc.junit.extensions.EmbeddedRuntime; +import org.eclipse.edc.junit.extensions.RuntimeExtension; +import org.eclipse.edc.junit.extensions.RuntimePerClassExtension; + +import java.util.Map; + +import static io.restassured.RestAssured.given; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_KEY; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_VALUE; +import static org.eclipse.edc.samples.util.TransferUtil.post; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.Matchers.emptyString; + +public class FederatedCatalogCommon { + private static final String CREATE_ASSET_FILE_PATH = "transfer/transfer-01-negotiation/resources/create-asset.json"; + private static final String V3_ASSETS_PATH = "/v3/assets"; + private static final String ASSET_ID = "@id"; + + private static final String STANDALONE_FC_MODULE_PATH = ":federated-catalog:fc-02-standalone:standalone-fc"; + private static final String FC_CONNECTOR_MODULE_PATH = ":federated-catalog:fc-01-embedded:fc-connector"; + private static final String STANDALONE_FC = "standalone-fc"; + private static final String CONSUMER = "consumer"; + + private static final String EDC_KEYSTORE = "edc.keystore"; + private static final String EDC_KEYSTORE_PASSWORD = "edc.keystore.password"; + private static final String EDC_FS_CONFIG = "edc.fs.config"; + private static final String CERT_PFX_FILE_PATH = "transfer/transfer-00-prerequisites/resources/certs/cert.pfx"; + private static final String KEYSTORE_PASSWORD = "123456"; + + private static final String STANDALONE_FC_CONFIG_PROPERTIES_FILE_PATH = "federated-catalog/fc-02-standalone/standalone-fc/config.properties"; + private static final String FC_CONNECTOR_CONFIG_PROPERTIES_FILE_PATH = "federated-catalog/fc-01-embedded/fc-connector/config.properties"; + + private static final String CRAWLER_EXECUTION_DELAY = "edc.catalog.cache.execution.delay.seconds"; + public static final int CRAWLER_EXECUTION_DELAY_VALUE = 5; + private static final String CRAWLER_EXECUTION_PERIOD = "edc.catalog.cache.execution.period.seconds"; + public static final int CRAWLER_EXECUTION_PERIOD_VALUE = 5; + public static final int TIMEOUT = 5 * CRAWLER_EXECUTION_PERIOD_VALUE; + + public static final String EMBEDDED_FC_CATALOG_API_ENDPOINT = "http://localhost:29195/api/catalog/v1alpha/catalog/query"; + public static final String STANDALONE_FC_CATALOG_API_ENDPOINT = "http://localhost:39195/api/catalog/v1alpha/catalog/query"; + public static final String EMPTY_QUERY_FILE_PATH = "federated-catalog/fc-01-embedded/resources/empty-query.json"; + public static final String TYPE = "[0].@type"; + public static final String CATALOG = "dcat:Catalog"; + public static final String DATASET_ASSET_ID = "[0].'dcat:dataset'.@id"; + + public static RuntimeExtension getFcEmbeddedConnector() { + return getRuntime(FC_CONNECTOR_MODULE_PATH, CONSUMER,FC_CONNECTOR_CONFIG_PROPERTIES_FILE_PATH); + } + + public static RuntimeExtension getStandaloneFc() { + return getRuntime(STANDALONE_FC_MODULE_PATH, STANDALONE_FC,STANDALONE_FC_CONFIG_PROPERTIES_FILE_PATH); + } + + private static RuntimeExtension getRuntime( + String modulePath, + String moduleName, + String configPropertiesFilePath + ) { + return new RuntimePerClassExtension(new EmbeddedRuntime( + moduleName, + Map.of( + EDC_KEYSTORE, getFileFromRelativePath(CERT_PFX_FILE_PATH).getAbsolutePath(), + EDC_KEYSTORE_PASSWORD, KEYSTORE_PASSWORD, + EDC_FS_CONFIG, getFileFromRelativePath(configPropertiesFilePath).getAbsolutePath(), + CRAWLER_EXECUTION_DELAY, Integer.toString(CRAWLER_EXECUTION_DELAY_VALUE), + CRAWLER_EXECUTION_PERIOD, Integer.toString(CRAWLER_EXECUTION_PERIOD_VALUE) + ), + modulePath + )); + } + + public static String createAsset() { + return post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V3_ASSETS_PATH, + getFileContentFromRelativePath(CREATE_ASSET_FILE_PATH), + ASSET_ID); + } + + public static String postAndAssertType(String url, String requestBody, String jsonPath) { + return given() + .headers(API_KEY_HEADER_KEY, API_KEY_HEADER_VALUE) + .contentType(ContentType.JSON) + .body(requestBody) + .when() + .post(url) + .then() + .log().ifError() + .statusCode(HttpStatus.SC_OK) + .body(TYPE, not(emptyString())) + .body(TYPE, is(CATALOG)) + .extract() + .jsonPath() + .get(jsonPath); + } + +} diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java new file mode 100644 index 00000000..db78a728 --- /dev/null +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +package org.eclipse.edc.samples.federatedCatalog; + +import org.assertj.core.api.Assertions; +import org.eclipse.edc.junit.annotations.EndToEndTest; +import org.eclipse.edc.junit.extensions.RuntimeExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.time.Clock; +import java.time.Duration; + +import static org.awaitility.Awaitility.await; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.*; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.NegotiationCommon.createContractDefinition; +import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.*; + +//@EndToEndTest +public class FederatedCatalog01embeddedTest { + + @RegisterExtension + static RuntimeExtension participantConnector = getProvider(); + + @RegisterExtension + static RuntimeExtension fcConnector = getFcEmbeddedConnector(); + + @Test + void shouldStartConnector() { + Assertions.assertThat(participantConnector.getService(Clock.class)).isNotNull(); + Assertions.assertThat(fcConnector.getService(Clock.class)).isNotNull(); + } + + @Test + void runSampleSteps() { + String assetId = createAsset(); + createPolicy(); + createContractDefinition(); + + await() + .atMost(Duration.ofSeconds(TIMEOUT)) + .pollDelay(Duration.ofSeconds(CRAWLER_EXECUTION_DELAY_VALUE)) + .pollInterval(Duration.ofSeconds(CRAWLER_EXECUTION_PERIOD_VALUE)) + .ignoreExceptions() + .until(() -> postAndAssertType(EMBEDDED_FC_CATALOG_API_ENDPOINT, getFileContentFromRelativePath(EMPTY_QUERY_FILE_PATH), DATASET_ASSET_ID), + id -> id.equals(assetId)); + } + +} diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java new file mode 100644 index 00000000..0b768f90 --- /dev/null +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Fraunhofer-Gesellschaft + * + * 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: + * Fraunhofer-Gesellschaft - initial API and implementation + * + */ + +package org.eclipse.edc.samples.federatedCatalog; + +import org.assertj.core.api.Assertions; +import org.eclipse.edc.junit.annotations.EndToEndTest; +import org.eclipse.edc.junit.extensions.RuntimeExtension; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.time.Clock; +import java.time.Duration; + +import static org.awaitility.Awaitility.await; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.*; +import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; +import static org.eclipse.edc.samples.common.NegotiationCommon.createContractDefinition; +import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.*; + +@EndToEndTest +public class FederatedCatalog02standaloneTest { + @RegisterExtension + static RuntimeExtension participantConnector = getProvider(); + + @RegisterExtension + static RuntimeExtension standaloneFcRuntime = getStandaloneFc(); + + @Test + void shouldStartRuntimes() { + Assertions.assertThat(participantConnector.getService(Clock.class)).isNotNull(); + Assertions.assertThat(standaloneFcRuntime.getService(Clock.class)).isNotNull(); + } + + @Test + void runSampleSteps() { + String assetId = createAsset(); + createPolicy(); + createContractDefinition(); + + await() + .atMost(Duration.ofSeconds(TIMEOUT)) + .pollDelay(Duration.ofSeconds(CRAWLER_EXECUTION_DELAY_VALUE)) + .pollInterval(Duration.ofSeconds(CRAWLER_EXECUTION_PERIOD_VALUE)) + .ignoreExceptions() + .until(() -> postAndAssertType(STANDALONE_FC_CATALOG_API_ENDPOINT, getFileContentFromRelativePath(EMPTY_QUERY_FILE_PATH), DATASET_ASSET_ID), + id -> id.equals(assetId)); + } + +} From 246b424542c61c2563f895dad87bd1ce50c2933b Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 29 Nov 2024 12:21:13 +0100 Subject: [PATCH 4/9] Add tests for federated catalog samples 01 and 02 --- .../federatedCatalog/FederatedCatalog01embeddedTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java index db78a728..71768546 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java @@ -30,7 +30,7 @@ import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; import static org.eclipse.edc.samples.common.PrerequisitesCommon.*; -//@EndToEndTest +@EndToEndTest public class FederatedCatalog01embeddedTest { @RegisterExtension From d733d954b84dd9dced32e5c745c80af4395369ab Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 29 Nov 2024 13:30:40 +0100 Subject: [PATCH 5/9] Correct code for checkstyle issues --- .../samples/common/FederatedCatalogCommon.java | 7 ++++--- .../FederatedCatalog01embeddedTest.java | 18 +++++++++++++----- .../FederatedCatalog02standaloneTest.java | 18 +++++++++++++----- 3 files changed, 30 insertions(+), 13 deletions(-) rename system-tests/src/test/java/org/eclipse/edc/samples/{federatedCatalog => federated/catalog}/FederatedCatalog01embeddedTest.java (68%) rename system-tests/src/test/java/org/eclipse/edc/samples/{federatedCatalog => federated/catalog}/FederatedCatalog02standaloneTest.java (68%) diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java b/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java index d8c1125e..3a0fed1a 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java @@ -28,7 +28,8 @@ import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_KEY; import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_VALUE; import static org.eclipse.edc.samples.util.TransferUtil.post; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.Matchers.emptyString; public class FederatedCatalogCommon { @@ -64,11 +65,11 @@ public class FederatedCatalogCommon { public static final String DATASET_ASSET_ID = "[0].'dcat:dataset'.@id"; public static RuntimeExtension getFcEmbeddedConnector() { - return getRuntime(FC_CONNECTOR_MODULE_PATH, CONSUMER,FC_CONNECTOR_CONFIG_PROPERTIES_FILE_PATH); + return getRuntime(FC_CONNECTOR_MODULE_PATH, CONSUMER, FC_CONNECTOR_CONFIG_PROPERTIES_FILE_PATH); } public static RuntimeExtension getStandaloneFc() { - return getRuntime(STANDALONE_FC_MODULE_PATH, STANDALONE_FC,STANDALONE_FC_CONFIG_PROPERTIES_FILE_PATH); + return getRuntime(STANDALONE_FC_MODULE_PATH, STANDALONE_FC, STANDALONE_FC_CONFIG_PROPERTIES_FILE_PATH); } private static RuntimeExtension getRuntime( diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java similarity index 68% rename from system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java index 71768546..a5a247d8 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog01embeddedTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.federatedCatalog; +package org.eclipse.edc.samples.federated.catalog; import org.assertj.core.api.Assertions; import org.eclipse.edc.junit.annotations.EndToEndTest; @@ -24,20 +24,28 @@ import java.time.Duration; import static org.awaitility.Awaitility.await; -import static org.eclipse.edc.samples.common.FederatedCatalogCommon.*; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_DELAY_VALUE; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_PERIOD_VALUE; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.DATASET_ASSET_ID; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.EMBEDDED_FC_CATALOG_API_ENDPOINT; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.EMPTY_QUERY_FILE_PATH; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.TIMEOUT; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.createAsset; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.getFcEmbeddedConnector; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.postAndAssertType; import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; import static org.eclipse.edc.samples.common.NegotiationCommon.createContractDefinition; import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; -import static org.eclipse.edc.samples.common.PrerequisitesCommon.*; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; @EndToEndTest public class FederatedCatalog01embeddedTest { @RegisterExtension - static RuntimeExtension participantConnector = getProvider(); + static final RuntimeExtension participantConnector = getProvider(); @RegisterExtension - static RuntimeExtension fcConnector = getFcEmbeddedConnector(); + static final RuntimeExtension fcConnector = getFcEmbeddedConnector(); @Test void shouldStartConnector() { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java similarity index 68% rename from system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java rename to system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java index 0b768f90..609b8c81 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federatedCatalog/FederatedCatalog02standaloneTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.samples.federatedCatalog; +package org.eclipse.edc.samples.federated.catalog; import org.assertj.core.api.Assertions; import org.eclipse.edc.junit.annotations.EndToEndTest; @@ -24,19 +24,27 @@ import java.time.Duration; import static org.awaitility.Awaitility.await; -import static org.eclipse.edc.samples.common.FederatedCatalogCommon.*; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_DELAY_VALUE; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_PERIOD_VALUE; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.DATASET_ASSET_ID; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.EMPTY_QUERY_FILE_PATH; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.STANDALONE_FC_CATALOG_API_ENDPOINT; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.TIMEOUT; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.createAsset; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.getStandaloneFc; +import static org.eclipse.edc.samples.common.FederatedCatalogCommon.postAndAssertType; import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath; import static org.eclipse.edc.samples.common.NegotiationCommon.createContractDefinition; import static org.eclipse.edc.samples.common.NegotiationCommon.createPolicy; -import static org.eclipse.edc.samples.common.PrerequisitesCommon.*; +import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider; @EndToEndTest public class FederatedCatalog02standaloneTest { @RegisterExtension - static RuntimeExtension participantConnector = getProvider(); + static final RuntimeExtension participantConnector = getProvider(); @RegisterExtension - static RuntimeExtension standaloneFcRuntime = getStandaloneFc(); + static final RuntimeExtension standaloneFcRuntime = getStandaloneFc(); @Test void shouldStartRuntimes() { From ddfdb0b128cc5c82a69288000dcb45a80fc680c0 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 29 Nov 2024 14:10:45 +0100 Subject: [PATCH 6/9] Correct code for checkstyle issues, add new dependency --- system-tests/build.gradle.kts | 1 + .../edc/samples/common/FederatedCatalogCommon.java | 4 ++-- .../federated/catalog/FederatedCatalog01embeddedTest.java | 8 ++++---- .../catalog/FederatedCatalog02standaloneTest.java | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/system-tests/build.gradle.kts b/system-tests/build.gradle.kts index 25420dda..11855353 100644 --- a/system-tests/build.gradle.kts +++ b/system-tests/build.gradle.kts @@ -57,6 +57,7 @@ dependencies { testCompileOnly(project(":transfer:transfer-05-file-transfer-cloud:cloud-transfer-consumer")) testCompileOnly(project(":transfer:transfer-05-file-transfer-cloud:transfer-file-cloud")) + testCompileOnly(project(":federated-catalog:fc-00-basic:fixed-node-resolver")) testCompileOnly(project(":federated-catalog:fc-01-embedded:fc-connector")) testCompileOnly(project(":federated-catalog:fc-02-standalone:standalone-fc")) } diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java b/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java index 3a0fed1a..1705f5dc 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/common/FederatedCatalogCommon.java @@ -40,7 +40,7 @@ public class FederatedCatalogCommon { private static final String STANDALONE_FC_MODULE_PATH = ":federated-catalog:fc-02-standalone:standalone-fc"; private static final String FC_CONNECTOR_MODULE_PATH = ":federated-catalog:fc-01-embedded:fc-connector"; private static final String STANDALONE_FC = "standalone-fc"; - private static final String CONSUMER = "consumer"; + private static final String EMBEDDED_FC = "fc-connector"; private static final String EDC_KEYSTORE = "edc.keystore"; private static final String EDC_KEYSTORE_PASSWORD = "edc.keystore.password"; @@ -65,7 +65,7 @@ public class FederatedCatalogCommon { public static final String DATASET_ASSET_ID = "[0].'dcat:dataset'.@id"; public static RuntimeExtension getFcEmbeddedConnector() { - return getRuntime(FC_CONNECTOR_MODULE_PATH, CONSUMER, FC_CONNECTOR_CONFIG_PROPERTIES_FILE_PATH); + return getRuntime(FC_CONNECTOR_MODULE_PATH, EMBEDDED_FC, FC_CONNECTOR_CONFIG_PROPERTIES_FILE_PATH); } public static RuntimeExtension getStandaloneFc() { diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java index a5a247d8..f72f9f15 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java @@ -42,15 +42,15 @@ public class FederatedCatalog01embeddedTest { @RegisterExtension - static final RuntimeExtension participantConnector = getProvider(); + static final RuntimeExtension PARTICIPANT_CONNECTOR = getProvider(); @RegisterExtension - static final RuntimeExtension fcConnector = getFcEmbeddedConnector(); + static final RuntimeExtension FC_CONNECTOR = getFcEmbeddedConnector(); @Test void shouldStartConnector() { - Assertions.assertThat(participantConnector.getService(Clock.class)).isNotNull(); - Assertions.assertThat(fcConnector.getService(Clock.class)).isNotNull(); + Assertions.assertThat(PARTICIPANT_CONNECTOR.getService(Clock.class)).isNotNull(); + Assertions.assertThat(FC_CONNECTOR.getService(Clock.class)).isNotNull(); } @Test diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java index 609b8c81..49f14262 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java @@ -41,15 +41,15 @@ @EndToEndTest public class FederatedCatalog02standaloneTest { @RegisterExtension - static final RuntimeExtension participantConnector = getProvider(); + static final RuntimeExtension PARTICIPANT_CONNECTOR = getProvider(); @RegisterExtension - static final RuntimeExtension standaloneFcRuntime = getStandaloneFc(); + static final RuntimeExtension STANDALONE_FC_RUNTIME = getStandaloneFc(); @Test void shouldStartRuntimes() { - Assertions.assertThat(participantConnector.getService(Clock.class)).isNotNull(); - Assertions.assertThat(standaloneFcRuntime.getService(Clock.class)).isNotNull(); + Assertions.assertThat(PARTICIPANT_CONNECTOR.getService(Clock.class)).isNotNull(); + Assertions.assertThat(STANDALONE_FC_RUNTIME.getService(Clock.class)).isNotNull(); } @Test From 6e9d50947312db24c1bf2f9392b577c9606907fe Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 29 Nov 2024 17:57:35 +0100 Subject: [PATCH 7/9] Update configuration for number of crawlers --- .../fc-01-embedded/fc-connector/config.properties | 2 +- .../fc-02-standalone/standalone-fc/config.properties | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/federated-catalog/fc-01-embedded/fc-connector/config.properties b/federated-catalog/fc-01-embedded/fc-connector/config.properties index 38349e9d..8df2f80c 100644 --- a/federated-catalog/fc-01-embedded/fc-connector/config.properties +++ b/federated-catalog/fc-01-embedded/fc-connector/config.properties @@ -25,7 +25,7 @@ web.http.catalog.port=29195 edc.catalog.cache.execution.delay.seconds=5 edc.catalog.cache.execution.period.seconds=5 -edc.catalog.cache.partition.num.crawlers=5 +edc.catalog.cache.partition.num.crawlers=1 diff --git a/federated-catalog/fc-02-standalone/standalone-fc/config.properties b/federated-catalog/fc-02-standalone/standalone-fc/config.properties index 79629c11..72c24270 100644 --- a/federated-catalog/fc-02-standalone/standalone-fc/config.properties +++ b/federated-catalog/fc-02-standalone/standalone-fc/config.properties @@ -4,9 +4,9 @@ web.http.path=/api web.http.catalog.path=/api/catalog web.http.catalog.port=39195 -edc.catalog.cache.execution.delay.seconds=10 -edc.catalog.cache.execution.period.seconds=10 -edc.catalog.cache.partition.num.crawlers=10 +edc.catalog.cache.execution.delay.seconds=5 +edc.catalog.cache.execution.period.seconds=5 +edc.catalog.cache.partition.num.crawlers=1 From 09fa89eea04a0b280c3d6e6bf1784571f647def2 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Tue, 3 Dec 2024 17:32:16 +0100 Subject: [PATCH 8/9] Update code to improve readability, remove later sample directories --- federated-catalog/README.md | 20 ++++++++++++------- federated-catalog/fc-00-basic/README.md | 5 ++--- .../federated-catalog-base/build.gradle.kts | 4 ++-- .../extension/fc/CatalogNodeDirectory.java | 4 +--- .../fc/CatalogNodeDirectoryExtension.java | 7 +------ .../fc-03-static-node-directory/README.md | 1 - gradle/libs.versions.toml | 6 +++--- .../FederatedCatalog01embeddedTest.java | 6 +++--- .../FederatedCatalog02standaloneTest.java | 6 +++--- 9 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 federated-catalog/fc-03-static-node-directory/README.md diff --git a/federated-catalog/README.md b/federated-catalog/README.md index 9fac7ba3..d450d5af 100644 --- a/federated-catalog/README.md +++ b/federated-catalog/README.md @@ -15,8 +15,10 @@ The following samples shows how to * implement, build and run different versions of FC e.g. * standalone, * embedded. -* implement TargetNodeDirectory and resolve Target Nodes, - * from a static file containing all participants' DSP endpoints, + +[//]: # (* implement TargetNodeDirectory and resolve Target Nodes,) + +[//]: # ( * from a static file containing all participants' DSP endpoints,) @@ -42,13 +44,17 @@ exposes a catalog API that serves the list of catalogs. --- -### Different Implementations of Node Resolver +[//]: # (### Different Implementations of Node Resolver) + +[//]: # () +[//]: # () +[//]: # (In the following samples you will learn how to implement a TargetNodeDirectory depending on different use cases.) +[//]: # () +[//]: # (### [FC sample 03](): Resolve Target Catalog Nodes from static participant file) -In the following samples you will learn how to implement a TargetNodeDirectory depending on different use cases. +[//]: # (This sample demonstrates a Catalog Node resolver, that implements TargetNodeDirectory. It resolves the Target Catalog) -### [FC sample 03](): Resolve Target Catalog Nodes from static participant file -This sample demonstrates a Catalog Node resolver, that implements TargetNodeDirectory. It resolves the Target Catalog -Nodes from a static participant file containing the DSP endpoints of the participants. +[//]: # (Nodes from a static participant file containing the DSP endpoints of the participants.) diff --git a/federated-catalog/fc-00-basic/README.md b/federated-catalog/fc-00-basic/README.md index 0a848f62..13cd65f1 100644 --- a/federated-catalog/fc-00-basic/README.md +++ b/federated-catalog/fc-00-basic/README.md @@ -35,8 +35,7 @@ Check out [eclipse-edc/FederatedCatalog](https://github.com/eclipse-edc/Federate In this module, we've included a fixed Node Resolver, [fixed-node-resolver](./fixed-node-resolver) that simply returns a hard-coded Target Node of the `participant-connector`. -However, we will not cover the implementation of the resolver in this sample; that will be explained in detail later in -[fc-03-static-node-directory](../fc-03-static-node-directory/README.md). +However, we will not cover the implementation of the resolver in this sample; that will be explained in detail in later samples. The purpose of including this [`fixed-node-resolver`](./fixed-node-resolver) @@ -48,7 +47,7 @@ of the federated catalogs that we are going to build in sample When the federated catalog boots up, the crawler begins periodically invoking the Target Nodes returned by the Node Resolver and collecting the catalogs offered by these nodes. To test whether our federated catalogs -(which we will build in later samples: [fc-01-embedded](../fc-01-embedded) and [fc-02-standalone](../../fc/fc-02-standalone)) can successfully request and retrieve these catalogs, we need at least one connector with a contract offer. +(which we will build in later samples: [fc-01-embedded](../fc-01-embedded) and [fc-02-standalone](../fc-02-standalone)) can successfully request and retrieve these catalogs, we need at least one connector with a contract offer. Therefore, in this section, we will start a connector and then create a contract for this connector. In the future samples, we will refer to it as `participant-connector`. diff --git a/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts b/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts index a3367149..bbbffbda 100644 --- a/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts +++ b/federated-catalog/fc-00-basic/federated-catalog-base/build.gradle.kts @@ -19,8 +19,8 @@ plugins { dependencies { implementation(libs.edc.fc.spi.crawler) - runtimeOnly(libs.fc.core) - runtimeOnly(libs.fc.ext.api) + runtimeOnly(libs.edc.fc.core) + runtimeOnly(libs.edc.fc.ext.api) } diff --git a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java index a949d55b..0424b986 100644 --- a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java +++ b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectory.java @@ -31,9 +31,7 @@ public List getAll() { "provider", "http://localhost:19194/protocol", protocolList); - List targetNodes = new ArrayList<>(); - targetNodes.add(participantNode); - return targetNodes; + return List.of(participantNode); } @Override diff --git a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java index 2f9c65aa..38ea1708 100644 --- a/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java +++ b/federated-catalog/fc-00-basic/fixed-node-resolver/src/main/java/org/eclipse/edc/sample/extension/fc/CatalogNodeDirectoryExtension.java @@ -19,15 +19,10 @@ import org.eclipse.edc.spi.system.ServiceExtension; public class CatalogNodeDirectoryExtension implements ServiceExtension { - private TargetNodeDirectory nodeDirectory; - @Provider public TargetNodeDirectory federatedCacheNodeDirectory() { - if (nodeDirectory == null) { - nodeDirectory = new CatalogNodeDirectory(); - } - return nodeDirectory; + return new CatalogNodeDirectory(); } } diff --git a/federated-catalog/fc-03-static-node-directory/README.md b/federated-catalog/fc-03-static-node-directory/README.md deleted file mode 100644 index 80d21657..00000000 --- a/federated-catalog/fc-03-static-node-directory/README.md +++ /dev/null @@ -1 +0,0 @@ -# Catalog Node Resolver - Static Node Directory \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 04c948ae..f014b65c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -75,9 +75,9 @@ azure-storage-blob = { module = "com.azure:azure-storage-blob", version = "12.29 minio-io = { module = "io.minio:minio", version = "8.5.13" } # federated catalog modules -fc-spi-core = { module = "org.eclipse.edc:federated-catalog-spi", version.ref = "edc" } -fc-core = { module = "org.eclipse.edc:federated-catalog-core", version.ref = "edc" } -fc-ext-api = { module = "org.eclipse.edc:federated-catalog-api", version.ref = "edc" } +edc-fc-spi-core = { module = "org.eclipse.edc:federated-catalog-spi", version.ref = "edc" } +edc-fc-core = { module = "org.eclipse.edc:federated-catalog-core", version.ref = "edc" } +edc-fc-ext-api = { module = "org.eclipse.edc:federated-catalog-api", version.ref = "edc" } edc-fc-spi-crawler = { module = "org.eclipse.edc:crawler-spi", version.ref = "edc" } [plugins] diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java index f72f9f15..b40e362d 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog01embeddedTest.java @@ -14,7 +14,6 @@ package org.eclipse.edc.samples.federated.catalog; -import org.assertj.core.api.Assertions; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.extensions.RuntimeExtension; import org.junit.jupiter.api.Test; @@ -23,6 +22,7 @@ import java.time.Clock; import java.time.Duration; +import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_DELAY_VALUE; import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_PERIOD_VALUE; @@ -49,8 +49,8 @@ public class FederatedCatalog01embeddedTest { @Test void shouldStartConnector() { - Assertions.assertThat(PARTICIPANT_CONNECTOR.getService(Clock.class)).isNotNull(); - Assertions.assertThat(FC_CONNECTOR.getService(Clock.class)).isNotNull(); + assertThat(PARTICIPANT_CONNECTOR.getService(Clock.class)).isNotNull(); + assertThat(FC_CONNECTOR.getService(Clock.class)).isNotNull(); } @Test diff --git a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java index 49f14262..d748d959 100644 --- a/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java +++ b/system-tests/src/test/java/org/eclipse/edc/samples/federated/catalog/FederatedCatalog02standaloneTest.java @@ -14,7 +14,6 @@ package org.eclipse.edc.samples.federated.catalog; -import org.assertj.core.api.Assertions; import org.eclipse.edc.junit.annotations.EndToEndTest; import org.eclipse.edc.junit.extensions.RuntimeExtension; import org.junit.jupiter.api.Test; @@ -23,6 +22,7 @@ import java.time.Clock; import java.time.Duration; +import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_DELAY_VALUE; import static org.eclipse.edc.samples.common.FederatedCatalogCommon.CRAWLER_EXECUTION_PERIOD_VALUE; @@ -48,8 +48,8 @@ public class FederatedCatalog02standaloneTest { @Test void shouldStartRuntimes() { - Assertions.assertThat(PARTICIPANT_CONNECTOR.getService(Clock.class)).isNotNull(); - Assertions.assertThat(STANDALONE_FC_RUNTIME.getService(Clock.class)).isNotNull(); + assertThat(PARTICIPANT_CONNECTOR.getService(Clock.class)).isNotNull(); + assertThat(STANDALONE_FC_RUNTIME.getService(Clock.class)).isNotNull(); } @Test From 0521cc08aa25e906a3e8df2c521268c4b54fdd24 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Thu, 5 Dec 2024 16:12:34 +0100 Subject: [PATCH 9/9] Update README.md - remove comments --- federated-catalog/README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/federated-catalog/README.md b/federated-catalog/README.md index d450d5af..0e9ad868 100644 --- a/federated-catalog/README.md +++ b/federated-catalog/README.md @@ -16,11 +16,6 @@ The following samples shows how to * standalone, * embedded. -[//]: # (* implement TargetNodeDirectory and resolve Target Nodes,) - -[//]: # ( * from a static file containing all participants' DSP endpoints,) - - ## Samples @@ -43,18 +38,3 @@ a standalone federated catalog will not have the added functionalities of a conn exposes a catalog API that serves the list of catalogs. --- - -[//]: # (### Different Implementations of Node Resolver) - -[//]: # () -[//]: # () -[//]: # (In the following samples you will learn how to implement a TargetNodeDirectory depending on different use cases.) - -[//]: # () -[//]: # (### [FC sample 03](): Resolve Target Catalog Nodes from static participant file) - -[//]: # (This sample demonstrates a Catalog Node resolver, that implements TargetNodeDirectory. It resolves the Target Catalog) - -[//]: # (Nodes from a static participant file containing the DSP endpoints of the participants.) - -