Search in sources :

Example 56 with OrientGraphNoTx

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();
    }
}
Also used : OGraphRepair(com.tinkerpop.blueprints.impls.orient.OGraphRepair) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) OrientBaseGraph(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph) Test(org.junit.Test)

Example 57 with OrientGraphNoTx

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();
    }
}
Also used : OGraphRepair(com.tinkerpop.blueprints.impls.orient.OGraphRepair) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) OrientBaseGraph(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph) Edge(com.tinkerpop.blueprints.Edge) OrientEdge(com.tinkerpop.blueprints.impls.orient.OrientEdge) Test(org.junit.Test)

Example 58 with OrientGraphNoTx

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();
    }
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OGraphRepair(com.tinkerpop.blueprints.impls.orient.OGraphRepair) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OrientBaseGraph(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph) Test(org.junit.Test)

Example 59 with OrientGraphNoTx

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();
    }
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OGraphRepair(com.tinkerpop.blueprints.impls.orient.OGraphRepair) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OrientBaseGraph(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph) ORecordId(com.orientechnologies.orient.core.id.ORecordId) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Example 60 with OrientGraphNoTx

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" });
}
Also used : OrientVertexType(com.tinkerpop.blueprints.impls.orient.OrientVertexType) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) Before(org.junit.Before)

Aggregations

OrientGraphNoTx (com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)72 OrientVertex (com.tinkerpop.blueprints.impls.orient.OrientVertex)28 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)23 Test (org.junit.Test)22 OrientGraphFactory (com.tinkerpop.blueprints.impls.orient.OrientGraphFactory)20 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)17 OrientVertexType (com.tinkerpop.blueprints.impls.orient.OrientVertexType)17 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)16 OrientBaseGraph (com.tinkerpop.blueprints.impls.orient.OrientBaseGraph)15 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)7 Vertex (com.tinkerpop.blueprints.Vertex)6 OrientGraph (com.tinkerpop.blueprints.impls.orient.OrientGraph)6 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)5 OGraphMLReader (com.orientechnologies.orient.graph.graphml.OGraphMLReader)5 OGraphRepair (com.tinkerpop.blueprints.impls.orient.OGraphRepair)5 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)4 Edge (com.tinkerpop.blueprints.Edge)4 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)3 OrientEdge (com.tinkerpop.blueprints.impls.orient.OrientEdge)3 File (java.io.File)3