From 3a5839dde5d60212d9fe8a57a7997164b19a781e Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 28 Apr 2023 11:41:02 +0200 Subject: [PATCH] Fixed tests to comply with id property rename --- .../entities/facets/AccessPointFacetTest.java | 3 ++- .../reference/entities/facets/PolymorphismTest.java | 13 +++++++------ .../model/reference/entities/facets/Serializer.java | 3 ++- 3 files changed, 11 insertions(+), 8 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 2edbd78..c5ba447 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 @@ -3,6 +3,7 @@ package org.gcube.resourcemanagement.model.reference.entities.facets; 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.properties.Encrypted; import org.gcube.informationsystem.serialization.ElementMapper; @@ -57,7 +58,7 @@ public class AccessPointFacetTest { @Test public void testEncryptedSpecilization() throws Exception { - String marshalled = "{\"" + Element.TYPE_PROPERTY + "\":\"AccessPointFacet\",\"uuid\":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\",\""+ Element.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 1a7c0d3..2a0d7df 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 @@ -6,6 +6,7 @@ package org.gcube.resourcemanagement.model.reference.entities.facets; 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.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; @@ -30,13 +31,13 @@ public class PolymorphismTest { private static Logger logger = LoggerFactory .getLogger(PolymorphismTest.class); - public static final String NYESERVICE = "{\"" + Element.TYPE_PROPERTY + "\":\"EService\",\"uuid\":\"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\",\"uuid\":\"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\",\"uuid\":\"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\",\"uuid\":\"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\":{\""+ 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 NYESERVICE2 = "{\"" + Element.TYPE_PROPERTY + "\":\"MyEService\",\""+ Element.SUPERTYPES_PROPERTY + "\":[\"EService\",\"Service\",\"Resource\"],\"uuid\":\"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\"],\"uuid\":\"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\",\""+ 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 MY_CONSISTS_OF = "{\""+ Element.SUPERTYPES_PROPERTY + "\":[\"IsIdentifiedBy\", \"ConsistsOf\", \"Relation\"],\"" + Element.TYPE_PROPERTY + "\":\"MyIsIdentifiedBy\",\"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}}"; public static final String MY_TEST_FACET = "{\""+ Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\",\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}"; 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 1df0821..689ea5d 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 @@ -10,6 +10,7 @@ import org.gcube.com.fasterxml.jackson.core.JsonGenerationException; import org.gcube.com.fasterxml.jackson.core.JsonParseException; import org.gcube.com.fasterxml.jackson.databind.JsonMappingException; import org.gcube.informationsystem.base.reference.Element; +import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.contexts.reference.entities.Context; import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl; import org.gcube.informationsystem.model.reference.entities.Facet; @@ -159,7 +160,7 @@ public class Serializer { @Test public void deserializeContext() throws JsonParseException, JsonMappingException, IOException { - String contextString = "{\"name\":\"gcube\",\"uuid\":\"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\",\"uuid\":\"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\"]}},{\"uuid\":\"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\",\"uuid\":\"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\"]}},{\"uuid\":\"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\",\""+ 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\"]}}]}"; logger.trace("Source Context String {}",contextString); StringReader stringReader = new StringReader(contextString); Context c = ElementMapper.unmarshal(Context.class, stringReader);