From e2dbd009d940eda21a33cb94830eef2cd02c2ab3 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Mon, 30 Jan 2017 10:43:18 +0000 Subject: [PATCH] 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 --- .../DatabaseIntializator.java | 4 +- .../resourceregistry/utils/HeaderUtility.java | 4 +- .../resourceregistry/utils/Utility.java | 4 +- .../context/ContextManagementImplTest.java | 60 +++++++------- .../context/MultiContextTest.java | 18 ++-- .../resourceregistry/er/ERManagementTest.java | 82 +++++++++---------- .../er/SmartgearResourcesTest.java | 22 ++--- 7 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java index b9f0648..fa34a41 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java @@ -3,7 +3,7 @@ */ 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.model.embedded.Embedded; import org.gcube.informationsystem.model.embedded.ValueSchema; @@ -111,7 +111,7 @@ public class DatabaseIntializator { } public static void createEntitiesAndRelations() throws Exception { - ERDiscovery erDiscovery = Entities.getErdiscovery(); + ERDiscovery erDiscovery = ISMapper.getErdiscovery(); SchemaActionImpl entityRegistrationAction = new SchemaActionImpl(); entityRegistrationAction.manageEmbeddedClass(Embedded.class); entityRegistrationAction.manageEmbeddedClass(ValueSchema.class); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java index c7dc4a4..ad7d6c3 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java @@ -12,7 +12,7 @@ import java.util.UUID; import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.ClientInfo; 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.entity.Entity; import org.gcube.informationsystem.model.entity.Resource; @@ -101,7 +101,7 @@ public class HeaderUtility { }else{ try { 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.setCreator(header.getCreator()); headerOrient.setCreationTime(header.getCreationTime()); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java index c1132ac..de9c93e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java @@ -10,7 +10,7 @@ import java.util.UUID; import org.codehaus.jettison.json.JSONException; 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.Header; import org.gcube.informationsystem.model.entity.Entity; @@ -132,7 +132,7 @@ public class Utility { throws ResourceRegistryException { try { ODocument oDocument = element.getProperty(property); - E e = Entities.unmarshal(clz, oDocument.toJSON()); + E e = ISMapper.unmarshal(clz, oDocument.toJSON()); return e; } catch (Exception ex) { String error = String.format("Error while getting %s from %s", diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java index 6062c29..13f7846 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java @@ -5,7 +5,7 @@ package org.gcube.informationsystem.resourceregistry.context; 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.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException; @@ -102,7 +102,7 @@ public class ContextManagementImplTest { @Test public void simpleTest() throws Exception { String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A); - Context createdContexA1 = Entities.unmarshal(Context.class, + Context createdContexA1 = ISMapper.unmarshal(Context.class, contextJsonA1); UUID A_1 = createdContexA1.getHeader().getUUID(); logger.info("{}", contextJsonA1); @@ -112,7 +112,7 @@ public class ContextManagementImplTest { */ String contextJsonA2 = contextManagementImpl.create(A_1, CTX_NAME_A); - Context createdContexA2 = Entities.unmarshal(Context.class, + Context createdContexA2 = ISMapper.unmarshal(Context.class, contextJsonA2); logger.info("{}", contextJsonA2); UUID A_2 = createdContexA2.getHeader().getUUID(); @@ -121,7 +121,7 @@ public class ContextManagementImplTest { */ String contextJsonB3 = contextManagementImpl.create(A_2, CTX_NAME_B); - Context createdContexB3 = Entities.unmarshal(Context.class, + Context createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3); logger.info("{}", contextJsonB3); UUID B_3 = createdContexB3.getHeader().getUUID(); @@ -130,7 +130,7 @@ public class ContextManagementImplTest { */ contextJsonB3 = contextManagementImpl.move(A_1, B_3); - createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); + createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3); logger.info("{}", contextJsonB3); /* @@ -138,21 +138,21 @@ public class ContextManagementImplTest { */ contextJsonB3 = contextManagementImpl.rename(B_3, CTX_NAME_C); - createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); + createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3); logger.info("{}", contextJsonB3); /* * A_1 A_2 C_3 */ contextJsonB3 = contextManagementImpl.rename(B_3, CTX_NAME_B); - createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); + createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3); logger.info("{}", contextJsonB3); /* * A_1 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); /* * A_1 A_2 B_3 @@ -184,7 +184,7 @@ public class ContextManagementImplTest { String name = "test"; 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); UUID testUUID = testContext.getHeader().getUUID(); logger.trace("/test : {}", testUUID); @@ -197,28 +197,28 @@ public class ContextManagementImplTest { // @Test public void createDevContext() throws Exception { 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(); logger.trace("/gcube : {}", gcubeJson); 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(); logger.trace("/gcube/devsec : {}", devsecJson); String devVREJson = contextManagementImpl.create(devsec, "devVRE"); - Context devVREContex = Entities.unmarshal(Context.class, devVREJson); + Context devVREContex = ISMapper.unmarshal(Context.class, devVREJson); @SuppressWarnings("unused") UUID devVRE = devVREContex.getHeader().getUUID(); logger.trace("/gcube/devsec/devVRE : {}", devVREJson); 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(); logger.trace("/gcube/devNext : {}", devNextJson); String NextNextJson = contextManagementImpl.create(devNext, "NextNext"); - Context NextNextContex = Entities + Context NextNextContex = ISMapper .unmarshal(Context.class, NextNextJson); @SuppressWarnings("unused") UUID NextNext = NextNextContex.getHeader().getUUID(); @@ -250,14 +250,14 @@ public class ContextManagementImplTest { public void readTest() throws Exception { String name = "LLL"; String contextJsonA1 = contextManagementImpl.create(null, name); - Context createdContexA1 = Entities.unmarshal(Context.class, + Context createdContexA1 = ISMapper.unmarshal(Context.class, contextJsonA1); UUID A_1 = createdContexA1.getHeader().getUUID(); logger.info("{}", contextJsonA1); Assert.assertTrue(createdContexA1.getName().compareTo(name) == 0); String readContextJsonA1 = contextManagementImpl.read(A_1); - Context readContexA1 = Entities.unmarshal(Context.class, + Context readContexA1 = ISMapper.unmarshal(Context.class, readContextJsonA1); Assert.assertTrue(readContexA1.getName().compareTo(name) == 0); Assert.assertTrue(A_1.compareTo(readContexA1.getHeader().getUUID()) == 0); @@ -270,7 +270,7 @@ public class ContextManagementImplTest { @Test public void completeTest() throws Exception { String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A); - Context createdContexA1 = Entities.unmarshal(Context.class, + Context createdContexA1 = ISMapper.unmarshal(Context.class, contextJsonA1); UUID A_1 = createdContexA1.getHeader().getUUID(); logger.info("{}", contextJsonA1); @@ -279,7 +279,7 @@ public class ContextManagementImplTest { */ String contextJsonA2 = contextManagementImpl.create(A_1, CTX_NAME_A); - Context createdContexA2 = Entities.unmarshal(Context.class, + Context createdContexA2 = ISMapper.unmarshal(Context.class, contextJsonA2); logger.info("{}", contextJsonA2); UUID A_2 = createdContexA2.getHeader().getUUID(); @@ -289,7 +289,7 @@ public class ContextManagementImplTest { */ String contextJsonB3 = contextManagementImpl.create(A_2, CTX_NAME_B); - Context createdContexB3 = Entities.unmarshal(Context.class, + Context createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3); logger.info("{}", contextJsonB3); UUID B_3 = createdContexB3.getHeader().getUUID(); @@ -298,7 +298,7 @@ public class ContextManagementImplTest { */ String contextJsonB4 = contextManagementImpl.create(A_1, CTX_NAME_B); - Context createdContexB4 = Entities.unmarshal(Context.class, + Context createdContexB4 = ISMapper.unmarshal(Context.class, contextJsonB4); logger.info("{}", contextJsonB4); UUID B_4 = createdContexB4.getHeader().getUUID(); @@ -307,7 +307,7 @@ public class ContextManagementImplTest { */ String contextJsonA5 = contextManagementImpl.create(B_4, CTX_NAME_A); - Context createdContexA5 = Entities.unmarshal(Context.class, + Context createdContexA5 = ISMapper.unmarshal(Context.class, contextJsonA5); logger.info("{}", contextJsonA5); UUID A_5 = createdContexA5.getHeader().getUUID(); @@ -328,7 +328,7 @@ public class ContextManagementImplTest { // Moving B_3 as child of B_4. OK String movedContextJsonB3 = contextManagementImpl.move(B_4, B_3); - Context movedContexB3 = Entities.unmarshal(Context.class, + Context movedContexB3 = ISMapper.unmarshal(Context.class, movedContextJsonB3); Assert.assertTrue(B_3.compareTo(movedContexB3.getHeader().getUUID()) == 0); logger.info("{}", contextJsonB3); @@ -338,7 +338,7 @@ public class ContextManagementImplTest { // Restoring the initial situation by moving B_3 as child of A_2 String movedAgainJsonB3 = contextManagementImpl.move(A_2, B_3); - Context movedAgainContexB3 = Entities.unmarshal(Context.class, + Context movedAgainContexB3 = ISMapper.unmarshal(Context.class, movedAgainJsonB3); Assert.assertTrue(B_3.compareTo(movedAgainContexB3.getHeader() .getUUID()) == 0); @@ -352,7 +352,7 @@ public class ContextManagementImplTest { // Renaming B_3 as C_3 String contextJsonC3 = contextManagementImpl.rename(B_3, CTX_NAME_C); - Context createdContexC3 = Entities.unmarshal(Context.class, + Context createdContexC3 = ISMapper.unmarshal(Context.class, contextJsonC3); logger.info("{}", contextJsonC3); 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 contextJsonC3 = contextManagementImpl.move(A_1, C_3); - createdContexC3 = Entities.unmarshal(Context.class, contextJsonC3); + createdContexC3 = ISMapper.unmarshal(Context.class, contextJsonC3); logger.info("{}", contextJsonC3); /* * 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. contextJsonB3 = contextManagementImpl.move(A_2, C_3); - createdContexB3 = Entities.unmarshal(Context.class, contextJsonB3); + createdContexB3 = ISMapper.unmarshal(Context.class, contextJsonB3); logger.info("{}", contextJsonB3); String contextJsonBC3 = contextManagementImpl.rename(C_3, CTX_NAME_B); - Context createdContexBC3 = Entities.unmarshal(Context.class, + Context createdContexBC3 = ISMapper.unmarshal(Context.class, contextJsonBC3); logger.info("{}", contextJsonBC3); UUID BC_3 = createdContexBC3.getHeader().getUUID(); @@ -430,7 +430,7 @@ public class ContextManagementImplTest { @Test public void moveToRootTest() throws Exception { String contextJsonA1 = contextManagementImpl.create(null, CTX_NAME_A); - Context createdContexA1 = Entities.unmarshal(Context.class, + Context createdContexA1 = ISMapper.unmarshal(Context.class, contextJsonA1); UUID A_1 = createdContexA1.getHeader().getUUID(); logger.info("{}", contextJsonA1); @@ -439,7 +439,7 @@ public class ContextManagementImplTest { */ String contextJsonB2 = contextManagementImpl.create(A_1, CTX_NAME_B); - Context createdContexB2 = Entities.unmarshal(Context.class, + Context createdContexB2 = ISMapper.unmarshal(Context.class, contextJsonB2); logger.info("{}", contextJsonB2); UUID B_2 = createdContexB2.getHeader().getUUID(); @@ -449,7 +449,7 @@ public class ContextManagementImplTest { */ String movedContextJsonB2 = contextManagementImpl.move(null, B_2); - Context movedContexB2 = Entities.unmarshal(Context.class, + Context movedContexB2 = ISMapper.unmarshal(Context.class, movedContextJsonB2); Assert.assertTrue(B_2.compareTo(movedContexB2.getHeader().getUUID()) == 0); contextManagementImpl.delete(A_1); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java index 292e475..4ecdbdf 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java @@ -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.HasVolatileMemoryImpl; 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.entity.Entity; import org.gcube.informationsystem.model.entity.Facet; @@ -71,7 +71,7 @@ public class MultiContextTest extends ScopedTest { cpuFacet.setVendor("AMD"); FacetManagement facetManagement = new FacetManagement(); - facetManagement.setJSON(Entities.marshal(cpuFacet)); + facetManagement.setJSON(ISMapper.marshal(cpuFacet)); facetManagement.setElementType(CPUFacet.NAME); String json = facetManagement.create(); @@ -108,7 +108,7 @@ public class MultiContextTest extends ScopedTest { try { facetManagement = new FacetManagement(); facetManagement.setUUID(uuid); - facetManagement.setJSON(Entities.marshal(cpuFacet)); + facetManagement.setJSON(ISMapper.marshal(cpuFacet)); readJson = facetManagement.update(); logger.debug("You should not be able to update Facet with UUID {}", uuid); @@ -137,7 +137,7 @@ public class MultiContextTest extends ScopedTest { facetManagement = new FacetManagement(); facetManagement.setUUID(uuid); - facetManagement.setJSON(Entities.marshal(cpuFacet)); + facetManagement.setJSON(ISMapper.marshal(cpuFacet)); readJson = facetManagement.update(); logger.debug("Updated : {}", readJson); @@ -188,11 +188,11 @@ public class MultiContextTest extends ScopedTest { ResourceManagement resourceManagement = new ResourceManagement(); resourceManagement.setElementType(EService.NAME); - resourceManagement.setJSON(Entities.marshal(eService)); + resourceManagement.setJSON(ISMapper.marshal(eService)); String json = resourceManagement.create(); logger.debug("Created : {}", json); - eService = Entities.unmarshal(EService.class, json); + eService = ISMapper.unmarshal(EService.class, json); logger.debug("Unmarshalled {} {}", EService.NAME, eService); @@ -239,11 +239,11 @@ public class MultiContextTest extends ScopedTest { resourceManagement = new ResourceManagement(); resourceManagement.setElementType(HostingNode.NAME); - resourceManagement.setJSON(Entities.marshal(hostingNode)); + resourceManagement.setJSON(ISMapper.marshal(hostingNode)); String hnJson = resourceManagement.create(); logger.debug("Created : {}", hnJson); - hostingNode = Entities.unmarshal(HostingNode.class, hnJson); + hostingNode = ISMapper.unmarshal(HostingNode.class, hnJson); logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode); UUID uuid = hostingNode.getHeader().getUUID(); @@ -262,7 +262,7 @@ public class MultiContextTest extends ScopedTest { resourceManagement.setUUID(uuid); 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); UUID eServiceUUID = eService.getHeader().getUUID(); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java index 786b45e..04f33c1 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java @@ -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.relation.IsIdentifiedByImpl; 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.model.embedded.PropagationConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint; @@ -101,11 +101,11 @@ public class ERManagementTest extends ScopedTest { ResourceManagement resourceManagement = new ResourceManagement(); resourceManagement.setElementType(EService.NAME); - resourceManagement.setJSON(Entities.marshal(eService)); + resourceManagement.setJSON(ISMapper.marshal(eService)); String json = resourceManagement.create(); logger.debug("Created : {}", json); - eService = Entities.unmarshal(EService.class, json); + eService = ISMapper.unmarshal(EService.class, json); logger.debug("Unmarshalled {} {}", EService.NAME, eService); resourceManagement = new ResourceManagement(); @@ -135,10 +135,10 @@ public class ERManagementTest extends ScopedTest { FacetManagement facetManagement = new FacetManagement(); facetManagement.setElementType(CPUFacet.NAME); - facetManagement.setJSON(Entities.marshal(cpuFacet)); + facetManagement.setJSON(ISMapper.marshal(cpuFacet)); String cpuFacetJson = facetManagement.create(); - CPUFacet createdCpuFacet = Entities.unmarshal(CPUFacet.class, + CPUFacet createdCpuFacet = ISMapper.unmarshal(CPUFacet.class, cpuFacetJson); logger.debug("Created:\nRaw Json : {}\nUnmarshalled : {}", cpuFacetJson, createdCpuFacet); @@ -156,7 +156,7 @@ public class ERManagementTest extends ScopedTest { facetManagement.setUUID(uuid); 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, readCpuFacet); Assert.assertTrue(cpuFacet.getClockSpeed().compareTo( @@ -179,10 +179,10 @@ public class ERManagementTest extends ScopedTest { facetManagement = new FacetManagement(); facetManagement.setUUID(uuid); - facetManagement.setJSON(Entities.marshal(readCpuFacet)); + facetManagement.setJSON(ISMapper.marshal(readCpuFacet)); String updatedJson = facetManagement.update(); - CPUFacet updatedCpuFacet = Entities.unmarshal(CPUFacet.class, + CPUFacet updatedCpuFacet = ISMapper.unmarshal(CPUFacet.class, updatedJson); logger.debug("Updated:\nRaw Json : {}\nUnmarshalled : {}", updatedJson, updatedCpuFacet); @@ -202,7 +202,7 @@ public class ERManagementTest extends ScopedTest { facetManagement.setUUID(uuid); String readUpdatedJson = facetManagement.read(); - CPUFacet readUpdatedCpuFacet = Entities.unmarshal(CPUFacet.class, + CPUFacet readUpdatedCpuFacet = ISMapper.unmarshal(CPUFacet.class, readUpdatedJson); logger.debug("Read Updated:\nRaw Json : {}\nUnmarshalled : {}", readUpdatedJson, readUpdatedCpuFacet); @@ -242,11 +242,11 @@ public class ERManagementTest extends ScopedTest { ResourceManagement resourceManagement = new ResourceManagement(); resourceManagement.setElementType(EService.NAME); - resourceManagement.setJSON(Entities.marshal(eService)); + resourceManagement.setJSON(ISMapper.marshal(eService)); String json = resourceManagement.create(); logger.debug("Created : {}", json); - eService = Entities.unmarshal(EService.class, json); + eService = ISMapper.unmarshal(EService.class, json); logger.debug("Unmarshalled {} {}", EService.NAME, eService); map.put(EService.NAME, eService); @@ -258,12 +258,12 @@ public class ERManagementTest extends ScopedTest { networkingFacet.setBroadcastAddress("146.48.87.255"); FacetManagement facetManagement = new FacetManagement(); - facetManagement.setJSON(Entities.marshal(networkingFacet)); + facetManagement.setJSON(ISMapper.marshal(networkingFacet)); facetManagement.setElementType(NetworkingFacet.NAME); json = facetManagement.create(); logger.debug("Created : {}", json); - networkingFacet = Entities.unmarshal(NetworkingFacet.class, json); + networkingFacet = ISMapper.unmarshal(NetworkingFacet.class, json); logger.debug("Unmarshalled {} {}", NetworkingFacet.NAME, networkingFacet); @@ -289,11 +289,11 @@ public class ERManagementTest extends ScopedTest { resourceManagement = new ResourceManagement(); resourceManagement.setElementType(HostingNode.NAME); - resourceManagement.setJSON(Entities.marshal(hostingNode)); + resourceManagement.setJSON(ISMapper.marshal(hostingNode)); json = resourceManagement.create(); logger.debug("Created : {}", json); - hostingNode = Entities.unmarshal(HostingNode.class, json); + hostingNode = ISMapper.unmarshal(HostingNode.class, json); logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode); map.put(HostingNode.NAME, hostingNode); @@ -370,7 +370,7 @@ public class ERManagementTest extends ScopedTest { cpuFacet.setVendor("AMD"); FacetManagement facetManagement = new FacetManagement(); - facetManagement.setJSON(Entities.marshal(cpuFacet)); + facetManagement.setJSON(ISMapper.marshal(cpuFacet)); facetManagement.setElementType(CPUFacet.NAME); json = facetManagement.create(); @@ -434,7 +434,7 @@ public class ERManagementTest extends ScopedTest { ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(key); String json = resourceManagement.all(false); - List list = Entities.unmarshalList(Resource.class, json); + List list = ISMapper.unmarshalList(Resource.class, json); logger.debug("{} are {} : {} ", key, list.size(), list); Assert.assertTrue(list.size()==MAX); } @@ -445,13 +445,13 @@ public class ERManagementTest extends ScopedTest { ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(Resource.NAME); String json = resourceManagement.all(true); - List list = Entities.unmarshalList(Resource.class, json); + List list = ISMapper.unmarshalList(Resource.class, json); logger.debug("{} are {} : {} ", Resource.NAME, list.size(), list); Assert.assertTrue(list.size()==(MAX*typeNumber)); json = resourceManagement.all(false); - list = Entities.unmarshalList(Resource.class, json); + list = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(list.size()==0); @@ -461,13 +461,13 @@ public class ERManagementTest extends ScopedTest { json = isRelatedToManagement.all(true); - List resourcesList = Entities.unmarshalList(Resource.class, json); + List resourcesList = ISMapper.unmarshalList(Resource.class, json); logger.debug("{} are {} : {} ", IsRelatedTo.NAME, resourcesList.size(), resourcesList); Assert.assertTrue(resourcesList.size()==MAX); json = isRelatedToManagement.all(false); - resourcesList = Entities.unmarshalList(Resource.class, json); + resourcesList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourcesList.size()==0); @@ -478,12 +478,12 @@ public class ERManagementTest extends ScopedTest { ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ERManagement.getERManagement(ConsistsOf.NAME); json = consistsOfManagement.all(true); - List consistsOfPolimorphicList = Entities.unmarshalList(Resource.class, json); + List consistsOfPolimorphicList = ISMapper.unmarshalList(Resource.class, json); logger.debug("{} are {} : {} ", IsRelatedTo.NAME, consistsOfPolimorphicList.size(), consistsOfPolimorphicList); json = consistsOfManagement.all(false); - List consistsOfNonPolimorphicList = Entities.unmarshalList(Resource.class, json); + List consistsOfNonPolimorphicList = ISMapper.unmarshalList(Resource.class, json); logger.debug("{} are {} : {} ", IsRelatedTo.NAME, consistsOfNonPolimorphicList.size(), consistsOfNonPolimorphicList); Assert.assertTrue(consistsOfPolimorphicList.size()>=consistsOfNonPolimorphicList.size()); @@ -518,7 +518,7 @@ public class ERManagementTest extends ScopedTest { /* EService */ String json = isRelatedToManagement.allFrom(eServiceUUID, Direction.BOTH, true); - List resourceList = Entities.unmarshalList(Resource.class, json); + List resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==1); Resource sourceResource = resourceList.get(0); Resource targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); @@ -527,7 +527,7 @@ public class ERManagementTest extends ScopedTest { json = isRelatedToManagement.allFrom(eServiceUUID, Direction.IN, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==1); sourceResource = resourceList.get(0); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); @@ -536,18 +536,18 @@ public class ERManagementTest extends ScopedTest { json = isRelatedToManagement.allFrom(eServiceUUID, Direction.OUT, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.BOTH, false); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.IN, false); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = isRelatedToManagement.allFrom(eServiceUUID, Direction.OUT, false); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); /* END EService */ @@ -555,7 +555,7 @@ public class ERManagementTest extends ScopedTest { /* Hosting Node */ json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.BOTH, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==1); sourceResource = resourceList.get(0); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); @@ -564,11 +564,11 @@ public class ERManagementTest extends ScopedTest { json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.IN, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = isRelatedToManagement.allFrom(hostingNodeUUID, Direction.OUT, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==1); sourceResource = resourceList.get(0); targetResource = sourceResource.getIsRelatedTo().get(0).getTarget(); @@ -577,15 +577,15 @@ public class ERManagementTest extends ScopedTest { 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); 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); 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); /* END HostingNode */ @@ -598,7 +598,7 @@ public class ERManagementTest extends ScopedTest { /* SoftwareFacet of Eservice */ json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.BOTH, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==1); sourceResource = resourceList.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); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.IN, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==1); sourceResource = resourceList.get(0); targetIdentificationFacet = sourceResource.getIdentificationFacets().get(0); @@ -615,22 +615,22 @@ public class ERManagementTest extends ScopedTest { json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.OUT, true); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.BOTH, false); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.IN, false); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); json = consistsOfManagement.allFrom(identificationFacetUUID, Direction.OUT, false); - resourceList = Entities.unmarshalList(Resource.class, json); + resourceList = ISMapper.unmarshalList(Resource.class, json); Assert.assertTrue(resourceList.size()==0); /* END SoftwareFacet of Eservice */ diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java index 8541399..6d52ab9 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java @@ -35,7 +35,7 @@ import org.gcube.informationsystem.impl.relation.ConsistsOfImpl; import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl; import org.gcube.informationsystem.impl.relation.consistsof.HasPersistentMemoryImpl; 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.PropagationConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint; @@ -80,7 +80,7 @@ public class SmartgearResourcesTest extends ScopedTest { @Test public void testHostingNode() throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException { - HostingNode hostingNode = Entities.unmarshal(HostingNode.class, + HostingNode hostingNode = ISMapper.unmarshal(HostingNode.class, HOSTING_NODE); logger.debug("{}", hostingNode); @@ -90,7 +90,7 @@ public class SmartgearResourcesTest extends ScopedTest { String hnJson = resourceManagement.create(); logger.debug("Created : {}", hnJson); - hostingNode = Entities.unmarshal(HostingNode.class, hnJson); + hostingNode = ISMapper.unmarshal(HostingNode.class, hnJson); logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode); UUID hnUUID = hostingNode.getHeader().getUUID(); @@ -98,7 +98,7 @@ public class SmartgearResourcesTest extends ScopedTest { resourceManagement = new ResourceManagement(); resourceManagement.setUUID(hnUUID); String read = resourceManagement.read(); - HostingNode readHN = Entities.unmarshal(HostingNode.class, read); + HostingNode readHN = ISMapper.unmarshal(HostingNode.class, read); logger.debug("Read {} {}", EService.NAME, readHN); Assert.assertTrue(hnUUID.compareTo(readHN.getHeader().getUUID()) == 0); @@ -112,7 +112,7 @@ public class SmartgearResourcesTest extends ScopedTest { @Test public void testEService() throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException { - EService eService = Entities.unmarshal(EService.class, ESERVICE); + EService eService = ISMapper.unmarshal(EService.class, ESERVICE); logger.debug("{}", eService); ResourceManagement resourceManagement = new ResourceManagement(); @@ -120,7 +120,7 @@ public class SmartgearResourcesTest extends ScopedTest { resourceManagement.setJSON(ESERVICE); String json = resourceManagement.create(); - eService = Entities.unmarshal(EService.class, json); + eService = ISMapper.unmarshal(EService.class, json); logger.debug("Created {} {}", EService.NAME, eService); UUID eServiceUUID = eService.getHeader().getUUID(); @@ -128,7 +128,7 @@ public class SmartgearResourcesTest extends ScopedTest { resourceManagement = new ResourceManagement(); resourceManagement.setUUID(eServiceUUID); String read = resourceManagement.read(); - EService readEService = Entities.unmarshal(EService.class, read); + EService readEService = ISMapper.unmarshal(EService.class, read); logger.debug("Read {} {}", EService.NAME, readEService); Assert.assertTrue(eServiceUUID.compareTo(readEService.getHeader() @@ -220,11 +220,11 @@ public class SmartgearResourcesTest extends ScopedTest { ResourceManagement resourceManagement = new ResourceManagement(); resourceManagement.setElementType(HostingNode.NAME); - resourceManagement.setJSON(Entities.marshal(hostingNode)); + resourceManagement.setJSON(ISMapper.marshal(hostingNode)); String json = resourceManagement.create(); - HostingNode hostingNodeToUpdate = Entities.unmarshal(HostingNode.class, + HostingNode hostingNodeToUpdate = ISMapper.unmarshal(HostingNode.class, json); List> consistsOfToRemove = new ArrayList<>(); @@ -270,12 +270,12 @@ public class SmartgearResourcesTest extends ScopedTest { resourceManagement = new ResourceManagement(); resourceManagement.setUUID(uuid); - resourceManagement.setJSON(Entities.marshal(hostingNodeToUpdate)); + resourceManagement.setJSON(ISMapper.marshal(hostingNodeToUpdate)); String updatedHN = resourceManagement.update(); logger.debug("Updated {}", updatedHN); - HostingNode updatedHostingNode = Entities.unmarshal(HostingNode.class, + HostingNode updatedHostingNode = ISMapper.unmarshal(HostingNode.class, updatedHN); logger.debug("Updated Hosting Node {}", updatedHostingNode);