Exposing AddToContext APi refs #5701

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@134041 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-11-10 14:13:51 +00:00
parent 6bf96d6189
commit 2d2f13a67c
9 changed files with 367 additions and 66 deletions

View File

@ -86,6 +86,8 @@ public class SecurityContext {
SecurityContextMapper.PermissionMode.READER,
SecurityContextMapper.SecurityType.ROLE, context));
oDocument.save();
// oSecurity.allowRole(oDocument, ORestrictedOperation.ALLOW_ALL,
// DEFAULT_WRITER_ROLE);
// oSecurity.allowRole(oDocument, ORestrictedOperation.ALLOW_READ,
@ -141,7 +143,9 @@ public class SecurityContext {
readerUser.save();
logger.trace("{} created", readerUser);
oDatabaseDocumentTx.commit();
if(commit){
oDatabaseDocumentTx.commit();
}
logger.trace(
"Security Context (roles and users) with UUID {} successfully created",
@ -197,7 +201,9 @@ public class SecurityContext {
logger.error("{} was not dropped successfully", role);
}
oDatabaseDocumentTx.commit();
if(commit){
oDatabaseDocumentTx.commit();
}
logger.trace(
"Security Context (roles and users) with UUID {} successfully removed",

View File

@ -14,9 +14,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.resourceregistry.api.ContextManagement;
import org.gcube.informationsystem.resourceregistry.api.exceptions.InternalException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -26,18 +23,11 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.context.Conte
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.rest.ContextPath;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
import org.gcube.informationsystem.resourceregistry.api.rest.EntityPath;
import org.gcube.informationsystem.resourceregistry.resources.impl.ContextManagementImpl;
import org.gcube.informationsystem.resourceregistry.resources.impl.EntityManagementImpl;
import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
/**
* @author Luca Frosini (ISTI - CNR)
* @author Lucio Lelii (ISTI - CNR)
@ -138,48 +128,18 @@ public class ContextManager {
UUID.fromString(uuid));
}
protected <E extends Entity> boolean addEntityToContext(Class<E> clz,
String uuid) throws FacetNotFoundException,
ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
EntityManagementImpl entityManagement = new EntityManagementImpl();
OrientGraph orientGraph;
orientGraph = SecurityContextMapper.getSecurityContextFactory(
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
PermissionMode.WRITER).getTx();
Vertex vertex = entityManagement.getEntity(orientGraph,
UUID.fromString(uuid), null, clz);
ContextUtility.addToActualContext(orientGraph, vertex);
if (Resource.class.isAssignableFrom(clz)) {
// TODO Add all related facet to the context
}
((OrientVertex) vertex).save();
/*
* TODO check if needed. Is such a case add a parameter to allow
* addToActualContext function to save because it it also needed for
* related edge.
*/
return true;
}
@POST
@Path("add/" + EntityPath.RESOURCE_PATH_PART + "/{" + ID_PATH_PARAM + "}")
public boolean addResourceToContext(String uuid) throws ResourceNotFoundException,
ContextNotFoundException, ResourceRegistryException {
return addEntityToContext(Resource.class, uuid);
return contextManager.addResourceToContext(UUID.fromString(uuid));
}
@POST
@Path("add/" + EntityPath.FACET_PATH_PART + "/{" + ID_PATH_PARAM + "}")
public boolean addFacetToContext(String uuid) throws FacetNotFoundException,
ContextNotFoundException, ResourceRegistryException {
return addEntityToContext(Facet.class, uuid);
return contextManager.addFacetToContext(UUID.fromString(uuid));
}
}

View File

@ -8,6 +8,10 @@ import java.util.UUID;
import org.gcube.informationsystem.model.embedded.Header;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsParentOf;
import org.gcube.informationsystem.resourceregistry.api.ContextManagement;
import org.gcube.informationsystem.resourceregistry.api.exceptions.InternalException;
@ -15,9 +19,12 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.context.SecurityContext;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility;
import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderUtility;
import org.gcube.informationsystem.resourceregistry.resources.utils.Utility;
import org.slf4j.Logger;
@ -219,8 +226,9 @@ public class ContextManagementImpl implements ContextManagement {
}
Vertex parent = edge.getVertex(Direction.OUT);
parentUUID = UUID.fromString((String) parent.getProperty(Context.HEADER_PROPERTY + "."
+ Header.UUID_PROPERTY));
parentUUID = UUID.fromString((String) parent
.getProperty(Context.HEADER_PROPERTY + "."
+ Header.UUID_PROPERTY));
}
checkContext(orientGraph, parentUUID, newName);
@ -366,4 +374,59 @@ public class ContextManagementImpl implements ContextManagement {
}
}
protected <E extends Entity> boolean addEntityToContext(Class<E> clz,
UUID uuid) throws FacetNotFoundException,
ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
EntityManagementImpl entityManagement = new EntityManagementImpl();
OrientGraph orientGraph = null;
try {
orientGraph = SecurityContextMapper.getSecurityContextFactory(
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
PermissionMode.WRITER).getTx();
Vertex vertex = entityManagement.getEntity(orientGraph, uuid, null,
clz);
UUID contextUUID = ContextUtility.addToActualContext(orientGraph, vertex);
if (Resource.class.isAssignableFrom(clz)) {
Iterable<Vertex> facets = vertex.getVertices(Direction.OUT,
ConsistsOf.NAME);
for (Vertex facet : facets) {
ContextUtility.addToActualContext(orientGraph, facet);
}
}
orientGraph.commit();
logger.info("{} with UUID {} successfully added to actual Context with UUID {}", clz.getSimpleName(),
uuid, contextUUID);
return true;
} catch (Exception e) {
if (orientGraph != null) {
orientGraph.rollback();
}
throw new ContextException(e.getMessage());
} finally {
if (orientGraph != null) {
orientGraph.shutdown();
}
}
}
@Override
public boolean addResourceToContext(UUID uuid)
throws ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return addEntityToContext(Resource.class, uuid);
}
@Override
public boolean addFacetToContext(UUID uuid) throws FacetNotFoundException,
ContextNotFoundException, ResourceRegistryException {
return addEntityToContext(Facet.class, uuid);
}
}

