Renamed class in ISMapper

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141894 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-01-30 10:43:18 +00:00
parent 8a7542d5dd
commit e2dbd009d9
7 changed files with 97 additions and 97 deletions

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.resourceregistry.dbinitialization; package org.gcube.informationsystem.resourceregistry.dbinitialization;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery; import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery;
import org.gcube.informationsystem.model.embedded.Embedded; import org.gcube.informationsystem.model.embedded.Embedded;
import org.gcube.informationsystem.model.embedded.ValueSchema; import org.gcube.informationsystem.model.embedded.ValueSchema;
@ -111,7 +111,7 @@ public class DatabaseIntializator {
} }
public static void createEntitiesAndRelations() throws Exception { public static void createEntitiesAndRelations() throws Exception {
ERDiscovery erDiscovery = Entities.getErdiscovery(); ERDiscovery erDiscovery = ISMapper.getErdiscovery();
SchemaActionImpl entityRegistrationAction = new SchemaActionImpl(); SchemaActionImpl entityRegistrationAction = new SchemaActionImpl();
entityRegistrationAction.manageEmbeddedClass(Embedded.class); entityRegistrationAction.manageEmbeddedClass(Embedded.class);
entityRegistrationAction.manageEmbeddedClass(ValueSchema.class); entityRegistrationAction.manageEmbeddedClass(ValueSchema.class);

View File

@ -12,7 +12,7 @@ import java.util.UUID;
import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.authorization.library.provider.ClientInfo; import org.gcube.common.authorization.library.provider.ClientInfo;
import org.gcube.common.authorization.library.utils.Caller; import org.gcube.common.authorization.library.utils.Caller;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.embedded.Header; import org.gcube.informationsystem.model.embedded.Header;
import org.gcube.informationsystem.model.entity.Entity; import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Resource; import org.gcube.informationsystem.model.entity.Resource;
@ -101,7 +101,7 @@ public class HeaderUtility {
}else{ }else{
try { try {
HeaderOrient headerOrient = new HeaderOrient(); HeaderOrient headerOrient = new HeaderOrient();
Header header = Entities.unmarshal(Header.class, oDocument.toJSON()); Header header = ISMapper.unmarshal(Header.class, oDocument.toJSON());
headerOrient.setUUID(header.getUUID()); headerOrient.setUUID(header.getUUID());
headerOrient.setCreator(header.getCreator()); headerOrient.setCreator(header.getCreator());
headerOrient.setCreationTime(header.getCreationTime()); headerOrient.setCreationTime(header.getCreationTime());

View File

@ -10,7 +10,7 @@ import java.util.UUID;
import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject; import org.codehaus.jettison.json.JSONObject;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.embedded.Embedded; import org.gcube.informationsystem.model.embedded.Embedded;
import org.gcube.informationsystem.model.embedded.Header; import org.gcube.informationsystem.model.embedded.Header;
import org.gcube.informationsystem.model.entity.Entity; import org.gcube.informationsystem.model.entity.Entity;
@ -132,7 +132,7 @@ public class Utility {
throws ResourceRegistryException { throws ResourceRegistryException {
try { try {
ODocument oDocument = element.getProperty(property); ODocument oDocument = element.getProperty(property);
E e = Entities.unmarshal(clz, oDocument.toJSON()); E e = ISMapper.unmarshal(clz, oDocument.toJSON());
return e; return e;
} catch (Exception ex) { } catch (Exception ex) {
String error = String.format("Error while getting %s from %s", String error = String.format("Error while getting %s from %s",

View File

@ -5,7 +5,7 @@ package org.gcube.informationsystem.resourceregistry.context;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.entity.Context; import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException;
@ -102,7 +102,7 @@ public class ContextManagementImplTest {
@Test @Test
public void simpleTest() throws Exception { public void simpleTest() throws Exception {
String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A); String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A);
Context createdContexA1 = Entities.unmarshal(Context.class, Context createdContexA1 = ISMapper.unmarshal(Context.class,
contextJsonA1); contextJsonA1);
UUID A_1 = createdContexA1.getHeader().getUUID(); UUID A_1 = createdContexA1.getHeader().getUUID();
logger.info("{}", contextJsonA1); logger.info("{}", contextJsonA1);
@ -112,7 +112,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonA2 = contextManagementImpl.create(A_1, CTX_NAME_A); String contextJsonA2 = contextManagementImpl.create(A_1, CTX_NAME_A);
Context createdContexA2 = Entities.unmarshal(Context.class, Context createdContexA2 = ISMapper.unmarshal(Context.class,
contextJsonA2); contextJsonA2);
logger.info("{}", contextJsonA2); logger.info("{}", contextJsonA2);
UUID A_2 = createdContexA2.getHeader().getUUID(); UUID A_2 = createdContexA2.getHeader().getUUID();
@ -121,7 +121,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonB3 = contextManagementImpl.create(A_2, CTX_NAME_B); String contextJsonB3 = contextManagementImpl.create(A_2, CTX_NAME_B);
Context createdContexB3 = Entities.unmarshal(Context.class, Context createdContexB3 = ISMapper.unmarshal(Context.class,
contextJsonB3); contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
UUID B_3 = createdContexB3.getHeader().getUUID(); UUID B_3 = createdContexB3.getHeader().getUUID();
@ -130,7 +130,7 @@ public class ContextManagementImplTest {
*/ */
contextJsonB3 = contextManagementImpl.move(A_1, B_3); contextJsonB3 = contextManagementImpl.move(A_1, B_3);
createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
/* /*
@ -138,21 +138,21 @@ public class ContextManagementImplTest {
*/ */
contextJsonB3 = contextManagementImpl.rename(B_3, CTX_NAME_C); contextJsonB3 = contextManagementImpl.rename(B_3, CTX_NAME_C);
createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
/* /*
* A_1 A_2 C_3 * A_1 A_2 C_3
*/ */
contextJsonB3 = contextManagementImpl.rename(B_3, CTX_NAME_B); contextJsonB3 = contextManagementImpl.rename(B_3, CTX_NAME_B);
createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
/* /*
* A_1 A_2 B_3 * A_1 A_2 B_3
*/ */
contextJsonB3 = contextManagementImpl.move(A_2, B_3); contextJsonB3 = contextManagementImpl.move(A_2, B_3);
createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
/* /*
* A_1 A_2 B_3 * A_1 A_2 B_3
@ -184,7 +184,7 @@ public class ContextManagementImplTest {
String name = "test"; String name = "test";
String testJson = contextManagementImpl.create(null, name); String testJson = contextManagementImpl.create(null, name);
Context testContext = Entities.unmarshal(Context.class, testJson); Context testContext = ISMapper.unmarshal(Context.class, testJson);
Assert.assertTrue(testContext.getName().compareTo(name) == 0); Assert.assertTrue(testContext.getName().compareTo(name) == 0);
UUID testUUID = testContext.getHeader().getUUID(); UUID testUUID = testContext.getHeader().getUUID();
logger.trace("/test : {}", testUUID); logger.trace("/test : {}", testUUID);
@ -197,28 +197,28 @@ public class ContextManagementImplTest {
// @Test // @Test
public void createDevContext() throws Exception { public void createDevContext() throws Exception {
String gcubeJson = contextManagementImpl.create(null, "gcube"); String gcubeJson = contextManagementImpl.create(null, "gcube");
Context gcubeContext = Entities.unmarshal(Context.class, gcubeJson); Context gcubeContext = ISMapper.unmarshal(Context.class, gcubeJson);
UUID gcube = gcubeContext.getHeader().getUUID(); UUID gcube = gcubeContext.getHeader().getUUID();
logger.trace("/gcube : {}", gcubeJson); logger.trace("/gcube : {}", gcubeJson);
String devsecJson = contextManagementImpl.create(gcube, "devsec"); String devsecJson = contextManagementImpl.create(gcube, "devsec");
Context devsecContex = Entities.unmarshal(Context.class, devsecJson); Context devsecContex = ISMapper.unmarshal(Context.class, devsecJson);
UUID devsec = devsecContex.getHeader().getUUID(); UUID devsec = devsecContex.getHeader().getUUID();
logger.trace("/gcube/devsec : {}", devsecJson); logger.trace("/gcube/devsec : {}", devsecJson);
String devVREJson = contextManagementImpl.create(devsec, "devVRE"); String devVREJson = contextManagementImpl.create(devsec, "devVRE");
Context devVREContex = Entities.unmarshal(Context.class, devVREJson); Context devVREContex = ISMapper.unmarshal(Context.class, devVREJson);
@SuppressWarnings("unused") @SuppressWarnings("unused")
UUID devVRE = devVREContex.getHeader().getUUID(); UUID devVRE = devVREContex.getHeader().getUUID();
logger.trace("/gcube/devsec/devVRE : {}", devVREJson); logger.trace("/gcube/devsec/devVRE : {}", devVREJson);
String devNextJson = contextManagementImpl.create(gcube, "devNext"); String devNextJson = contextManagementImpl.create(gcube, "devNext");
Context devNextContex = Entities.unmarshal(Context.class, devNextJson); Context devNextContex = ISMapper.unmarshal(Context.class, devNextJson);
UUID devNext = devNextContex.getHeader().getUUID(); UUID devNext = devNextContex.getHeader().getUUID();
logger.trace("/gcube/devNext : {}", devNextJson); logger.trace("/gcube/devNext : {}", devNextJson);
String NextNextJson = contextManagementImpl.create(devNext, "NextNext"); String NextNextJson = contextManagementImpl.create(devNext, "NextNext");
Context NextNextContex = Entities Context NextNextContex = ISMapper
.unmarshal(Context.class, NextNextJson); .unmarshal(Context.class, NextNextJson);
@SuppressWarnings("unused") @SuppressWarnings("unused")
UUID NextNext = NextNextContex.getHeader().getUUID(); UUID NextNext = NextNextContex.getHeader().getUUID();
@ -250,14 +250,14 @@ public class ContextManagementImplTest {
public void readTest() throws Exception { public void readTest() throws Exception {
String name = "LLL"; String name = "LLL";
String contextJsonA1 = contextManagementImpl.create(null, name); String contextJsonA1 = contextManagementImpl.create(null, name);
Context createdContexA1 = Entities.unmarshal(Context.class, Context createdContexA1 = ISMapper.unmarshal(Context.class,
contextJsonA1); contextJsonA1);
UUID A_1 = createdContexA1.getHeader().getUUID(); UUID A_1 = createdContexA1.getHeader().getUUID();
logger.info("{}", contextJsonA1); logger.info("{}", contextJsonA1);
Assert.assertTrue(createdContexA1.getName().compareTo(name) == 0); Assert.assertTrue(createdContexA1.getName().compareTo(name) == 0);
String readContextJsonA1 = contextManagementImpl.read(A_1); String readContextJsonA1 = contextManagementImpl.read(A_1);
Context readContexA1 = Entities.unmarshal(Context.class, Context readContexA1 = ISMapper.unmarshal(Context.class,
readContextJsonA1); readContextJsonA1);
Assert.assertTrue(readContexA1.getName().compareTo(name) == 0); Assert.assertTrue(readContexA1.getName().compareTo(name) == 0);
Assert.assertTrue(A_1.compareTo(readContexA1.getHeader().getUUID()) == 0); Assert.assertTrue(A_1.compareTo(readContexA1.getHeader().getUUID()) == 0);
@ -270,7 +270,7 @@ public class ContextManagementImplTest {
@Test @Test
public void completeTest() throws Exception { public void completeTest() throws Exception {
String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A); String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A);
Context createdContexA1 = Entities.unmarshal(Context.class, Context createdContexA1 = ISMapper.unmarshal(Context.class,
contextJsonA1); contextJsonA1);
UUID A_1 = createdContexA1.getHeader().getUUID(); UUID A_1 = createdContexA1.getHeader().getUUID();
logger.info("{}", contextJsonA1); logger.info("{}", contextJsonA1);
@ -279,7 +279,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonA2 = contextManagementImpl.create(A_1, CTX_NAME_A); String contextJsonA2 = contextManagementImpl.create(A_1, CTX_NAME_A);
Context createdContexA2 = Entities.unmarshal(Context.class, Context createdContexA2 = ISMapper.unmarshal(Context.class,
contextJsonA2); contextJsonA2);
logger.info("{}", contextJsonA2); logger.info("{}", contextJsonA2);
UUID A_2 = createdContexA2.getHeader().getUUID(); UUID A_2 = createdContexA2.getHeader().getUUID();
@ -289,7 +289,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonB3 = contextManagementImpl.create(A_2, CTX_NAME_B); String contextJsonB3 = contextManagementImpl.create(A_2, CTX_NAME_B);
Context createdContexB3 = Entities.unmarshal(Context.class, Context createdContexB3 = ISMapper.unmarshal(Context.class,
contextJsonB3); contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
UUID B_3 = createdContexB3.getHeader().getUUID(); UUID B_3 = createdContexB3.getHeader().getUUID();
@ -298,7 +298,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonB4 = contextManagementImpl.create(A_1, CTX_NAME_B); String contextJsonB4 = contextManagementImpl.create(A_1, CTX_NAME_B);
Context createdContexB4 = Entities.unmarshal(Context.class, Context createdContexB4 = ISMapper.unmarshal(Context.class,
contextJsonB4); contextJsonB4);
logger.info("{}", contextJsonB4); logger.info("{}", contextJsonB4);
UUID B_4 = createdContexB4.getHeader().getUUID(); UUID B_4 = createdContexB4.getHeader().getUUID();
@ -307,7 +307,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonA5 = contextManagementImpl.create(B_4, CTX_NAME_A); String contextJsonA5 = contextManagementImpl.create(B_4, CTX_NAME_A);
Context createdContexA5 = Entities.unmarshal(Context.class, Context createdContexA5 = ISMapper.unmarshal(Context.class,
contextJsonA5); contextJsonA5);
logger.info("{}", contextJsonA5); logger.info("{}", contextJsonA5);
UUID A_5 = createdContexA5.getHeader().getUUID(); UUID A_5 = createdContexA5.getHeader().getUUID();
@ -328,7 +328,7 @@ public class ContextManagementImplTest {
// Moving B_3 as child of B_4. OK // Moving B_3 as child of B_4. OK
String movedContextJsonB3 = contextManagementImpl.move(B_4, B_3); String movedContextJsonB3 = contextManagementImpl.move(B_4, B_3);
Context movedContexB3 = Entities.unmarshal(Context.class, Context movedContexB3 = ISMapper.unmarshal(Context.class,
movedContextJsonB3); movedContextJsonB3);
Assert.assertTrue(B_3.compareTo(movedContexB3.getHeader().getUUID()) == 0); Assert.assertTrue(B_3.compareTo(movedContexB3.getHeader().getUUID()) == 0);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
@ -338,7 +338,7 @@ public class ContextManagementImplTest {
// Restoring the initial situation by moving B_3 as child of A_2 // Restoring the initial situation by moving B_3 as child of A_2
String movedAgainJsonB3 = contextManagementImpl.move(A_2, B_3); String movedAgainJsonB3 = contextManagementImpl.move(A_2, B_3);
Context movedAgainContexB3 = Entities.unmarshal(Context.class, Context movedAgainContexB3 = ISMapper.unmarshal(Context.class,
movedAgainJsonB3); movedAgainJsonB3);
Assert.assertTrue(B_3.compareTo(movedAgainContexB3.getHeader() Assert.assertTrue(B_3.compareTo(movedAgainContexB3.getHeader()
.getUUID()) == 0); .getUUID()) == 0);
@ -352,7 +352,7 @@ public class ContextManagementImplTest {
// Renaming B_3 as C_3 // Renaming B_3 as C_3
String contextJsonC3 = contextManagementImpl.rename(B_3, CTX_NAME_C); String contextJsonC3 = contextManagementImpl.rename(B_3, CTX_NAME_C);
Context createdContexC3 = Entities.unmarshal(Context.class, Context createdContexC3 = ISMapper.unmarshal(Context.class,
contextJsonC3); contextJsonC3);
logger.info("{}", contextJsonC3); logger.info("{}", contextJsonC3);
UUID C_3 = createdContexC3.getHeader().getUUID(); UUID C_3 = createdContexC3.getHeader().getUUID();
@ -363,7 +363,7 @@ public class ContextManagementImplTest {
// Moving C_3 (was B_3) as child of A_1. Now it is possible // Moving C_3 (was B_3) as child of A_1. Now it is possible
contextJsonC3 = contextManagementImpl.move(A_1, C_3); contextJsonC3 = contextManagementImpl.move(A_1, C_3);
createdContexC3 = Entities.unmarshal(Context.class, contextJsonC3); createdContexC3 = ISMapper.unmarshal(Context.class, contextJsonC3);
logger.info("{}", contextJsonC3); logger.info("{}", contextJsonC3);
/* /*
* A_1 C_3 A_2 B_4 A_5 * A_1 C_3 A_2 B_4 A_5
@ -374,11 +374,11 @@ public class ContextManagementImplTest {
// Moving back C_3 (was B_3) as child of A_2. // Moving back C_3 (was B_3) as child of A_2.
contextJsonB3 = contextManagementImpl.move(A_2, C_3); contextJsonB3 = contextManagementImpl.move(A_2, C_3);
createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3);
logger.info("{}", contextJsonB3); logger.info("{}", contextJsonB3);
String contextJsonBC3 = contextManagementImpl.rename(C_3, CTX_NAME_B); String contextJsonBC3 = contextManagementImpl.rename(C_3, CTX_NAME_B);
Context createdContexBC3 = Entities.unmarshal(Context.class, Context createdContexBC3 = ISMapper.unmarshal(Context.class,
contextJsonBC3); contextJsonBC3);
logger.info("{}", contextJsonBC3); logger.info("{}", contextJsonBC3);
UUID BC_3 = createdContexBC3.getHeader().getUUID(); UUID BC_3 = createdContexBC3.getHeader().getUUID();
@ -430,7 +430,7 @@ public class ContextManagementImplTest {
@Test @Test
public void moveToRootTest() throws Exception { public void moveToRootTest() throws Exception {
String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A); String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A);
Context createdContexA1 = Entities.unmarshal(Context.class, Context createdContexA1 = ISMapper.unmarshal(Context.class,
contextJsonA1); contextJsonA1);
UUID A_1 = createdContexA1.getHeader().getUUID(); UUID A_1 = createdContexA1.getHeader().getUUID();
logger.info("{}", contextJsonA1); logger.info("{}", contextJsonA1);
@ -439,7 +439,7 @@ public class ContextManagementImplTest {
*/ */
String contextJsonB2 = contextManagementImpl.create(A_1, CTX_NAME_B); String contextJsonB2 = contextManagementImpl.create(A_1, CTX_NAME_B);
Context createdContexB2 = Entities.unmarshal(Context.class, Context createdContexB2 = ISMapper.unmarshal(Context.class,
contextJsonB2); contextJsonB2);
logger.info("{}", contextJsonB2); logger.info("{}", contextJsonB2);
UUID B_2 = createdContexB2.getHeader().getUUID(); UUID B_2 = createdContexB2.getHeader().getUUID();
@ -449,7 +449,7 @@ public class ContextManagementImplTest {
*/ */
String movedContextJsonB2 = contextManagementImpl.move(null, B_2); String movedContextJsonB2 = contextManagementImpl.move(null, B_2);
Context movedContexB2 = Entities.unmarshal(Context.class, Context movedContexB2 = ISMapper.unmarshal(Context.class,
movedContextJsonB2); movedContextJsonB2);
Assert.assertTrue(B_2.compareTo(movedContexB2.getHeader().getUUID()) == 0); Assert.assertTrue(B_2.compareTo(movedContexB2.getHeader().getUUID()) == 0);
contextManagementImpl.delete(A_1); contextManagementImpl.delete(A_1);

View File

@ -24,7 +24,7 @@ import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl;
import org.gcube.informationsystem.impl.relation.consistsof.HasPersistentMemoryImpl; import org.gcube.informationsystem.impl.relation.consistsof.HasPersistentMemoryImpl;
import org.gcube.informationsystem.impl.relation.consistsof.HasVolatileMemoryImpl; import org.gcube.informationsystem.impl.relation.consistsof.HasVolatileMemoryImpl;
import org.gcube.informationsystem.impl.relation.isrelatedto.HostsImpl; import org.gcube.informationsystem.impl.relation.isrelatedto.HostsImpl;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.embedded.Header; import org.gcube.informationsystem.model.embedded.Header;
import org.gcube.informationsystem.model.entity.Entity; import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Facet; import org.gcube.informationsystem.model.entity.Facet;
@ -71,7 +71,7 @@ public class MultiContextTest extends ScopedTest {
cpuFacet.setVendor("AMD"); cpuFacet.setVendor("AMD");
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setJSON(Entities.marshal(cpuFacet)); facetManagement.setJSON(ISMapper.marshal(cpuFacet));
facetManagement.setElementType(CPUFacet.NAME); facetManagement.setElementType(CPUFacet.NAME);
String json = facetManagement.create(); String json = facetManagement.create();
@ -108,7 +108,7 @@ public class MultiContextTest extends ScopedTest {
try { try {
facetManagement = new FacetManagement(); facetManagement = new FacetManagement();
facetManagement.setUUID(uuid); facetManagement.setUUID(uuid);
facetManagement.setJSON(Entities.marshal(cpuFacet)); facetManagement.setJSON(ISMapper.marshal(cpuFacet));
readJson = facetManagement.update(); readJson = facetManagement.update();
logger.debug("You should not be able to update Facet with UUID {}", logger.debug("You should not be able to update Facet with UUID {}",
uuid); uuid);
@ -137,7 +137,7 @@ public class MultiContextTest extends ScopedTest {
facetManagement = new FacetManagement(); facetManagement = new FacetManagement();
facetManagement.setUUID(uuid); facetManagement.setUUID(uuid);
facetManagement.setJSON(Entities.marshal(cpuFacet)); facetManagement.setJSON(ISMapper.marshal(cpuFacet));
readJson = facetManagement.update(); readJson = facetManagement.update();
logger.debug("Updated : {}", readJson); logger.debug("Updated : {}", readJson);
@ -188,11 +188,11 @@ public class MultiContextTest extends ScopedTest {
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(EService.NAME); resourceManagement.setElementType(EService.NAME);
resourceManagement.setJSON(Entities.marshal(eService)); resourceManagement.setJSON(ISMapper.marshal(eService));
String json = resourceManagement.create(); String json = resourceManagement.create();
logger.debug("Created : {}", json); logger.debug("Created : {}", json);
eService = Entities.unmarshal(EService.class, json); eService = ISMapper.unmarshal(EService.class, json);
logger.debug("Unmarshalled {} {}", EService.NAME, eService); logger.debug("Unmarshalled {} {}", EService.NAME, eService);
@ -239,11 +239,11 @@ public class MultiContextTest extends ScopedTest {
resourceManagement = new ResourceManagement(); resourceManagement = new ResourceManagement();
resourceManagement.setElementType(HostingNode.NAME); resourceManagement.setElementType(HostingNode.NAME);
resourceManagement.setJSON(Entities.marshal(hostingNode)); resourceManagement.setJSON(ISMapper.marshal(hostingNode));
String hnJson = resourceManagement.create(); String hnJson = resourceManagement.create();
logger.debug("Created : {}", hnJson); logger.debug("Created : {}", hnJson);
hostingNode = Entities.unmarshal(HostingNode.class, hnJson); hostingNode = ISMapper.unmarshal(HostingNode.class, hnJson);
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode); logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
UUID uuid = hostingNode.getHeader().getUUID(); UUID uuid = hostingNode.getHeader().getUUID();
@ -262,7 +262,7 @@ public class MultiContextTest extends ScopedTest {
resourceManagement.setUUID(uuid); resourceManagement.setUUID(uuid);
String hnString = resourceManagement.read(); String hnString = resourceManagement.read();
HostingNode readHN = Entities.unmarshal(HostingNode.class, hnString); HostingNode readHN = ISMapper.unmarshal(HostingNode.class, hnString);
Assert.assertTrue(readHN.getHeader().getUUID().compareTo(uuid) == 0); Assert.assertTrue(readHN.getHeader().getUUID().compareTo(uuid) == 0);
UUID eServiceUUID = eService.getHeader().getUUID(); UUID eServiceUUID = eService.getHeader().getUUID();

View File

@ -24,7 +24,7 @@ import org.gcube.informationsystem.impl.entity.resource.EServiceImpl;
import org.gcube.informationsystem.impl.entity.resource.HostingNodeImpl; import org.gcube.informationsystem.impl.entity.resource.HostingNodeImpl;
import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl; import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl;
import org.gcube.informationsystem.impl.relation.isrelatedto.HostsImpl; import org.gcube.informationsystem.impl.relation.isrelatedto.HostsImpl;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.impl.utils.Utility; import org.gcube.informationsystem.impl.utils.Utility;
import org.gcube.informationsystem.model.embedded.PropagationConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint;
import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint;
@ -101,11 +101,11 @@ public class ERManagementTest extends ScopedTest {
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(EService.NAME); resourceManagement.setElementType(EService.NAME);
resourceManagement.setJSON(Entities.marshal(eService)); resourceManagement.setJSON(ISMapper.marshal(eService));
String json = resourceManagement.create(); String json = resourceManagement.create();
logger.debug("Created : {}", json); logger.debug("Created : {}", json);
eService = Entities.unmarshal(EService.class, json); eService = ISMapper.unmarshal(EService.class, json);
logger.debug("Unmarshalled {} {}", EService.NAME, eService); logger.debug("Unmarshalled {} {}", EService.NAME, eService);
resourceManagement = new ResourceManagement(); resourceManagement = new ResourceManagement();
@ -135,10 +135,10 @@ public class ERManagementTest extends ScopedTest {
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setElementType(CPUFacet.NAME); facetManagement.setElementType(CPUFacet.NAME);
facetManagement.setJSON(Entities.marshal(cpuFacet)); facetManagement.setJSON(ISMapper.marshal(cpuFacet));
String cpuFacetJson = facetManagement.create(); String cpuFacetJson = facetManagement.create();
CPUFacet createdCpuFacet = Entities.unmarshal(CPUFacet.class, CPUFacet createdCpuFacet = ISMapper.unmarshal(CPUFacet.class,
cpuFacetJson); cpuFacetJson);
logger.debug("Created:\nRaw Json : {}\nUnmarshalled : {}", logger.debug("Created:\nRaw Json : {}\nUnmarshalled : {}",
cpuFacetJson, createdCpuFacet); cpuFacetJson, createdCpuFacet);
@ -156,7 +156,7 @@ public class ERManagementTest extends ScopedTest {
facetManagement.setUUID(uuid); facetManagement.setUUID(uuid);
String readJson = facetManagement.read(); String readJson = facetManagement.read();
CPUFacet readCpuFacet = Entities.unmarshal(CPUFacet.class, readJson); CPUFacet readCpuFacet = ISMapper.unmarshal(CPUFacet.class, readJson);
logger.debug("Read:\nRaw Json : {}\nUnmarshalled : {}", readJson, logger.debug("Read:\nRaw Json : {}\nUnmarshalled : {}", readJson,
readCpuFacet); readCpuFacet);
Assert.assertTrue(cpuFacet.getClockSpeed().compareTo( Assert.assertTrue(cpuFacet.getClockSpeed().compareTo(
@ -179,10 +179,10 @@ public class ERManagementTest extends ScopedTest {
facetManagement = new FacetManagement(); facetManagement = new FacetManagement();
facetManagement.setUUID(uuid); facetManagement.setUUID(uuid);
facetManagement.setJSON(Entities.marshal(readCpuFacet)); facetManagement.setJSON(ISMapper.marshal(readCpuFacet));
String updatedJson = facetManagement.update(); String updatedJson = facetManagement.update();
CPUFacet updatedCpuFacet = Entities.unmarshal(CPUFacet.class, CPUFacet updatedCpuFacet = ISMapper.unmarshal(CPUFacet.class,
updatedJson); updatedJson);
logger.debug("Updated:\nRaw Json : {}\nUnmarshalled : {}", updatedJson, logger.debug("Updated:\nRaw Json : {}\nUnmarshalled : {}", updatedJson,
updatedCpuFacet); updatedCpuFacet);
@ -202,7 +202,7 @@ public class ERManagementTest extends ScopedTest {
facetManagement.setUUID(uuid); facetManagement.setUUID(uuid);
String readUpdatedJson = facetManagement.read(); String readUpdatedJson = facetManagement.read();
CPUFacet readUpdatedCpuFacet = Entities.unmarshal(CPUFacet.class, CPUFacet readUpdatedCpuFacet = ISMapper.unmarshal(CPUFacet.class,
readUpdatedJson); readUpdatedJson);
logger.debug("Read Updated:\nRaw Json : {}\nUnmarshalled : {}", logger.debug("Read Updated:\nRaw Json : {}\nUnmarshalled : {}",
readUpdatedJson, readUpdatedCpuFacet); readUpdatedJson, readUpdatedCpuFacet);
@ -242,11 +242,11 @@ public class ERManagementTest extends ScopedTest {
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(EService.NAME); resourceManagement.setElementType(EService.NAME);
resourceManagement.setJSON(Entities.marshal(eService)); resourceManagement.setJSON(ISMapper.marshal(eService));
String json = resourceManagement.create(); String json = resourceManagement.create();
logger.debug("Created : {}", json); logger.debug("Created : {}", json);
eService = Entities.unmarshal(EService.class, json); eService = ISMapper.unmarshal(EService.class, json);
logger.debug("Unmarshalled {} {}", EService.NAME, eService); logger.debug("Unmarshalled {} {}", EService.NAME, eService);
map.put(EService.NAME, eService); map.put(EService.NAME, eService);
@ -258,12 +258,12 @@ public class ERManagementTest extends ScopedTest {
networkingFacet.setBroadcastAddress("146.48.87.255"); networkingFacet.setBroadcastAddress("146.48.87.255");
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setJSON(Entities.marshal(networkingFacet)); facetManagement.setJSON(ISMapper.marshal(networkingFacet));
facetManagement.setElementType(NetworkingFacet.NAME); facetManagement.setElementType(NetworkingFacet.NAME);
json = facetManagement.create(); json = facetManagement.create();
logger.debug("Created : {}", json); logger.debug("Created : {}", json);
networkingFacet = Entities.unmarshal(NetworkingFacet.class, json); networkingFacet = ISMapper.unmarshal(NetworkingFacet.class, json);
logger.debug("Unmarshalled {} {}", NetworkingFacet.NAME, logger.debug("Unmarshalled {} {}", NetworkingFacet.NAME,
networkingFacet); networkingFacet);
@ -289,11 +289,11 @@ public class ERManagementTest extends ScopedTest {
resourceManagement = new ResourceManagement(); resourceManagement = new ResourceManagement();
resourceManagement.setElementType(HostingNode.NAME); resourceManagement.setElementType(HostingNode.NAME);
resourceManagement.setJSON(Entities.marshal(hostingNode)); resourceManagement.setJSON(ISMapper.marshal(hostingNode));
json = resourceManagement.create(); json = resourceManagement.create();
logger.debug("Created : {}", json); logger.debug("Created : {}", json);
hostingNode = Entities.unmarshal(HostingNode.class, json); hostingNode = ISMapper.unmarshal(HostingNode.class, json);
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode); logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
map.put(HostingNode.NAME, hostingNode); map.put(HostingNode.NAME, hostingNode);
@ -370,7 +370,7 @@ public class ERManagementTest extends ScopedTest {
cpuFacet.setVendor("AMD"); cpuFacet.setVendor("AMD");
FacetManagement facetManagement = new FacetManagement(); FacetManagement facetManagement = new FacetManagement();
facetManagement.setJSON(Entities.marshal(cpuFacet)); facetManagement.setJSON(ISMapper.marshal(cpuFacet));
facetManagement.setElementType(CPUFacet.NAME); facetManagement.setElementType(CPUFacet.NAME);
json = facetManagement.create(); json = facetManagement.create();
@ -434,7 +434,7 @@ public class ERManagementTest extends ScopedTest {
ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(key); ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(key);
String json = resourceManagement.all(false); String json = resourceManagement.all(false);
List<Resource> list = Entities.unmarshalList(Resource.class, json); List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
logger.debug("{} are {} : {} ", key, list.size(), list); logger.debug("{} are {} : {} ", key, list.size(), list);
Assert.assertTrue(list.size()==MAX); Assert.assertTrue(list.size()==MAX);
} }
@ -445,13 +445,13 @@ public class ERManagementTest extends ScopedTest {
ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(Resource.NAME); ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(Resource.NAME);
String json = resourceManagement.all(true); String json = resourceManagement.all(true);
List<Resource> list = Entities.unmarshalList(Resource.class, json); List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
logger.debug("{} are {} : {} ", Resource.NAME, list.size(), list); logger.debug("{} are {} : {} ", Resource.NAME, list.size(), list);
Assert.assertTrue(list.size()==(MAX*typeNumber)); Assert.assertTrue(list.size()==(MAX*typeNumber));
json = resourceManagement.all(false); json = resourceManagement.all(false);
list = Entities.unmarshalList(Resource.class, json); list = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(list.size()==0); Assert.assertTrue(list.size()==0);
@ -461,13 +461,13 @@ public class ERManagementTest extends ScopedTest {
json = isRelatedToManagement.all(true); json = isRelatedToManagement.all(true);
List<Resource> resourcesList = Entities.unmarshalList(Resource.class, json); List<Resource> resourcesList = ISMapper.unmarshalList(Resource.class, json);
logger.debug("{} are {} : {} ", IsRelatedTo.NAME, resourcesList.size(), resourcesList); logger.debug("{} are {} : {} ", IsRelatedTo.NAME, resourcesList.size(), resourcesList);
Assert.assertTrue(resourcesList.size()==MAX); Assert.assertTrue(resourcesList.size()==MAX);
json = isRelatedToManagement.all(false); json = isRelatedToManagement.all(false);
resourcesList = Entities.unmarshalList(Resource.class, json); resourcesList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourcesList.size()==0); Assert.assertTrue(resourcesList.size()==0);
@ -478,12 +478,12 @@ public class ERManagementTest extends ScopedTest {
ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ERManagement.getERManagement(ConsistsOf.NAME); ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ERManagement.getERManagement(ConsistsOf.NAME);
json = consistsOfManagement.all(true); json = consistsOfManagement.all(true);
List<Resource> consistsOfPolimorphicList = Entities.unmarshalList(Resource.class, json); List<Resource> consistsOfPolimorphicList = ISMapper.unmarshalList(Resource.class, json);
logger.debug("{} are {} : {} ", IsRelatedTo.NAME, consistsOfPolimorphicList.size(), consistsOfPolimorphicList); logger.debug("{} are {} : {} ", IsRelatedTo.NAME, consistsOfPolimorphicList.size(), consistsOfPolimorphicList);
json = consistsOfManagement.all(false); json = consistsOfManagement.all(false);
List<Resource> consistsOfNonPolimorphicList = Entities.unmarshalList(Resource.class, json); List<Resource> consistsOfNonPolimorphicList = ISMapper.unmarshalList(Resource.class, json);
logger.debug("{} are {} : {} ", IsRelatedTo.NAME, consistsOfNonPolimorphicList.size(), consistsOfNonPolimorphicList); logger.debug("{} are {} : {} ", IsRelatedTo.NAME, consistsOfNonPolimorphicList.size(), consistsOfNonPolimorphicList);
Assert.assertTrue(consistsOfPolimorphicList.size()>=consistsOfNonPolimorphicList.size()); Assert.assertTrue(consistsOfPolimorphicList.size()>=consistsOfNonPolimorphicList.size());
@ -518,7 +518,7 @@ public class ERManagementTest extends ScopedTest {
/* EService */ /* EService */
String json = isRelatedToManagement.allFrom(eServiceUUID, Direction.BOTH, true); String json = isRelatedToManagement.allFrom(eServiceUUID, Direction.BOTH, true);
List<Resource> resourceList = Entities.unmarshalList(Resource.class, json); List<Resource> resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==1); Assert.assertTrue(resourceList.size()==1);
Resource sourceResource = resourceList.get(0); Resource sourceResource = resourceList.get(0);
Resource targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); Resource targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
@ -527,7 +527,7 @@ public class ERManagementTest extends ScopedTest {
json = isRelatedToManagement.allFrom(eServiceUUID, Direction.IN, true); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.IN, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==1); Assert.assertTrue(resourceList.size()==1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
@ -536,18 +536,18 @@ public class ERManagementTest extends ScopedTest {
json = isRelatedToManagement.allFrom(eServiceUUID, Direction.OUT, true); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.OUT, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = isRelatedToManagement.allFrom(eServiceUUID, Direction.BOTH, false); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.BOTH, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = isRelatedToManagement.allFrom(eServiceUUID, Direction.IN, false); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.IN, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = isRelatedToManagement.allFrom(eServiceUUID, Direction.OUT, false); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.OUT, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
/* END EService */ /* END EService */
@ -555,7 +555,7 @@ public class ERManagementTest extends ScopedTest {
/* Hosting Node */ /* Hosting Node */
json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.BOTH, true); json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.BOTH, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==1); Assert.assertTrue(resourceList.size()==1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
@ -564,11 +564,11 @@ public class ERManagementTest extends ScopedTest {
json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.IN, true); json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.IN, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.OUT, true); json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.OUT, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==1); Assert.assertTrue(resourceList.size()==1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget();
@ -577,15 +577,15 @@ public class ERManagementTest extends ScopedTest {
json = isRelatedToManagement.allFrom(hostingNode.getHeader().getUUID(), Direction.BOTH, false); json = isRelatedToManagement.allFrom(hostingNode.getHeader().getUUID(), Direction.BOTH, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = isRelatedToManagement.allFrom(hostingNode.getHeader().getUUID(), Direction.IN, false); json = isRelatedToManagement.allFrom(hostingNode.getHeader().getUUID(), Direction.IN, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = isRelatedToManagement.allFrom(hostingNode.getHeader().getUUID(), Direction.OUT, false); json = isRelatedToManagement.allFrom(hostingNode.getHeader().getUUID(), Direction.OUT, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
/* END HostingNode */ /* END HostingNode */
@ -598,7 +598,7 @@ public class ERManagementTest extends ScopedTest {
/* SoftwareFacet of Eservice */ /* SoftwareFacet of Eservice */
json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.BOTH, true); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.BOTH, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==1); Assert.assertTrue(resourceList.size()==1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
Facet targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0); Facet targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0);
@ -606,7 +606,7 @@ public class ERManagementTest extends ScopedTest {
Assert.assertTrue(targetIdentificationFacet.getHeader().getUUID().compareTo(identificationFacetUUID)==0); Assert.assertTrue(targetIdentificationFacet.getHeader().getUUID().compareTo(identificationFacetUUID)==0);
json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.IN, true); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.IN, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==1); Assert.assertTrue(resourceList.size()==1);
sourceResource = resourceList.get(0); sourceResource = resourceList.get(0);
targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0); targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0);
@ -615,22 +615,22 @@ public class ERManagementTest extends ScopedTest {
json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.OUT, true); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.OUT, true);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.BOTH, false); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.BOTH, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.IN, false); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.IN, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.OUT, false); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.OUT, false);
resourceList = Entities.unmarshalList(Resource.class, json); resourceList = ISMapper.unmarshalList(Resource.class, json);
Assert.assertTrue(resourceList.size()==0); Assert.assertTrue(resourceList.size()==0);
/* END SoftwareFacet of Eservice */ /* END SoftwareFacet of Eservice */

View File

@ -35,7 +35,7 @@ import org.gcube.informationsystem.impl.relation.ConsistsOfImpl;
import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl; import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl;
import org.gcube.informationsystem.impl.relation.consistsof.HasPersistentMemoryImpl; import org.gcube.informationsystem.impl.relation.consistsof.HasPersistentMemoryImpl;
import org.gcube.informationsystem.impl.relation.consistsof.HasVolatileMemoryImpl; import org.gcube.informationsystem.impl.relation.consistsof.HasVolatileMemoryImpl;
import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.embedded.Header; import org.gcube.informationsystem.model.embedded.Header;
import org.gcube.informationsystem.model.embedded.PropagationConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint;
import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint;
@ -80,7 +80,7 @@ public class SmartgearResourcesTest extends ScopedTest {
@Test @Test
public void testHostingNode() throws JsonParseException, public void testHostingNode() throws JsonParseException,
JsonMappingException, IOException, ResourceRegistryException { JsonMappingException, IOException, ResourceRegistryException {
HostingNode hostingNode = Entities.unmarshal(HostingNode.class, HostingNode hostingNode = ISMapper.unmarshal(HostingNode.class,
HOSTING_NODE); HOSTING_NODE);
logger.debug("{}", hostingNode); logger.debug("{}", hostingNode);
@ -90,7 +90,7 @@ public class SmartgearResourcesTest extends ScopedTest {
String hnJson = resourceManagement.create(); String hnJson = resourceManagement.create();
logger.debug("Created : {}", hnJson); logger.debug("Created : {}", hnJson);
hostingNode = Entities.unmarshal(HostingNode.class, hnJson); hostingNode = ISMapper.unmarshal(HostingNode.class, hnJson);
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode); logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
UUID hnUUID = hostingNode.getHeader().getUUID(); UUID hnUUID = hostingNode.getHeader().getUUID();
@ -98,7 +98,7 @@ public class SmartgearResourcesTest extends ScopedTest {
resourceManagement = new ResourceManagement(); resourceManagement = new ResourceManagement();
resourceManagement.setUUID(hnUUID); resourceManagement.setUUID(hnUUID);
String read = resourceManagement.read(); String read = resourceManagement.read();
HostingNode readHN = Entities.unmarshal(HostingNode.class, read); HostingNode readHN = ISMapper.unmarshal(HostingNode.class, read);
logger.debug("Read {} {}", EService.NAME, readHN); logger.debug("Read {} {}", EService.NAME, readHN);
Assert.assertTrue(hnUUID.compareTo(readHN.getHeader().getUUID()) == 0); Assert.assertTrue(hnUUID.compareTo(readHN.getHeader().getUUID()) == 0);
@ -112,7 +112,7 @@ public class SmartgearResourcesTest extends ScopedTest {
@Test @Test
public void testEService() throws JsonParseException, JsonMappingException, public void testEService() throws JsonParseException, JsonMappingException,
IOException, ResourceRegistryException { IOException, ResourceRegistryException {
EService eService = Entities.unmarshal(EService.class, ESERVICE); EService eService = ISMapper.unmarshal(EService.class, ESERVICE);
logger.debug("{}", eService); logger.debug("{}", eService);
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
@ -120,7 +120,7 @@ public class SmartgearResourcesTest extends ScopedTest {
resourceManagement.setJSON(ESERVICE); resourceManagement.setJSON(ESERVICE);
String json = resourceManagement.create(); String json = resourceManagement.create();
eService = Entities.unmarshal(EService.class, json); eService = ISMapper.unmarshal(EService.class, json);
logger.debug("Created {} {}", EService.NAME, eService); logger.debug("Created {} {}", EService.NAME, eService);
UUID eServiceUUID = eService.getHeader().getUUID(); UUID eServiceUUID = eService.getHeader().getUUID();
@ -128,7 +128,7 @@ public class SmartgearResourcesTest extends ScopedTest {
resourceManagement = new ResourceManagement(); resourceManagement = new ResourceManagement();
resourceManagement.setUUID(eServiceUUID); resourceManagement.setUUID(eServiceUUID);
String read = resourceManagement.read(); String read = resourceManagement.read();
EService readEService = Entities.unmarshal(EService.class, read); EService readEService = ISMapper.unmarshal(EService.class, read);
logger.debug("Read {} {}", EService.NAME, readEService); logger.debug("Read {} {}", EService.NAME, readEService);
Assert.assertTrue(eServiceUUID.compareTo(readEService.getHeader() Assert.assertTrue(eServiceUUID.compareTo(readEService.getHeader()
@ -220,11 +220,11 @@ public class SmartgearResourcesTest extends ScopedTest {
ResourceManagement resourceManagement = new ResourceManagement(); ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(HostingNode.NAME); resourceManagement.setElementType(HostingNode.NAME);
resourceManagement.setJSON(Entities.marshal(hostingNode)); resourceManagement.setJSON(ISMapper.marshal(hostingNode));
String json = resourceManagement.create(); String json = resourceManagement.create();
HostingNode hostingNodeToUpdate = Entities.unmarshal(HostingNode.class, HostingNode hostingNodeToUpdate = ISMapper.unmarshal(HostingNode.class,
json); json);
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfToRemove = new ArrayList<>(); List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfToRemove = new ArrayList<>();
@ -270,12 +270,12 @@ public class SmartgearResourcesTest extends ScopedTest {
resourceManagement = new ResourceManagement(); resourceManagement = new ResourceManagement();
resourceManagement.setUUID(uuid); resourceManagement.setUUID(uuid);
resourceManagement.setJSON(Entities.marshal(hostingNodeToUpdate)); resourceManagement.setJSON(ISMapper.marshal(hostingNodeToUpdate));
String updatedHN = resourceManagement.update(); String updatedHN = resourceManagement.update();
logger.debug("Updated {}", updatedHN); logger.debug("Updated {}", updatedHN);
HostingNode updatedHostingNode = Entities.unmarshal(HostingNode.class, HostingNode updatedHostingNode = ISMapper.unmarshal(HostingNode.class,
updatedHN); updatedHN);
logger.debug("Updated Hosting Node {}", updatedHostingNode); logger.debug("Updated Hosting Node {}", updatedHostingNode);