Fixed imports and class names due to IS Model refactoring

This commit is contained in:
Luca Frosini 2020-02-03 10:53:24 +01:00
parent c6fe6ecad3
commit 3c9455fbcc
10 changed files with 35 additions and 45 deletions

View File

@ -8,7 +8,6 @@ import java.net.URI;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.annotations.Key;
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -17,7 +16,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Access_Point_Facet * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Access_Point_Facet
*/ */
@Key(fields={AccessPointFacet.ENDPOINT_PROPERTY})
@JsonDeserialize(as=AccessPointFacetImpl.class) @JsonDeserialize(as=AccessPointFacetImpl.class)
public interface AccessPointFacet extends Facet { public interface AccessPointFacet extends Facet {

View File

@ -5,7 +5,6 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.annotations.Key;
import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -14,7 +13,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Contact_Facet * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Contact_Facet
*/ */
@Key(fields={ContactFacet.EMAIL_PROPERTY})
@JsonDeserialize(as=ContactFacetImpl.class) @JsonDeserialize(as=ContactFacetImpl.class)
public interface ContactFacet extends Facet { public interface ContactFacet extends Facet {

View File

@ -5,7 +5,6 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.annotations.Key;
import org.gcube.resourcemanagement.model.impl.entities.facets.IdentifierFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.IdentifierFacetImpl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -14,7 +13,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Identifier_Facet * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Identifier_Facet
*/ */
@Key(fields={IdentifierFacet.VALUE_PROPERTY, IdentifierFacet.TYPE_PROPERTY})
@JsonDeserialize(as=IdentifierFacetImpl.class) @JsonDeserialize(as=IdentifierFacetImpl.class)
public interface IdentifierFacet extends Facet { public interface IdentifierFacet extends Facet {

View File

@ -7,7 +7,6 @@ import java.net.URL;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.annotations.Key;
import org.gcube.resourcemanagement.model.impl.entities.facets.SchemaFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.SchemaFacetImpl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -16,7 +15,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Schema_Facet * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Schema_Facet
*/ */
@Key(fields={SchemaFacet.NAME_PROPERTY})
@JsonDeserialize(as=SchemaFacetImpl.class) @JsonDeserialize(as=SchemaFacetImpl.class)
public interface SchemaFacet extends Facet { public interface SchemaFacet extends Facet {

View File

@ -5,7 +5,6 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.annotations.Key;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -14,7 +13,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Software_Facet * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Software_Facet
*/ */
@Key(fields={NameProperty.NAME_PROPERTY, SoftwareFacet.GROUP_PROPERTY, SoftwareFacet.VERSION_PROPERTY})
@JsonDeserialize(as=SoftwareFacetImpl.class) @JsonDeserialize(as=SoftwareFacetImpl.class)
public interface SoftwareFacet extends Facet, NameProperty { public interface SoftwareFacet extends Facet, NameProperty {

View File

@ -4,7 +4,7 @@ import java.net.URI;
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl; import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
import org.gcube.informationsystem.model.reference.properties.Encrypted; import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
import org.gcube.resourcemanagement.model.impl.properties.ValueSchemaImpl; import org.gcube.resourcemanagement.model.impl.properties.ValueSchemaImpl;
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
@ -36,13 +36,13 @@ public class AccessPointFacetTest {
encrypted.setEncryptedValue("Encrypted"); encrypted.setEncryptedValue("Encrypted");
accessPointFacet.setAdditionalProperty("Enc", encrypted); accessPointFacet.setAdditionalProperty("Enc", encrypted);
String marshalled = ISMapper.marshal(accessPointFacet); String marshalled = ElementMapper.marshal(accessPointFacet);
logger.debug(marshalled); logger.debug(marshalled);
AccessPointFacet apf = ISMapper.unmarshal(AccessPointFacet.class, marshalled); AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc"); Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc");
logger.debug(ISMapper.marshal(enc)); logger.debug(ElementMapper.marshal(enc));
String reMarshalled = ISMapper.marshal(apf); String reMarshalled = ElementMapper.marshal(apf);
logger.debug(reMarshalled); logger.debug(reMarshalled);
} }
@ -50,10 +50,10 @@ public class AccessPointFacetTest {
@Test @Test
public void testEncryptedSpecilization() throws Exception { public void testEncryptedSpecilization() throws Exception {
String marshalled = "{\"@class\":\"AccessPointFacet\",\"header\":null,\"entryName\":\"port1\",\"endpoint\":\"http://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"pwd\",\"type\":\"http://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"@class\":\"MyEncrypted\",\"@superClasses\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}"; String marshalled = "{\"@class\":\"AccessPointFacet\",\"header\":null,\"entryName\":\"port1\",\"endpoint\":\"http://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"pwd\",\"type\":\"http://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"@class\":\"MyEncrypted\",\"@superClasses\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}";
AccessPointFacet apf = ISMapper.unmarshal(AccessPointFacet.class, marshalled); AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc"); Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc");
logger.debug(ISMapper.marshal(enc)); logger.debug(ElementMapper.marshal(enc));
String reMarshalled = ISMapper.marshal(apf); String reMarshalled = ElementMapper.marshal(apf);
logger.debug(reMarshalled); logger.debug(reMarshalled);
} }

View File

@ -7,7 +7,7 @@ import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.ActionFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.ActionFacetImpl;
import org.gcube.resourcemanagement.model.impl.properties.EnumStringPropertyImpl; import org.gcube.resourcemanagement.model.impl.properties.EnumStringPropertyImpl;
import org.gcube.resourcemanagement.model.reference.entities.facets.ActionFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.ActionFacet;
@ -42,7 +42,7 @@ public class ActionFacetTest {
facet.setOptions("playbook.yml"); facet.setOptions("playbook.yml");
String marshalled = ""; String marshalled = "";
try { try {
marshalled = ISMapper.marshal(facet); marshalled = ElementMapper.marshal(facet);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
assertFalse("Failed to marshal the action.", false); assertFalse("Failed to marshal the action.", false);
} }
@ -56,7 +56,7 @@ public class ActionFacetTest {
+ "\"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 {
facet = ISMapper.unmarshal(ActionFacetImpl.class, marshalled); facet = ElementMapper.unmarshal(ActionFacetImpl.class, marshalled);
} catch (Exception e) { } catch (Exception e) {
assertFalse("Failed to unmarshal the context.", false); assertFalse("Failed to unmarshal the context.", false);
} }

View File

@ -2,7 +2,7 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import java.io.IOException; import java.io.IOException;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl;
import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet;
import org.junit.Test; import org.junit.Test;
@ -24,11 +24,11 @@ public class ContactFacetImplTest {
contactFacet.setName("luca.frosini"); contactFacet.setName("luca.frosini");
contactFacet.setEMail("test@d4science.org"); contactFacet.setEMail("test@d4science.org");
String marshalled = ISMapper.marshal(contactFacet); String marshalled = ElementMapper.marshal(contactFacet);
logger.debug(marshalled); logger.debug(marshalled);
ContactFacetImpl cf = ISMapper.unmarshal(ContactFacetImpl.class, marshalled); ContactFacetImpl cf = ElementMapper.unmarshal(ContactFacetImpl.class, marshalled);
String reMarshalled = ISMapper.marshal(cf); String reMarshalled = ElementMapper.marshal(cf);
logger.debug(reMarshalled); logger.debug(reMarshalled);
} }
@ -48,9 +48,9 @@ public class ContactFacetImplTest {
+ "\"phoneNumber\":\"123456789\"" + "\"phoneNumber\":\"123456789\""
+ "}"; + "}";
ContactFacet contactFacet = ISMapper.unmarshal(ContactFacet.class, json); ContactFacet contactFacet = ElementMapper.unmarshal(ContactFacet.class, json);
String marshalled = ISMapper.marshal(contactFacet); String marshalled = ElementMapper.marshal(contactFacet);
logger.debug(marshalled); logger.debug(marshalled);
} }

View File

@ -11,7 +11,7 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl; import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.HostingNodeImpl; import org.gcube.resourcemanagement.model.impl.entities.resources.HostingNodeImpl;
import org.gcube.resourcemanagement.model.impl.relations.isrelatedto.ActivatesImpl; import org.gcube.resourcemanagement.model.impl.relations.isrelatedto.ActivatesImpl;
@ -46,18 +46,18 @@ public class PolymorphismTest {
@Test @Test
public void testER() throws Exception { public void testER() throws Exception {
Facet f = ISMapper.unmarshal(Facet.class, MY_TEST_FACET); Facet f = ElementMapper.unmarshal(Facet.class, MY_TEST_FACET);
logger.debug("\n\n{} {}\n\n", f.getClass().getSimpleName(), f); logger.debug("\n\n{} {}\n\n", f.getClass().getSimpleName(), f);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ConsistsOf c = ISMapper.unmarshal(ConsistsOf.class, MY_CONSISTS_OF); ConsistsOf c = ElementMapper.unmarshal(ConsistsOf.class, MY_CONSISTS_OF);
logger.debug("{} {}\n\n", c.getClass().getSimpleName(), c); logger.debug("{} {}\n\n", c.getClass().getSimpleName(), c);
String[] eServices = new String[]{NYESERVICE, MYESERVICE, MYOTHERESERVICE, MYANOTHERESERVICE, NYESERVICE2, MYANOTHERESERVICE2}; String[] eServices = new String[]{NYESERVICE, MYESERVICE, MYOTHERESERVICE, MYANOTHERESERVICE, NYESERVICE2, MYANOTHERESERVICE2};
//String[] eServices = new String[]{NYESERVICE2, MYANOTHERESERVICE2}; //String[] eServices = new String[]{NYESERVICE2, MYANOTHERESERVICE2};
//String[] eServices = new String[]{ESERVICE}; //String[] eServices = new String[]{ESERVICE};
for(String eService : eServices){ for(String eService : eServices){
Resource resource = ISMapper.unmarshal(Resource.class, eService); Resource resource = ElementMapper.unmarshal(Resource.class, eService);
logger.debug("{} {}", resource.getClass().getSimpleName(), resource); logger.debug("{} {}", resource.getClass().getSimpleName(), resource);
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfs = resource.getConsistsOf(); List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfs = resource.getConsistsOf();
@ -86,7 +86,7 @@ public class PolymorphismTest {
hostingNode.attachResource(activates); hostingNode.attachResource(activates);
String string = ISMapper.marshal(activates); String string = ElementMapper.marshal(activates);
logger.debug(string); logger.debug(string);
} }

View File

@ -12,7 +12,7 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.HostingNodeImpl; import org.gcube.resourcemanagement.model.impl.entities.resources.HostingNodeImpl;
@ -49,11 +49,11 @@ public class Serializer {
cpuFacetImpl.setAdditionalProperty("MYLong", 3.56); cpuFacetImpl.setAdditionalProperty("MYLong", 3.56);
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
ISMapper.marshal(cpuFacetImpl, stringWriter); ElementMapper.marshal(cpuFacetImpl, stringWriter);
logger.trace(stringWriter.toString()); logger.trace(stringWriter.toString());
StringReader stringReader = new StringReader(stringWriter.toString()); StringReader stringReader = new StringReader(stringWriter.toString());
CPUFacet cpuFacet = ISMapper.unmarshal(CPUFacet.class, stringReader); CPUFacet cpuFacet = ElementMapper.unmarshal(CPUFacet.class, stringReader);
logger.trace("Deserialized : {} ", cpuFacet); logger.trace("Deserialized : {} ", cpuFacet);
} }
@ -68,29 +68,29 @@ public class Serializer {
cpuFacetImpl.setAdditionalProperty("Other", 1); cpuFacetImpl.setAdditionalProperty("Other", 1);
cpuFacetImpl.setAdditionalProperty("MYLong", 3.56); cpuFacetImpl.setAdditionalProperty("MYLong", 3.56);
logger.debug(ISMapper.marshal(cpuFacetImpl)); logger.debug(ElementMapper.marshal(cpuFacetImpl));
CPUFacet cpuFacet = new CPUFacetImpl(); CPUFacet cpuFacet = new CPUFacetImpl();
cpuFacet.setClockSpeed("1 GHz"); cpuFacet.setClockSpeed("1 GHz");
cpuFacet.setModel("Opteron"); cpuFacet.setModel("Opteron");
cpuFacet.setVendor("AMD"); cpuFacet.setVendor("AMD");
logger.debug(ISMapper.marshal(cpuFacet)); logger.debug(ElementMapper.marshal(cpuFacet));
ContactFacet contactFacet = new ContactFacetImpl(); ContactFacet contactFacet = new ContactFacetImpl();
contactFacet.setName("Luca"); contactFacet.setName("Luca");
contactFacet.setSurname("Frosini"); contactFacet.setSurname("Frosini");
contactFacet.setEMail("luca.frosini@isti.cnr.it"); contactFacet.setEMail("luca.frosini@isti.cnr.it");
logger.debug(ISMapper.marshal(contactFacet)); logger.debug(ElementMapper.marshal(contactFacet));
List<Facet> list = new ArrayList<>(); List<Facet> list = new ArrayList<>();
list.add(cpuFacetImpl); list.add(cpuFacetImpl);
list.add(cpuFacet); list.add(cpuFacet);
list.add(contactFacet); list.add(contactFacet);
logger.debug(ISMapper.marshal(list)); logger.debug(ElementMapper.marshal(list));
Facet[] array = new Facet[] {cpuFacetImpl, cpuFacet, contactFacet}; Facet[] array = new Facet[] {cpuFacetImpl, cpuFacet, contactFacet};
logger.debug(ISMapper.marshal(array)); logger.debug(ElementMapper.marshal(array));
} }
@Test @Test
@ -111,12 +111,12 @@ public class Serializer {
hostingNode.addFacet(contactFacet); hostingNode.addFacet(contactFacet);
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
ISMapper.marshal(hostingNode, stringWriter); ElementMapper.marshal(hostingNode, stringWriter);
logger.trace(stringWriter.toString()); logger.trace(stringWriter.toString());
StringReader stringReader = new StringReader(stringWriter.toString()); StringReader stringReader = new StringReader(stringWriter.toString());
HostingNode hn = ISMapper.unmarshal(HostingNode.class, stringReader); HostingNode hn = ElementMapper.unmarshal(HostingNode.class, stringReader);
logger.trace("Deserialized : {} ", hn); logger.trace("Deserialized : {} ", hn);
@ -133,7 +133,7 @@ public class Serializer {
ConsistsOf<Resource,Facet> consistsOf = new ConsistsOfImpl<Resource,Facet>(hostingNode, cpuFacet, null); ConsistsOf<Resource,Facet> consistsOf = new ConsistsOfImpl<Resource,Facet>(hostingNode, cpuFacet, null);
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
ISMapper.marshal(consistsOf, stringWriter); ElementMapper.marshal(consistsOf, stringWriter);
logger.trace(stringWriter.toString()); logger.trace(stringWriter.toString());
} }
@ -149,7 +149,7 @@ public class Serializer {
+ "\"surname\":\"Frosini\"," + "\"eMail\":\"luca.frosini@isti.cnr.it\"" + "}," + "\"surname\":\"Frosini\"," + "\"eMail\":\"luca.frosini@isti.cnr.it\"" + "},"
+ "\"relationProperty\":null" + "}" + "]," + "\"isRelatedTo\":[]" + "}"); + "\"relationProperty\":null" + "}" + "]," + "\"isRelatedTo\":[]" + "}");
HostingNode hn = ISMapper.unmarshal(HostingNode.class, stringReader); HostingNode hn = ElementMapper.unmarshal(HostingNode.class, stringReader);
logger.trace("Deserialized : {} ", hn); logger.trace("Deserialized : {} ", hn);
@ -159,7 +159,7 @@ public class Serializer {
public void deserializeContext() throws JsonParseException, JsonMappingException, IOException { public void deserializeContext() throws JsonParseException, JsonMappingException, IOException {
String contextString = "{\"name\":\"gcube\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:33.706 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"fe44822a-d8bb-418b-ba79-59b4aef01cf9\",\"lastUpdateTime\":\"2019-02-06 11:08:33.706 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"],\"children\":[{\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.627 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"401a2381-3a05-48fd-952b-0aa3cbb8ad8b\",\"lastUpdateTime\":\"2019-02-06 11:08:34.627 +0100\"},\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"@class\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"devsec\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.663 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"007f9154-25fa-4f52-9cd4-ec1f8c3c3baf\",\"lastUpdateTime\":\"2019-02-06 11:08:34.663 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"]}},{\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.658 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"aeec2ea9-c3d2-43af-998e-d19953fc2c42\",\"lastUpdateTime\":\"2019-02-06 11:08:36.658 +0100\"},\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"@class\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"devNext\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.695 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"b16bc587-3fd8-4c0a-9196-8515c4501649\",\"lastUpdateTime\":\"2019-02-06 11:08:36.695 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"]}},{\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.224 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"eba6cd76-525c-4037-9095-a712b054fd1b\",\"lastUpdateTime\":\"2019-02-06 11:08:38.224 +0100\"},\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"@class\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"preprod\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.248 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"d971a5e4-0a11-49c6-a65d-551161802335\",\"lastUpdateTime\":\"2019-02-06 11:08:38.248 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"]}}]}"; String contextString = "{\"name\":\"gcube\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:33.706 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"fe44822a-d8bb-418b-ba79-59b4aef01cf9\",\"lastUpdateTime\":\"2019-02-06 11:08:33.706 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"],\"children\":[{\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.627 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"401a2381-3a05-48fd-952b-0aa3cbb8ad8b\",\"lastUpdateTime\":\"2019-02-06 11:08:34.627 +0100\"},\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"@class\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"devsec\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:34.663 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"007f9154-25fa-4f52-9cd4-ec1f8c3c3baf\",\"lastUpdateTime\":\"2019-02-06 11:08:34.663 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"]}},{\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.658 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"aeec2ea9-c3d2-43af-998e-d19953fc2c42\",\"lastUpdateTime\":\"2019-02-06 11:08:36.658 +0100\"},\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"@class\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"devNext\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:36.695 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"b16bc587-3fd8-4c0a-9196-8515c4501649\",\"lastUpdateTime\":\"2019-02-06 11:08:36.695 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"]}},{\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.224 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"eba6cd76-525c-4037-9095-a712b054fd1b\",\"lastUpdateTime\":\"2019-02-06 11:08:38.224 +0100\"},\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"unpropagate\",\"remove\":\"keep\"},\"@class\":\"IsParentOf\",\"@superClasses\":[\"Relation\"],\"target\":{\"name\":\"preprod\",\"header\":{\"@class\":\"Header\",\"creator\":\"UNKNOWN_USER\",\"creationTime\":\"2019-02-06 11:08:38.248 +0100\",\"modifiedBy\":\"UNKNOWN_USER\",\"uuid\":\"d971a5e4-0a11-49c6-a65d-551161802335\",\"lastUpdateTime\":\"2019-02-06 11:08:38.248 +0100\"},\"@class\":\"Context\",\"@superClasses\":[\"Entity\"]}}]}";
StringReader stringReader = new StringReader(contextString); StringReader stringReader = new StringReader(contextString);
Context c = ISMapper.unmarshal(Context.class, stringReader); Context c = ElementMapper.unmarshal(Context.class, stringReader);
logger.trace("Deserialized Context : {} ", c); logger.trace("Deserialized Context : {} ", c);
} }