use of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph in project orientdb by orientechnologies.
the class BlueprintsConcurrentGraphChangesTestNoTx method addEdgesConcurrently.
private void addEdgesConcurrently() throws Exception {
ExecutorService executorService = Executors.newCachedThreadPool();
beginTime = System.currentTimeMillis();
List<Future<Void>> futures = new ArrayList<Future<Void>>();
for (int i = 0; i < THREADS; i++) futures.add(executorService.submit(new ConcurrentGraphCreator()));
latchCreate.countDown();
for (Future<Void> future : futures) future.get();
final OrientBaseGraph g = getGraph();
printStats(g);
g.shutdown();
}
use of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph in project orientdb by orientechnologies.
the class BlueprintsConcurrentGraphChangesTestNoTx method assertEdgesDeletedGraph.
private void assertEdgesDeletedGraph() {
OrientBaseGraph graph = getGraph();
graph.setUseLightweightEdges(false);
Assert.assertEquals(VERTEXES_COUNT, graph.countVertices("TestVertex"));
Assert.assertEquals(0, graph.countEdges("TestEdge"));
for (TestVertex vertex : vertexes) {
Iterable<Vertex> vertexes = graph.command(new OSQLSynchQuery<Vertex>("select from TestVertex where uuid = '" + vertex.uuid + "'")).execute();
Assert.assertTrue(vertexes.iterator().hasNext());
Vertex gVertex = vertexes.iterator().next();
OMultiCollectionIterator<Edge> outEdges = (OMultiCollectionIterator<Edge>) gVertex.getEdges(Direction.OUT);
Assert.assertEquals(outEdges.size(), 0);
OMultiCollectionIterator<Edge> inEdges = (OMultiCollectionIterator<Edge>) gVertex.getEdges(Direction.IN);
Assert.assertEquals(inEdges.size(), 0);
}
assertGraphIsConsistent(graph);
graph.shutdown();
}
use of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph in project orientdb by orientechnologies.
the class BlueprintsConcurrentGraphChangesTestNoTx method assertVerticesDeletedGraph.
private void assertVerticesDeletedGraph() {
OrientBaseGraph graph = getGraph();
graph.setUseLightweightEdges(false);
Assert.assertEquals(0, graph.countVertices("TestVertex"));
Assert.assertEquals(0, graph.countEdges("TestEdge"));
assertGraphIsConsistent(graph);
graph.shutdown();
}
use of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph in project orientdb by orientechnologies.
the class BlueprintsConcurrentGraphChangesTestNoTx method deleteVerticesConcurrently.
private void deleteVerticesConcurrently() throws Exception {
ExecutorService executorService = Executors.newCachedThreadPool();
beginTime = System.currentTimeMillis();
List<Future<Void>> futures = new ArrayList<Future<Void>>();
for (int i = 0; i < THREADS; i++) futures.add(executorService.submit(new ConcurrentVertexRemover()));
latchVertexDelete.countDown();
for (Future<Void> future : futures) future.get();
final OrientBaseGraph g = getGraph();
printStats(g);
g.shutdown();
}
use of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph in project orientdb by orientechnologies.
the class BlueprintsConcurrentGraphChangesTestNoTx method createGraphAndDeleteVertices.
protected void createGraphAndDeleteVertices() throws Exception {
OrientBaseGraph graph = getGraph();
graph.drop();
generateVertexes();
generateEdges();
initGraph();
System.out.println("Start adding edges concurrently for further delete vertices...");
addEdgesConcurrently();
System.out.println("Checking the graph...");
assertCreatedGraph();
System.out.println("Start removing vertices concurrently...");
deleteVerticesConcurrently();
System.out.println("Checking the graph...");
assertVerticesDeletedGraph();
graph = getGraph();
graph.drop();
}
Aggregations