Changesets · Branches · Tags · Compare
| Changeset | b488bd35123e6dea40d737428b1feb027c03bd4a37e62d36bfb3c35270abdab9 |
|---|---|
| Author | Enrico Risa <enrico.risa@gmail.com> · 2024-07-15 13:17 +02:00 |
| Committer | GitHub <noreply@github.com> · 2024-07-15 13:17 +02:00 |
| Parents | f28dc1f7ad58 |
4 files changed
modified DEPENDENCIES +2 −2
| @@ -82,7 +82,7 @@ | ||
| 82 | 82 | maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.28, Apache-2.0, approved, clearlydefined |
| 83 | 83 | maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.40, Apache-2.0, approved, #15156 |
| 84 | 84 | maven/mavencentral/com.puppycrawl.tools/checkstyle/10.17.0, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-or-later) AND Apache-2.0, approved, #15077 |
| 85 | -maven/mavencentral/com.samskivert/jmustache/1.15, BSD-2-Clause, approved, clearlydefined | |
| 85 | +maven/mavencentral/com.samskivert/jmustache/1.15, BSD-2-Clause AND BSD-3-Clause, approved, clearlydefined | |
| 86 | 86 | maven/mavencentral/com.squareup.okhttp3/okhttp-dnsoverhttps/4.12.0, Apache-2.0, approved, #11159 |
| 87 | 87 | maven/mavencentral/com.squareup.okhttp3/okhttp/4.12.0, Apache-2.0, approved, #15227 |
| 88 | 88 | maven/mavencentral/com.squareup.okhttp3/okhttp/4.9.3, Apache-2.0 AND MPL-2.0, approved, #3225 |
| @@ -225,7 +225,7 @@ | ||
| 225 | 225 | maven/mavencentral/org.apache.maven.doxia/doxia-sink-api/1.12.0, Apache-2.0, approved, clearlydefined |
| 226 | 226 | maven/mavencentral/org.apache.velocity.tools/velocity-tools-generic/3.1, Apache-2.0, approved, #9331 |
| 227 | 227 | maven/mavencentral/org.apache.velocity/velocity-engine-core/2.3, Apache-2.0, approved, #2478 |
| 228 | -maven/mavencentral/org.apache.velocity/velocity-engine-scripting/2.3, Apache-2.0, approved, clearlydefined | |
| 228 | +maven/mavencentral/org.apache.velocity/velocity-engine-scripting/2.3, Apache-2.0, restricted, clearlydefined | |
| 229 | 229 | maven/mavencentral/org.apache.xbean/xbean-reflect/3.7, Apache-2.0, approved, clearlydefined |
| 230 | 230 | maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined |
| 231 | 231 | maven/mavencentral/org.assertj/assertj-core/3.26.0, Apache-2.0, approved, #14886 |
modified spi/control-plane/catalog-spi/src/main/java/org/eclipse/edc/connector/controlplane/catalog/spi/Catalog.java +2 −0
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | |
| 16 | 16 | package org.eclipse.edc.connector.controlplane.catalog.spi; |
| 17 | 17 | |
| 18 | +import com.fasterxml.jackson.annotation.JsonTypeName; | |
| 18 | 19 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 19 | 20 | import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; |
| 20 | 21 | |
| @@ -25,6 +26,7 @@ | ||
| 25 | 26 | * Entity representing a Catalog |
| 26 | 27 | */ |
| 27 | 28 | @JsonDeserialize(builder = Catalog.Builder.class) |
| 29 | +@JsonTypeName("dataspaceconnector:catalog") | |
| 28 | 30 | public class Catalog extends Dataset { |
| 29 | 31 | protected final List<Dataset> datasets = new ArrayList<>(); |
| 30 | 32 | protected List<DataService> dataServices = new ArrayList<>(); |
modified spi/control-plane/catalog-spi/src/main/java/org/eclipse/edc/connector/controlplane/catalog/spi/Dataset.java +4 −1
| @@ -16,9 +16,11 @@ | ||
| 16 | 16 | |
| 17 | 17 | import com.fasterxml.jackson.annotation.JsonCreator; |
| 18 | 18 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 19 | +import com.fasterxml.jackson.annotation.JsonTypeName; | |
| 19 | 20 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 20 | 21 | import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; |
| 21 | 22 | import org.eclipse.edc.policy.model.Policy; |
| 23 | +import org.eclipse.edc.spi.types.domain.Polymorphic; | |
| 22 | 24 | |
| 23 | 25 | import java.util.ArrayList; |
| 24 | 26 | import java.util.HashMap; |
| @@ -33,7 +35,8 @@ | ||
| 33 | 35 | * different policies and may be available via different distributions. |
| 34 | 36 | */ |
| 35 | 37 | @JsonDeserialize(builder = Dataset.Builder.class) |
| 36 | -public class Dataset { | |
| 38 | +@JsonTypeName("dataspaceconnector:dataset") | |
| 39 | +public class Dataset implements Polymorphic { | |
| 37 | 40 | |
| 38 | 41 | /** |
| 39 | 42 | * Policies under which this Dataset is available. |
modified spi/control-plane/catalog-spi/src/test/java/org/eclipse/edc/connector/controlplane/catalog/spi/CatalogSerializationTest.java +13 −2
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | import org.eclipse.edc.json.JacksonTypeManager; |
| 18 | 18 | import org.eclipse.edc.policy.model.Policy; |
| 19 | 19 | import org.eclipse.edc.spi.types.TypeManager; |
| 20 | +import org.junit.jupiter.api.BeforeEach; | |
| 20 | 21 | import org.junit.jupiter.api.Test; |
| 21 | 22 | |
| 22 | 23 | import java.util.List; |
| @@ -28,6 +29,11 @@ | ||
| 28 | 29 | |
| 29 | 30 | private final TypeManager typeManager = new JacksonTypeManager(); |
| 30 | 31 | |
| 32 | + @BeforeEach | |
| 33 | + void beforeAll() { | |
| 34 | + typeManager.registerTypes(Catalog.class, Dataset.class); | |
| 35 | + } | |
| 36 | + | |
| 31 | 37 | @Test |
| 32 | 38 | void verifySerialization() { |
| 33 | 39 | var catalog = createCatalog(); |
| @@ -35,7 +41,9 @@ | ||
| 35 | 41 | var json = typeManager.writeValueAsString(catalog); |
| 36 | 42 | |
| 37 | 43 | var deserialized = typeManager.readValue(json, Catalog.class); |
| 38 | - assertThat(deserialized).usingRecursiveComparison().isEqualTo(catalog); | |
| 44 | + assertThat(catalog).usingRecursiveComparison().isEqualTo(deserialized); | |
| 45 | + | |
| 46 | + assertThat(catalog.getDatasets().get(1)).isInstanceOf(Catalog.class); | |
| 39 | 47 | } |
| 40 | 48 | |
| 41 | 49 | |
| @@ -51,10 +59,13 @@ | ||
| 51 | 59 | .distributions(List.of(distribution)) |
| 52 | 60 | .build(); |
| 53 | 61 | |
| 62 | + | |
| 63 | + var nestedCatalog = Catalog.Builder.newInstance().id("nestedId").participantId("participantId").build(); | |
| 64 | + | |
| 54 | 65 | return Catalog.Builder.newInstance() |
| 55 | 66 | .id("id") |
| 56 | 67 | .dataServices(List.of(dataService)) |
| 57 | - .datasets(List.of(dataset)) | |
| 68 | + .datasets(List.of(dataset, nestedCatalog)) | |
| 58 | 69 | .property("prop", "propValue") |
| 59 | 70 | .build(); |
| 60 | 71 | } |