@Before public void doBefore() { tx = graphDb.beginTx(); }
@Override protected void tryBackup( EmbeddedGraphDatabase graphDb, String location, int relCount ) throws IOException { System.out.println( "backing up to backup location" ); Backup backupComp = Neo4jBackup.neo4jDataSource( graphDb, location ); backupComp.doBackup(); EmbeddedGraphDatabase bDb = Util.startGraphDbInstance( location ); Transaction bTx = bDb.beginTx(); try { List<Relationship> rels = new ArrayList<Relationship>(); for ( Relationship rel : bDb.getReferenceNode().getRelationships() ) { rels.add( rel ); } assertEquals( relCount, rels.size() ); bTx.success(); } finally { bTx.finish(); } Util.stopGraphDb( bDb ); } }
@Before public void clean() { Util.deleteDir( new File( VAR ) ); System.out.println( "setting up simple database and backup-copy" ); EmbeddedGraphDatabase graphDb = Util.startGraphDbInstance( STORE_LOCATION_DIR ); configureSourceDb( graphDb ); Transaction tx = graphDb.beginTx(); try { addNode( graphDb ); tx.success(); } finally { tx.finish(); } Util.stopGraphDb( graphDb ); Util.copyDir( STORE_LOCATION_DIR, BACKUP_LOCATION_DIR ); }
protected void tryBackup( EmbeddedGraphDatabase graphDb, String location, int relCount ) throws IOException { System.out.println( "backing up to running EmbeddedGraphDatabase instance" ); EmbeddedGraphDatabase bDb = Util.startGraphDbInstance( location ); Backup backupComp = Neo4jBackup.neo4jDataSource( graphDb, bDb ); configureBackup( backupComp ); backupComp.doBackup(); Util.stopGraphDb( bDb ); bDb = Util.startGraphDbInstance( location ); Transaction bTx = bDb.beginTx(); try { List<Relationship> rels = new ArrayList<Relationship>(); for ( Relationship rel : bDb.getReferenceNode().getRelationships() ) { rels.add( rel ); } assertEquals( relCount, rels.size() ); bTx.success(); } finally { bTx.finish(); } Util.stopGraphDb( bDb ); }
@Before public void setup() { Util.deleteDir( new File( VAR ) ); System.out .println( "setting up database and backup-copy including Lucene" ); EmbeddedGraphDatabase graphDb = Util.startGraphDbInstance( STORE_LOCATION_DIR ); IndexService indexService = new LuceneIndexService( graphDb ); configureSourceDb( graphDb ); Transaction tx = graphDb.beginTx(); try { indexService.index( addNode( graphDb ), "number", 1 ); tx.success(); } finally { tx.finish(); } Util.stopGraphDb( graphDb, indexService ); Util.copyDir( STORE_LOCATION_DIR, BACKUP_LOCATION_DIR ); }
protected void tryBackup( EmbeddedGraphDatabase graphDb, String location, int relCount ) throws IOException { setupBackup( graphDb, location ); EmbeddedGraphDatabase bDb = Util.startGraphDbInstance( location ); IndexService bIndexService = new LuceneIndexService( bDb ); Transaction bTx = bDb.beginTx(); try { List<Relationship> rels = new ArrayList<Relationship>(); for ( Relationship rel : bDb.getReferenceNode().getRelationships() ) { rels.add( rel ); } assertEquals( relCount, rels.size() ); Node node = bIndexService.getSingleNode( "number", relCount ); assertEquals( true, node != null ); assertEquals( node.getId(), (long) (Long) node.getProperty( "theId", -1L ) ); bTx.success(); } finally { bTx.finish(); } Util.stopGraphDb( bDb, bIndexService ); }
@Before public void setup() { Util.deleteDir( new File( VAR ) ); System.out.println( "setting up database and backup-copy " + "including Lucene and lucene-fulltext" ); EmbeddedGraphDatabase graphDb = Util.startGraphDbInstance( STORE_LOCATION_DIR, getConfiguration() ); IndexService index = new LuceneIndexService( graphDb ); LuceneFulltextIndexService fulltextIndex = new LuceneFulltextIndexService( graphDb ); Transaction tx = graphDb.beginTx(); try { Node node = addNode( graphDb ); index.index( node, "number", 1 ); fulltextIndex.index( node, "text", "abc def" ); tx.success(); } finally { tx.finish(); } Util.stopGraphDb( graphDb, index, fulltextIndex ); Util.copyDir( STORE_LOCATION_DIR, BACKUP_LOCATION_DIR ); }
bDb ); Transaction bTx = bDb.beginTx(); try