@Test
public void testWriteNodes() throws IOException, SQLException {
KiWiConnection con = store.getPersistence().getConnection();
PGCopyOutputStream out = new PGCopyOutputStream(PGCopyUtil.getWrappedConnection(con.getJDBCConnection()), "COPY nodes FROM STDIN (FORMAT csv)");
long start = System.currentTimeMillis();
List<KiWiNode> nodes = new ArrayList<>(10000);
nodes.add(TYPE_INT);
nodes.add(TYPE_DBL);
nodes.add(TYPE_BOOL);
nodes.add(TYPE_DATE);
nodes.add(EMPTY);
// randomly create 10000 nodes
for(int i=0; i<10000; i++) {
nodes.add(randomObject());
}
// flush out nodes
PGCopyUtil.flushNodes(nodes, out);
out.close();
long imported = System.currentTimeMillis();
log.info("imported {} nodes in {} ms", nodes.size(), imported-start);