use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class DatabaseShutdownTest method invokeDatabaseShutdownListenersOnShutdown.
@Test
void invokeDatabaseShutdownListenersOnShutdown() {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(databaseLayout).setFileSystem(fs).build();
ShutdownListenerDatabaseEventListener shutdownHandler = new ShutdownListenerDatabaseEventListener();
managementService.registerDatabaseEventListener(shutdownHandler);
managementService.shutdown();
assertEquals(2, shutdownHandler.shutdownCounter());
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class QueryRestartIT method startSnapshotQueryDb.
private GraphDatabaseService startSnapshotQueryDb() {
// Inject TransactionVersionContextSupplier
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependencies(testContextSupplier);
managementService = new TestDatabaseManagementServiceBuilder(storeDir).setExternalDependencies(dependencies).setConfig(snapshot_query, true).setConfig(index_background_sampling_enabled, false).build();
return managementService.database(DEFAULT_DATABASE_NAME);
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class TestGraphDescription method startDatabase.
@BeforeAll
public static void startDatabase() {
managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
graphdb = managementService.database(DEFAULT_DATABASE_NAME);
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class RecoveryLogIT method transactionsRecoveryLogContainsTimeSpent.
@Test
void transactionsRecoveryLogContainsTimeSpent() throws IOException {
// Create database with forced recovery
Path tmpLogDir = testDirectory.directory("logs");
managementService = new TestDatabaseManagementServiceBuilder(testDirectory.homePath()).build();
GraphDatabaseAPI db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
StorageEngineFactory storageEngineFactory = db.getDependencyResolver().resolveDependency(StorageEngineFactory.class);
try (Transaction tx = db.beginTx()) {
Node node1 = tx.createNode();
Node node2 = tx.createNode();
node1.createRelationshipTo(node2, RelationshipType.withName("likes"));
tx.commit();
}
Path[] txLogs = LogFilesBuilder.logFilesBasedOnlyBuilder(databaseLayout.getTransactionLogsDirectory(), fileSystem).withCommandReaderFactory(storageEngineFactory.commandReaderFactory()).build().logFiles();
for (Path file : txLogs) {
fileSystem.copyToDirectory(file, tmpLogDir);
}
managementService.shutdown();
for (Path txLog : fileSystem.listFiles(databaseLayout.getTransactionLogsDirectory())) {
fileSystem.deleteFile(txLog);
}
for (Path file : LogFilesBuilder.logFilesBasedOnlyBuilder(tmpLogDir, fileSystem).withCommandReaderFactory(storageEngineFactory.commandReaderFactory()).build().logFiles()) {
fileSystem.moveToDirectory(file, databaseLayout.getTransactionLogsDirectory());
}
AssertableLogProvider provider = new AssertableLogProvider();
managementService = new TestDatabaseManagementServiceBuilder(testDirectory.homePath()).setInternalLogProvider(provider).build();
managementService.database(DEFAULT_DATABASE_NAME);
assertThat(provider).containsMessages("Recovery completed", "time spent");
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class UniqueSpatialIndexIT method setupDb.
private void setupDb(GraphDatabaseSettings.SchemaIndex schemaIndex) {
managementService = new TestDatabaseManagementServiceBuilder(directory.homePath()).setConfig(GraphDatabaseSettings.default_schema_provider, schemaIndex.providerName()).build();
db = managementService.database(DEFAULT_DATABASE_NAME);
}
Aggregations