Skip to content

Commit

Permalink
Update code to improve readability, remove later sample directories
Browse files Browse the repository at this point in the history
  • Loading branch information
farhin23 committed Dec 3, 2024
1 parent 6e9d509 commit 09fa89e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 31 deletions.
20 changes: 13 additions & 7 deletions federated-catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,)



Expand All @@ -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.)


5 changes: 2 additions & 3 deletions federated-catalog/fc-00-basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}


Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public List<TargetNode> getAll() {
"provider",
"http://localhost:19194/protocol", protocolList);

List<TargetNode> targetNodes = new ArrayList<>();
targetNodes.add(participantNode);
return targetNodes;
return List.of(participantNode);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
1 change: 0 additions & 1 deletion federated-catalog/fc-03-static-node-directory/README.md

This file was deleted.

6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 09fa89e

Please sign in to comment.