Refactored due to is-model constant name change

This commit is contained in:
Luca Frosini 2023-04-27 10:41:10 +02:00
parent 1227001ef4
commit 90859e7cb8
5 changed files with 18 additions and 18 deletions

View File

@ -57,7 +57,7 @@ public class AccessPointFacetTest {
@Test @Test
public void testEncryptedSpecilization() throws Exception { public void testEncryptedSpecilization() throws Exception {
String marshalled = "{\"" + Element.CLASS_PROPERTY + "\":\"AccessPointFacet\",\"uuid\":null,\"metadata\":null,\"entryName\":\"port1\",\"endpoint\":\"https://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"" + Element.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"pwd\",\"" + Element.CLASS_PROPERTY + "\":\"https://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"" + Element.CLASS_PROPERTY + "\":\"MyEncrypted\",\"@superClasses\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}"; 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\"}}";
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled); AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
Encrypted vlt = (Encrypted) apf.getAdditionalProperty("Enc"); Encrypted vlt = (Encrypted) apf.getAdditionalProperty("Enc");
logger.debug(ElementMapper.marshal(vlt)); logger.debug(ElementMapper.marshal(vlt));

View File

@ -49,8 +49,8 @@ public class ActionFacetTest {
//@Test //@Test
public void deserialize() { public void deserialize() {
String marshalled = "{\"" + Element.CLASS_PROPERTY + "\":\"ActionFacet\",\"metadata\":null,\"name\":\"FirstAction\"," String marshalled = "{\"" + Element.TYPE_PROPERTY + "\":\"ActionFacet\",\"metadata\":null,\"name\":\"FirstAction\","
+ "\"" + Element.CLASS_PROPERTY + "\":{\"" + Element.CLASS_PROPERTY + "\":\"EnumStringPropertyImpl\",\"" + Element.CLASS_PROPERTY + "\":[\"EXECUTABLE\",\"ANSIBLE\",\"COMMAND\",\"REMOTE_SERVICE\"]," + "\"" + Element.TYPE_PROPERTY + "\":{\"" + Element.TYPE_PROPERTY + "\":\"EnumStringPropertyImpl\",\"" + Element.TYPE_PROPERTY + "\":[\"EXECUTABLE\",\"ANSIBLE\",\"COMMAND\",\"REMOTE_SERVICE\"],"
+ "\"value\":\"ANSIBLE\"},\"source\":\"git@myrepo:playbook.yml\",\"options\":\"playbook.yml\",\"command\":\"ansible-pull\"}"; + "\"value\":\"ANSIBLE\"},\"source\":\"git@myrepo:playbook.yml\",\"options\":\"playbook.yml\",\"command\":\"ansible-pull\"}";
ActionFacet facet = null; ActionFacet facet = null;
try { try {

View File

@ -36,9 +36,9 @@ public class ContactFacetImplTest {
@Test @Test
public void test() throws Exception{ public void test() throws Exception{
String json = "{ " String json = "{ "
+ "\"" + Element.CLASS_PROPERTY + "\":\"ContactFacet\"," + "\"" + Element.TYPE_PROPERTY + "\":\"ContactFacet\","
+ "\"metadata\" : {" + "\"metadata\" : {"
+ "\"" + Element.CLASS_PROPERTY + "\":\"Metadata\"," + "\"" + Element.TYPE_PROPERTY + "\":\"Metadata\","
+ "\"creator\":\"luca.frosini\"" + "\"creator\":\"luca.frosini\""
+ "}," + "},"
+ "\"name\":\"Luca\"," + "\"name\":\"Luca\","

View File

@ -30,16 +30,16 @@ public class PolymorphismTest {
private static Logger logger = LoggerFactory private static Logger logger = LoggerFactory
.getLogger(PolymorphismTest.class); .getLogger(PolymorphismTest.class);
public static final String NYESERVICE = "{\"" + Element.CLASS_PROPERTY + "\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.CLASS_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}"; 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.CLASS_PROPERTY + "\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.CLASS_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"AccessPointFacet\",\"@superClasses\":[\"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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_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.CLASS_PROPERTY + "\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.CLASS_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_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.CLASS_PROPERTY + "\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.CLASS_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"metadata\":null,\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_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 NYESERVICE2 = "{\"" + Element.CLASS_PROPERTY + "\":\"MyEService\",\"@superClasses\":[\"EService\",\"Service\",\"Resource\"],\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.CLASS_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_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.CLASS_PROPERTY + "\":\"MyEService\",\"@superClasses\":[\"EService\",\"Service\",\"Resource\"],\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"" + Element.CLASS_PROPERTY + "\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"" + Element.CLASS_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.CLASS_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 MY_CONSISTS_OF = "{\"@superClasses\":[\"IsIdentifiedBy\", \"ConsistsOf\", \"Relation\"],\"" + Element.CLASS_PROPERTY + "\":\"MyIsIdentifiedBy\",\"target\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.CLASS_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_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 = "{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"" + Element.CLASS_PROPERTY + "\":\"MySoftwareFacet\",\"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}";
@Test @Test

View File

@ -142,11 +142,11 @@ public class Serializer {
@Test @Test
public void deserializeResource() throws JsonGenerationException, JsonMappingException, IOException { public void deserializeResource() throws JsonGenerationException, JsonMappingException, IOException {
StringReader stringReader = new StringReader("{\"" + Element.CLASS_PROPERTY + "\":\"HostingNode\"," + "\"metadata\":null," StringReader stringReader = new StringReader("{\"" + Element.TYPE_PROPERTY + "\":\"HostingNode\"," + "\"metadata\":null,"
+ "\"consistsOf\":[{" + "\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\"," + "\"metadata\":null," + "\"target\":{" + "\"consistsOf\":[{" + "\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\"," + "\"metadata\":null," + "\"target\":{"
+ "\"" + Element.CLASS_PROPERTY + "\":\"CPUFacet\"," + "\"metadata\":null," + "\"model\":\"Opteron\"," + "\"vendor\":\"AMD\"," + "\"" + Element.TYPE_PROPERTY + "\":\"CPUFacet\"," + "\"metadata\":null," + "\"model\":\"Opteron\"," + "\"vendor\":\"AMD\","
+ "\"clockSpeed\":\"1 GHz\"" + "}," + "\"relationProperty\":null" + "}," + "{" + "\"clockSpeed\":\"1 GHz\"" + "}," + "\"relationProperty\":null" + "}," + "{"
+ "\"" + Element.CLASS_PROPERTY + "\":\"ConsistsOf\"," + "\"metadata\":null," + "\"target\":{" + "\"" + Element.CLASS_PROPERTY + "\":\"ContactFacet\"," + "\"" + Element.TYPE_PROPERTY + "\":\"ConsistsOf\"," + "\"metadata\":null," + "\"target\":{" + "\"" + Element.TYPE_PROPERTY + "\":\"ContactFacet\","
+ "\"metadata\":null," + "\"title\":null," + "\"name\":\"Luca\"," + "\"middleName\":null," + "\"metadata\":null," + "\"title\":null," + "\"name\":\"Luca\"," + "\"middleName\":null,"
+ "\"surname\":\"Frosini\"," + "\"eMail\":\"luca.frosini@isti.cnr.it\"" + "}," + "\"surname\":\"Frosini\"," + "\"eMail\":\"luca.frosini@isti.cnr.it\"" + "},"
+ "\"relationProperty\":null" + "}" + "]," + "\"isRelatedTo\":[]" + "}"); + "\"relationProperty\":null" + "}" + "]," + "\"isRelatedTo\":[]" + "}");
@ -159,7 +159,7 @@ public class Serializer {
@Test @Test
public void deserializeContext() throws JsonParseException, JsonMappingException, IOException { public void deserializeContext() throws JsonParseException, JsonMappingException, IOException {
String contextString = "{\"name\":\"gcube\",\"uuid\":\"fe44822a-d8bb-418b-ba79-59b4aef01cf9\",\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"Context\",\"@superClasses\":[\"Entity\"],\"children\":[{\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.CLASS_PROPERTY + "\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"devsec\",\"uuid\":\"007f9154-25fa-4f52-9cd4-ec1f8c3c3baf\",\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"Context\",\"@superClasses\":[\"Entity\"]}},{\"uuid\":\"aeec2ea9-c3d2-43af-998e-d19953fc2c42\",\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.CLASS_PROPERTY + "\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"devNext\",\"uuid\":\"b16bc587-3fd8-4c0a-9196-8515c4501649\",\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"Context\",\"@superClasses\":[\"Entity\"]}},{\"uuid\":\"eba6cd76-525c-4037-9095-a712b054fd1b\",\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"" + Element.CLASS_PROPERTY + "\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"preprod\",\"metadata\":{\"" + Element.CLASS_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.CLASS_PROPERTY + "\":\"Context\",\"@superClasses\":[\"Entity\"]}}]}"; 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\"]}}]}";
logger.trace("Source Context String {}",contextString); logger.trace("Source Context String {}",contextString);
StringReader stringReader = new StringReader(contextString); StringReader stringReader = new StringReader(contextString);
Context c = ElementMapper.unmarshal(Context.class, stringReader); Context c = ElementMapper.unmarshal(Context.class, stringReader);