@Test
public void createLinktest() {
database.open("admin", "admin");
Assert.assertTrue((Integer) database.command(new OCommandSQL("CREATE CLASS POST")).execute() > 0);
Assert
.assertTrue(database.command(new OCommandSQL("INSERT INTO POST (id, title) VALUES ( 10, 'NoSQL movement' );")).execute() instanceof ODocument);
Assert
.assertTrue(database.command(new OCommandSQL("INSERT INTO POST (id, title) VALUES ( 20, 'New OrientDB' )")).execute() instanceof ODocument);
Assert.assertTrue((Integer) database.command(new OCommandSQL("CREATE CLASS COMMENT")).execute() > 0);
Assert.assertTrue(database.command(new OCommandSQL("INSERT INTO COMMENT (id, postId, text) VALUES ( 0, 10, 'First' )"))
.execute() instanceof ODocument);
Assert.assertTrue(database.command(new OCommandSQL("INSERT INTO COMMENT (id, postId, text) VALUES ( 1, 10, 'Second' )"))
.execute() instanceof ODocument);
Assert.assertTrue(database.command(new OCommandSQL("INSERT INTO COMMENT (id, postId, text) VALUES ( 21, 10, 'Another' )"))
.execute() instanceof ODocument);
Assert.assertTrue(database.command(new OCommandSQL("INSERT INTO COMMENT (id, postId, text) VALUES ( 41, 20, 'First again' )"))
.execute() instanceof ODocument);
Assert.assertTrue(database.command(new OCommandSQL("INSERT INTO COMMENT (id, postId, text) VALUES ( 82, 20, 'Second Again' )"))
.execute() instanceof ODocument);
Assert.assertEquals(((Number) database.command(new OCommandSQL("CREATE LINK comments FROM comment.postId To post.id INVERSE"))
.execute()).intValue(), 5);
Assert.assertEquals(((Number) database.command(new OCommandSQL("UPDATE comment REMOVE postId")).execute()).intValue(), 5);
database.close();
}