Search in sources :

Example 1 with SimpleRelationship

use of org.neo4j.kernel.impl.batchinsert.SimpleRelationship in project graphdb by neo4j-attic.

the class TestBatchInsert method testMore.

@Test
public void testMore() {
    BatchInserter graphDb = newBatchInserter();
    long startNode = graphDb.createNode(properties);
    long[] endNodes = new long[25];
    Set<Long> rels = new HashSet<Long>();
    for (int i = 0; i < 25; i++) {
        endNodes[i] = graphDb.createNode(properties);
        rels.add(graphDb.createRelationship(startNode, endNodes[i], relTypeArray[i % 5], properties));
    }
    for (SimpleRelationship rel : graphDb.getRelationships(startNode)) {
        assertTrue(rels.contains(rel.getId()));
        assertEquals(rel.getStartNode(), startNode);
    }
    graphDb.setNodeProperties(startNode, properties);
    graphDb.shutdown();
}
Also used : BatchInserter(org.neo4j.kernel.impl.batchinsert.BatchInserter) SimpleRelationship(org.neo4j.kernel.impl.batchinsert.SimpleRelationship) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with SimpleRelationship

use of org.neo4j.kernel.impl.batchinsert.SimpleRelationship in project graphdb by neo4j-attic.

the class TestBatchInsert method testSimple.

@Test
public void testSimple() {
    BatchInserter graphDb = newBatchInserter();
    long node1 = graphDb.createNode(null);
    long node2 = graphDb.createNode(null);
    long rel1 = graphDb.createRelationship(node1, node2, RelTypes.BATCH_TEST, null);
    SimpleRelationship rel = graphDb.getRelationshipById(rel1);
    assertEquals(rel.getStartNode(), node1);
    assertEquals(rel.getEndNode(), node2);
    assertEquals(RelTypes.BATCH_TEST.name(), rel.getType().name());
    graphDb.shutdown();
}
Also used : BatchInserter(org.neo4j.kernel.impl.batchinsert.BatchInserter) SimpleRelationship(org.neo4j.kernel.impl.batchinsert.SimpleRelationship) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BatchInserter (org.neo4j.kernel.impl.batchinsert.BatchInserter)2 SimpleRelationship (org.neo4j.kernel.impl.batchinsert.SimpleRelationship)2 HashSet (java.util.HashSet)1