use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverPerfectGraphNonLW.
@Test
public void testRecoverPerfectGraphNonLW() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverPerfectGraphNonLW");
try {
init(g, false);
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 3);
Assert.assertEquals(eventListener.removedEdges, 0);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 6);
Assert.assertEquals(eventListener.removedLinks, 0);
Assert.assertEquals(eventListener.repairedVertices, 0);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverBrokenGraphAllEdges.
@Test
public void testRecoverBrokenGraphAllEdges() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverBrokenGraphAllEdges");
try {
init(g, false);
for (Edge e : g.getEdges()) {
((OrientEdge) e).getRecord().removeField("out");
((OrientEdge) e).getRecord().save();
}
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 3);
Assert.assertEquals(eventListener.removedEdges, 3);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 6);
Assert.assertEquals(eventListener.removedLinks, 6);
Assert.assertEquals(eventListener.repairedVertices, 3);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverBrokenGraphLinksInVerticesNonLW.
@Test
public void testRecoverBrokenGraphLinksInVerticesNonLW() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverBrokenGraphLinksInVerticesNonLW");
try {
init(g, false);
for (Vertex v : g.getVertices()) {
for (String f : ((OrientVertex) v).getRecord().fieldNames()) {
if (f.startsWith("out_"))
((OrientVertex) v).getRecord().removeField(f);
}
}
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 3);
Assert.assertEquals(eventListener.removedEdges, 3);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 3);
Assert.assertEquals(eventListener.removedLinks, 3);
Assert.assertEquals(eventListener.repairedVertices, 3);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverBrokenGraphLinksInVerticesLW.
@Test
public void testRecoverBrokenGraphLinksInVerticesLW() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverBrokenGraphLinksInVerticesLW");
try {
init(g, true);
for (Vertex v : g.getVertices()) {
final ODocument record = ((OrientVertex) v).getRecord();
int key = v.getProperty("key");
if (key == 0)
record.field("out_", record);
else if (key == 1)
record.field("in_E1", new ORecordId(100, 200));
else if (key == 2)
record.field("out_E2", record);
record.save();
}
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 0);
Assert.assertEquals(eventListener.removedEdges, 0);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 7);
Assert.assertEquals(eventListener.removedLinks, 5);
Assert.assertEquals(eventListener.repairedVertices, 3);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class LuceneTransactionCompositeQueryTest method init.
@Before
public void init() {
final OrientVertexType c1 = new OrientGraphNoTx(db).createVertexType("Foo");
c1.createProperty("name", OType.STRING);
c1.createProperty("bar", OType.STRING);
c1.createIndex("Foo.bar", "FULLTEXT", null, null, "LUCENE", new String[] { "bar" });
c1.createIndex("Foo.name", "NOTUNIQUE", null, null, "SBTREE", new String[] { "name" });
}
Aggregations