use of org.neo4j.logging.AssertableLogProvider in project neo4j-documentation by neo4j.
the class NeoServerShutdownLoggingDocIT method setupServer.
@Before
public void setupServer() throws IOException {
logProvider = new AssertableLogProvider();
server = ServerHelper.createNonPersistentServer(logProvider);
ServerHelper.cleanTheDatabase(server);
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeShouldGiveProgressMonitorProgressMessages.
@ParameterizedTest
@MethodSource("versions")
void upgradeShouldGiveProgressMonitorProgressMessages(RecordFormats formats) throws Exception {
init(formats);
// Given
StoreVersionCheck check = getVersionCheck(pageCache);
// When
AssertableLogProvider logProvider = new AssertableLogProvider();
newUpgrader(check, pageCache, allowMigrateConfig, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(databaseLayout, false);
// Then
assertThat(logProvider).containsMessages("Store files", "Indexes", "Successfully finished");
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class StoreUpgraderTest method failToMoveTransactionLogsIfTheyAlreadyExist.
@ParameterizedTest
@MethodSource("versions")
void failToMoveTransactionLogsIfTheyAlreadyExist(RecordFormats formats) throws IOException {
init(formats);
Path txRoot = testDirectory.directory("customTxRoot");
AssertableLogProvider logProvider = new AssertableLogProvider();
StoreVersionCheck check = getVersionCheck(pageCache);
Config config = Config.newBuilder().fromConfig(allowMigrateConfig).set(neo4j_home, testDirectory.homePath()).set(GraphDatabaseSettings.transaction_logs_root_path, txRoot.toAbsolutePath()).set(default_database, databaseLayout.getDatabaseName()).build();
DatabaseLayout migrationLayout = DatabaseLayout.of(config);
Path databaseTransactionLogsHome = txRoot.resolve(migrationLayout.getDatabaseName());
fileSystem.mkdir(databaseTransactionLogsHome);
createDummyTxLogFiles(databaseTransactionLogsHome);
assertThrows(StoreUpgrader.TransactionLogsRelocationException.class, () -> newUpgrader(check, pageCache, config, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(migrationLayout, false));
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeFailsIfMigrationIsNotAllowed.
@ParameterizedTest
@MethodSource("versions")
void upgradeFailsIfMigrationIsNotAllowed(RecordFormats formats) throws IOException {
init(formats);
StoreVersionCheck check = getVersionCheck(pageCache);
AssertableLogProvider logProvider = new AssertableLogProvider();
assertThrows(UpgradeNotAllowedException.class, () -> newUpgrader(check, pageCache, Config.defaults(), new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(databaseLayout, false));
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeMoveTransactionLogs.
@ParameterizedTest
@MethodSource("versions")
void upgradeMoveTransactionLogs(RecordFormats formats) throws IOException {
init(formats);
Path txRoot = testDirectory.directory("customTxRoot");
AssertableLogProvider logProvider = new AssertableLogProvider();
StoreVersionCheck check = getVersionCheck(pageCache);
Config config = Config.newBuilder().fromConfig(allowMigrateConfig).set(neo4j_home, testDirectory.homePath()).set(GraphDatabaseSettings.transaction_logs_root_path, txRoot.toAbsolutePath()).set(default_database, databaseLayout.getDatabaseName()).build();
DatabaseLayout migrationLayout = DatabaseLayout.of(config);
newUpgrader(check, pageCache, config, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(migrationLayout, false);
assertThat(logProvider).containsMessages("Starting transaction logs migration.", "Transaction logs migration completed.");
assertThat(getLogFiles(migrationLayout.databaseDirectory())).isEmpty();
Path databaseTransactionLogsHome = txRoot.resolve(migrationLayout.getDatabaseName());
assertTrue(fileSystem.fileExists(databaseTransactionLogsHome));
Set<String> logFileNames = getLogFileNames(databaseTransactionLogsHome);
assertThat(logFileNames).isNotEmpty();
assertThat(logFileNames).containsAll(getLogFileNames(prepareDatabaseDirectory));
}
Aggregations