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.schema.SchemaException;
|
||||
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.PermissionMode;
|
||||
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);
|
||||
|
||||
checkPropagationConstraint();
|
||||
if(!(this instanceof IsParentOfManagement)) {
|
||||
checkPropagationConstraint();
|
||||
}
|
||||
|
||||
logger.info("{} successfully created", elementType);
|
||||
|
||||
|
@ -499,23 +502,24 @@ public abstract class RelationManagement<R extends BaseRelation, S extends Entit
|
|||
|
||||
RemoveConstraint removeConstraint = RemoveConstraint.keep;
|
||||
|
||||
try {
|
||||
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
|
||||
Relation.PROPAGATION_CONSTRAINT);
|
||||
if(propagationConstraint.getRemoveConstraint() != null) {
|
||||
removeConstraint = propagationConstraint.getRemoveConstraint();
|
||||
} else {
|
||||
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT,
|
||||
PropagationConstraint.REMOVE_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
logger.error(error);
|
||||
throw new ResourceRegistryException(error);
|
||||
if(! (this instanceof IsParentOfManagement)) {
|
||||
try {
|
||||
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
|
||||
Relation.PROPAGATION_CONSTRAINT);
|
||||
if(propagationConstraint.getRemoveConstraint() != null) {
|
||||
removeConstraint = propagationConstraint.getRemoveConstraint();
|
||||
} else {
|
||||
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT,
|
||||
PropagationConstraint.REMOVE_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
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();
|
||||
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.types.TypeBinder;
|
||||
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.resources.Actor;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts;
|
||||
|
@ -24,9 +25,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
|
@ -106,10 +104,8 @@ public class SchemaManagementImplTest {
|
|||
String list = schemaManagement.read(BaseProperty.NAME, includeSubTypes);
|
||||
logger.debug("{} list : {}", BaseProperty.NAME, list);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<TypeDefinition<BaseProperty>> typeDefinitions = mapper.readValue(list,
|
||||
new TypeReference<List<TypeDefinition<BaseProperty>>>() {
|
||||
});
|
||||
@SuppressWarnings("rawtypes")
|
||||
List<TypeDefinition> typeDefinitions = ISMapper.unmarshalList(TypeDefinition.class, list);
|
||||
logger.debug("{}", typeDefinitions);
|
||||
|
||||
list = schemaManagement.read(Entity.NAME, includeSubTypes);
|
||||
|
|
Loading…
Reference in New Issue