All tests are back to normal
This commit is contained in:
parent
495cba3145
commit
914f267c29
|
@ -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);
|
||||||
|
|
||||||
checkPropagationConstraint();
|
if(!(this instanceof IsParentOfManagement)) {
|
||||||
|
checkPropagationConstraint();
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("{} successfully created", elementType);
|
logger.info("{} successfully created", elementType);
|
||||||
|
|
||||||
|
@ -499,23 +502,24 @@ public abstract class RelationManagement<R extends BaseRelation, S extends Entit
|
||||||
|
|
||||||
RemoveConstraint removeConstraint = RemoveConstraint.keep;
|
RemoveConstraint removeConstraint = RemoveConstraint.keep;
|
||||||
|
|
||||||
try {
|
if(! (this instanceof IsParentOfManagement)) {
|
||||||
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
|
try {
|
||||||
Relation.PROPAGATION_CONSTRAINT);
|
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
|
||||||
if(propagationConstraint.getRemoveConstraint() != null) {
|
Relation.PROPAGATION_CONSTRAINT);
|
||||||
removeConstraint = propagationConstraint.getRemoveConstraint();
|
if(propagationConstraint.getRemoveConstraint() != null) {
|
||||||
} else {
|
removeConstraint = propagationConstraint.getRemoveConstraint();
|
||||||
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT,
|
} else {
|
||||||
PropagationConstraint.REMOVE_PROPERTY, Utility.toJsonString(element, true),
|
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT,
|
||||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
PropagationConstraint.REMOVE_PROPERTY, Utility.toJsonString(element, true),
|
||||||
logger.error(error);
|
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||||
throw new ResourceRegistryException(error);
|
logger.error(error);
|
||||||
|
throw new ResourceRegistryException(error);
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.warn("Error while getting {} from {}. Assuming {}. {}", Relation.PROPAGATION_CONSTRAINT,
|
||||||
|
Utility.toJsonString(element, true), removeConstraint, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
|
||||||
logger.warn("Error while getting {} from {}. Assuming {}. {}", Relation.PROPAGATION_CONSTRAINT,
|
|
||||||
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();
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue