Search in sources :

Example 61 with OrientVertex

use of com.tinkerpop.blueprints.impls.orient.OrientVertex in project orientdb by orientechnologies.

the class TestFailOperationOnRemovedElement method testDoubleRemoveVertex.

@Test(expected = ORecordNotFoundException.class)
public void testDoubleRemoveVertex() {
    OrientVertex v = grap.addVertex(null);
    grap.commit();
    v.remove();
    v.remove();
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) Test(org.junit.Test)

Example 62 with OrientVertex

use of com.tinkerpop.blueprints.impls.orient.OrientVertex in project orientdb by orientechnologies.

the class TestFailOperationOnRemovedElement method testSetPropertiesRemovedEdge.

@Test(expected = ORecordNotFoundException.class)
public void testSetPropertiesRemovedEdge() {
    OrientVertex v = grap.addVertex(null);
    OrientVertex v1 = grap.addVertex(null);
    OrientEdge e = (OrientEdge) v.addEdge("test", v1);
    grap.commit();
    e.remove();
    e.setProperties("test", "test");
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OrientEdge(com.tinkerpop.blueprints.impls.orient.OrientEdge) Test(org.junit.Test)

Example 63 with OrientVertex

use of com.tinkerpop.blueprints.impls.orient.OrientVertex in project orientdb by orientechnologies.

the class TestGraphRecovering method init.

private void init(OrientBaseGraph g, boolean lightweight) {
    g.setUseLightweightEdges(lightweight);
    g.createVertexType("V1");
    g.createVertexType("V2");
    g.createEdgeType("E1");
    g.createEdgeType("E2");
    final OrientVertex v0 = g.addVertex(null, "key", 0);
    final OrientVertex v1 = g.addVertex("class:V1", "key", 1);
    final OrientVertex v2 = g.addVertex("class:V2", "key", 2);
    v0.addEdge("E", v1);
    v1.addEdge("E1", v2);
    v2.addEdge("E2", v0);
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex)

Example 64 with OrientVertex

use of com.tinkerpop.blueprints.impls.orient.OrientVertex in project orientdb by orientechnologies.

the class IndexAgainstEdges method indexes.

@Test
public void indexes() {
    OrientGraph g = new OrientGraph(URL, "admin", "admin");
    try {
        if (g.getVertexType("Profile") == null)
            g.createVertexType("Profile");
        if (g.getEdgeType("Friend") == null) {
            final OrientEdgeType f = g.createEdgeType("Friend");
            f.createProperty("in", OType.LINK);
            f.createProperty("out", OType.LINK);
            f.createIndex("Friend.in_out", OClass.INDEX_TYPE.UNIQUE, "in", "out");
        }
        OrientVertex luca = g.addVertex("class:Profile", "name", "Luca");
        OrientVertex jay = g.addVertex("class:Profile", "name", "Jay");
        OrientEdge friend = (OrientEdge) luca.addEdge("Friend", jay);
        assertFalse(friend.isLightweight());
    } finally {
        g.shutdown();
    }
}
Also used : OrientEdgeType(com.tinkerpop.blueprints.impls.orient.OrientEdgeType) OrientGraph(com.tinkerpop.blueprints.impls.orient.OrientGraph) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OrientEdge(com.tinkerpop.blueprints.impls.orient.OrientEdge) Test(org.junit.Test)

Example 65 with OrientVertex

use of com.tinkerpop.blueprints.impls.orient.OrientVertex in project orientdb by orientechnologies.

the class OrientTestsAutoStartTx method noOConcurrentModificationExceptionSettingAFixedValueWithMultipleVertexObjects.

@Test
public void noOConcurrentModificationExceptionSettingAFixedValueWithMultipleVertexObjects() {
    final int fixedValue = 113;
    OrientVertex firstVertexHandle = graph.addVertex(null, PROPERTY_NAME, fixedValue);
    graph.commit();
    triggerException(graph);
    Object recordId = firstVertexHandle.getId();
    Vertex secondVertexHandle = graph.getVertex(recordId);
    secondVertexHandle.setProperty(PROPERTY_NAME, fixedValue);
    graph.commit();
    try {
        firstVertexHandle.setProperty(PROPERTY_NAME, fixedValue);
        graph.commit();
    } catch (OConcurrentModificationException o) {
        Assert.fail("OConcurrentModificationException was thrown");
    }
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) Vertex(com.tinkerpop.blueprints.Vertex) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) OConcurrentModificationException(com.orientechnologies.orient.core.exception.OConcurrentModificationException) Test(org.junit.Test)

Aggregations

OrientVertex (com.tinkerpop.blueprints.impls.orient.OrientVertex)155 Test (org.junit.Test)73 OrientGraph (com.tinkerpop.blueprints.impls.orient.OrientGraph)42 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)40 OrientBaseGraph (com.tinkerpop.blueprints.impls.orient.OrientBaseGraph)37 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)35 OrientGraphNoTx (com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)26 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)25 OrientEdge (com.tinkerpop.blueprints.impls.orient.OrientEdge)25 Vertex (com.tinkerpop.blueprints.Vertex)24 HashMap (java.util.HashMap)20 OBasicCommandContext (com.orientechnologies.orient.core.command.OBasicCommandContext)13 OrientGraphFactory (com.tinkerpop.blueprints.impls.orient.OrientGraphFactory)13 OrientVertexType (com.tinkerpop.blueprints.impls.orient.OrientVertexType)13 Edge (com.tinkerpop.blueprints.Edge)12 OConcurrentModificationException (com.orientechnologies.orient.core.exception.OConcurrentModificationException)10 GraphNoTxAbstractTest (com.orientechnologies.orient.graph.GraphNoTxAbstractTest)9 ORID (com.orientechnologies.orient.core.id.ORID)7 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)7 GraphTxAbstractTest (com.orientechnologies.orient.graph.GraphTxAbstractTest)7