use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class MissingStoreFilesRecoveryIT method setUp.
@BeforeEach
void setUp() throws IOException {
serviceBuilder = new TestDatabaseManagementServiceBuilder(testDirectory.homePath());
managementService = serviceBuilder.build();
var databaseApi = defaultDatabase(managementService);
createSomeData(databaseApi);
databaseLayout = databaseApi.databaseLayout();
defaultNamedDatabaseId = getDatabaseManager().databaseIdRepository().getByName(DEFAULT_DATABASE_NAME).get();
managementService.shutdown();
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class RecoveryCorruptedTransactionLogIT method setUp.
@BeforeEach
void setUp() {
monitors.addMonitorListener(recoveryMonitor);
databaseFactory = new TestDatabaseManagementServiceBuilder(databaseLayout).setConfig(checkpoint_logical_log_keep_threshold, 25).setInternalLogProvider(logProvider).setMonitors(monitors).setFileSystem(fileSystem);
txOffsetAfterStart = startStopDatabaseAndGetTxOffset();
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class TestTxEntries method testStartEntryWrittenOnceOnRollback.
@Test
void testStartEntryWrittenOnceOnRollback() {
Path storeDir = testDirectory.homePath();
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(storeDir).setFileSystem(fs).impermanent().build();
final GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
createSomeTransactions(db);
EphemeralFileSystemAbstraction snapshot = fs.snapshot();
managementService.shutdown();
managementService = new TestDatabaseManagementServiceBuilder(storeDir).setFileSystem(snapshot).impermanent().build();
managementService.shutdown();
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class DatabaseFileListingTest method verifyLogFilesWithCustomPathListing.
private void verifyLogFilesWithCustomPathListing(Path path) throws IOException {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(testDirectory.homePath("customDb")).setConfig(GraphDatabaseSettings.transaction_logs_root_path, path).build();
GraphDatabaseAPI graphDatabase = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
Database database = graphDatabase.getDependencyResolver().resolveDependency(Database.class);
LogFiles logFiles = graphDatabase.getDependencyResolver().resolveDependency(LogFiles.class);
assertTrue(database.listStoreFiles(true).stream().anyMatch(metadata -> metadata.isLogFile() && logFiles.isLogFile(metadata.path())));
assertEquals(path.getFileName().toString(), logFiles.logFilesDirectory().getParent().getFileName().toString());
managementService.shutdown();
}
use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.
the class LockerLifecycleAdapterTest method shouldNotAllowDatabasesToUseFilesetsConcurrently.
private void shouldNotAllowDatabasesToUseFilesetsConcurrently(Map<Setting<?>, Object> config) {
DatabaseManagementService managementService = newDb();
DatabaseManagementService embeddedService = null;
try {
embeddedService = new TestDatabaseManagementServiceBuilder(directory.homePath()).setConfig(config).build();
fail();
} catch (RuntimeException e) {
assertThat(e.getCause().getCause()).isInstanceOf(FileLockException.class);
} finally {
if (embeddedService != null) {
embeddedService.shutdown();
}
if (managementService != null) {
managementService.shutdown();
}
}
}
Aggregations