View File

@ -44,6 +44,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.NullNode;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
@ -396,7 +397,9 @@ public class EntityManagementImpl implements EntityManagement {
continue;
}
JsonNode value = entry.getValue();
vertex.setProperty(entry.getKey(), value.asText());
if(!(value instanceof NullNode)){
vertex.setProperty(entry.getKey(), value.asText());
}
}
}
@ -415,7 +418,7 @@ public class EntityManagementImpl implements EntityManagement {
return vertex;
} catch (Exception e) {
if (orientGraph != null) {
if (orientGraph != null && !deferredCommit) {
orientGraph.rollback();
}
throw new ResourceRegistryException("Error Creating " + entityType

View File

@ -41,28 +41,32 @@ public class ContextUtility {
private static final Logger logger = LoggerFactory
.getLogger(ContextUtility.class);
public static void addToActualContext(OrientGraph orientGraph, Vertex vertex)
public static UUID addToActualContext(OrientGraph orientGraph, Vertex vertex)
throws ContextException {
UUID contextUUID = ContextUtility.getActualContextUUID();
SecurityContext.addToSecurityContext(orientGraph, vertex, contextUUID);
return contextUUID;
}
public static void addToActualContext(OSecurity oSecurity, Vertex vertex)
public static UUID addToActualContex(OSecurity oSecurity, Vertex vertex)
throws ContextException {
UUID contextUUID = ContextUtility.getActualContextUUID();
SecurityContext.addToSecurityContext(oSecurity, vertex, contextUUID);
return contextUUID;
}
public static void addToActualContext(OrientGraph orientGraph, Edge edge)
public static UUID addToActualContext(OrientGraph orientGraph, Edge edge)
throws ContextException {
UUID contextUUID = ContextUtility.getActualContextUUID();
SecurityContext.addToSecurityContext(orientGraph, edge, contextUUID);
return contextUUID;
}
public static void addToActualContext(OSecurity oSecurity, Edge edge)
public static UUID addToActualContext(OSecurity oSecurity, Edge edge)
throws ContextException {
UUID contextUUID = ContextUtility.getActualContextUUID();
SecurityContext.addToSecurityContext(oSecurity, edge, contextUUID);
return contextUUID;
}
protected static UUID getContextUUIDFromContextVertex(Vertex vertex) {
@ -82,8 +86,8 @@ public class ContextUtility {
}
return authorizationEntry.getContext();
}
public static UUID getActualContextUUID() throws ContextException {
public static Vertex getActualContextVertex() throws ContextNotFoundException, ContextException{
try {
String scope = getCurrentScope();
if(scope==null){
@ -94,14 +98,25 @@ public class ContextUtility {
.getSecurityContextFactory(
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
PermissionMode.READER);
Vertex context = ContextUtility.getContextVertexByFullName(
return ContextUtility.getContextVertexByFullName(
factory.getTx(), scope);
} catch (ContextNotFoundException e) {
throw e;
} catch (Exception e) {
throw new ContextException(
"Unable to restrive Context Vertex for current Context", e);
}
}
public static UUID getActualContextUUID() throws ContextException {
try {
Vertex context = getActualContextVertex();
return getContextUUIDFromContextVertex(context);
} catch (ContextException e) {
throw e;
} catch (Exception e) {
throw new ContextException(
"Unable to restrive Context UUID from current Context", e);
"Unable to restrive Context UUID for current Context", e);
}
}

View File

@ -3,9 +3,12 @@ package org.gcube.informationsystem.resourceregistry;
import java.util.UUID;
import org.gcube.informationsystem.resourceregistry.api.ContextManagement;
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.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.ResourceNotFoundException;
import org.glassfish.hk2.api.Factory;
public class ContextManagerFactory implements Factory<ContextManagement> {
@ -48,6 +51,24 @@ public class ContextManagerFactory implements Factory<ContextManagement> {
throws ContextNotFoundException, ContextException {
return "{}";
}
@Override
public boolean addResourceToContext(UUID uuid)
throws ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean addFacetToContext(UUID uuid)
throws FacetNotFoundException, ContextNotFoundException,
ResourceRegistryException {
// TODO Auto-generated method stub
return false;
}
};

View File

@ -0,0 +1,49 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.facet;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.informationsystem.impl.entity.facet.AccessPointFacetImpl;
import org.gcube.informationsystem.impl.utils.Entities;
import org.gcube.informationsystem.model.entity.facet.AccessPointFacet;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.resources.impl.EntityManagementImpl;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class FacetCreationTest {
private static Logger logger = LoggerFactory
.getLogger(FacetCreationTest.class);
protected EntityManagementImpl entityManagementImpl;
public FacetCreationTest() {
entityManagementImpl = new EntityManagementImpl();
}
@Test
public void createAccessPointFacet() throws URISyntaxException, ResourceRegistryException, IOException{
ScopeProvider.instance.set("/gcube/devNext");
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
accessPointFacet.setEndpoint(new URI("http://localhost"));
accessPointFacet.setEntryName("port1");
String json = entityManagementImpl.createFacet(AccessPointFacet.NAME, Entities.marshal(accessPointFacet));
logger.debug("Created : {}", json);
accessPointFacet = Entities.unmarshal(AccessPointFacet.class, json);
logger.debug("Unmarshalled {} {}", AccessPointFacet.NAME, accessPointFacet);
}
}

View File

@ -195,14 +195,24 @@ public class ContextManagementImplTest {
logger.debug("The DB should be now clean");
}
@Test
public void createContext() throws ContextNotFoundException,
ContextException, InternalException, JsonParseException,
JsonMappingException, IOException {
String testJson = contextManagementImpl.create(null, "test");
Context testContext = Entities.unmarshal(Context.class, testJson);
UUID testUUID = testContext.getHeader().getUUID();
logger.trace("/test : {}", testUUID);
}
@Test
public void createDevContext() throws ContextNotFoundException,
ContextException, InternalException, JsonParseException,
JsonMappingException, IOException {
String gcubeJson = contextManagementImpl.create(null, "gcube");
Context gcubeContex = Entities.unmarshal(Context.class, gcubeJson);
UUID gcube = gcubeContex.getHeader().getUUID();
Context gcubeContext = Entities.unmarshal(Context.class, gcubeJson);
UUID gcube = gcubeContext.getHeader().getUUID();
logger.trace("/gcube : {}", gcubeJson);
String devsecJson = contextManagementImpl.create(gcube, "devsec");
@ -238,11 +248,12 @@ public class ContextManagementImplTest {
logger.debug("The DB should be now clean");
}
//@Test
@Test
public void removeDevContext() throws ContextNotFoundException,
ContextException, InternalException {
contextManagementImpl.delete(UUID
.fromString("28f2ce60-e1dd-47e6-9780-58ad8aeb35ed"));
.fromString("4c39472d-3ee8-4da3-8a4f-53d06af4fd4b"));
}
@Test

View File

@ -0,0 +1,173 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.resources.impl;
import java.net.URI;
import java.net.URL;
import java.util.Calendar;
import java.util.UUID;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.informationsystem.impl.entity.facet.AccessPointFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.CPUFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.EventFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.LicenseFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.MemoryFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.NetworkingFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.ServiceStateFacetImpl;
import org.gcube.informationsystem.impl.entity.facet.SoftwareFacetImpl;
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.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.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.entity.facet.AccessPointFacet;
import org.gcube.informationsystem.model.entity.facet.CPUFacet;
import org.gcube.informationsystem.model.entity.facet.EventFacet;
import org.gcube.informationsystem.model.entity.facet.LicenseFacet;
import org.gcube.informationsystem.model.entity.facet.MemoryFacet;
import org.gcube.informationsystem.model.entity.facet.MemoryFacet.MemoryUnit;
import org.gcube.informationsystem.model.entity.facet.NetworkingFacet;
import org.gcube.informationsystem.model.entity.facet.ServiceStateFacet;
import org.gcube.informationsystem.model.entity.facet.SoftwareFacet;
import org.gcube.informationsystem.model.entity.resource.EService;
import org.gcube.informationsystem.model.entity.resource.HostingNode;
import org.gcube.informationsystem.model.relation.IsIdentifiedBy;
import org.gcube.informationsystem.model.relation.consistsof.HasPersistentMemory;
import org.gcube.informationsystem.model.relation.consistsof.HasVolatileMemory;
import org.gcube.informationsystem.model.relation.isrelatedto.Hosts;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.ResourceNotFoundException;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
public class MultiContextTest {
private static Logger logger = LoggerFactory
.getLogger(EntityManagementImplTest.class);
protected ContextManagementImpl contextManagementImpl;
protected EntityManagementImpl entityManagementImpl;
public MultiContextTest() {
entityManagementImpl = new EntityManagementImpl();
contextManagementImpl = new ContextManagementImpl();
}
@Test
public void testCreateHostingNode() throws Exception {
ScopeProvider.instance.set("/gcube/devNext");
EService eService = new EServiceImpl();
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
softwareFacet.setGroup("InformationSystem");
softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<Resource, Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(eService, softwareFacet, null);
eService.addFacet(isIdentifiedBy);
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
accessPointFacet.setEndpoint(new URI("http://localhost"));
accessPointFacet.setEntryName("port1");
eService.addFacet(accessPointFacet);
EventFacet eventFacet = new EventFacetImpl();
eventFacet.setDate(Calendar.getInstance().getTime());
eventFacet.setValue("Created");
eService.addFacet(eventFacet);
ServiceStateFacet serviceStateFacet = new ServiceStateFacetImpl();
serviceStateFacet.setValue("ready");
eService.addFacet(serviceStateFacet);
LicenseFacet licenseFacet = new LicenseFacetImpl();
licenseFacet.setName("EUPL");
licenseFacet.setTextURL(new URL("https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
eService.addFacet(licenseFacet);
String json = entityManagementImpl.createResource(EService.NAME, Entities.marshal(eService));
logger.debug("Created : {}", json);
eService = Entities.unmarshal(EService.class, json);
logger.debug("Unmarshalled {} {}", EService.NAME, eService);
/* ----- */
HostingNode hostingNode = new HostingNodeImpl();
NetworkingFacet networkingFacet = new NetworkingFacetImpl();
networkingFacet.setIPAddress("146.48.87.183");
networkingFacet.setHostName("pc-frosini.isti.cnr.it");
networkingFacet.setDomainName("isti.cnr.it");
networkingFacet.setMask("255.255.248.0");
networkingFacet.setBroadcastAddress("146.48.87.255");
isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(hostingNode, networkingFacet, null);
hostingNode.addFacet(isIdentifiedBy);
CPUFacet cpuFacet = new CPUFacetImpl();
cpuFacet.setClockSpeed("1 GHz");
cpuFacet.setModel("Opteron");
cpuFacet.setVendor("AMD");
hostingNode.addFacet(cpuFacet);
MemoryFacet ram = new MemoryFacetImpl();
ram.setSize(8);
ram.setUnit(MemoryUnit.GB);
ram.setUsed(2);
HasVolatileMemory<HostingNode, MemoryFacet> hasVolatileMemory =
new HasVolatileMemoryImpl<HostingNode, MemoryFacet>(hostingNode, ram, null);
hostingNode.addFacet(hasVolatileMemory);
MemoryFacet disk = new MemoryFacetImpl();
disk.setSize(256);
disk.setUnit(MemoryUnit.GB);
disk.setUsed(120);
HasPersistentMemory<HostingNode, MemoryFacet> hasPersistentMemory =
new HasPersistentMemoryImpl<HostingNode, MemoryFacet>(hostingNode, disk, null);
hostingNode.addFacet(hasPersistentMemory);
Hosts<HostingNode, EService> hosts = new HostsImpl<HostingNode, EService>(hostingNode, eService, null);
hostingNode.attachResource(hosts);
json = entityManagementImpl.createResource(HostingNode.NAME, Entities.marshal(hostingNode));
hostingNode = Entities.unmarshal(HostingNode.class, json);
logger.debug("Created : {}", json);
ScopeProvider.instance.set("/gcube/devNext/NextNext");
contextManagementImpl.addResourceToContext(hostingNode.getHeader().getUUID());
}
@Test
public void addTest() throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException{
ScopeProvider.instance.set("/gcube/devsec");
contextManagementImpl.addResourceToContext(UUID.fromString("36799dbc-e0df-463d-9895-861cc19a9442"));
}
}