From 945a58a3fc0796a696442d119118cec918aedc1a Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 8 Mar 2021 17:10:39 +0100 Subject: [PATCH] Fixing test --- .../resourceregistry/instances/QueryTest.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/instances/QueryTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/instances/QueryTest.java index 46d045c..606f0a1 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/instances/QueryTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/instances/QueryTest.java @@ -14,6 +14,7 @@ import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.resourceregistry.ContextTest; +import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException; import org.gcube.informationsystem.resourceregistry.api.utils.Utility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement; @@ -61,7 +62,11 @@ public class QueryTest extends ContextTest { String all = rm.all(true); List allResources = ElementMapper.unmarshalList(Resource.class, all); for(Resource r : allResources) { - ERManagementTest.deleteResource(r); + try { + ERManagementTest.deleteResource(r); + }catch (ResourceNotFoundException e) { + // A resource could be already deleted deleting another resource giving the propagation constraint + } } Map> resources = new HashMap<>(); @@ -155,7 +160,11 @@ public class QueryTest extends ContextTest { String all = rm.all(true); List allResources = ElementMapper.unmarshalList(Resource.class, all); for(Resource r : allResources) { - ERManagementTest.deleteResource(r); + try { + ERManagementTest.deleteResource(r); + }catch (ResourceNotFoundException e) { + // A resource could be already deleted deleting another resource giving the propagation constraint + } } Map map = ERManagementTest.createHostingNodeAndEService(); @@ -304,7 +313,11 @@ public class QueryTest extends ContextTest { String all = rm.all(true); List allResources = ElementMapper.unmarshalList(Resource.class, all); for(Resource r : allResources) { - ERManagementTest.deleteResource(r); + try { + ERManagementTest.deleteResource(r); + }catch (ResourceNotFoundException e) { + // A resource could be already deleted deleting another resource giving the propagation constraint + } } String relationType = ConsistsOf.NAME; @@ -362,7 +375,11 @@ public class QueryTest extends ContextTest { String all = rm.all(true); List allResources = ElementMapper.unmarshalList(Resource.class, all); for(Resource r : allResources) { - ERManagementTest.deleteResource(r); + try { + ERManagementTest.deleteResource(r); + }catch (ResourceNotFoundException e) { + // A resource could be already deleted deleting another resource giving the propagation constraint + } }