Search in sources :

Example 26 with OrientVertex

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

the class ODatabaseFailDueCloseTest method fillTheGraph.

private static void fillTheGraph(OrientGraph graph) {
    OrientVertex riccardo = createPerson(graph, "riccardo", 32);
    OrientVertex luca = createPerson(graph, "luca", 40);
    OrientVertex luigi = createPerson(graph, "luigi", 30);
    OrientVertex milano = createCity(graph, "milano", 1332516);
    OrientVertex roma = createCity(graph, "roma", 1332516);
    OrientVertex unknown = createCity(graph, "unknown", -1);
    riccardo.addEdge("lives", milano);
    luca.addEdge("lives", roma);
    luigi.addEdge("lives", unknown);
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex)

Example 27 with OrientVertex

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

the class ODatabaseFailDueCloseTest method createCity.

private static OrientVertex createCity(OrientGraph graph, String localName, int population) {
    OrientVertex a = graph.addVertex("class:City");
    a.setProperties("localName", localName, "population", population);
    return a;
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex)

Example 28 with OrientVertex

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

the class TestFailOperationOnRemovedElement method testPropertyTypeRemovedEdge.

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

Example 29 with OrientVertex

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

the class TestFailOperationOnRemovedElement method testSetPropertyTypeOnRemovedVertex.

@Test(expected = ORecordNotFoundException.class)
public void testSetPropertyTypeOnRemovedVertex() {
    OrientVertex v = grap.addVertex(null);
    grap.commit();
    v.remove();
    v.setProperty("test", "aaaa", OType.STRING);
}
Also used : OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex) Test(org.junit.Test)

Example 30 with OrientVertex

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

the class ServerClusterQueryTest method checkShardedGroupBy.

private void checkShardedGroupBy() {
    for (int s = 0; s < SERVERS; ++s) {
        OrientGraphFactory factory = new OrientGraphFactory("plocal:target/server" + s + "/databases/" + getDatabaseName());
        OrientGraphNoTx g = factory.getNoTx();
        try {
            Iterable<OrientVertex> result = g.command(new OCommandSQL("select from ( select amount, kind from v group by kind ) order by kind")).execute();
            Iterator<OrientVertex> it = result.iterator();
            Assert.assertTrue(it.hasNext());
            OrientVertex r1 = it.next();
            Assert.assertTrue(it.hasNext());
            OrientVertex r2 = it.next();
            Assert.assertFalse(it.hasNext());
            Assert.assertEquals(r1.getProperty("kind"), "a");
            Assert.assertEquals(r2.getProperty("kind"), "b");
        } finally {
            g.shutdown();
        }
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) OrientGraphFactory(com.tinkerpop.blueprints.impls.orient.OrientGraphFactory) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) OrientVertex(com.tinkerpop.blueprints.impls.orient.OrientVertex)

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