use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class IndexingServiceIntegrationTest method setUp.
@Before
public void setUp() {
EphemeralFileSystemAbstraction fileSystem = fileSystemRule.get();
database = new TestGraphDatabaseFactory().setFileSystem(fileSystem).addKernelExtension(new LuceneSchemaIndexProviderFactory()).newImpermanentDatabase();
createData(database, 100);
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestMigrateToDenseNodeSupport method migrateDbWithDenseNodes.
@Test
public void migrateDbWithDenseNodes() throws Exception {
// migrate
new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(dir).setConfig(allow_store_upgrade, "true").newGraphDatabase().shutdown();
// check consistency
assertConsistentStore(dir);
// open again to do extra checks
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(dir).newGraphDatabase();
try (Transaction tx = db.beginTx()) {
ResourceIterator<Node> allNodesWithLabel = db.findNodes(referenceNode);
Node refNode = Iterators.single(allNodesWithLabel);
int sparseCount = 0;
for (Relationship relationship : refNode.getRelationships(Types.SPARSE, OUTGOING)) {
verifySparseNode(db, relationship.getEndNode());
sparseCount++;
}
int denseCount = 0;
for (Relationship relationship : refNode.getRelationships(Types.DENSE, OUTGOING)) {
verifyDenseNode(db, relationship.getEndNode());
denseCount++;
}
assertEquals(10, sparseCount);
assertEquals(10, denseCount);
tx.success();
}
db.shutdown();
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestConfiguration method testEnableDefaultsInConfig.
@Test
public void testEnableDefaultsInConfig() throws Exception {
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(SOURCE_DIR).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.TRUE).newGraphDatabase();
OnlineBackup.from(HOST_ADDRESS).full(BACKUP_DIR);
db.shutdown();
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class InProcessBuilderTest method shouldRunBuilderOnExistingStoreDir.
@Test
public void shouldRunBuilderOnExistingStoreDir() throws Exception {
// When
// create graph db with one node upfront
Path dir = Files.createTempDirectory(getClass().getSimpleName() + "_shouldRunBuilderOnExistingStorageDir");
File storeDir = Config.embeddedDefaults(stringMap(DatabaseManagementSystemSettings.data_directory.name(), dir.toString())).get(DatabaseManagementSystemSettings.database_path);
try {
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabase(storeDir);
try {
db.execute("create ()");
} finally {
db.shutdown();
}
try (ServerControls server = getTestServerBuilder(testDir.directory()).copyFrom(dir.toFile()).newServer()) {
// Then
try (Transaction tx = server.graph().beginTx()) {
ResourceIterable<Node> allNodes = Iterables.asResourceIterable(server.graph().getAllNodes());
assertTrue(Iterables.count(allNodes) > 0);
// When: create another node
server.graph().createNode();
tx.success();
}
}
// Then: we still only have one node since the server is supposed to work on a copy
db = new TestGraphDatabaseFactory().newEmbeddedDatabase(storeDir);
try {
try (Transaction tx = db.beginTx()) {
assertEquals(1, Iterables.count(db.getAllNodes()));
tx.success();
}
} finally {
db.shutdown();
}
} finally {
FileUtils.forceDelete(dir.toFile());
}
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class PropertySettingStrategyTest method createDb.
@BeforeClass
public static void createDb() {
db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabase();
propSetter = new PropertySettingStrategy(db);
}
Aggregations