package com.gentics.mesh.graphdb.orientdb;

import org.junit.Test;

import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph;

public class OrientDBTinkerpopMultithreadingTest extends AbstractOrientDBTest {

	OrientTransactionalGraph memoryGraph = new OrientGraph("memory:tinkerpop");

	@Test
	public void testMultithreading() {
		Vertex v2 = memoryGraph.addVertex(null);
		Vertex v = memoryGraph.addVertex(null);
		memoryGraph.commit();
		//		Object id = v.getId();
		runAndWait(() -> {
//			memoryGraph.activateOnCurrentThread(); 
			v.setProperty("sfaf", "dxgvasdg");
			v.addEdge("adadsg", v2);
			//			Vertex e = memoryGraph.getVertex(id);
			//			assertNotNull(e);
			//			assertEquals("marko", e.getProperty("name"));
			//			e.setProperty("name", "joe");
			//			memoryGraph.rollback();
		});
		//		assertEquals("marko", v.getProperty("name"));

	}

}

@@ -152,21 +152,23 @@
 t.Orient
-Graph
+Element
 ;%0Aimport
@@ -212,34 +212,86 @@
 t.Orient
-TransactionalGraph
+Graph;%0Aimport com.tinkerpop.blueprints.impls.orient.OrientGraphFactory
 ;%0A%0Apubli
@@ -377,38 +377,28 @@
 ient
-TransactionalGraph memoryGraph
+GraphFactory factory
  = n
@@ -411,16 +411,23 @@
 entGraph
+Factory
 (%22memory
@@ -484,16 +484,55 @@
 ing() %7B%0A
+%09%09OrientGraph graph = factory.getTx();%0A
 %09%09Vertex
@@ -537,23 +537,17 @@
 ex v2 = 
-memoryG
+g
 raph.add
@@ -573,23 +573,17 @@
 tex v = 
-memoryG
+g
 raph.add
@@ -598,23 +598,17 @@
 ull);%0A%09%09
-memoryG
+g
 raph.com
@@ -614,16 +614,19 @@
 mmit();%0A
+%09%09%0A
 %09%09//%09%09Ob
@@ -667,32 +667,38 @@
 () -%3E %7B%0A
-//
 %09%09%09
-memory
+graph.getRaw
 Graph
+()
 .activat
@@ -716,17 +716,52 @@
 hread();
- 
+%0A%09%09%09graph.attach((OrientElement) v);
 %0A%09%09%09v.se

Add guardcode