From a73c69c1f1f80d5c9b68136c0348b01c56e9e9c9 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 12 May 2023 17:56:30 +0200 Subject: [PATCH] Applied changes made in IS Model --- .../entities/facets/AccessPointFacetTest.java | 3 ++- .../entities/facets/PolymorphismTest.java | 17 +++++++++-------- .../reference/entities/facets/Serializer.java | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/AccessPointFacetTest.java b/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/AccessPointFacetTest.java index c5ba447..40be9a4 100644 --- a/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/AccessPointFacetTest.java +++ b/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/AccessPointFacetTest.java @@ -5,6 +5,7 @@ import java.net.URI; import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.model.impl.properties.EncryptedImpl; +import org.gcube.informationsystem.model.reference.ModelElement; import org.gcube.informationsystem.model.reference.properties.Encrypted; import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.types.PropertyTypeName.BaseType; @@ -58,7 +59,7 @@ public class AccessPointFacetTest { @Test public void testEncryptedSpecilization() throws Exception { - String marshalled = "{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"" + IdentifiableElement.ID_PROPERTY + "\":null,\"metadata\":null,\"entryName\":\"port1\",\"endpoint\":\"https://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"pwd\",\"" + Element.TYPE_PROPERTY + "\":\"https://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"" + Element.TYPE_PROPERTY + "\":\"MyEncrypted\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}"; + String marshalled = "{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"" + IdentifiableElement.ID_PROPERTY + "\":null,\"metadata\":null,\"entryName\":\"port1\",\"endpoint\":\"https://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"pwd\",\"" + Element.TYPE_PROPERTY + "\":\"https://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"" + Element.TYPE_PROPERTY + "\":\"MyEncrypted\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}"; AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled); Encrypted vlt = (Encrypted) apf.getAdditionalProperty("Enc"); logger.debug(ElementMapper.marshal(vlt)); diff --git a/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/PolymorphismTest.java b/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/PolymorphismTest.java index 9eb3560..2268fa8 100644 --- a/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/PolymorphismTest.java +++ b/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/PolymorphismTest.java @@ -8,6 +8,7 @@ import java.util.List; import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.model.impl.properties.MetadataImpl; +import org.gcube.informationsystem.model.reference.ModelElement; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.Metadata; @@ -32,19 +33,19 @@ public class PolymorphismTest { private static Logger logger = LoggerFactory .getLogger(PolymorphismTest.class); - public static final String NYESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; - public static final String MYESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Facet\", \"Entity\"],\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; - public static final String MYOTHERESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; - public static final String MYANOTHERESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; + public static final String NYESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; + public static final String MYESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"Facet\", \"Entity\"],\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; + public static final String MYOTHERESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; + public static final String MYANOTHERESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; - public static final String NYESERVICE2 = "{\"" + Element.TYPE_PROPERTY + "\":\"MyEService\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"EService\",\"Service\",\"Resource\"],\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; - public static final String MYANOTHERESERVICE2 = "{\"" + Element.TYPE_PROPERTY + "\":\"MyEService\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"EService\",\"Service\",\"Resource\"],\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; + public static final String NYESERVICE2 = "{\"" + Element.TYPE_PROPERTY + "\":\"MyEService\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"EService\",\"Service\",\"Resource\"],\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; + public static final String MYANOTHERESERVICE2 = "{\"" + Element.TYPE_PROPERTY + "\":\"MyEService\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"EService\",\"Service\",\"Resource\"],\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\""+ ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.TYPE_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; public static final String MY_SOFTWARE_FACET_TYPE = "MySoftwareFacetTest"; - public static final String MY_TEST_FACET = "{\"" + Element.TYPE_PROPERTY + "\":\"" + MY_SOFTWARE_FACET_TYPE + "\",\"" + Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\" ],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}"; + public static final String MY_TEST_FACET = "{\"" + Element.TYPE_PROPERTY + "\":\"" + MY_SOFTWARE_FACET_TYPE + "\",\"" + ModelElement.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\" ],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}"; public static final String MY_IS_IDENTIFIED_BY_TYPE = "MyIsIdentifiedByTest"; - public static final String MY_CONSISTS_OF = "{\"" + Element.TYPE_PROPERTY + "\":\"" + MY_IS_IDENTIFIED_BY_TYPE + "\",\"" + Element.SUPERTYPES_PROPERTY + "\":[\"IsIdentifiedBy\", \"ConsistsOf\" ],\"target\":" + MY_TEST_FACET + "}"; + public static final String MY_CONSISTS_OF = "{\"" + Element.TYPE_PROPERTY + "\":\"" + MY_IS_IDENTIFIED_BY_TYPE + "\",\"" + ModelElement.SUPERTYPES_PROPERTY + "\":[\"IsIdentifiedBy\", \"ConsistsOf\" ],\"target\":" + MY_TEST_FACET + "}"; @Test public void testER() throws Exception { diff --git a/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/Serializer.java b/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/Serializer.java index 689ea5d..c92b5a6 100644 --- a/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/Serializer.java +++ b/src/test/java/org/gcube/resourcemanagement/model/reference/entities/facets/Serializer.java @@ -160,7 +160,7 @@ public class Serializer { @Test public void deserializeContext() throws JsonParseException, JsonMappingException, IOException { - String contextString = "{\"name\":\"gcube\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"fe44822a-d8bb-418b-ba79-59b4aef01cf9\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:33.706 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:33.706 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Entity\"],\"children\":[{\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.627 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:34.627 +0100\"},\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.TYPE_PROPERTY + "\":\"IsParentOf\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Relation\"],\"target\":{\"name\":\"devsec\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"007f9154-25fa-4f52-9cd4-ec1f8c3c3baf\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.663 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:34.663 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Entity\"]}},{\"" + IdentifiableElement.ID_PROPERTY + "\":\"aeec2ea9-c3d2-43af-998e-d19953fc2c42\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.658 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:36.658 +0100\"},\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.TYPE_PROPERTY + "\":\"IsParentOf\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Relation\"],\"target\":{\"name\":\"devNext\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"b16bc587-3fd8-4c0a-9196-8515c4501649\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.695 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:36.695 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Entity\"]}},{\"" + IdentifiableElement.ID_PROPERTY + "\":\"eba6cd76-525c-4037-9095-a712b054fd1b\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.224 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:38.224 +0100\"},\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.TYPE_PROPERTY + "\":\"IsParentOf\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Relation\"],\"target\":{\"name\":\"preprod\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.248 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:38.248 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"Entity\"]}}]}"; + String contextString = "{\"name\":\"gcube\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"fe44822a-d8bb-418b-ba79-59b4aef01cf9\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:33.706 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:33.706 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\",\"children\":[{\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.627 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:34.627 +0100\"},\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.TYPE_PROPERTY + "\":\"IsParentOf\",\"target\":{\"name\":\"devsec\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"007f9154-25fa-4f52-9cd4-ec1f8c3c3baf\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.663 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:34.663 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\"}},{\"" + IdentifiableElement.ID_PROPERTY + "\":\"aeec2ea9-c3d2-43af-998e-d19953fc2c42\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.658 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:36.658 +0100\"},\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.TYPE_PROPERTY + "\":\"IsParentOf\",\"target\":{\"name\":\"devNext\",\"" + IdentifiableElement.ID_PROPERTY + "\":\"b16bc587-3fd8-4c0a-9196-8515c4501649\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.695 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:36.695 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\"}},{\"" + IdentifiableElement.ID_PROPERTY + "\":\"eba6cd76-525c-4037-9095-a712b054fd1b\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.224 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:38.224 +0100\"},\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.TYPE_PROPERTY + "\":\"IsParentOf\",\"target\":{\"name\":\"preprod\",\"metadata\":{\"" + Element.TYPE_PROPERTY + "\":\"Metadata\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.248 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"lastUpdateTime\":\"2019-02-06 11:08:38.248 +0100\"},\"" + Element.TYPE_PROPERTY + "\":\"Context\"}}]}"; logger.trace("Source Context String {}",contextString); StringReader stringReader = new StringReader(contextString); Context c = ElementMapper.unmarshal(Context.class, stringReader);