use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class RecoveryIT method createBuilder.
private void createBuilder(long logThreshold) {
if (builder == null) {
builder = new TestDatabaseManagementServiceBuilder(neo4jLayout).setConfig(preallocate_logical_logs, false).setConfig(logical_log_rotation_threshold, logThreshold);
builder = additionalConfiguration(builder);
}
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class TestRecoveryRelationshipTypes method main.
public static void main(String[] args) throws IOException {
if (args.length != 1) {
exit(1);
}
Path storeDir = Path.of(args[0]).toAbsolutePath();
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(storeDir).build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
try (Transaction tx = db.beginTx()) {
tx.createNode().createRelationshipTo(tx.createNode(), MyRelTypes.TEST);
tx.commit();
}
CheckPointer checkPointer = ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(CheckPointer.class);
checkPointer.forceCheckPoint(new SimpleTriggerInfo("test"));
exit(0);
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class FileWatchIT method notifyWhenFileWatchingFailToStart.
@Test
void notifyWhenFileWatchingFailToStart() {
AssertableLogProvider logProvider = new AssertableLogProvider(true);
DatabaseManagementService service = null;
try {
service = new TestDatabaseManagementServiceBuilder(testDirectory.homePath("failed-start-db")).setInternalLogProvider(logProvider).setFileSystem(new NonWatchableFileSystemAbstraction()).build();
assertNotNull(managementService.database(DEFAULT_DATABASE_NAME));
assertThat(logProvider).containsMessages("Can not create file watcher for current file system. " + "File monitoring capabilities for store files will be disabled.");
} finally {
shutdownDatabaseSilently(service);
}
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class FileWatchIT method shouldLogWhenDisabled.
@Test
void shouldLogWhenDisabled() {
AssertableLogProvider logProvider = new AssertableLogProvider(true);
DatabaseManagementService service = null;
try {
service = new TestDatabaseManagementServiceBuilder(testDirectory.homePath("failed-start-db")).setInternalLogProvider(logProvider).setFileSystem(new NonWatchableFileSystemAbstraction()).setConfig(GraphDatabaseSettings.filewatcher_enabled, false).build();
assertNotNull(managementService.database(DEFAULT_DATABASE_NAME));
assertThat(logProvider).containsMessages("File watcher disabled by configuration.");
} finally {
shutdownDatabaseSilently(service);
}
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class RecoveryRequiredCheckerTest method createSomeDataAndCrash.
private static EphemeralFileSystemAbstraction createSomeDataAndCrash(Path store, Config config) throws IOException {
try (EphemeralFileSystemAbstraction ephemeralFs = new EphemeralFileSystemAbstraction()) {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(store).setFileSystem(ephemeralFs).setConfig(config).build();
final GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
try (Transaction tx = db.beginTx()) {
tx.createNode();
tx.commit();
}
EphemeralFileSystemAbstraction snapshot = ephemeralFs.snapshot();
managementService.shutdown();
return snapshot;
}
}
Aggregations