@Test public void whenDatabaseTuningFilePresentInDefaultLocationShouldLoadItEvenIfNotSpecified() throws IOException { File emptyPropertyFile = PropertyFileBuilder.builder(folder.getRoot()).build(); DatabaseTuningPropertyFileBuilder.builder(folder.getRoot()).build(); PropertyFileConfigurator configurator = new PropertyFileConfigurator(emptyPropertyFile); assertEquals( "25M", configurator .getDatabaseTuningProperties() .get(GraphDatabaseSettings.nodestore_mapped_memory_size.name())); }
@Test public void whenDatabaseTuningFilePresentInDefaultLocationShouldNotLoadIfAnotherSpecified() throws IOException { int unlikelyDefaultMemoryMappedValue = 8351; File databaseTuningPropertyFileWeWantToUse = DatabaseTuningPropertyFileBuilder.builder(folder.getRoot()) .mappedMemory(unlikelyDefaultMemoryMappedValue) .build(); File emptyPropertyFile = PropertyFileBuilder.builder(folder.getRoot()) .withDbTuningPropertyFile(databaseTuningPropertyFileWeWantToUse) .build(); // The tuning properties we want to ignore, in the same dir as the neo // server properties DatabaseTuningPropertyFileBuilder.builder(folder.newFolder()).build(); PropertyFileConfigurator configurator = new PropertyFileConfigurator(emptyPropertyFile); assertEquals( String.valueOf(unlikelyDefaultMemoryMappedValue) + "M", configurator .getDatabaseTuningProperties() .get(GraphDatabaseSettings.nodestore_mapped_memory_size.name())); }
@Test public void shouldLogInfoWhenDefaultingToTuningPropertiesFileInTheSameDirectoryAsTheNeoServerPropertiesFile() throws IOException { File emptyPropertyFile = PropertyFileBuilder.builder(folder.getRoot()).build(); File tuningPropertiesFile = DatabaseTuningPropertyFileBuilder.builder(folder.getRoot()).build(); BufferingConsoleLogger logger = new BufferingConsoleLogger(); new PropertyFileConfigurator(emptyPropertyFile, logger); assertThat( logger.toString(), containsString( String.format( "No database tuning file explicitly set, defaulting to [%s]", tuningPropertiesFile.getAbsolutePath()))); }