Fixes #13180: Migrate OrientDB from version 2.2.X to 3.0.X

Task-Url: https://support.d4science.org/issues/13180

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@177123 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-02-13 15:53:17 +00:00
parent 1e14003aa8
commit e7e7cc588e
3 changed files with 68 additions and 70 deletions

View File

@ -156,7 +156,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
if(oClass == null) { if(oClass == null) {
if(element != null) { if(element != null) {
OrientElement orientElement = (OrientElement) element; OrientElement orientElement = (OrientElement) element;
OMetadata oMetadata = orientElement.getGraph().getRawGraph().getMetadata(); OMetadata oMetadata = orientElement.getRecord().getDatabase().getMetadata();
OSchema oSchema = oMetadata.getSchema(); OSchema oSchema = oMetadata.getSchema();
String type = orientElement.getRecord().getClassName(); String type = orientElement.getRecord().getClassName();
oClass = oSchema.getClass(type); oClass = oSchema.getClass(type);

View File

@ -31,7 +31,6 @@ import org.gcube.informationsystem.resourceregistry.utils.PropagationConstraintO
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ArrayNode;

View File

@ -25,10 +25,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.metadata.security.ORole; import com.orientechnologies.orient.core.metadata.security.ORole;
import com.orientechnologies.orient.core.metadata.security.OSecurity; import com.orientechnologies.orient.core.metadata.security.OSecurity;
import com.orientechnologies.orient.core.metadata.security.OUser; import com.orientechnologies.orient.core.metadata.security.OUser;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
public class ContextManagementTest extends ScopedTest { public class ContextManagementTest extends ScopedTest {
@ -62,8 +62,8 @@ public class ContextManagementTest extends ScopedTest {
ContextUtility.getInstance().addSecurityContext(contextSecurityContext.getUUID().toString(), ContextUtility.getInstance().addSecurityContext(contextSecurityContext.getUUID().toString(),
contextSecurityContext); contextSecurityContext);
OrientGraph orientGraph = contextSecurityContext.getGraph(PermissionMode.READER); ODatabaseSession oDatabaseSession = contextSecurityContext.getDatabaseSession(PermissionMode.READER);
OSecurity oSecurity = orientGraph.getRawGraph().getMetadata().getSecurity(); OSecurity oSecurity = oDatabaseSession.getMetadata().getSecurity();
SecurityContext securityContext = null; SecurityContext securityContext = null;
if(deleted) { if(deleted) {
@ -95,7 +95,8 @@ public class ContextManagementTest extends ScopedTest {
} }
parent = securityContext.getParentSecurityContext(); parent = securityContext.getParentSecurityContext();
while(parent != null) { while(parent != null) {
String parentUser = parent.getSecurityRoleOrUserName(permissionMode, SecurityType.USER, hierarchic); String parentUser = parent.getSecurityRoleOrUserName(permissionMode, SecurityType.USER,
hierarchic);
OUser parentOUser = oSecurity.getUser(parentUser); OUser parentOUser = oSecurity.getUser(parentUser);
Assert.assertTrue(parentOUser != null); Assert.assertTrue(parentOUser != null);
Assert.assertEquals(parentOUser.hasRole(oRole.getName(), false), !deleted); Assert.assertEquals(parentOUser.hasRole(oRole.getName(), false), !deleted);
@ -372,7 +373,6 @@ public class ContextManagementTest extends ScopedTest {
// B3______________A5 // B3______________A5
*/ */
// The following delete are not allowed because they are not child contexts // The following delete are not allowed because they are not child contexts
invalidDelete(contextA1); invalidDelete(contextA1);
invalidDelete(contextA2); invalidDelete(contextA2);
@ -455,7 +455,6 @@ public class ContextManagementTest extends ScopedTest {
logger.debug("{}", context); logger.debug("{}", context);
} }
// @Test // @Test
public void deleteContext() throws ResourceRegistryException, IOException { public void deleteContext() throws ResourceRegistryException, IOException {
Context context = read(UUID.fromString("")); Context context = read(UUID.fromString(""));