use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method testQueryLogMigration.
private static void testQueryLogMigration(Boolean oldValue, LogQueryLevel newValue) {
var setting = GraphDatabaseSettings.log_queries;
Config config = Config.newBuilder().setRaw(Map.of(setting.name(), oldValue.toString())).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertEquals(newValue, config.get(setting));
String msg = "Use of deprecated setting value %s=%s. It is replaced by %s=%s";
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessageWithArguments(msg, setting.name(), oldValue.toString(), setting.name(), newValue.name());
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method transactionCypherMaxAllocationsConflict.
@Test
void transactionCypherMaxAllocationsConflict() throws IOException {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("cypher.query_max_allocations=6g", memory_transaction_max_size.name() + "=7g"));
Config config = Config.newBuilder().fromFile(confFile).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessageWithArguments("The setting cypher.query_max_allocations is removed and replaced by %s. Since both are set, %s will take " + "precedence and the value of cypher.query_max_allocations, %s, will be ignored.", memory_transaction_max_size.name(), memory_transaction_max_size.name(), "6g");
assertEquals(BYTES.parse("7g"), config.get(memory_transaction_max_size));
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method logFormatMigrator.
@Test
void logFormatMigrator() throws IOException {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("unsupported.dbms.logs.format=JSON_FORMAT"));
Config config = Config.newBuilder().fromFile(confFile).build();
AssertableLogProvider logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessages("Use of deprecated setting unsupported.dbms.logs.format");
assertThat(config.get(GraphDatabaseSettings.store_internal_log_format)).isEqualTo(FormattedLogFormat.JSON);
assertThat(config.get(GraphDatabaseSettings.store_user_log_format)).isEqualTo(FormattedLogFormat.JSON);
assertThat(config.get(GraphDatabaseSettings.log_query_format)).isEqualTo(FormattedLogFormat.JSON);
Files.write(confFile, List.of("unsupported.dbms.logs.format=FOO"));
config = Config.newBuilder().fromFile(confFile).build();
logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessages("Unrecognized value for unsupported.dbms.logs.format. Was FOO");
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method testKillQueryVerbose.
@Test
void testKillQueryVerbose() throws IOException {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("dbms.procedures.kill_query_verbose=false"));
Config config = Config.newBuilder().fromFile(confFile).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessages("Setting dbms.procedures.kill_query_verbose is removed. It's no longer possible to disable verbose kill query logging.");
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method testDefaultSchemaProvider.
@Test
void testDefaultSchemaProvider() throws IOException {
Map<String, String> migrationMap = Map.of("lucene-1.0", "lucene+native-3.0", "lucene+native-1.0", "lucene+native-3.0", "lucene+native-2.0", "native-btree-1.0", "native-btree-1.0", "native-btree-1.0");
for (String oldSchemaProvider : migrationMap.keySet()) {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("dbms.index.default_schema_provider=" + oldSchemaProvider));
Config config = Config.newBuilder().fromFile(confFile).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
String expectedWarning = "Use of deprecated setting dbms.index.default_schema_provider.";
if (!"native-btree-1.0".equals(oldSchemaProvider)) {
expectedWarning += " Value migrated from " + oldSchemaProvider + " to " + migrationMap.get(oldSchemaProvider) + ".";
}
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessages(expectedWarning);
}
}
Aggregations