From a72cd18a7e5ec4e8fa8d4bb3ad76e8cee9193e6a Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 3 Feb 2020 10:52:35 +0100 Subject: [PATCH] Fixed imports and class names due to IS Model refactoring --- .../ResourceRegistryContextClientImpl.java | 18 ++++++++--------- .../ResourceRegistryContextClientTest.java | 20 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientImpl.java index 0977c09..58b7563 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientImpl.java @@ -14,7 +14,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.context.Conte import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.ContextPath; import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility; -import org.gcube.informationsystem.utils.ISMapper; +import org.gcube.informationsystem.utils.ElementMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,7 +41,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex } UUID uuid = context.getHeader().getUUID(); - String contextString = ISMapper.marshal(context); + String contextString = ElementMapper.marshal(context); logger.trace("Going to create {}", contextString); @@ -71,7 +71,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex public Context create(Context context) throws ContextAlreadyPresentException, ResourceRegistryException { try { String res = internalCreate(context); - return ISMapper.unmarshal(Context.class, res); + return ElementMapper.unmarshal(Context.class, res); } catch(ResourceRegistryException e) { // logger.trace("Error Creating {}", facet, e); throw e; @@ -84,7 +84,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex @Override public String create(String context) throws ContextAlreadyPresentException, ResourceRegistryException { try { - Context c = ISMapper.unmarshal(Context.class, context); + Context c = ElementMapper.unmarshal(Context.class, context); return internalCreate(c); } catch(ResourceRegistryException e) { // logger.trace("Error Creating {}", facet, e); @@ -104,7 +104,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex public Context read(UUID uuid) throws ContextNotFoundException, ResourceRegistryException { try { String res = read(uuid.toString()); - return ISMapper.unmarshal(Context.class, res); + return ElementMapper.unmarshal(Context.class, res); } catch(ResourceRegistryException e) { // logger.trace("Error Creating {}", facet, e); throw e; @@ -141,7 +141,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex public String internalUpdate(Context context) throws ResourceRegistryException { try { - String contextString = ISMapper.marshal(context); + String contextString = ElementMapper.marshal(context); logger.trace("Going to update {}", contextString); UUID uuid = context.getHeader().getUUID(); @@ -172,7 +172,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex public Context update(Context context) throws ResourceRegistryException { try { String res = internalUpdate(context); - return ISMapper.unmarshal(Context.class, res); + return ElementMapper.unmarshal(Context.class, res); } catch(ResourceRegistryException e) { // logger.trace("Error Updating {}", facet, e); throw e; @@ -185,7 +185,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex @Override public String update(String context) throws ResourceRegistryException { try { - Context c = ISMapper.unmarshal(Context.class, context); + Context c = ElementMapper.unmarshal(Context.class, context); return internalUpdate(c); } catch(ResourceRegistryException e) { // logger.trace("Error Updating {}", facet, e); @@ -246,7 +246,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex String all = HTTPUtility.getResponse(String.class, httpURLConnection); logger.debug("Got contexts are {}", Context.NAME, all); - return ISMapper.unmarshalList(Context.class, all); + return ElementMapper.unmarshalList(Context.class, all); } catch(ResourceRegistryException e) { // logger.trace("Error Creating {}", facet, e); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientTest.java index 74717da..20d5eba 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ResourceRegistryContextClientTest.java @@ -10,7 +10,7 @@ import org.gcube.common.authorization.client.Constants; import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.authorization.library.provider.ClientInfo; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; -import org.gcube.informationsystem.base.reference.ER; +import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.context.impl.entities.ContextImpl; import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.model.reference.properties.Header; @@ -18,7 +18,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; -import org.gcube.informationsystem.utils.ISMapper; +import org.gcube.informationsystem.utils.ElementMapper; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -62,7 +62,7 @@ public class ResourceRegistryContextClientTest extends ContextTest { return user; } - public static void checkHeader(ER er, UUID uuid, boolean create) { + public static void checkHeader(IdentifiableElement er, UUID uuid, boolean create) { Assert.assertTrue(er.getHeader() != null); Assert.assertTrue(er.getHeader().getUUID() != null); @@ -133,23 +133,23 @@ public class ResourceRegistryContextClientTest extends ContextTest { protected void invalidCreate(Context context) throws ResourceRegistryException, IOException { try { Context c = create(context); - throw new RuntimeException(ISMapper.marshal(c) + " was created successfully. This is not what we expected"); + throw new RuntimeException(ElementMapper.marshal(c) + " was created successfully. This is not what we expected"); } catch(ContextAlreadyPresentException e) { - logger.debug("As expected {} cannot be created.", ISMapper.marshal(context)); + logger.debug("As expected {} cannot be created.", ElementMapper.marshal(context)); } } protected void invalidUpdate(Context context) throws ResourceRegistryException, IOException { try { Context c = update(context); - throw new RuntimeException(ISMapper.marshal(c) + " was updated successfully. This is not what we expected"); + throw new RuntimeException(ElementMapper.marshal(c) + " was updated successfully. This is not what we expected"); } catch(ContextAlreadyPresentException e) { - logger.debug("As expected {} cannot be updated.", ISMapper.marshal(context)); + logger.debug("As expected {} cannot be updated.", ElementMapper.marshal(context)); } } protected void invalidDelete(Context context) throws ResourceRegistryException, JsonProcessingException { - String contextString = ISMapper.marshal(context); + String contextString = ElementMapper.marshal(context); try { delete(context); throw new RuntimeException(contextString + " was deleted successfully. This is not what we expected"); @@ -162,7 +162,7 @@ public class ResourceRegistryContextClientTest extends ContextTest { public void readTest() throws Exception { UUID uuid = UUID.fromString("4828d488-285b-4383-af4b-4d72069ad11b"); Context gcube = read(uuid); - logger.debug(ISMapper.marshal(gcube)); + logger.debug(ElementMapper.marshal(gcube)); } @Test @@ -361,7 +361,7 @@ public class ResourceRegistryContextClientTest extends ContextTest { public void testGetAll() throws Exception { List all = resourceRegistryContextClient.all(); for(Context c : all) { - logger.debug("{}", ISMapper.marshal(c)); + logger.debug("{}", ElementMapper.marshal(c)); } }