All tests are back to normal

This commit is contained in:
Luca Frosini 2019-10-30 12:43:30 +01:00
parent 495cba3145
commit 914f267c29
2 changed files with 23 additions and 23 deletions

View File

@ -21,6 +21,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.context.Conte
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
import org.gcube.informationsystem.resourceregistry.context.IsParentOfManagement;
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.er.ERManagement; import org.gcube.informationsystem.resourceregistry.er.ERManagement;
@ -312,7 +313,9 @@ public abstract class RelationManagement<R extends BaseRelation, S extends Entit
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
if(!(this instanceof IsParentOfManagement)) {
checkPropagationConstraint(); checkPropagationConstraint();
}
logger.info("{} successfully created", elementType); logger.info("{} successfully created", elementType);
@ -499,6 +502,7 @@ public abstract class RelationManagement<R extends BaseRelation, S extends Entit
RemoveConstraint removeConstraint = RemoveConstraint.keep; RemoveConstraint removeConstraint = RemoveConstraint.keep;
if(! (this instanceof IsParentOfManagement)) {
try { try {
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element, PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
Relation.PROPAGATION_CONSTRAINT); Relation.PROPAGATION_CONSTRAINT);
@ -515,7 +519,7 @@ public abstract class RelationManagement<R extends BaseRelation, S extends Entit
logger.warn("Error while getting {} from {}. Assuming {}. {}", Relation.PROPAGATION_CONSTRAINT, logger.warn("Error while getting {} from {}. Assuming {}. {}", Relation.PROPAGATION_CONSTRAINT,
Utility.toJsonString(element, true), removeConstraint, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); Utility.toJsonString(element, true), removeConstraint, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
}
Vertex target = (Vertex) getTargetEntityManagement().getElement(); Vertex target = (Vertex) getTargetEntityManagement().getElement();
element.remove(); element.remove();

View File

@ -17,6 +17,7 @@ import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.utils.ISMapper;
import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet;
import org.gcube.resourcemanagement.model.reference.entities.resources.Actor; import org.gcube.resourcemanagement.model.reference.entities.resources.Actor;
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts;
@ -24,9 +25,6 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@ -106,10 +104,8 @@ public class SchemaManagementImplTest {
String list = schemaManagement.read(BaseProperty.NAME, includeSubTypes); String list = schemaManagement.read(BaseProperty.NAME, includeSubTypes);
logger.debug("{} list : {}", BaseProperty.NAME, list); logger.debug("{} list : {}", BaseProperty.NAME, list);
ObjectMapper mapper = new ObjectMapper(); @SuppressWarnings("rawtypes")
List<TypeDefinition<BaseProperty>> typeDefinitions = mapper.readValue(list, List<TypeDefinition> typeDefinitions = ISMapper.unmarshalList(TypeDefinition.class, list);
new TypeReference<List<TypeDefinition<BaseProperty>>>() {
});
logger.debug("{}", typeDefinitions); logger.debug("{}", typeDefinitions);
list = schemaManagement.read(Entity.NAME, includeSubTypes); list = schemaManagement.read(Entity.NAME, includeSubTypes);