From c4a2a28b68a141b9cb554de63c9346d19f3520d5 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Tue, 21 Nov 2017 17:35:12 +0000 Subject: [PATCH] Refs #10238: Refactor Context Port Type Task-Url: https://support.d4science.org/issues/10238 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@158741 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../context/ContextManagementImpl.java | 2 +- .../context/ContextManagementImplTest.java | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java index c8a5854..07ec035 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java @@ -348,7 +348,7 @@ public class ContextManagementImpl implements OLDContextManagement { uuid); return true; - } catch (ContextException ce) { + } catch (ContextException | ContextNotFoundException ce) { if (orientGraph != null) { orientGraph.rollback(); } 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 89e0261..cbe2e79 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java @@ -306,21 +306,21 @@ public class ContextManagementImplTest { @Test public void readTest() throws Exception { String name = "LLL"; - String contextJsonA1 = contextManagementImpl.create(null, name); - Context createdContexA1 = ISMapper.unmarshal(Context.class, - contextJsonA1); - UUID A_1 = createdContexA1.getHeader().getUUID(); - logger.info("{}", contextJsonA1); - Assert.assertTrue(createdContexA1.getName().compareTo(name) == 0); + String contextJson = contextManagementImpl.create(null, name); + Context createdContex = ISMapper.unmarshal(Context.class, + contextJson); + UUID uuid = createdContex.getHeader().getUUID(); + logger.info("{}", contextJson); + Assert.assertTrue(createdContex.getName().compareTo(name) == 0); - String readContextJsonA1 = contextManagementImpl.read(A_1); - Context readContexA1 = ISMapper.unmarshal(Context.class, - readContextJsonA1); - Assert.assertTrue(readContexA1.getName().compareTo(name) == 0); - Assert.assertTrue(A_1.compareTo(readContexA1.getHeader().getUUID()) == 0); - logger.trace("{}", createdContexA1); + String readContextJson = contextManagementImpl.read(uuid); + Context readContex = ISMapper.unmarshal(Context.class, + readContextJson); + Assert.assertTrue(readContex.getName().compareTo(name) == 0); + Assert.assertTrue(uuid.compareTo(readContex.getHeader().getUUID()) == 0); + logger.trace("{}", createdContex); - boolean deleted = contextManagementImpl.delete(A_1); + boolean deleted = contextManagementImpl.delete(uuid); Assert.assertTrue(deleted); }