use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class CountsComputerTest method setup.
@Before
public void setup() {
fs = fsRule.get();
dir = testDir.directory("dir").getAbsoluteFile();
dbBuilder = new TestGraphDatabaseFactory().setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).newImpermanentDatabaseBuilder(dir);
pageCache = pcRule.getPageCache(fs);
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class CountsRotationTest method setup.
@Before
public void setup() {
fs = fsRule.get();
dir = testDir.directory("dir").getAbsoluteFile();
dbBuilder = new TestGraphDatabaseFactory().setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).newImpermanentDatabaseBuilder(dir);
pageCache = pcRule.getPageCache(fs);
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestGraphProperties method produceUncleanStore.
private EphemeralFileSystemAbstraction produceUncleanStore(EphemeralFileSystemAbstraction fileSystem, File storeDir) {
GraphDatabaseService db = new TestGraphDatabaseFactory().setFileSystem(fileSystem).newImpermanentDatabase(storeDir);
Transaction tx = db.beginTx();
Node node = db.createNode();
node.setProperty("name", "Something");
properties((GraphDatabaseAPI) db).setProperty("prop", "Some value");
tx.success();
tx.close();
EphemeralFileSystemAbstraction snapshot = fileSystem.snapshot();
db.shutdown();
return snapshot;
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestGraphProperties method twoUncleanInARow.
@Test
public void twoUncleanInARow() throws Exception {
File storeDir = new File("dir");
try (EphemeralFileSystemAbstraction snapshot = produceUncleanStore(fs.get(), storeDir)) {
try (EphemeralFileSystemAbstraction snapshot2 = produceUncleanStore(snapshot, storeDir)) {
GraphDatabaseAPI db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().setFileSystem(produceUncleanStore(snapshot2, storeDir)).newImpermanentDatabase(storeDir);
assertThat(properties(db), inTx(db, hasProperty("prop").withValue("Some value")));
db.shutdown();
}
}
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class RelationshipChainExplorerTest method createStoreWithOneHighDegreeNodeAndSeveralDegreeTwoNodes.
private StoreAccess createStoreWithOneHighDegreeNodeAndSeveralDegreeTwoNodes(int nDegreeTwoNodes) {
File storeDirectory = storeLocation.graphDbDir();
GraphDatabaseService database = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDirectory).setConfig(GraphDatabaseSettings.record_format, getRecordFormatName()).newGraphDatabase();
try (Transaction transaction = database.beginTx()) {
Node denseNode = database.createNode();
for (int i = 0; i < nDegreeTwoNodes; i++) {
Node degreeTwoNode = database.createNode();
Node leafNode = database.createNode();
if (i % 2 == 0) {
denseNode.createRelationshipTo(degreeTwoNode, TestRelationshipType.CONNECTED);
} else {
degreeTwoNode.createRelationshipTo(denseNode, TestRelationshipType.CONNECTED);
}
degreeTwoNode.createRelationshipTo(leafNode, TestRelationshipType.CONNECTED);
}
transaction.success();
}
database.shutdown();
PageCache pageCache = pageCacheRule.getPageCache(fileSystemRule.get());
StoreAccess storeAccess = new StoreAccess(fileSystemRule.get(), pageCache, storeDirectory, Config.empty());
return storeAccess.initialize();
}
Aggregations