diff --git a/community/community-it/cypher-it/src/test/java/org/neo4j/cypher/CreateIndexStressIT.java b/community/community-it/cypher-it/src/test/java/org/neo4j/cypher/CreateIndexStressIT.java index 4dba528c57160..faba4785a213a 100644 --- a/community/community-it/cypher-it/src/test/java/org/neo4j/cypher/CreateIndexStressIT.java +++ b/community/community-it/cypher-it/src/test/java/org/neo4j/cypher/CreateIndexStressIT.java @@ -30,8 +30,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.neo4j.graphdb.factory.GraphDatabaseBuilder; import org.neo4j.graphdb.factory.GraphDatabaseSettings; +import org.neo4j.test.rule.DatabaseRule; import org.neo4j.test.rule.ImpermanentDatabaseRule; import static org.junit.Assert.assertFalse; @@ -42,14 +42,8 @@ public class CreateIndexStressIT private final AtomicBoolean hasFailed = new AtomicBoolean( false ); @Rule - public ImpermanentDatabaseRule db = new ImpermanentDatabaseRule() - { - @Override - protected void configure( GraphDatabaseBuilder builder ) - { - builder.setConfig( GraphDatabaseSettings.query_cache_size, "0" ); - } - }; + public DatabaseRule db = new ImpermanentDatabaseRule() + .withSetting( GraphDatabaseSettings.query_cache_size, "0" ); private final ExecutorService executorService = Executors.newFixedThreadPool( 10 ); diff --git a/community/community-it/index-it/src/test/java/org/neo4j/index/AccessExplicitIndexReadOnlyIT.java b/community/community-it/index-it/src/test/java/org/neo4j/index/AccessExplicitIndexReadOnlyIT.java index 7e4e12f18a720..4546f4651ef17 100644 --- a/community/community-it/index-it/src/test/java/org/neo4j/index/AccessExplicitIndexReadOnlyIT.java +++ b/community/community-it/index-it/src/test/java/org/neo4j/index/AccessExplicitIndexReadOnlyIT.java @@ -83,7 +83,7 @@ public void shouldListAndReadExplicitIndexesForReadOnlyDb() throws Exception public void shouldNotCreateIndexesForReadOnlyDb() { // given - db.ensureStarted( GraphDatabaseSettings.read_only.name(), TRUE.toString() ); + db.withSetting( GraphDatabaseSettings.read_only, TRUE.toString() ); // when try ( Transaction tx = db.beginTx() ) diff --git a/community/community-it/index-it/src/test/java/org/neo4j/index/IndexFailureOnStartupTest.java b/community/community-it/index-it/src/test/java/org/neo4j/index/IndexFailureOnStartupTest.java index 32a6d4d6c1a81..c15d5d9b50f47 100644 --- a/community/community-it/index-it/src/test/java/org/neo4j/index/IndexFailureOnStartupTest.java +++ b/community/community-it/index-it/src/test/java/org/neo4j/index/IndexFailureOnStartupTest.java @@ -112,7 +112,7 @@ public void shouldNotBeAbleToViolateConstraintWhenBackingIndexFailsToOpen() thro public void shouldArchiveFailedIndex() throws Exception { // given - db.setConfig( GraphDatabaseSettings.archive_failed_index, "true" ); + db.withSetting( GraphDatabaseSettings.archive_failed_index, "true" ); try ( Transaction tx = db.beginTx() ) { Node node = db.createNode( PERSON ); diff --git a/community/community-it/it-test-support/src/main/java/org/neo4j/test/rule/DatabaseRule.java b/community/community-it/it-test-support/src/main/java/org/neo4j/test/rule/DatabaseRule.java index d3b192e7fea3b..37deb99bce3c8 100644 --- a/community/community-it/it-test-support/src/main/java/org/neo4j/test/rule/DatabaseRule.java +++ b/community/community-it/it-test-support/src/main/java/org/neo4j/test/rule/DatabaseRule.java @@ -70,12 +70,12 @@ public abstract class DatabaseRule extends ExternalResource implements GraphData private DatabaseLayout databaseLayout; private Supplier statementSupplier; private boolean startEagerly = true; - private Map, String> config; + private final Map, String> globalConfig = new HashMap<>(); private final Monitors monitors = new Monitors(); /** * Means the database will be started on first {@link #getGraphDatabaseAPI()}} - * or {@link #ensureStarted(String...)} call. + * or {@link #ensureStarted()} call. */ public DatabaseRule startLazily() { @@ -274,7 +274,7 @@ private void create() factory.setMonitors( monitors ); configure( factory ); databaseBuilder = newBuilder( factory ); - configure( databaseBuilder ); + globalConfig.forEach( databaseBuilder::setConfig ); } catch ( RuntimeException e ) { @@ -308,22 +308,9 @@ protected void configure( GraphDatabaseFactory databaseFactory ) // Override to configure the database factory } - protected void configure( GraphDatabaseBuilder builder ) - { - // Override to configure the database - - // Adjusted defaults for testing - applyConfigChanges( builder ); - } - - public GraphDatabaseBuilder setConfig( Setting setting, String value ) - { - return databaseBuilder.setConfig( setting, value ); - } - /** * {@link DatabaseRule} now implements {@link GraphDatabaseAPI} directly, so no need. Also for ensuring - * a lazily started database is created, use {@link #ensureStarted( String... )} instead. + * a lazily started database is created, use {@link #ensureStarted()} instead. */ public GraphDatabaseAPI getGraphDatabaseAPI() { @@ -331,34 +318,56 @@ public GraphDatabaseAPI getGraphDatabaseAPI() return database; } - public synchronized void ensureStarted( String... additionalConfig ) + public synchronized void ensureStarted() { if ( database == null ) { - applyConfigChanges( databaseBuilder, additionalConfig ); database = (GraphDatabaseAPI) databaseBuilder.newGraphDatabase(); databaseLayout = database.databaseLayout(); statementSupplier = resolveDependency( ThreadToStatementContextBridge.class ); } } + /** + * Adds or replaces a setting for the database managed by this database rule. + *

+ * If this method is called when constructing the rule, the setting is considered a global setting applied to all tests. + *

+ * If this method is called inside a specific test, i.e. after {@link #before()}, but before started (a call to {@link #startLazily()} have been made), + * then this setting will be considered a test-specific setting, adding to or overriding the global settings for this test only. + * Test-specific settings will be remembered throughout a test, even between restarts. + *

+ * If this method is called when a database is already started an {@link IllegalStateException} will be thrown since the setting + * will have no effect, instead letting the developer notice that and change the test code. + */ public DatabaseRule withSetting( Setting key, String value ) { - if ( this.config == null ) + if ( database != null ) { - this.config = new HashMap<>(); + // Database already started + throw new IllegalStateException( "Wanted to set " + key + "=" + value + ", but database has already been started" ); + } + if ( databaseBuilder != null ) + { + // Test already started, but db not yet started + databaseBuilder.setConfig( key, value ); + } + else + { + // Test haven't started, we're still in phase of constructing this rule + globalConfig.put( key, value ); } - this.config.put( key, value ); return this; } - public DatabaseRule withConfiguration( Map,String> configuration ) + /** + * Applies all settings in the settings map. + * + * @see #withSetting(Setting, String) + */ + public DatabaseRule withSettings( Map,String> configuration ) { - if ( this.config == null ) - { - this.config = new HashMap<>(); - } - this.config.putAll( configuration ); + configuration.forEach( this::withSetting ); return this; } @@ -383,19 +392,12 @@ public GraphDatabaseAPI restartDatabase( RestartAction action, String... configC database.shutdown(); action.run( fs, databaseLayout ); database = null; - applyConfigChanges( databaseBuilder, configChanges ); + // This DatabaseBuilder has already been configured with the global settings as well as any test-specific settings, + // so just apply these additional settings. + databaseBuilder.setConfig( stringMap( configChanges ) ); return getGraphDatabaseAPI(); } - private void applyConfigChanges( GraphDatabaseBuilder builder, String... configChanges ) - { - if ( config != null ) - { - config.forEach( builder::setConfig ); - } - builder.setConfig( stringMap( configChanges ) ); - } - @Override public void shutdown() { diff --git a/enterprise/backup/src/test/java/org/neo4j/backup/impl/BackupProtocolServiceIT.java b/enterprise/backup/src/test/java/org/neo4j/backup/impl/BackupProtocolServiceIT.java index 831fb2d72a10e..275589539de8f 100644 --- a/enterprise/backup/src/test/java/org/neo4j/backup/impl/BackupProtocolServiceIT.java +++ b/enterprise/backup/src/test/java/org/neo4j/backup/impl/BackupProtocolServiceIT.java @@ -236,7 +236,7 @@ public void shouldPrintThatIncrementalBackupIsPerformedAndFallingBackToFull() th { defaultBackupPortHostParams(); Config defaultConfig = Config.defaults(); - dbRule.setConfig( GraphDatabaseSettings.keep_logical_logs, "false" ); + dbRule.withSetting( GraphDatabaseSettings.keep_logical_logs, "false" ); // have logs rotated on every transaction GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); createSchemaIndex( db ); @@ -676,7 +676,7 @@ public void shouldGiveHelpfulErrorMessageIfLogsPrunedPastThePointOfNoReturn() th // Given defaultBackupPortHostParams(); Config defaultConfig = Config.defaults(); - dbRule.setConfig( GraphDatabaseSettings.keep_logical_logs, "false" ); + dbRule.withSetting( GraphDatabaseSettings.keep_logical_logs, "false" ); // have logs rotated on every transaction GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); createSchemaIndex( db ); @@ -719,7 +719,7 @@ public void shouldFallbackToFullBackupIfIncrementalFailsAndExplicitlyAskedToDoTh // Given defaultBackupPortHostParams(); Config defaultConfig = Config.defaults(); - dbRule.setConfig( GraphDatabaseSettings.keep_logical_logs, "false" ); + dbRule.withSetting( GraphDatabaseSettings.keep_logical_logs, "false" ); // have logs rotated on every transaction GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); createSchemaIndex( db ); @@ -763,7 +763,7 @@ public void shouldHandleBackupWhenLogFilesHaveBeenDeleted() throws Exception // Given defaultBackupPortHostParams(); Config defaultConfig = Config.defaults(); - dbRule.setConfig( GraphDatabaseSettings.keep_logical_logs, "false" ); + dbRule.withSetting( GraphDatabaseSettings.keep_logical_logs, "false" ); GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); createSchemaIndex( db ); BackupProtocolService backupProtocolService = backupService(); @@ -841,7 +841,7 @@ public void shouldDoFullBackupOnIncrementalFallbackToFullIfNoBackupFolderExists( // Given defaultBackupPortHostParams(); Config defaultConfig = Config.defaults(); - dbRule.setConfig( GraphDatabaseSettings.keep_logical_logs, "false" ); + dbRule.withSetting( GraphDatabaseSettings.keep_logical_logs, "false" ); GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); createSchemaIndex( db ); BackupProtocolService backupProtocolService = backupService(); @@ -865,7 +865,7 @@ public void shouldContainTransactionsThatHappenDuringBackupProcess() throws Thro defaultBackupPortHostParams(); Config defaultConfig = Config.defaults(); defaultConfig.augment( OnlineBackupSettings.online_backup_server, BACKUP_HOST + ":" + backupPort ); - dbRule.setConfig( OnlineBackupSettings.online_backup_enabled, "false" ); + dbRule.withSetting( OnlineBackupSettings.online_backup_enabled, "false" ); Config withOnlineBackupDisabled = Config.defaults(); final Barrier.Control barrier = new Barrier.Control(); @@ -925,7 +925,7 @@ public void backupsShouldBeMentionedInServerConsoleLog() throws Throwable defaultBackupPortHostParams(); Config config = Config.defaults(); config.augment( OnlineBackupSettings.online_backup_server, BACKUP_HOST + ":" + backupPort ); - dbRule.setConfig( OnlineBackupSettings.online_backup_enabled, "false" ); + dbRule.withSetting( OnlineBackupSettings.online_backup_enabled, "false" ); Config withOnlineBackupDisabled = Config.defaults(); createAndIndexNode( dbRule, 1 ); @@ -1025,7 +1025,7 @@ public void incrementalBackupShouldFailWhenTargetDirContainsDifferentStore() thr private void defaultBackupPortHostParams() { - dbRule.setConfig( OnlineBackupSettings.online_backup_server, BACKUP_HOST + ":" + backupPort ); + dbRule.withSetting( OnlineBackupSettings.online_backup_server, BACKUP_HOST + ":" + backupPort ); } private static void createSchemaIndex( GraphDatabaseService db ) diff --git a/enterprise/backup/src/test/java/org/neo4j/backup/impl/OnlineBackupCommandHaIT.java b/enterprise/backup/src/test/java/org/neo4j/backup/impl/OnlineBackupCommandHaIT.java index 7b25c90b15647..0656f353be432 100644 --- a/enterprise/backup/src/test/java/org/neo4j/backup/impl/OnlineBackupCommandHaIT.java +++ b/enterprise/backup/src/test/java/org/neo4j/backup/impl/OnlineBackupCommandHaIT.java @@ -452,9 +452,9 @@ private void startDb( Integer backupPort ) private void startDb( EmbeddedDatabaseRule db, Integer backupPort ) { - db.setConfig( GraphDatabaseSettings.record_format, recordFormat ); - db.setConfig( OnlineBackupSettings.online_backup_enabled, Settings.TRUE ); - db.setConfig( OnlineBackupSettings.online_backup_server, "127.0.0.1" + ":" + backupPort ); + db.withSetting( GraphDatabaseSettings.record_format, recordFormat ); + db.withSetting( OnlineBackupSettings.online_backup_enabled, Settings.TRUE ); + db.withSetting( OnlineBackupSettings.online_backup_server, "127.0.0.1" + ":" + backupPort ); db.ensureStarted(); createSomeData( db ); } diff --git a/enterprise/deferred-locks/src/test/java/org/neo4j/kernel/impl/locking/DeferringLocksIT.java b/enterprise/deferred-locks/src/test/java/org/neo4j/kernel/impl/locking/DeferringLocksIT.java index c85391751e30d..ce7848edcec86 100644 --- a/enterprise/deferred-locks/src/test/java/org/neo4j/kernel/impl/locking/DeferringLocksIT.java +++ b/enterprise/deferred-locks/src/test/java/org/neo4j/kernel/impl/locking/DeferringLocksIT.java @@ -71,7 +71,7 @@ public class DeferringLocksIT @Before public void initDb() { - dbRule.setConfig( DeferringStatementLocksFactory.deferred_locks_enabled, Settings.TRUE ); + dbRule.withSetting( DeferringStatementLocksFactory.deferred_locks_enabled, Settings.TRUE ); db = dbRule.getGraphDatabaseAPI(); } diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java b/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java index 5a9e178d88d0d..c2fbb7ffe786d 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java +++ b/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java @@ -415,7 +415,7 @@ public void shouldDisableCpuTimeTracking() throws Exception { // given String query = "MATCH (n) SET n.v = n.v + 1"; - db.setConfig( track_query_cpu_time, FALSE ); + db.withSetting( track_query_cpu_time, FALSE ); Map data; // when @@ -467,7 +467,7 @@ public void shouldDisableHeapAllocationTracking() throws Exception { // given String query = "MATCH (n) SET n.v = n.v + 1"; - db.setConfig( track_query_allocation, FALSE ); + db.withSetting( track_query_allocation, FALSE ); Map data; // when diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/lock/forseti/ForsetiServiceLoadingTest.java b/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/lock/forseti/ForsetiServiceLoadingTest.java index aabc86146af81..d8c73a5366b17 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/lock/forseti/ForsetiServiceLoadingTest.java +++ b/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/lock/forseti/ForsetiServiceLoadingTest.java @@ -53,7 +53,7 @@ public void shouldUseForsetiAsDefaultLockManager() public void shouldAllowUsingCommunityLockManager() { // When - dbRule.setConfig( GraphDatabaseSettings.lock_manager, "community" ); + dbRule.withSetting( GraphDatabaseSettings.lock_manager, "community" ); GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); // Then diff --git a/enterprise/kernel/src/test/java/org/neo4j/locking/MergeLockConcurrencyTest.java b/enterprise/kernel/src/test/java/org/neo4j/locking/MergeLockConcurrencyTest.java index ee176be36bbae..b2f518389b355 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/locking/MergeLockConcurrencyTest.java +++ b/enterprise/kernel/src/test/java/org/neo4j/locking/MergeLockConcurrencyTest.java @@ -67,7 +67,7 @@ public static Iterable configurations() public MergeLockConcurrencyTest( ConfigBuilder config ) { - db.withConfiguration( config.configuration() ); + db.withSettings( config.configuration() ); } @Test diff --git a/enterprise/neo4j-enterprise/src/test/java/org/neo4j/consistency/ConsistencyCheckServiceRecordFormatIT.java b/enterprise/neo4j-enterprise/src/test/java/org/neo4j/consistency/ConsistencyCheckServiceRecordFormatIT.java index b6916d42924f7..08d9380cff031 100644 --- a/enterprise/neo4j-enterprise/src/test/java/org/neo4j/consistency/ConsistencyCheckServiceRecordFormatIT.java +++ b/enterprise/neo4j-enterprise/src/test/java/org/neo4j/consistency/ConsistencyCheckServiceRecordFormatIT.java @@ -77,7 +77,7 @@ public static List recordFormats() @Before public void configureRecordFormat() { - db.setConfig( GraphDatabaseSettings.record_format, recordFormat ); + db.withSetting( GraphDatabaseSettings.record_format, recordFormat ); } @Test diff --git a/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/ShellQueryLoggingIT.java b/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/ShellQueryLoggingIT.java index 6143742ccf27c..7ac8f577314e1 100644 --- a/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/ShellQueryLoggingIT.java +++ b/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/ShellQueryLoggingIT.java @@ -38,7 +38,6 @@ import org.neo4j.graphdb.Result; import org.neo4j.graphdb.Transaction; -import org.neo4j.graphdb.factory.GraphDatabaseBuilder; import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.kernel.configuration.Settings; @@ -71,14 +70,8 @@ protected void configure( GraphDatabaseFactory factory ) { ((TestGraphDatabaseFactory) factory).setFileSystem( fs.get() ); } + }.withSetting( GraphDatabaseSettings.log_queries, Settings.TRUE ).startLazily(); - @Override - protected void configure( GraphDatabaseBuilder builder ) - { - builder.setConfig( GraphDatabaseSettings.log_queries, Settings.TRUE ); - builder.setConfig( GraphDatabaseSettings.logs_directory, logsDirectory().getPath() ); - } - }; @Rule public final TestRule order = outerRule( dir ).around( fs ).around( db ) .around( ( base, description ) -> new Statement() @@ -106,6 +99,8 @@ public void evaluate() throws Throwable @Before public void setup() throws Exception { + // Set this config a bit later since it's dependent on directory of the dbRule, which is assigned in its creation phase. + db.withSetting( GraphDatabaseSettings.logs_directory, logsDirectory().getPath() ); server = new GraphDatabaseShellServer( db.getGraphDatabaseAPI() ); SystemOutput output = new SystemOutput( new PrintWriter( out ) ); client = ShellLobby.newClient( server, new HashMap<>(), output, action -> () -> diff --git a/integrationtests/src/test/java/org/neo4j/kernel/PageCacheWarmupEnterpriseEditionIT.java b/integrationtests/src/test/java/org/neo4j/kernel/PageCacheWarmupEnterpriseEditionIT.java index 2aa78b5e7f9c4..b402b7a235cab 100644 --- a/integrationtests/src/test/java/org/neo4j/kernel/PageCacheWarmupEnterpriseEditionIT.java +++ b/integrationtests/src/test/java/org/neo4j/kernel/PageCacheWarmupEnterpriseEditionIT.java @@ -77,9 +77,9 @@ private static void verifyEventuallyWarmsUp( long pagesInMemory, File metricsDir public void warmupMustReloadHotPagesAfterRestartAndFaultsMustBeVisibleViaMetrics() throws Exception { File metricsDirectory = testDirectory.directory( "metrics" ); - db.setConfig( MetricsSettings.metricsEnabled, Settings.FALSE ) - .setConfig( OnlineBackupSettings.online_backup_enabled, Settings.FALSE ) - .setConfig( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "100ms" ); + db.withSetting( MetricsSettings.metricsEnabled, Settings.FALSE ) + .withSetting( OnlineBackupSettings.online_backup_enabled, Settings.FALSE ) + .withSetting( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "100ms" ); db.ensureStarted(); createTestData( db ); @@ -98,11 +98,11 @@ public void warmupMustReloadHotPagesAfterRestartAndFaultsMustBeVisibleViaMetrics public void cacheProfilesMustBeIncludedInOnlineBackups() throws Exception { int backupPort = PortAuthority.allocatePort(); - db.setConfig( MetricsSettings.metricsEnabled, Settings.FALSE ) - .setConfig( UdcSettings.udc_enabled, Settings.FALSE ) - .setConfig( OnlineBackupSettings.online_backup_enabled, Settings.TRUE ) - .setConfig( OnlineBackupSettings.online_backup_server, "localhost:" + backupPort ) - .setConfig( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "100ms" ); + db.withSetting( MetricsSettings.metricsEnabled, Settings.FALSE ) + .withSetting( UdcSettings.udc_enabled, Settings.FALSE ) + .withSetting( OnlineBackupSettings.online_backup_enabled, Settings.TRUE ) + .withSetting( OnlineBackupSettings.online_backup_server, "localhost:" + backupPort ) + .withSetting( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "100ms" ); db.ensureStarted(); createTestData( db ); @@ -135,10 +135,10 @@ public void cacheProfilesMustNotInterfereWithOnlineBackups() throws Exception // Here we are testing that the file modifications done by the page cache profiler, // does not make online backup throw any exceptions. int backupPort = PortAuthority.allocatePort(); - db.setConfig( MetricsSettings.metricsEnabled, Settings.FALSE ) - .setConfig( OnlineBackupSettings.online_backup_enabled, Settings.TRUE ) - .setConfig( OnlineBackupSettings.online_backup_server, "localhost:" + backupPort ) - .setConfig( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "1ms" ); + db.withSetting( MetricsSettings.metricsEnabled, Settings.FALSE ) + .withSetting( OnlineBackupSettings.online_backup_enabled, Settings.TRUE ) + .withSetting( OnlineBackupSettings.online_backup_server, "localhost:" + backupPort ) + .withSetting( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "1ms" ); db.ensureStarted(); createTestData( db ); @@ -154,9 +154,9 @@ public void cacheProfilesMustNotInterfereWithOnlineBackups() throws Exception @Test public void cacheProfilesMustBeIncludedInOfflineBackups() throws Exception { - db.setConfig( MetricsSettings.metricsEnabled, Settings.FALSE ) - .setConfig( OnlineBackupSettings.online_backup_enabled, Settings.FALSE ) - .setConfig( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "100ms" ); + db.withSetting( MetricsSettings.metricsEnabled, Settings.FALSE ) + .withSetting( OnlineBackupSettings.online_backup_enabled, Settings.FALSE ) + .withSetting( GraphDatabaseSettings.pagecache_warmup_profiling_interval, "100ms" ); db.ensureStarted(); createTestData( db ); long pagesInMemory = waitForCacheProfile( db.getMonitors() ); @@ -192,12 +192,11 @@ public void exit( int status ) FileUtils.deleteRecursively( graphdb ); File metricsDirectory = testDirectory.cleanDirectory( "metrics" ); - db.ensureStarted( - OnlineBackupSettings.online_backup_enabled.name(), Settings.FALSE, - MetricsSettings.neoPageCacheEnabled.name(), Settings.TRUE, - MetricsSettings.csvEnabled.name(), Settings.TRUE, - MetricsSettings.csvInterval.name(), "100ms", - MetricsSettings.csvPath.name(), metricsDirectory.getAbsolutePath() ); + db.withSetting( MetricsSettings.neoPageCacheEnabled, Settings.TRUE ) + .withSetting( MetricsSettings.csvEnabled, Settings.TRUE ) + .withSetting( MetricsSettings.csvInterval, "100ms" ) + .withSetting( MetricsSettings.csvPath, metricsDirectory.getAbsolutePath() ); + db.ensureStarted(); verifyEventuallyWarmsUp( pagesInMemory, metricsDirectory ); }