Neo4jBatchInserterRelationshipTest.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:neo4j-talend-component 作者:
@Test
public void insert_edge_should_succeed() throws Exception {
    Neo4jBatchInserterNode nodeInserter = getNeo4jBatchInserterNode(false);

    // populate the db with nodes
    List<String> columns = DummyTalendPojo.getColumnList();
    for (int i = 0; i < 100; i++) {
        DummyTalendPojo pojo = DummyTalendPojo.getDummyTalendPojo(i);
        nodeInserter.create(pojo, columns);
    }
    nodeInserter.finish();

    // create relationship
    Neo4jBatchInserterRelationship batchInserterRelationship = getNeo4jBatchInserterRelationship(true);
    for (int i = 0; i < 100; i++) {
        batchInserterRelationship.create(DummyTalendPojo.getDummyTalendPojo(i), DummyTalendPojo.getColumnList());
    }
    batchInserterRelationship.finish();

    // check the database data
    batchDb.shutdown();

    // Testing it with real graphdb
    GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
    try (Transaction tx = graphDb.beginTx()) {
        String result = graphDb.execute("MATCH ()-[r:" + REL_TYPE + "]->() RETURN count(r) AS count").resultAsString();
        Assert.assertEquals("+-------+\n| count |\n+-------+\n| 100   |\n+-------+\n1 row\n", result);
    }
    graphDb.shutdown();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号