Changed '@class' to 'type'

This commit is contained in:
Luca Frosini 2023-04-26 21:41:57 +02:00
parent 82a50a26e2
commit 1227001ef4
13 changed files with 37 additions and 31 deletions

View File

@ -49,14 +49,15 @@ public class IdentifierFacetImpl extends FacetImpl implements IdentifierFacet {
* @return the type
*/
@Override
public IdentificationType getType() {
public IdentificationType getIdentificationType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(IdentificationType type) {
@Override
public void setIdentificationType(IdentificationType type) {
this.type = type;
}

View File

@ -36,6 +36,7 @@ public interface IdentifierFacet extends Facet {
public static final String NAME = "IdentifierFacet"; // IdentifierFacet.class.getSimpleName();
public static final String VALUE_PROPERTY = "value";
public static final String IDENTIFICATION_TYPE_PROPERTY = "identificationType";
public enum IdentificationType {
URI, DOI, IRI, URL, URN, UUID, STRING
@ -46,10 +47,10 @@ public interface IdentifierFacet extends Facet {
public void setValue(String value);
@ISProperty(description = "The typology of identifier", mandatory=true, nullable=false)
public IdentificationType getType();
@ISProperty(name = IDENTIFICATION_TYPE_PROPERTY, description = "The typology of identifier", mandatory=true, nullable=false)
public IdentificationType getIdentificationType();
public void setType(IdentificationType type);
public void setIdentificationType(IdentificationType type);
@ISProperty(description = "To indicate whether the identifier is persistent or not")
public boolean isPersistent();

View File

@ -38,7 +38,7 @@ import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdent
* Federated systems can provide virtual machines as resource or containers as resources.
* In some cases, the description of a container includes (virtual) hardware information.
*
* It is important to highlight that HostingNode is not a subclass of VirtualMachine.
* It is important to highlight that HostingNode is not a subtype of VirtualMachine.
*
* HostingNode could be though as a specialisation of the entity
* PE6_Software_Hosting_Service defined in PARTHENOS Entities Model (PE Model).

View File

@ -19,7 +19,7 @@ import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Demand
/**
* VirtualService is an abstract service (non-physically existing service) worth being
* represented as an existing Service for management purposes.
* Examples of usage include cases where classes or set of services have to
* Examples of usage include cases where set of services have to
* be managed like an existing unit.
* This resource is essential from infrastructure management point of view because
* it allows easily share a pool of services across VREs as a single unit.

View File

@ -26,6 +26,6 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Service;
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface HasAction<Out extends Service, In extends ActionFacet> extends ConsistsOf<Out, In> {
public static final String NAME = "HasAction";
public static final String NAME = "HasAction"; //HasAction.class.getSimpleName();
}

View File

@ -24,6 +24,6 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Service;
public interface HasAddAction<Out extends Service, In extends ActionFacet>
extends HasAction<Out, In> {
public static final String NAME = "HasAddAction";
public static final String NAME = "HasAddAction"; //HasAddAction.class.getSimpleName();
}

View File

@ -24,6 +24,6 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Service;
public interface HasRemoveAction<Out extends Service, In extends ActionFacet>
extends HasAction<Out, In> {
public static final String NAME = "HasRemoveAction";
public static final String NAME = "HasRemoveAction"; // HasRemoveAction.class.getSimpleName();
}

View File

@ -57,7 +57,7 @@ public class AccessPointFacetTest {
@Test
public void testEncryptedSpecilization() throws Exception {
String marshalled = "{\"@class\":\"AccessPointFacet\",\"uuid\":null,\"metadata\":null,\"entryName\":\"port1\",\"endpoint\":\"https://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"pwd\",\"type\":\"https://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"@class\":\"MyEncrypted\",\"@superClasses\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}";
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\"}}";
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
Encrypted vlt = (Encrypted) apf.getAdditionalProperty("Enc");
logger.debug(ElementMapper.marshal(vlt));
@ -72,7 +72,7 @@ public class AccessPointFacetTest {
Assert.assertTrue(type.getName().compareTo(AccessPointFacet.NAME)==0);
for(PropertyDefinition propertyDefinition : type.getProperties()) {
if(propertyDefinition.getName().compareTo(AccessPointFacet.AUTHORIZATION_PROPERTY)==0) {
Assert.assertTrue(propertyDefinition.getType().compareTo(BaseType.PROPERTY.toString())==0);
Assert.assertTrue(propertyDefinition.getPropertyType().compareTo(BaseType.PROPERTY.toString())==0);
logger.debug("{}", propertyDefinition);
}
}

View File

@ -8,6 +8,7 @@ import java.util.HashSet;
import java.util.Set;
import org.gcube.com.fasterxml.jackson.core.JsonProcessingException;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.ActionFacetImpl;
import org.gcube.resourcemanagement.model.impl.properties.EnumStringPropertyImpl;
@ -48,8 +49,8 @@ public class ActionFacetTest {
//@Test
public void deserialize() {
String marshalled = "{\"@class\":\"ActionFacet\",\"metadata\":null,\"name\":\"FirstAction\","
+ "\"type\":{\"@class\":\"EnumStringPropertyImpl\",\"type\":[\"EXECUTABLE\",\"ANSIBLE\",\"COMMAND\",\"REMOTE_SERVICE\"],"
String marshalled = "{\"" + Element.CLASS_PROPERTY + "\":\"ActionFacet\",\"metadata\":null,\"name\":\"FirstAction\","
+ "\"" + Element.CLASS_PROPERTY + "\":{\"" + Element.CLASS_PROPERTY + "\":\"EnumStringPropertyImpl\",\"" + Element.CLASS_PROPERTY + "\":[\"EXECUTABLE\",\"ANSIBLE\",\"COMMAND\",\"REMOTE_SERVICE\"],"
+ "\"value\":\"ANSIBLE\"},\"source\":\"git@myrepo:playbook.yml\",\"options\":\"playbook.yml\",\"command\":\"ansible-pull\"}";
ActionFacet facet = null;
try {

View File

@ -2,6 +2,7 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import java.io.IOException;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl;
import org.junit.Test;
@ -35,9 +36,9 @@ public class ContactFacetImplTest {
@Test
public void test() throws Exception{
String json = "{ "
+ "\"@class\":\"ContactFacet\","
+ "\"" + Element.CLASS_PROPERTY + "\":\"ContactFacet\","
+ "\"metadata\" : {"
+ "\"@class\":\"Metadata\","
+ "\"" + Element.CLASS_PROPERTY + "\":\"Metadata\","
+ "\"creator\":\"luca.frosini\""
+ "},"
+ "\"name\":\"Luca\","

View File

@ -5,6 +5,7 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import java.util.List;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.impl.properties.MetadataImpl;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
@ -29,16 +30,16 @@ public class PolymorphismTest {
private static Logger logger = LoggerFactory
.getLogger(PolymorphismTest.class);
public static final String NYESERVICE = "{\"@class\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"@class\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"@class\":\"MySoftwareFacet\",\"metadata\":null,\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}";
public static final String MYESERVICE = "{\"@class\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"@class\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@class\":\"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}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"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\": {\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}";
public static final String MYOTHERESERVICE = "{\"@class\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"@class\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@class\":\"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}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}";
public static final String MYANOTHERESERVICE = "{\"@class\":\"EService\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"@class\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@class\":\"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}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}";
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 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 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 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 NYESERVICE2 = "{\"@class\":\"MyEService\",\"@superClasses\":[\"EService\",\"Service\",\"Resource\"],\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"@class\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"@class\":\"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}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}}],\"isRelatedTo\":[]}";
public static final String MYANOTHERESERVICE2 = "{\"@class\":\"MyEService\",\"@superClasses\":[\"EService\",\"Service\",\"Resource\"],\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"metadata\":{\"@class\":\"Metadata\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null},\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"target\":{\"@class\":\"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}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"whnmanager\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/vremanagement/ws/whnmanager\",\"protocol\":null,\"description\":null,\"authorization\": {\"@class\":\"ValueSchema\",\"value\":\"gcube-token\",\"schema\":null},\"properties\":null}},{\"@class\":\"ConsistsOf\",\"metadata\":null,\"target\":{\"@class\":\"AccessPointFacet\",\"metadata\":null,\"entryName\":\"WhnManager-remote-management\",\"endpoint\":\"https://pc-frosini.isti.cnr.it:8080/whn-manager/gcube/resource\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"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 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 MY_CONSISTS_OF = "{\"@superClasses\":[\"IsIdentifiedBy\", \"ConsistsOf\", \"Relation\"],\"@class\":\"MyIsIdentifiedBy\",\"target\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"@class\":\"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\"],\"@class\":\"MySoftwareFacet\",\"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 = "{\"@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_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}";
@Test

View File

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

View File

@ -39,7 +39,7 @@ public class ResourceTypeDefintionsTest {
Assert.assertTrue(type.getName().compareTo(EntityElement.NAME)==0);
for(PropertyDefinition propertyDefinition : type.getProperties()) {
if(propertyDefinition.getName().compareTo(EntityElement.METADATA_PROPERTY)==0) {
Assert.assertTrue(propertyDefinition.getType().compareTo(Metadata.NAME)==0);
Assert.assertTrue(propertyDefinition.getPropertyType().compareTo(Metadata.NAME)==0);
logger.debug("{}", propertyDefinition);
}
}
@ -54,7 +54,7 @@ public class ResourceTypeDefintionsTest {
Assert.assertTrue(type.getName().compareTo(AccessPolicy.NAME)==0);
for(PropertyDefinition propertyDefinition : type.getProperties()) {
if(propertyDefinition.getName().compareTo("policy")==0) {
Assert.assertTrue(propertyDefinition.getType().compareTo(ValueSchema.NAME)==0);
Assert.assertTrue(propertyDefinition.getPropertyType().compareTo(ValueSchema.NAME)==0);
logger.debug("{}", propertyDefinition);
}
}