Rename Node#{id => name}

Refer to the "name" of a node rather than its "id". This is reflected in
the command line options as well. Instead of `--id`, now pass `--name`.
Instead of `--bootstrap.node.id`, now pass `--bootstrap.node.id`.
This commit is contained in:
Chris Beams 2014-11-10 12:49:24 +01:00
parent 2ae5949448
commit 3398a97311
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
8 changed files with 34 additions and 30 deletions

View file

@ -97,7 +97,7 @@ public class TomP2PTests {
static {
try {
BOOTSTRAP_NODE_ADDRESS = new PeerAddress(
Number160.createHash(BOOTSTRAP_NODE.getId()),
Number160.createHash(BOOTSTRAP_NODE.getName()),
BOOTSTRAP_NODE.getIp(), BOOTSTRAP_NODE.getPort(), BOOTSTRAP_NODE.getPort());
} catch (UnknownHostException ex) {
throw new RuntimeException(BOOTSTRAP_NODE.toString(), ex);

View file

@ -38,8 +38,8 @@ public class NodeTests {
assertThat(node1a, not((Object) equalTo("not a node")));
assertThat(node1a, not(equalTo(Node.at("bitsquare2.example.com", node1a.getIp()))));
assertThat(node1a, not(equalTo(Node.at(node1a.getId(), "203.0.113.2"))));
assertThat(node1a, not(equalTo(Node.at(node1a.getId(), node1a.getIp(), Node.DEFAULT_PORT + 1))));
assertThat(node1a, not(equalTo(Node.at(node1a.getName(), "203.0.113.2"))));
assertThat(node1a, not(equalTo(Node.at(node1a.getName(), node1a.getIp(), Node.DEFAULT_PORT + 1))));
Node node2 = Node.at("bitsquare2.example.com", "203.0.113.2");
assertThat(node1a.hashCode(), equalTo(node1b.hashCode()));
@ -57,6 +57,6 @@ public class NodeTests {
@Test
public void testToString() {
Node node = Node.at("bitsquare1.example.com", "203.0.113.1", 5001);
assertThat(node.toString(), equalTo("Node{id=bitsquare1.example.com, ip=203.0.113.1, port=5001}"));
assertThat(node.toString(), equalTo("Node{name=bitsquare1.example.com, ip=203.0.113.1, port=5001}"));
}
}