mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Config: Make configFile field private and add getter
This commit is contained in:
parent
38515ce7ae
commit
bf98531c46
@ -28,6 +28,8 @@ import java.util.Optional;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.lang.String.format;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
@ -157,7 +159,8 @@ public class Config {
|
||||
|
||||
// Options supported only at the command-line interface (cli)
|
||||
public final boolean helpRequested;
|
||||
public final File configFile;
|
||||
@Getter
|
||||
private final File configFile;
|
||||
|
||||
// Options supported on cmd line and in the config file
|
||||
public final String appName;
|
||||
|
@ -53,7 +53,7 @@ public class ConfigTests {
|
||||
assertThat(config.appName, equalTo(config.defaultAppName));
|
||||
assertThat(config.userDataDir, equalTo(config.defaultUserDataDir));
|
||||
assertThat(config.appDataDir, equalTo(config.defaultAppDataDir));
|
||||
assertThat(config.configFile, equalTo(config.defaultConfigFile));
|
||||
assertThat(config.getConfigFile(), equalTo(config.defaultConfigFile));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -62,7 +62,7 @@ public class ConfigTests {
|
||||
assertThat(config.appName, equalTo("My-Bisq"));
|
||||
assertThat(config.userDataDir, equalTo(config.defaultUserDataDir));
|
||||
assertThat(config.appDataDir, equalTo(new File(config.userDataDir, "My-Bisq")));
|
||||
assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -72,7 +72,7 @@ public class ConfigTests {
|
||||
assertThat(config.appName, equalTo(config.defaultAppName));
|
||||
assertThat(config.userDataDir, equalTo(config.defaultUserDataDir));
|
||||
assertThat(config.appDataDir, equalTo(appDataDir));
|
||||
assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -82,7 +82,7 @@ public class ConfigTests {
|
||||
assertThat(config.appName, equalTo(config.defaultAppName));
|
||||
assertThat(config.userDataDir, equalTo(userDataDir));
|
||||
assertThat(config.appDataDir, equalTo(new File(userDataDir, config.defaultAppName)));
|
||||
assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -92,7 +92,7 @@ public class ConfigTests {
|
||||
assertThat(config.appName, equalTo("My-Bisq"));
|
||||
assertThat(config.userDataDir, equalTo(config.defaultUserDataDir));
|
||||
assertThat(config.appDataDir, equalTo(appDataDir));
|
||||
assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -166,7 +166,7 @@ public class ConfigTests {
|
||||
public void whenConfigFileOptionIsSetToExistingFile_thenConfigFilePropertyReflectsItsValue() throws IOException {
|
||||
File configFile = File.createTempFile("bisq", "properties");
|
||||
Config config = configWithOpts(opt(CONFIG_FILE, configFile.getAbsolutePath()));
|
||||
assertThat(config.configFile, equalTo(configFile));
|
||||
assertThat(config.getConfigFile(), equalTo(configFile));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -175,7 +175,7 @@ public class ConfigTests {
|
||||
File appDataDir = configFile.getParentFile();
|
||||
String relativeConfigFilePath = configFile.getName();
|
||||
Config config = configWithOpts(opt(APP_DATA_DIR, appDataDir), opt(CONFIG_FILE, relativeConfigFilePath));
|
||||
assertThat(config.configFile, equalTo(configFile));
|
||||
assertThat(config.getConfigFile(), equalTo(configFile));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -188,7 +188,7 @@ public class ConfigTests {
|
||||
assertThat(config.appName, equalTo("My-Bisq"));
|
||||
assertThat(config.userDataDir, equalTo(config.defaultUserDataDir));
|
||||
assertThat(config.appDataDir, equalTo(new File(config.userDataDir, config.appName)));
|
||||
assertThat(config.configFile, equalTo(configFile));
|
||||
assertThat(config.getConfigFile(), equalTo(configFile));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -128,7 +128,7 @@ public class FilterManager {
|
||||
this.keyRing = keyRing;
|
||||
this.user = user;
|
||||
this.preferences = preferences;
|
||||
this.configFileEditor = new ConfigFileEditor(config.configFile);
|
||||
this.configFileEditor = new ConfigFileEditor(config.getConfigFile());
|
||||
this.providersRepository = providersRepository;
|
||||
this.ignoreDevMsg = ignoreDevMsg;
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||
this.localBitcoinNode = localBitcoinNode;
|
||||
this.torNetworkSettingsWindow = torNetworkSettingsWindow;
|
||||
this.clockWatcher = clockWatcher;
|
||||
this.configFileEditor = new ConfigFileEditor(config.configFile);
|
||||
this.configFileEditor = new ConfigFileEditor(config.getConfigFile());
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
|
Loading…
Reference in New Issue
Block a user