mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-25 16:05:28 -04:00
Favor use of Properties vs. for configuration
This reverts a number of changes made in commit 3033a19
. Primary changes
include:
- Restoring the immutability of the Node class
- The argparse4j Namespace object is no longer passed down through
Guice modules
- Instead, arguments are eagerly read from the Namespace object by the
#main method and these values are used to populate the Properties
object that is already supplied to each Guice module
Other changes include:
- The addition of a BootstrapNodes#DEFAULT_BOOTSTRAP_NODE field as
a convenient alias to BootstrapNodes#DIGITAL_OCEAN_1 (or whatever the
future default bootstrap node may be)
- A Node#getPortAsString method has been added for convenience when
dealing with String-based properties
- A variant of the Node#at static factory method has been added which
accepts the port value as a String vs. an int--again this is for
convenience when dealing with String-based properties
- Tests have been added to NodeTests to reflect the above
This commit is contained in:
parent
017ebb3f38
commit
162fc3da0e
9 changed files with 64 additions and 57 deletions
|
@ -25,6 +25,7 @@ import com.google.inject.Guice;
|
|||
import com.google.inject.Injector;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
@ -63,9 +64,7 @@ public class ViewLoaderTests {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Injector injector = Guice.createInjector(new MainModule("testApp",
|
||||
new Namespace(new HashMap<>()),
|
||||
TestApp.primaryStage));
|
||||
Injector injector = Guice.createInjector(new MainModule(new Properties(), "testApp", TestApp.primaryStage));
|
||||
ViewLoader.setInjector(injector);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,14 @@ public class NodeTests {
|
|||
Node node2 = Node.at("bitsquare2.example.com", "203.0.113.2");
|
||||
assertThat(node1a.hashCode(), equalTo(node1b.hashCode()));
|
||||
assertThat(node1a.hashCode(), not(equalTo(node2.hashCode())));
|
||||
|
||||
assertThat(node1a.getPort(), equalTo(Node.DEFAULT_PORT));
|
||||
assertThat(node1a.getPortAsString(), equalTo(String.valueOf(Node.DEFAULT_PORT)));
|
||||
|
||||
Node node3a = Node.at("bitsquare3.example.com", "203.0.113.3", 1234);
|
||||
Node node3b = Node.at("bitsquare3.example.com", "203.0.113.3", "1234");
|
||||
|
||||
assertThat(node3a, equalTo(node3b));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue