use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestConcurrentRelationshipChainLoadingIssue method tryToTriggerRelationshipLoadingStoppingMidWay.
private void tryToTriggerRelationshipLoadingStoppingMidWay(int denseNodeThreshold) throws Throwable {
GraphDatabaseAPI db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().setConfig(dense_node_threshold, "" + denseNodeThreshold).newGraphDatabase();
Node node = createNodeWithRelationships(db);
checkStateToHelpDiagnoseFlakeyTest(db, node);
long end = currentTimeMillis() + SECONDS.toMillis(5);
int iterations = 0;
while (currentTimeMillis() < end && iterations < 100) {
tryOnce(db, node);
iterations++;
}
db.shutdown();
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestExceptionTypeOnInvalidIds method createDatabase.
@BeforeClass
public static void createDatabase() {
graphdb = new TestGraphDatabaseFactory().newEmbeddedDatabase(getRandomStoreDir());
File storeDir = getRandomStoreDir();
new TestGraphDatabaseFactory().newEmbeddedDatabase(storeDir).shutdown();
graphDbReadOnly = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig(GraphDatabaseSettings.read_only, TRUE).newGraphDatabase();
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class TestLogPruning method newDb.
private GraphDatabaseAPI newDb(String logPruning, int rotateEveryNTransactions) {
this.rotateEveryNTransactions = rotateEveryNTransactions;
fs = new EphemeralFileSystemAbstraction();
TestGraphDatabaseFactory gdf = new TestGraphDatabaseFactory();
gdf.setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs));
GraphDatabaseBuilder builder = gdf.newImpermanentDatabaseBuilder();
builder.setConfig(keep_logical_logs, logPruning);
this.db = (GraphDatabaseAPI) builder.newGraphDatabase();
files = new PhysicalLogFiles(new File(db.getStoreDir()), PhysicalLogFile.DEFAULT_NAME, fs);
return db;
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class RestoreClusterUtils method createClassicNeo4jStore.
public static File createClassicNeo4jStore(File base, FileSystemAbstraction fileSystem, int nodesToCreate, String recordFormat) {
File existingDbDir = new File(base, "existing");
GraphDatabaseService db = new TestGraphDatabaseFactory().setFileSystem(fileSystem).newEmbeddedDatabaseBuilder(existingDbDir).setConfig(GraphDatabaseSettings.record_format, recordFormat).newGraphDatabase();
for (int i = 0; i < (nodesToCreate / 2); i++) {
try (Transaction tx = db.beginTx()) {
Node node1 = db.createNode(Label.label("Label-" + i));
Node node2 = db.createNode(Label.label("Label-" + i));
node1.createRelationshipTo(node2, RelationshipType.withName("REL-" + i));
tx.success();
}
}
db.shutdown();
return existingDbDir;
}
use of org.neo4j.test.TestGraphDatabaseFactory in project neo4j by neo4j.
the class UserFunctionIT method shouldLogLikeThereIsNoTomorrow.
@Test
public void shouldLogLikeThereIsNoTomorrow() throws Throwable {
// Given
AssertableLogProvider logProvider = new AssertableLogProvider();
db.shutdown();
db = new TestGraphDatabaseFactory().setInternalLogProvider(logProvider).setUserLogProvider(logProvider).newImpermanentDatabaseBuilder().setConfig(GraphDatabaseSettings.plugin_dir, plugins.getRoot().getAbsolutePath()).newGraphDatabase();
// When
try (Transaction ignore = db.beginTx()) {
Result res = db.execute("RETURN org.neo4j.procedure.logAround()");
while (res.hasNext()) {
res.next();
}
}
// Then
AssertableLogProvider.LogMatcherBuilder match = inLog(Procedures.class);
logProvider.assertAtLeastOnce(match.debug("1"), match.info("2"), match.warn("3"), match.error("4"));
}
Aggregations