Metadata are included only if requested by the client
This commit is contained in:
parent
3fbdc1d734
commit
119ae14dfa
|
@ -51,33 +51,6 @@ public class ContextUtility {
|
||||||
contexts = new HashMap<>();
|
contexts = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final InheritableThreadLocal<Boolean> hierarchicalMode = new InheritableThreadLocal<Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean initialValue() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
public static InheritableThreadLocal<Boolean> getHierarchicalMode() {
|
|
||||||
return hierarchicalMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final InheritableThreadLocal<Boolean> includeInstanceContexts = new InheritableThreadLocal<Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean initialValue() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
public static InheritableThreadLocal<Boolean> getIncludeInstanceContexts() {
|
|
||||||
return includeInstanceContexts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCurrentContextFullName() {
|
public static String getCurrentContextFullName() {
|
||||||
return SecretManagerProvider.instance.get().getContext();
|
return SecretManagerProvider.instance.get().getContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.gcube.informationsystem.contexts.reference.entities.Context;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
|
import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
|
||||||
import org.gcube.informationsystem.utils.UUIDManager;
|
import org.gcube.informationsystem.utils.UUIDManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -93,7 +94,7 @@ public class SecurityContext {
|
||||||
protected Set<SecurityContext> children;
|
protected Set<SecurityContext> children;
|
||||||
|
|
||||||
protected boolean isHierarchicalMode() {
|
protected boolean isHierarchicalMode() {
|
||||||
return hierarchical && ContextUtility.getHierarchicalMode().get();
|
return hierarchical && RequestUtility.getRequestInfo().get().isHierarchicalMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentSecurityContext(SecurityContext parentSecurityContext) {
|
public void setParentSecurityContext(SecurityContext parentSecurityContext) {
|
||||||
|
@ -419,7 +420,7 @@ public class SecurityContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean call() throws Exception {
|
public Boolean call() throws Exception {
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
RequestUtility.getRequestInfo().get().setHierarchicalMode(false);
|
||||||
|
|
||||||
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
|
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
|
||||||
ODatabaseDocument oDatabaseDocument = null;
|
ODatabaseDocument oDatabaseDocument = null;
|
||||||
|
|
|
@ -46,6 +46,8 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityCo
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.base.properties.PropertyElementManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.base.properties.PropertyElementManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.Operation;
|
import org.gcube.informationsystem.resourceregistry.instances.model.Operation;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestInfo;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.types.CachedType;
|
import org.gcube.informationsystem.resourceregistry.types.CachedType;
|
||||||
import org.gcube.informationsystem.resourceregistry.types.TypesCache;
|
import org.gcube.informationsystem.resourceregistry.types.TypesCache;
|
||||||
import org.gcube.informationsystem.resourceregistry.utils.MetadataOrient;
|
import org.gcube.informationsystem.resourceregistry.utils.MetadataOrient;
|
||||||
|
@ -178,7 +180,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
||||||
this.dryRun = dryRun;
|
this.dryRun = dryRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setAsEntryPoint() {
|
public void setAsEntryPoint() {
|
||||||
this.entryPoint = true;
|
this.entryPoint = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,14 +403,14 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
||||||
|
|
||||||
/* Add first these key to provide an order in Json */
|
/* Add first these key to provide an order in Json */
|
||||||
|
|
||||||
|
RequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||||
|
|
||||||
List<String> keysToAddFirst = new ArrayList<>();
|
List<String> keysToAddFirst = new ArrayList<>();
|
||||||
keysToAddFirst.add(Element.TYPE_PROPERTY);
|
keysToAddFirst.add(Element.TYPE_PROPERTY);
|
||||||
keysToAddFirst.add(Element.SUPERTYPES_PROPERTY);
|
keysToAddFirst.add(Element.SUPERTYPES_PROPERTY);
|
||||||
keysToAddFirst.add(IdentifiableElement.ID_PROPERTY);
|
keysToAddFirst.add(IdentifiableElement.ID_PROPERTY);
|
||||||
keysToAddFirst.add(IdentifiableElement.METADATA_PROPERTY);
|
keysToAddFirst.add(IdentifiableElement.METADATA_PROPERTY);
|
||||||
if(ContextUtility.getIncludeInstanceContexts().get()) {
|
keysToAddFirst.add(ERElement.CONTEXTS_PROPERTY);
|
||||||
keysToAddFirst.add(ERElement.CONTEXTS_PROPERTY);
|
|
||||||
}
|
|
||||||
keysToAddFirst.add(Relation.PROPAGATION_CONSTRAINT_PROPERTY);
|
keysToAddFirst.add(Relation.PROPAGATION_CONSTRAINT_PROPERTY);
|
||||||
|
|
||||||
for(String key : keysToAddFirst) {
|
for(String key : keysToAddFirst) {
|
||||||
|
@ -423,8 +425,18 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
||||||
objectNode.replace(Element.SUPERTYPES_PROPERTY, arrayNode);
|
objectNode.replace(Element.SUPERTYPES_PROPERTY, arrayNode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IdentifiableElement.METADATA_PROPERTY:
|
||||||
|
if(requestInfo.includeMeta()) {
|
||||||
|
if(requestInfo.allMeta() || entryPoint) {
|
||||||
|
analizeProperty(element, key, objectNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case ERElement.CONTEXTS_PROPERTY:
|
case ERElement.CONTEXTS_PROPERTY:
|
||||||
objectNode.replace(ERElement.CONTEXTS_PROPERTY, getContextsAsObjectNode());
|
if(requestInfo.includeContexts()) {
|
||||||
|
objectNode.replace(ERElement.CONTEXTS_PROPERTY, getContextsAsObjectNode());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -501,6 +501,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
||||||
EntityManagement<?,?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
EntityManagement<?,?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||||
oDatabaseDocument, (OVertex) vertex);
|
oDatabaseDocument, (OVertex) vertex);
|
||||||
try {
|
try {
|
||||||
|
entityManagement.setAsEntryPoint();
|
||||||
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
|
@ -689,6 +690,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
||||||
jsonNode = entityManagement.serializeAsJsonNode();
|
jsonNode = entityManagement.serializeAsJsonNode();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
entityManagement.setAsEntryPoint();
|
||||||
JsonNode node = entityManagement.serializeAsJsonNode();
|
JsonNode node = entityManagement.serializeAsJsonNode();
|
||||||
|
|
||||||
arrayNode.add(node);
|
arrayNode.add(node);
|
||||||
|
@ -798,6 +800,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
entityManagement.setAsEntryPoint();
|
||||||
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class QueryImpl implements Query {
|
||||||
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
|
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
|
||||||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
||||||
element);
|
element);
|
||||||
|
erManagement.setAsEntryPoint();
|
||||||
jsonNode = erManagement.serializeAsJsonNode();
|
jsonNode = erManagement.serializeAsJsonNode();
|
||||||
}
|
}
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
|
|
|
@ -142,6 +142,7 @@ public class JsonQuery {
|
||||||
String gotType = erManagement.getTypeName();
|
String gotType = erManagement.getTypeName();
|
||||||
|
|
||||||
if(requestedType.compareTo(gotType)==0) {
|
if(requestedType.compareTo(gotType)==0) {
|
||||||
|
erManagement.setAsEntryPoint();
|
||||||
jsonNodeResult = erManagement.serializeAsJsonNode();
|
jsonNodeResult = erManagement.serializeAsJsonNode();
|
||||||
arrayNode.add(jsonNodeResult);
|
arrayNode.add(jsonNodeResult);
|
||||||
continue;
|
continue;
|
||||||
|
@ -149,6 +150,7 @@ public class JsonQuery {
|
||||||
|
|
||||||
CachedType<?> cachedType = TypesCache.getInstance().getCachedType(gotType);
|
CachedType<?> cachedType = TypesCache.getInstance().getCachedType(gotType);
|
||||||
if(cachedType.getSuperTypes().contains(requestedType)) {
|
if(cachedType.getSuperTypes().contains(requestedType)) {
|
||||||
|
erManagement.setAsEntryPoint();
|
||||||
jsonNodeResult = erManagement.serializeAsJsonNode();
|
jsonNodeResult = erManagement.serializeAsJsonNode();
|
||||||
arrayNode.add(jsonNodeResult);
|
arrayNode.add(jsonNodeResult);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
package org.gcube.informationsystem.resourceregistry.requests;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
||||||
|
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||||
|
import org.gcube.informationsystem.model.reference.properties.Metadata;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public class RequestInfo {
|
||||||
|
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(RequestInfo.class);
|
||||||
|
|
||||||
|
protected UriInfo uriInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track if the request requested to include {@link Metadata}
|
||||||
|
*/
|
||||||
|
protected boolean includeMeta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track if the request requested to include {@link Metadata} in all
|
||||||
|
* {@link IdentifiableElement} or just in the root instance
|
||||||
|
*/
|
||||||
|
protected boolean allMeta;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track if hierarchicalMode has been requested
|
||||||
|
*/
|
||||||
|
protected boolean hierarchicalMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track if the request requested to include contexts
|
||||||
|
*/
|
||||||
|
protected boolean includeContexts;
|
||||||
|
|
||||||
|
public RequestInfo() {
|
||||||
|
this.includeMeta = false;
|
||||||
|
this.allMeta = false;
|
||||||
|
this.hierarchicalMode = false;
|
||||||
|
this.includeContexts = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the parameter if the user is allowed otherwise the default is maintained
|
||||||
|
* @param queryParameterKey requested query parameter
|
||||||
|
* @param bool the value to set
|
||||||
|
* @return the value of variable corresponding the request parameter independetly if
|
||||||
|
* the value has been set.
|
||||||
|
*/
|
||||||
|
protected boolean setIfAllowed(String queryParameterKey, boolean bool) {
|
||||||
|
switch (queryParameterKey) {
|
||||||
|
case InstancePath.INCLUDE_META_QUERY_PARAMETER:
|
||||||
|
// TODO check is the user has the role to request such parameter
|
||||||
|
includeMeta = bool;
|
||||||
|
return includeMeta;
|
||||||
|
|
||||||
|
case InstancePath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER:
|
||||||
|
// TODO check is the user has the role to request such parameter
|
||||||
|
allMeta = bool;
|
||||||
|
return allMeta;
|
||||||
|
|
||||||
|
case InstancePath.INCLUDE_CONTEXTS_QUERY_PARAMETER:
|
||||||
|
// TODO check is the user has the role to request such parameter
|
||||||
|
includeContexts = bool;
|
||||||
|
return includeContexts;
|
||||||
|
|
||||||
|
case InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER:
|
||||||
|
// TODO check is the user has the role to request such parameter
|
||||||
|
hierarchicalMode = bool;
|
||||||
|
return hierarchicalMode;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkQueryParameter(String queryParameterKey) {
|
||||||
|
try {
|
||||||
|
List<String> queryParameterList = uriInfo.getQueryParameters().get(queryParameterKey);
|
||||||
|
if(queryParameterList!=null && queryParameterList.size()>0) {
|
||||||
|
String booleanString = queryParameterList.get(0);
|
||||||
|
boolean bool = Boolean.valueOf(booleanString);
|
||||||
|
setIfAllowed(queryParameterKey, bool);
|
||||||
|
}
|
||||||
|
}catch (Throwable t) {
|
||||||
|
logger.warn("Unable to properly set the Hierarchical Mode is set", t.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUriInfo(UriInfo uriInfo) {
|
||||||
|
this.uriInfo = uriInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkAllQueryParameters() {
|
||||||
|
checkIncludeQueryParameters();
|
||||||
|
checkQueryParameter(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkIncludeQueryParameters() {
|
||||||
|
checkQueryParameter(InstancePath.INCLUDE_META_QUERY_PARAMETER);
|
||||||
|
checkQueryParameter(InstancePath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER);
|
||||||
|
checkQueryParameter(InstancePath.INCLUDE_CONTEXTS_QUERY_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean includeMeta() {
|
||||||
|
return includeMeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncludeMeta(boolean includeMeta) {
|
||||||
|
this.includeMeta = includeMeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean allMeta() {
|
||||||
|
return allMeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllMeta(boolean allMeta) {
|
||||||
|
this.allMeta = allMeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHierarchicalMode() {
|
||||||
|
return hierarchicalMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHierarchicalMode(boolean hierarchicalMode) {
|
||||||
|
this.hierarchicalMode = hierarchicalMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean includeContexts() {
|
||||||
|
return includeContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncludeContexts(boolean includeContexts) {
|
||||||
|
this.includeContexts = includeContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.gcube.informationsystem.resourceregistry.requests;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public class RequestUtility {
|
||||||
|
|
||||||
|
private static final InheritableThreadLocal<RequestInfo> requestInfo = new InheritableThreadLocal<RequestInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected RequestInfo initialValue() {
|
||||||
|
return new RequestInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public static InheritableThreadLocal<RequestInfo> getRequestInfo() {
|
||||||
|
return requestInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -40,6 +40,8 @@ import org.gcube.informationsystem.resourceregistry.instances.model.entities.Res
|
||||||
import org.gcube.informationsystem.resourceregistry.queries.Query;
|
import org.gcube.informationsystem.resourceregistry.queries.Query;
|
||||||
import org.gcube.informationsystem.resourceregistry.queries.QueryImpl;
|
import org.gcube.informationsystem.resourceregistry.queries.QueryImpl;
|
||||||
import org.gcube.informationsystem.resourceregistry.queries.json.JsonQuery;
|
import org.gcube.informationsystem.resourceregistry.queries.json.JsonQuery;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestInfo;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.types.TypeManagement;
|
import org.gcube.informationsystem.resourceregistry.types.TypeManagement;
|
||||||
import org.gcube.informationsystem.types.TypeMapper;
|
import org.gcube.informationsystem.types.TypeMapper;
|
||||||
import org.gcube.informationsystem.types.reference.Type;
|
import org.gcube.informationsystem.types.reference.Type;
|
||||||
|
@ -131,8 +133,7 @@ public class Access extends BaseRest {
|
||||||
logger.info("Requested all {}instances of {}", polymorphic ? InstancePath.POLYMORPHIC_QUERY_PARAMETER + " " : "", type);
|
logger.info("Requested all {}instances of {}", polymorphic ? InstancePath.POLYMORPHIC_QUERY_PARAMETER + " " : "", type);
|
||||||
CalledMethodProvider.instance.set("listInstances");
|
CalledMethodProvider.instance.set("listInstances");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkAllQueryParameters();
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
return erManagement.all(polymorphic);
|
return erManagement.all(polymorphic);
|
||||||
|
@ -151,8 +152,7 @@ public class Access extends BaseRest {
|
||||||
logger.info("Requested to check if {} with id {} exists", type, uuid);
|
logger.info("Requested to check if {} with id {} exists", type, uuid);
|
||||||
CalledMethodProvider.instance.set("existInstance");
|
CalledMethodProvider.instance.set("existInstance");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkQueryParameter(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
|
|
||||||
|
@ -188,8 +188,7 @@ public class Access extends BaseRest {
|
||||||
logger.info("Requested to read {} with id {}", type, uuid);
|
logger.info("Requested to read {} with id {}", type, uuid);
|
||||||
CalledMethodProvider.instance.set("readInstance");
|
CalledMethodProvider.instance.set("readInstance");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkAllQueryParameters();
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
|
@ -245,8 +244,13 @@ public class Access extends BaseRest {
|
||||||
logger.info("Requested query (Raw {}):\n{}", raw, query);
|
logger.info("Requested query (Raw {}):\n{}", raw, query);
|
||||||
CalledMethodProvider.instance.set("graphQuery");
|
CalledMethodProvider.instance.set("graphQuery");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||||
checkIncludeInstancesContexts();
|
if(raw) {
|
||||||
|
// TODO Check if the role allow to request raw data
|
||||||
|
requestInfo.checkQueryParameter(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
|
||||||
|
}else {
|
||||||
|
requestInfo.checkAllQueryParameters();
|
||||||
|
}
|
||||||
|
|
||||||
Query queryManager = new QueryImpl();
|
Query queryManager = new QueryImpl();
|
||||||
return queryManager.query(query, raw);
|
return queryManager.query(query, raw);
|
||||||
|
@ -299,8 +303,7 @@ public class Access extends BaseRest {
|
||||||
logger.info("Requested json query \n{}", jsonQuery);
|
logger.info("Requested json query \n{}", jsonQuery);
|
||||||
CalledMethodProvider.instance.set("jsonQuery");
|
CalledMethodProvider.instance.set("jsonQuery");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkAllQueryParameters();
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
JsonQuery jsonQueryManager = new JsonQuery();
|
JsonQuery jsonQueryManager = new JsonQuery();
|
||||||
jsonQueryManager.setJsonQuery(jsonQuery);
|
jsonQueryManager.setJsonQuery(jsonQuery);
|
||||||
|
@ -350,8 +353,7 @@ public class Access extends BaseRest {
|
||||||
|
|
||||||
CalledMethodProvider.instance.set("query");
|
CalledMethodProvider.instance.set("query");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkAllQueryParameters();
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(resourcetype);
|
ElementManagement erManagement = ElementManagementUtility.getERManagement(resourcetype);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.rest;
|
package org.gcube.informationsystem.resourceregistry.rest;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
import org.gcube.informationsystem.resourceregistry.requests.RequestInfo;
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -17,56 +15,16 @@ public class BaseRest {
|
||||||
|
|
||||||
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
public BaseRest() {
|
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
|
||||||
ContextUtility.getIncludeInstanceContexts().set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Context
|
@Context
|
||||||
protected UriInfo uriInfo;
|
protected UriInfo uriInfo;
|
||||||
|
|
||||||
protected boolean isRequesterAllowedToPerformHierarchicalRequests() {
|
public BaseRest() {
|
||||||
// TODO check is the user has the role to query in hierarchic mode
|
RequestInfo requestInfo = new RequestInfo();
|
||||||
return true;
|
requestInfo.setUriInfo(uriInfo);
|
||||||
|
|
||||||
|
RequestUtility.getRequestInfo().set(requestInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkHierarchicalMode() {
|
|
||||||
try {
|
|
||||||
List<String> hierarchicalQueryParameterList = uriInfo.getQueryParameters().get(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
|
|
||||||
if(hierarchicalQueryParameterList!=null && hierarchicalQueryParameterList.size()>0) {
|
|
||||||
String hierarchicalBooleanString = hierarchicalQueryParameterList.get(0);
|
|
||||||
boolean hierarchical = Boolean.valueOf(hierarchicalBooleanString);
|
|
||||||
boolean h = hierarchical && isRequesterAllowedToPerformHierarchicalRequests();
|
|
||||||
if(h) {
|
|
||||||
logger.info("The request was performed in hierarchical mode and the requester is allowed. Going to set hierarchical mode.");
|
|
||||||
ContextUtility.getHierarchicalMode().set(h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Throwable t) {
|
|
||||||
logger.warn("Unable to properly set the Hierarchical Mode is set", t.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isRequesterAllowedToRequestInstancesContexts() {
|
|
||||||
// TODO check is the user has the role to query in get instance Contexts
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkIncludeInstancesContexts() {
|
|
||||||
try {
|
|
||||||
List<String> includeContextsQueryParameterList = uriInfo.getQueryParameters().get(InstancePath.INCLUDE_CONTEXTS_QUERY_PARAMETER);
|
|
||||||
if(includeContextsQueryParameterList!=null && includeContextsQueryParameterList.size()>0) {
|
|
||||||
String includeContextsBooleanString = includeContextsQueryParameterList.get(0);
|
|
||||||
boolean includeContexts = Boolean.valueOf(includeContextsBooleanString);
|
|
||||||
boolean i = includeContexts && isRequesterAllowedToRequestInstancesContexts();
|
|
||||||
if(i) {
|
|
||||||
logger.info("The requet to include the contexts is allowed.");
|
|
||||||
ContextUtility.getIncludeInstanceContexts().set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Throwable t) {
|
|
||||||
logger.warn("Unable to properly set the Hierarchical Mode is set", t.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,7 @@ public class ContextManager {
|
||||||
private static Logger logger = LoggerFactory.getLogger(ContextManager.class);
|
private static Logger logger = LoggerFactory.getLogger(ContextManager.class);
|
||||||
|
|
||||||
public ContextManager() {
|
public ContextManager() {
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
|
||||||
ContextUtility.getIncludeInstanceContexts().set(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
|
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -55,8 +56,7 @@ public class InstancesManager extends BaseRest {
|
||||||
logger.info("Requested all {}instances of {}", polymorphic ? InstancePath.POLYMORPHIC_QUERY_PARAMETER + " " : "", type);
|
logger.info("Requested all {}instances of {}", polymorphic ? InstancePath.POLYMORPHIC_QUERY_PARAMETER + " " : "", type);
|
||||||
CalledMethodProvider.instance.set("listInstances");
|
CalledMethodProvider.instance.set("listInstances");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkAllQueryParameters();
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
return erManagement.all(polymorphic);
|
return erManagement.all(polymorphic);
|
||||||
|
@ -76,8 +76,7 @@ public class InstancesManager extends BaseRest {
|
||||||
logger.info("Requested to check if {} with id {} exists", type, uuid);
|
logger.info("Requested to check if {} with id {} exists", type, uuid);
|
||||||
CalledMethodProvider.instance.set("existInstance");
|
CalledMethodProvider.instance.set("existInstance");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkQueryParameter(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
|
@ -114,8 +113,7 @@ public class InstancesManager extends BaseRest {
|
||||||
logger.info("Requested to read {} with id {}", type, uuid);
|
logger.info("Requested to read {} with id {}", type, uuid);
|
||||||
CalledMethodProvider.instance.set("readInstance");
|
CalledMethodProvider.instance.set("readInstance");
|
||||||
|
|
||||||
checkHierarchicalMode();
|
RequestUtility.getRequestInfo().get().checkAllQueryParameters();
|
||||||
checkIncludeInstancesContexts();
|
|
||||||
|
|
||||||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
erManagement.setElementType(type);
|
erManagement.setElementType(type);
|
||||||
|
@ -140,6 +138,8 @@ public class InstancesManager extends BaseRest {
|
||||||
logger.trace("Requested to update/create {} with id {} with json {}", type, uuid, json);
|
logger.trace("Requested to update/create {} with id {} with json {}", type, uuid, json);
|
||||||
CalledMethodProvider.instance.set("updateInstance");
|
CalledMethodProvider.instance.set("updateInstance");
|
||||||
|
|
||||||
|
RequestUtility.getRequestInfo().get().checkIncludeQueryParameters();
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||||
erManagement.setUUID(UUID.fromString(uuid));
|
erManagement.setUUID(UUID.fromString(uuid));
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.reso
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
|
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation;
|
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation;
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.ERManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.ERManagement;
|
||||||
|
@ -42,8 +41,7 @@ public class SharingManager {
|
||||||
private static Logger logger = LoggerFactory.getLogger(SharingManager.class);
|
private static Logger logger = LoggerFactory.getLogger(SharingManager.class);
|
||||||
|
|
||||||
public SharingManager() {
|
public SharingManager() {
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
|
||||||
ContextUtility.getIncludeInstanceContexts().set(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String serializeAffectedInstaces(ObjectMapper objectMapper, Map<UUID,JsonNode> affectedInstances) throws ResourceRegistryException {
|
protected String serializeAffectedInstaces(ObjectMapper objectMapper, Map<UUID,JsonNode> affectedInstances) throws ResourceRegistryException {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
|
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.types.TypeManagement;
|
import org.gcube.informationsystem.resourceregistry.types.TypeManagement;
|
||||||
import org.gcube.informationsystem.types.TypeMapper;
|
import org.gcube.informationsystem.types.TypeMapper;
|
||||||
import org.gcube.informationsystem.types.reference.Type;
|
import org.gcube.informationsystem.types.reference.Type;
|
||||||
|
@ -38,8 +37,7 @@ public class TypeManager {
|
||||||
public static final String TYPE_PATH_PARAMETER = "TYPE_NAME";
|
public static final String TYPE_PATH_PARAMETER = "TYPE_NAME";
|
||||||
|
|
||||||
public TypeManager() {
|
public TypeManager() {
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
|
||||||
ContextUtility.getIncludeInstanceContexts().set(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,6 +34,8 @@ import org.gcube.informationsystem.resourceregistry.instances.model.entities.Fac
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestInfo;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
|
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
|
||||||
import org.gcube.informationsystem.serialization.ElementMapper;
|
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||||
|
@ -73,6 +75,7 @@ import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVola
|
||||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -107,6 +110,12 @@ public class ERManagementTest extends ContextTest {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() throws Exception {
|
||||||
|
RequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||||
|
requestInfo.setIncludeMeta(true);
|
||||||
|
requestInfo.setAllMeta(true);
|
||||||
|
}
|
||||||
|
|
||||||
public static SoftwareFacet getSoftwareFacet() {
|
public static SoftwareFacet getSoftwareFacet() {
|
||||||
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
|
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
|
||||||
|
@ -257,7 +266,7 @@ public class ERManagementTest extends ContextTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(metadata.getLastUpdateTime()!=null) {
|
if(metadata.getLastUpdateTime()!=null) {
|
||||||
Assert.assertTrue(lastUpdateTime.after(metadata.getLastUpdateTime()));
|
Assert.assertTrue(lastUpdateTime.after(metadata.getLastUpdateTime()) || lastUpdateTime.compareTo(metadata.getLastUpdateTime())==0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +334,39 @@ public class ERManagementTest extends ContextTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <R extends Resource> ResourceManagement getResourceManagement(R r) throws Exception {
|
|
||||||
|
protected static <R extends Resource> void checkResourceRootMetaOnly(R resource, R gotResource) throws Exception {
|
||||||
|
Assert.assertTrue(resource.getClass() == gotResource.getClass());
|
||||||
|
checkUUIDAndMetadata(resource, gotResource);
|
||||||
|
|
||||||
|
List<ConsistsOf<? extends Resource, ? extends Facet>> resourceConsistsOf = resource.getConsistsOf();
|
||||||
|
List<ConsistsOf<? extends Resource, ? extends Facet>> gotResourceConsistsOf = gotResource.getConsistsOf();
|
||||||
|
Assert.assertTrue(resourceConsistsOf.size() == gotResourceConsistsOf.size());
|
||||||
|
|
||||||
|
for(ConsistsOf<? extends Resource, ? extends Facet> gotConsistsOf : gotResourceConsistsOf) {
|
||||||
|
Assert.assertNull(gotConsistsOf.getMetadata());
|
||||||
|
Assert.assertNull(gotConsistsOf.getTarget().getMetadata());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected static <R extends Resource> void checkResourceNoMeta(R resource, R gotResource) throws Exception {
|
||||||
|
Assert.assertTrue(resource.getClass() == gotResource.getClass());
|
||||||
|
Assert.assertNull(gotResource.getMetadata());
|
||||||
|
|
||||||
|
List<ConsistsOf<? extends Resource, ? extends Facet>> resourceConsistsOf = resource.getConsistsOf();
|
||||||
|
List<ConsistsOf<? extends Resource, ? extends Facet>> gotResourceConsistsOf = gotResource.getConsistsOf();
|
||||||
|
Assert.assertTrue(resourceConsistsOf.size() == gotResourceConsistsOf.size());
|
||||||
|
|
||||||
|
for(ConsistsOf<? extends Resource, ? extends Facet> gotConsistsOf : gotResourceConsistsOf) {
|
||||||
|
Assert.assertNull(gotConsistsOf.getMetadata());
|
||||||
|
Assert.assertNull(gotConsistsOf.getTarget().getMetadata());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public <R extends Resource> ResourceManagement getResourceManagement(R r) throws Exception {
|
||||||
ResourceManagement resourceManagement = new ResourceManagement();
|
ResourceManagement resourceManagement = new ResourceManagement();
|
||||||
resourceManagement.setElementType(r.getTypeName());
|
resourceManagement.setElementType(r.getTypeName());
|
||||||
resourceManagement.setJson(ElementMapper.marshal(r));
|
resourceManagement.setJson(ElementMapper.marshal(r));
|
||||||
|
@ -335,7 +376,7 @@ public class ERManagementTest extends ContextTest {
|
||||||
return resourceManagement;
|
return resourceManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <R extends Resource> IsRelatedToManagement getIsRelatedToManagement(IsRelatedTo<? extends Resource, ? extends Resource> isRelatedTo) throws Exception {
|
public <R extends Resource> IsRelatedToManagement getIsRelatedToManagement(IsRelatedTo<? extends Resource, ? extends Resource> isRelatedTo) throws Exception {
|
||||||
IsRelatedToManagement isRelatedToManagement = new IsRelatedToManagement();
|
IsRelatedToManagement isRelatedToManagement = new IsRelatedToManagement();
|
||||||
isRelatedToManagement.setElementType(isRelatedTo.getTypeName());
|
isRelatedToManagement.setElementType(isRelatedTo.getTypeName());
|
||||||
isRelatedToManagement.setJson(ElementMapper.marshal(isRelatedTo));
|
isRelatedToManagement.setJson(ElementMapper.marshal(isRelatedTo));
|
||||||
|
@ -347,7 +388,7 @@ public class ERManagementTest extends ContextTest {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static <R extends Resource> R createResource(R r) throws Exception {
|
public <R extends Resource> R createResource(R r) throws Exception {
|
||||||
ResourceManagement resourceManagement = getResourceManagement(r);
|
ResourceManagement resourceManagement = getResourceManagement(r);
|
||||||
String json = resourceManagement.create();
|
String json = resourceManagement.create();
|
||||||
|
|
||||||
|
@ -363,20 +404,20 @@ public class ERManagementTest extends ContextTest {
|
||||||
return createdR;
|
return createdR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EService createEService() throws Exception {
|
public EService createEService() throws Exception {
|
||||||
EService eService = ERManagementTest.instantiateValidEService();
|
EService eService = ERManagementTest.instantiateValidEService();
|
||||||
return createResource(eService);
|
return createResource(eService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostingNode createHostingNode() throws Exception {
|
public HostingNode createHostingNode() throws Exception {
|
||||||
return createHostingNode(null);
|
return createHostingNode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostingNode createHostingNode(EService eService) throws Exception {
|
public HostingNode createHostingNode(EService eService) throws Exception {
|
||||||
return createHostingNode(eService, RemoveConstraint.cascade, DeleteConstraint.cascade);
|
return createHostingNode(eService, RemoveConstraint.cascade, DeleteConstraint.cascade);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostingNode createHostingNode(EService eService, RemoveConstraint removeConstraint, DeleteConstraint deleteConstraint) throws Exception {
|
public HostingNode createHostingNode(EService eService, RemoveConstraint removeConstraint, DeleteConstraint deleteConstraint) throws Exception {
|
||||||
HostingNode hostingNode = ERManagementTest.instantiateValidHostingNode();
|
HostingNode hostingNode = ERManagementTest.instantiateValidHostingNode();
|
||||||
if(eService!=null) {
|
if(eService!=null) {
|
||||||
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
||||||
|
@ -389,12 +430,12 @@ public class ERManagementTest extends ContextTest {
|
||||||
return createResource(hostingNode);
|
return createResource(hostingNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Configuration createConfiguration() throws Exception {
|
public Configuration createConfiguration() throws Exception {
|
||||||
Configuration configuration = ERManagementTest.instantiateValidConfiguration();
|
Configuration configuration = ERManagementTest.instantiateValidConfiguration();
|
||||||
return createResource(configuration);
|
return createResource(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Resource> createHostingNodeAndEService() throws Exception {
|
public Map<String, Resource> createHostingNodeAndEService() throws Exception {
|
||||||
Map<String, Resource> map = new HashMap<>();
|
Map<String, Resource> map = new HashMap<>();
|
||||||
|
|
||||||
EService eService = createEService();
|
EService eService = createEService();
|
||||||
|
@ -406,7 +447,7 @@ public class ERManagementTest extends ContextTest {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <R extends Resource> void deleteResource(R r) throws Exception {
|
public <R extends Resource> void deleteResource(R r) throws Exception {
|
||||||
if(r!=null) {
|
if(r!=null) {
|
||||||
ResourceManagement resourceManagement = getResourceManagement(r);
|
ResourceManagement resourceManagement = getResourceManagement(r);
|
||||||
resourceManagement.delete();
|
resourceManagement.delete();
|
||||||
|
@ -425,13 +466,46 @@ public class ERManagementTest extends ContextTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateAndReadEService() throws Exception {
|
||||||
|
EService eService = null;
|
||||||
|
try {
|
||||||
|
eService = createEService();
|
||||||
|
RequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||||
|
|
||||||
|
requestInfo.setIncludeMeta(true);
|
||||||
|
requestInfo.setAllMeta(true);
|
||||||
|
EService readEService = (EService) readResource(eService.getID());
|
||||||
|
checkResource(eService, readEService);
|
||||||
|
|
||||||
|
requestInfo.setIncludeMeta(true);
|
||||||
|
requestInfo.setAllMeta(false);
|
||||||
|
readEService = (EService) readResource(eService.getID());
|
||||||
|
checkResourceRootMetaOnly(eService, readEService);
|
||||||
|
|
||||||
|
requestInfo.setIncludeMeta(false);
|
||||||
|
readEService = (EService) readResource(eService.getID());
|
||||||
|
checkResourceNoMeta(eService, readEService);
|
||||||
|
|
||||||
|
}finally {
|
||||||
|
deleteResource(eService);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected Resource readResource(UUID uuid) throws Exception {
|
||||||
|
ResourceManagement resourceManagement = new ResourceManagement();
|
||||||
|
resourceManagement.setUUID(uuid);
|
||||||
|
String json = resourceManagement.read().toString();
|
||||||
|
logger.debug(json);
|
||||||
|
return ElementMapper.unmarshal(Resource.class, json);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Test
|
@Test
|
||||||
public void testReadResource() throws Exception {
|
public void testReadResource() throws Exception {
|
||||||
ResourceManagement resourceManagement = new ResourceManagement();
|
readResource(UUID.fromString("26da57ee-33bd-4c4b-8aef-9206b61c329e"));
|
||||||
resourceManagement.setUUID(UUID.fromString("26da57ee-33bd-4c4b-8aef-9206b61c329e"));
|
|
||||||
String read = resourceManagement.read().toString();
|
|
||||||
logger.debug(read);
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -458,7 +532,7 @@ public class ERManagementTest extends ContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateHostingNodeAndEService() throws Exception {
|
public void testCreateHostingNodeAndEService() throws Exception {
|
||||||
Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService();
|
Map<String, Resource> map = createHostingNodeAndEService();
|
||||||
deleteResource(map.get(HostingNode.NAME));
|
deleteResource(map.get(HostingNode.NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
|
|
||||||
@Test(expected = SchemaViolationException.class)
|
@Test(expected = SchemaViolationException.class)
|
||||||
public void createInvalidIsRealtedTo() throws Exception {
|
public void createInvalidIsRealtedTo() throws Exception {
|
||||||
Configuration configuration = ERManagementTest.createConfiguration();
|
Configuration configuration = createConfiguration();
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
try {
|
try {
|
||||||
/*
|
/*
|
||||||
* Trying to create a relation activates between a Configuration and EService
|
* Trying to create a relation activates between a Configuration and EService
|
||||||
|
@ -66,18 +66,18 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
isRelatedToManagement.setJson(json);
|
isRelatedToManagement.setJson(json);
|
||||||
isRelatedToManagement.create();
|
isRelatedToManagement.create();
|
||||||
}finally {
|
}finally {
|
||||||
ERManagementTest.deleteResource(configuration);
|
deleteResource(configuration);
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ResourceAlreadyPresentException.class)
|
@Test(expected = ResourceAlreadyPresentException.class)
|
||||||
public void testRecreate() throws Exception {
|
public void testRecreate() throws Exception {
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
try {
|
try {
|
||||||
ERManagementTest.createResource(eService);
|
createResource(eService);
|
||||||
}finally {
|
}finally {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,12 +111,12 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
IsIdentifiedBy<RunningPlugin, SoftwareFacet> isIdentifiedBy = new IsIdentifiedByImpl<>(runningPlugin, softwareFacet);
|
IsIdentifiedBy<RunningPlugin, SoftwareFacet> isIdentifiedBy = new IsIdentifiedByImpl<>(runningPlugin, softwareFacet);
|
||||||
runningPlugin.addFacet(isIdentifiedBy);
|
runningPlugin.addFacet(isIdentifiedBy);
|
||||||
|
|
||||||
ERManagementTest.createResource(runningPlugin);
|
createResource(runningPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ResourceRegistryException.class)
|
@Test(expected = ResourceRegistryException.class)
|
||||||
public void testCreateAnEntityDifferentFromDeclared() throws Exception {
|
public void testCreateAnEntityDifferentFromDeclared() throws Exception {
|
||||||
EService eService = ERManagementTest.instantiateValidEService();
|
EService eService = instantiateValidEService();
|
||||||
ResourceManagement resourceManagement = new ResourceManagement();
|
ResourceManagement resourceManagement = new ResourceManagement();
|
||||||
resourceManagement.setElementType(Service.NAME);
|
resourceManagement.setElementType(Service.NAME);
|
||||||
resourceManagement.setJson(ElementMapper.marshal(eService));
|
resourceManagement.setJson(ElementMapper.marshal(eService));
|
||||||
|
@ -133,7 +133,7 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
|
|
||||||
@Test(expected = SchemaViolationException.class)
|
@Test(expected = SchemaViolationException.class)
|
||||||
public void testCreateHostingNodeAndEServiceWithSharedFacet() throws Exception {
|
public void testCreateHostingNodeAndEServiceWithSharedFacet() throws Exception {
|
||||||
Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService();
|
Map<String, Resource> map = createHostingNodeAndEService();
|
||||||
EService eService = (EService) map.get(EService.NAME);
|
EService eService = (EService) map.get(EService.NAME);
|
||||||
HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME);
|
HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME);
|
||||||
try {
|
try {
|
||||||
|
@ -150,8 +150,8 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
logger.debug("Created : {}", json);
|
logger.debug("Created : {}", json);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
ERManagementTest.deleteResource(hostingNode);
|
deleteResource(hostingNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
public void testCreateEServiceAndDeleteRequiredConsistsOf() throws Exception {
|
public void testCreateEServiceAndDeleteRequiredConsistsOf() throws Exception {
|
||||||
EService eService = null;
|
EService eService = null;
|
||||||
try {
|
try {
|
||||||
eService = ERManagementTest.createEService();
|
eService = createEService();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
||||||
|
@ -170,13 +170,13 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
consistsOfManagement.setUUID(isIdentifiedBy.getID());
|
consistsOfManagement.setUUID(isIdentifiedBy.getID());
|
||||||
consistsOfManagement.delete();
|
consistsOfManagement.delete();
|
||||||
}finally {
|
}finally {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SchemaViolationException.class)
|
@Test(expected = SchemaViolationException.class)
|
||||||
public void testCreateEServiceAndDeleteRequiredFacet() throws Exception {
|
public void testCreateEServiceAndDeleteRequiredFacet() throws Exception {
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
||||||
|
@ -192,14 +192,14 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
try {
|
try {
|
||||||
facetManagement.delete();
|
facetManagement.delete();
|
||||||
}finally {
|
}finally {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SchemaViolationException.class)
|
@Test(expected = SchemaViolationException.class)
|
||||||
public void testCreateConsistsOfBeetweenResources() throws Exception {
|
public void testCreateConsistsOfBeetweenResources() throws Exception {
|
||||||
Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService();
|
Map<String, Resource> map = createHostingNodeAndEService();
|
||||||
|
|
||||||
UUID hostingNodeUUID = map.get(HostingNode.NAME).getID();
|
UUID hostingNodeUUID = map.get(HostingNode.NAME).getID();
|
||||||
UUID eServiceUUID = map.get(EService.NAME).getID();
|
UUID eServiceUUID = map.get(EService.NAME).getID();
|
||||||
|
@ -223,8 +223,8 @@ public class InvalidOperationTest extends ERManagementTest {
|
||||||
consistsOfManagement.create();
|
consistsOfManagement.create();
|
||||||
throw new Exception("A ConsistsOf has been created between two resoures. This should not happen");
|
throw new Exception("A ConsistsOf has been created between two resoures. This should not happen");
|
||||||
} finally {
|
} finally {
|
||||||
ERManagementTest.deleteResource(map.get(EService.NAME));
|
deleteResource(map.get(EService.NAME));
|
||||||
ERManagementTest.deleteResource(map.get(HostingNode.NAME));
|
deleteResource(map.get(HostingNode.NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,10 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundExcep
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException;
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement;
|
import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||||
import org.gcube.informationsystem.serialization.ElementMapper;
|
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.ContactFacetImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.CoverageFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.CoverageFacetImpl;
|
||||||
|
@ -52,7 +52,7 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateEServiceAndRemoveFromContextRequiredFacet() throws Exception {
|
public void testCreateEServiceAndRemoveFromContextRequiredFacet() throws Exception {
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
||||||
|
@ -66,7 +66,7 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
}catch (SchemaViolationException e) {
|
}catch (SchemaViolationException e) {
|
||||||
// As expected
|
// As expected
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,11 +81,11 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
}catch (SchemaViolationException e) {
|
}catch (SchemaViolationException e) {
|
||||||
// As expected
|
// As expected
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,8 +151,8 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
protected void checkNumerOfContext(Dataset dataset, int expectedContextSize) throws Exception {
|
protected void checkNumerOfContext(Dataset dataset, int expectedContextSize) throws Exception {
|
||||||
setContextByName(GCUBE);
|
setContextByName(GCUBE);
|
||||||
|
|
||||||
ContextUtility.getHierarchicalMode().set(true);
|
RequestUtility.getRequestInfo().get().setHierarchicalMode(true);
|
||||||
ContextUtility.getIncludeInstanceContexts().set(true);
|
RequestUtility.getRequestInfo().get().setIncludeContexts(true);
|
||||||
|
|
||||||
String json = getResourceManagement(dataset).read();
|
String json = getResourceManagement(dataset).read();
|
||||||
logger.trace("Resource with contexts in HierarchicalMode from server is {}", json);
|
logger.trace("Resource with contexts in HierarchicalMode from server is {}", json);
|
||||||
|
@ -164,8 +164,9 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
logger.info("Contexts of {} with UUID {} and Id {} are {}", Dataset.NAME, r1.getID(), ((IdentifierFacet)r1.getIdentificationFacets().get(0)).getValue(), contextsR1Fullname);
|
logger.info("Contexts of {} with UUID {} and Id {} are {}", Dataset.NAME, r1.getID(), ((IdentifierFacet)r1.getIdentificationFacets().get(0)).getValue(), contextsR1Fullname);
|
||||||
Assert.assertTrue(contextsR1.size()==expectedContextSize);
|
Assert.assertTrue(contextsR1.size()==expectedContextSize);
|
||||||
|
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
RequestUtility.getRequestInfo().get().setHierarchicalMode(false);
|
||||||
ContextUtility.getIncludeInstanceContexts().set(false);
|
RequestUtility.getRequestInfo().get().setIncludeContexts(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -284,8 +285,9 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
throw e;
|
throw e;
|
||||||
}finally {
|
}finally {
|
||||||
ContextUtility.getHierarchicalMode().set(false);
|
|
||||||
ContextUtility.getIncludeInstanceContexts().set(false);
|
RequestUtility.getRequestInfo().get().setHierarchicalMode(false);
|
||||||
|
RequestUtility.getRequestInfo().get().setIncludeContexts(false);
|
||||||
|
|
||||||
setContextByName(GCUBE);
|
setContextByName(GCUBE);
|
||||||
deleteResource(datasetR1);
|
deleteResource(datasetR1);
|
||||||
|
@ -308,7 +310,7 @@ public class AddToContextTest extends MultiContextTest {
|
||||||
// ContextCache contextCache = ContextCache.getInstance();
|
// ContextCache contextCache = ContextCache.getInstance();
|
||||||
// HostingNode hostingNode = new HostingNodeImpl();
|
// HostingNode hostingNode = new HostingNodeImpl();
|
||||||
// hostingNode.setUUID(UUID.fromString("a87bb07e-5320-4fd8-a48d-bf3cc55756c4"));
|
// hostingNode.setUUID(UUID.fromString("a87bb07e-5320-4fd8-a48d-bf3cc55756c4"));
|
||||||
// ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(hostingNode);
|
// ResourceManagement resourceManagement = getResourceManagement(hostingNode);
|
||||||
// resourceManagement.setDryRun(false);
|
// resourceManagement.setDryRun(false);
|
||||||
// UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName("/gcube/devsec").getUUID();
|
// UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName("/gcube/devsec").getUUID();
|
||||||
// resourceManagement.addToContext(contextUUID);
|
// resourceManagement.addToContext(contextUUID);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.reso
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.resource.ResourceNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.resource.ResourceNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relations.RelationAvailableInAnotherContextException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.relations.RelationAvailableInAnotherContextException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relations.isrelatedto.IsRelatedToNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.relations.isrelatedto.IsRelatedToNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
||||||
|
@ -134,13 +133,13 @@ public class BasicTest extends MultiContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddResourceToContext() throws Exception {
|
public void testAddResourceToContext() throws Exception {
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
try {
|
try {
|
||||||
addToContextThenTestIfBehaveProperly(eService, ALTERNATIVE_TEST_SCOPE);
|
addToContextThenTestIfBehaveProperly(eService, ALTERNATIVE_TEST_SCOPE);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +147,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateEServiceHostingNode() throws Exception {
|
public void testCreateEServiceHostingNode() throws Exception {
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
|
|
||||||
Map<UUID, IdentifiableElement> eServiceInstances = new HashMap<>();
|
Map<UUID, IdentifiableElement> eServiceInstances = new HashMap<>();
|
||||||
eServiceInstances.put(eService.getID(), eService);
|
eServiceInstances.put(eService.getID(), eService);
|
||||||
|
@ -157,7 +156,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
eServiceInstances.put(consistsOf.getTarget().getID(), consistsOf.getTarget());
|
eServiceInstances.put(consistsOf.getTarget().getID(), consistsOf.getTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
HostingNode hostingNode = ERManagementTest.createHostingNode(eService);
|
HostingNode hostingNode = createHostingNode(eService);
|
||||||
UUID hostingNodeUUID = hostingNode.getID();
|
UUID hostingNodeUUID = hostingNode.getID();
|
||||||
|
|
||||||
Map<UUID, IdentifiableElement> hostingNodeInstances = new HashMap<>();
|
Map<UUID, IdentifiableElement> hostingNodeInstances = new HashMap<>();
|
||||||
|
@ -179,7 +178,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
|
|
||||||
addToContextThenTestIfBehaveProperly(hostingNode, targetContextFullName);
|
addToContextThenTestIfBehaveProperly(hostingNode, targetContextFullName);
|
||||||
|
|
||||||
ERManagementTest.deleteResource(hostingNode);
|
deleteResource(hostingNode);
|
||||||
|
|
||||||
rm = (ResourceManagement) ElementManagementUtility.getERManagement(Resource.NAME);
|
rm = (ResourceManagement) ElementManagementUtility.getERManagement(Resource.NAME);
|
||||||
all = rm.all(true);
|
all = rm.all(true);
|
||||||
|
@ -203,10 +202,10 @@ public class BasicTest extends MultiContextTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creating EService */
|
/* Creating EService */
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
|
|
||||||
/* Creating HostingNode */
|
/* Creating HostingNode */
|
||||||
HostingNode hostingNode = ERManagementTest.createHostingNode(eService, removeConstraint, DeleteConstraint.cascade);
|
HostingNode hostingNode = createHostingNode(eService, removeConstraint, DeleteConstraint.cascade);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Activates<HostingNode, EService> activates = (Activates<HostingNode, EService>) getOutcomingIsRelatedTo(hostingNode).get(0);
|
Activates<HostingNode, EService> activates = (Activates<HostingNode, EService>) getOutcomingIsRelatedTo(hostingNode).get(0);
|
||||||
|
@ -217,7 +216,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
|
|
||||||
// Adding Activated to ALTERNATIVE_TEST_SCOPE
|
// Adding Activated to ALTERNATIVE_TEST_SCOPE
|
||||||
|
|
||||||
IsRelatedToManagement isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates);
|
IsRelatedToManagement isRelatedToManagement = getIsRelatedToManagement(activates);
|
||||||
addToContextThenTestIfBehaveProperly(activates, ALTERNATIVE_TEST_SCOPE);
|
addToContextThenTestIfBehaveProperly(activates, ALTERNATIVE_TEST_SCOPE);
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
@ -233,7 +232,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
* I MUST not be able to read Activates relation and EService
|
* I MUST not be able to read Activates relation and EService
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(hostingNode);
|
ResourceManagement resourceManagement = getResourceManagement(hostingNode);
|
||||||
try {
|
try {
|
||||||
resourceManagement.read();
|
resourceManagement.read();
|
||||||
String error = String.format("{} with UUID {} should not be visible.", HostingNode.NAME, hostingNode.getID());
|
String error = String.format("{} with UUID {} should not be visible.", HostingNode.NAME, hostingNode.getID());
|
||||||
|
@ -243,7 +242,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
|
||||||
isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates);
|
isRelatedToManagement = getIsRelatedToManagement(activates);
|
||||||
try {
|
try {
|
||||||
isRelatedToManagement.read();
|
isRelatedToManagement.read();
|
||||||
String error = String.format("{} with UUID {} should not be visible.", Activates.NAME, activates.getID());
|
String error = String.format("{} with UUID {} should not be visible.", Activates.NAME, activates.getID());
|
||||||
|
@ -253,7 +252,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceManagement = ERManagementTest.getResourceManagement(eService);
|
resourceManagement = getResourceManagement(eService);
|
||||||
try {
|
try {
|
||||||
resourceManagement.read();
|
resourceManagement.read();
|
||||||
String error = String.format("{} with UUID {} should not be visible.", EService.NAME, eService.getID());
|
String error = String.format("{} with UUID {} should not be visible.", EService.NAME, eService.getID());
|
||||||
|
@ -268,22 +267,22 @@ public class BasicTest extends MultiContextTest {
|
||||||
// The Instances MUST be still available in ALTERNATIVE_TEST_SCOPE
|
// The Instances MUST be still available in ALTERNATIVE_TEST_SCOPE
|
||||||
ContextTest.setContextByName(ALTERNATIVE_TEST_SCOPE);
|
ContextTest.setContextByName(ALTERNATIVE_TEST_SCOPE);
|
||||||
|
|
||||||
resourceManagement = ERManagementTest.getResourceManagement(hostingNode);
|
resourceManagement = getResourceManagement(hostingNode);
|
||||||
resourceManagement.read();
|
resourceManagement.read();
|
||||||
|
|
||||||
isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates);
|
isRelatedToManagement = getIsRelatedToManagement(activates);
|
||||||
isRelatedToManagement.read();
|
isRelatedToManagement.read();
|
||||||
|
|
||||||
resourceManagement = ERManagementTest.getResourceManagement(eService);
|
resourceManagement = getResourceManagement(eService);
|
||||||
resourceManagement.read();
|
resourceManagement.read();
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
// Removing HostingNode MUST delete Activates and EService due to propagationConstraint
|
// Removing HostingNode MUST delete Activates and EService due to propagationConstraint
|
||||||
ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(hostingNode);
|
ResourceManagement resourceManagement = getResourceManagement(hostingNode);
|
||||||
resourceManagement.delete();
|
resourceManagement.delete();
|
||||||
|
|
||||||
resourceManagement = ERManagementTest.getResourceManagement(hostingNode);
|
resourceManagement = getResourceManagement(hostingNode);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resourceManagement.read();
|
resourceManagement.read();
|
||||||
|
@ -294,7 +293,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
|
||||||
IsRelatedToManagement isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(activates);
|
IsRelatedToManagement isRelatedToManagement = getIsRelatedToManagement(activates);
|
||||||
try {
|
try {
|
||||||
isRelatedToManagement.read();
|
isRelatedToManagement.read();
|
||||||
String error = String.format("{} with UUID {} should not be found.", Activates.NAME, activates.getID());
|
String error = String.format("{} with UUID {} should not be found.", Activates.NAME, activates.getID());
|
||||||
|
@ -304,7 +303,7 @@ public class BasicTest extends MultiContextTest {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceManagement = ERManagementTest.getResourceManagement(eService);
|
resourceManagement = getResourceManagement(eService);
|
||||||
try {
|
try {
|
||||||
resourceManagement.read();
|
resourceManagement.read();
|
||||||
String error = String.format("{} with UUID {} should not be found.", EService.NAME, eService.getID());
|
String error = String.format("{} with UUID {} should not be found.", EService.NAME, eService.getID());
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.gcube.informationsystem.model.reference.properties.PropagationConstra
|
||||||
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache;
|
import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
||||||
|
@ -39,10 +38,10 @@ public class ComplexTest extends MultiContextTest {
|
||||||
contextCache.setContextCacheRenewal(contextCacheRenewal);
|
contextCache.setContextCacheRenewal(contextCacheRenewal);
|
||||||
|
|
||||||
/* Creating HostingNode */
|
/* Creating HostingNode */
|
||||||
HostingNode hostingNode = ERManagementTest.createHostingNode();
|
HostingNode hostingNode = createHostingNode();
|
||||||
|
|
||||||
/* Creating EService */
|
/* Creating EService */
|
||||||
EService eService = ERManagementTest.createEService();
|
EService eService = createEService();
|
||||||
|
|
||||||
|
|
||||||
/* Creating Activates Relation */
|
/* Creating Activates Relation */
|
||||||
|
@ -72,7 +71,7 @@ public class ComplexTest extends MultiContextTest {
|
||||||
logger.debug("Switching to alternative scope");
|
logger.debug("Switching to alternative scope");
|
||||||
ContextTest.setContextByName(NEXTNEXT);
|
ContextTest.setContextByName(NEXTNEXT);
|
||||||
|
|
||||||
ResourceManagement hostingNodeManagement = ERManagementTest.getResourceManagement(hostingNode);
|
ResourceManagement hostingNodeManagement = getResourceManagement(hostingNode);
|
||||||
|
|
||||||
String hostingNodeContexts = hostingNodeManagement.getContexts();
|
String hostingNodeContexts = hostingNodeManagement.getContexts();
|
||||||
logger.debug("Contexts of {} with UUID {} have the following UUID {}", HostingNode.NAME, hostingNodeManagement.getUUID(), hostingNodeContexts);
|
logger.debug("Contexts of {} with UUID {} have the following UUID {}", HostingNode.NAME, hostingNodeManagement.getUUID(), hostingNodeContexts);
|
||||||
|
@ -109,7 +108,7 @@ public class ComplexTest extends MultiContextTest {
|
||||||
logger.debug("Contexts of {} with UUID {} are {}", Activates.NAME, activatesManagement.getUUID(), activatesContextMap.values());
|
logger.debug("Contexts of {} with UUID {} are {}", Activates.NAME, activatesManagement.getUUID(), activatesContextMap.values());
|
||||||
|
|
||||||
|
|
||||||
ResourceManagement eServiceManagement = ERManagementTest.getResourceManagement(eService);
|
ResourceManagement eServiceManagement = getResourceManagement(eService);
|
||||||
String eServiceContexts = eServiceManagement.getContexts();
|
String eServiceContexts = eServiceManagement.getContexts();
|
||||||
logger.debug("Contexts of {} with UUID {} have the following UUID {}", EService.NAME, eServiceManagement.getUUID(), eServiceContexts);
|
logger.debug("Contexts of {} with UUID {} have the following UUID {}", EService.NAME, eServiceManagement.getUUID(), eServiceContexts);
|
||||||
Map<UUID,String> eServiceContextMap = org.gcube.informationsystem.resourceregistry.api.contexts.ContextUtility.getContextMap(eServiceContexts);
|
Map<UUID,String> eServiceContextMap = org.gcube.informationsystem.resourceregistry.api.contexts.ContextUtility.getContextMap(eServiceContexts);
|
||||||
|
@ -121,11 +120,11 @@ public class ComplexTest extends MultiContextTest {
|
||||||
Assert.assertTrue(eServiceContextFullNames.size()==1);
|
Assert.assertTrue(eServiceContextFullNames.size()==1);
|
||||||
logger.debug("Contexts of {} with UUID {} are {}", EService.NAME, eServiceManagement.getUUID(), eServiceContextFullNames);
|
logger.debug("Contexts of {} with UUID {} are {}", EService.NAME, eServiceManagement.getUUID(), eServiceContextFullNames);
|
||||||
|
|
||||||
ERManagementTest.deleteResource(hostingNode);
|
deleteResource(hostingNode);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ContextTest.setContextByName(DEVNEXT);
|
ContextTest.setContextByName(DEVNEXT);
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("",e);
|
logger.error("",e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class MultiContextTest extends ERManagementTest {
|
||||||
// Must be investigated cause infinite recursion to Jackson
|
// Must be investigated cause infinite recursion to Jackson
|
||||||
// Map<UUID, Element> expectedInstances = getRemovedExpectedInstances(r);
|
// Map<UUID, Element> expectedInstances = getRemovedExpectedInstances(r);
|
||||||
|
|
||||||
ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(r);
|
ResourceManagement resourceManagement = getResourceManagement(r);
|
||||||
resourceManagement.setDryRun(dryRun);
|
resourceManagement.setDryRun(dryRun);
|
||||||
UUID contextUUID = ContextUtility.getCurrentSecurityContext().getUUID();
|
UUID contextUUID = ContextUtility.getCurrentSecurityContext().getUUID();
|
||||||
resourceManagement.removeFromContext(contextUUID);
|
resourceManagement.removeFromContext(contextUUID);
|
||||||
|
@ -179,7 +179,7 @@ public class MultiContextTest extends ERManagementTest {
|
||||||
|
|
||||||
protected Map<UUID, Element> getExpectedInstancesAddToContext(Resource resource) throws ResourceRegistryException, Exception {
|
protected Map<UUID, Element> getExpectedInstancesAddToContext(Resource resource) throws ResourceRegistryException, Exception {
|
||||||
|
|
||||||
String json = ERManagementTest.getResourceManagement(resource).read();
|
String json = getResourceManagement(resource).read();
|
||||||
Resource r = ElementMapper.unmarshal(resource.getClass(), json);
|
Resource r = ElementMapper.unmarshal(resource.getClass(), json);
|
||||||
|
|
||||||
Map<UUID, Element> expected = new HashMap<>();
|
Map<UUID, Element> expected = new HashMap<>();
|
||||||
|
@ -222,7 +222,7 @@ public class MultiContextTest extends ERManagementTest {
|
||||||
|
|
||||||
// Map<UUID, Element> expectedInstances = getExpectedInstancesAddToContext(r);
|
// Map<UUID, Element> expectedInstances = getExpectedInstancesAddToContext(r);
|
||||||
|
|
||||||
ResourceManagement resourceManagement = ERManagementTest.getResourceManagement(r);
|
ResourceManagement resourceManagement = getResourceManagement(r);
|
||||||
resourceManagement.setDryRun(dryRun);
|
resourceManagement.setDryRun(dryRun);
|
||||||
UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName(targetContextFullName).getUUID();
|
UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName(targetContextFullName).getUUID();
|
||||||
resourceManagement.addToContext(contextUUID);
|
resourceManagement.addToContext(contextUUID);
|
||||||
|
@ -233,7 +233,7 @@ public class MultiContextTest extends ERManagementTest {
|
||||||
if(!dryRun) {
|
if(!dryRun) {
|
||||||
String currentContext = SecretManagerProvider.instance.get().getContext();
|
String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||||
ContextTest.setContextByName(targetContextFullName);
|
ContextTest.setContextByName(targetContextFullName);
|
||||||
resourceManagement = ERManagementTest.getResourceManagement(r);
|
resourceManagement = getResourceManagement(r);
|
||||||
String json = resourceManagement.read();
|
String json = resourceManagement.read();
|
||||||
Resource resource = ElementMapper.unmarshal(r.getClass(), json);
|
Resource resource = ElementMapper.unmarshal(r.getClass(), json);
|
||||||
Assert.assertTrue(resource.getClass() == r.getClass());
|
Assert.assertTrue(resource.getClass() == r.getClass());
|
||||||
|
@ -281,7 +281,7 @@ public class MultiContextTest extends ERManagementTest {
|
||||||
// expectedInstances.putAll(getExpectedInstancesAddToContext(isRelatedTo.getTarget()));
|
// expectedInstances.putAll(getExpectedInstancesAddToContext(isRelatedTo.getTarget()));
|
||||||
// expectedInstances.put(isRelatedTo.getUUID(), isRelatedTo);
|
// expectedInstances.put(isRelatedTo.getUUID(), isRelatedTo);
|
||||||
|
|
||||||
IsRelatedToManagement isRelatedToManagement = ERManagementTest.getIsRelatedToManagement(isRelatedTo);
|
IsRelatedToManagement isRelatedToManagement = getIsRelatedToManagement(isRelatedTo);
|
||||||
isRelatedToManagement.setDryRun(dryRun);
|
isRelatedToManagement.setDryRun(dryRun);
|
||||||
UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName(targetContextFullName).getUUID();
|
UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName(targetContextFullName).getUUID();
|
||||||
isRelatedToManagement.addToContext(contextUUID);
|
isRelatedToManagement.addToContext(contextUUID);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class QueryTest extends ERManagementTest {
|
||||||
int typeNumber = 0;
|
int typeNumber = 0;
|
||||||
|
|
||||||
for (int i = 0; i < MAX; i++) {
|
for (int i = 0; i < MAX; i++) {
|
||||||
Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService();
|
Map<String, Resource> map = createHostingNodeAndEService();
|
||||||
if (typeNumber == 0) {
|
if (typeNumber == 0) {
|
||||||
typeNumber = map.size();
|
typeNumber = map.size();
|
||||||
}
|
}
|
||||||
|
@ -150,14 +150,14 @@ public class QueryTest extends ERManagementTest {
|
||||||
|
|
||||||
List<Resource> resourceList = resources.get(HostingNode.NAME);
|
List<Resource> resourceList = resources.get(HostingNode.NAME);
|
||||||
for (Resource r : resourceList) {
|
for (Resource r : resourceList) {
|
||||||
ERManagementTest.deleteResource(r);
|
deleteResource(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllFrom() throws Exception {
|
public void testGetAllFrom() throws Exception {
|
||||||
Map<String, Resource> map = ERManagementTest.createHostingNodeAndEService();
|
Map<String, Resource> map = createHostingNodeAndEService();
|
||||||
EService eService = (EService) map.get(EService.NAME);
|
EService eService = (EService) map.get(EService.NAME);
|
||||||
HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME);
|
HostingNode hostingNode = (HostingNode) map.get(HostingNode.NAME);
|
||||||
|
|
||||||
|
@ -280,8 +280,8 @@ public class QueryTest extends ERManagementTest {
|
||||||
/* END EService --ConsistsOf--> SoftwareFacet */
|
/* END EService --ConsistsOf--> SoftwareFacet */
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
ERManagementTest.deleteResource(eService);
|
deleteResource(eService);
|
||||||
ERManagementTest.deleteResource(hostingNode);
|
deleteResource(hostingNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ public class QueryTest extends ERManagementTest {
|
||||||
simplePropertyFacet.setValue("test");
|
simplePropertyFacet.setValue("test");
|
||||||
configuration.addFacet(simplePropertyFacet);
|
configuration.addFacet(simplePropertyFacet);
|
||||||
|
|
||||||
return ERManagementTest.createResource(configuration);
|
return createResource(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ public class QueryTest extends ERManagementTest {
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
for(Configuration configuration : createdConfigurations) {
|
for(Configuration configuration : createdConfigurations) {
|
||||||
ERManagementTest.deleteResource(configuration);
|
deleteResource(configuration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue