Fix RunnerBuilder method names (#1284)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
mbaxter 6 years ago committed by GitHub
parent 895e2cebbb
commit 963f75836e
  1. 4
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/ThreadPantheonNodeRunner.java
  2. 22
      pantheon/src/main/java/tech/pegasys/pantheon/RunnerBuilder.java
  3. 12
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  4. 4
      pantheon/src/test/java/tech/pegasys/pantheon/RunnerTest.java
  5. 4
      pantheon/src/test/java/tech/pegasys/pantheon/cli/CommandTestAbstract.java
  6. 20
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java

@ -92,8 +92,8 @@ public class ThreadPantheonNodeRunner implements PantheonNodeRunner {
.pantheonController(pantheonController)
.ethNetworkConfig(ethNetworkConfig)
.discovery(node.isDiscoveryEnabled())
.discoveryHost(node.hostName())
.discoveryPort(0)
.p2pAdvertisedHost(node.hostName())
.p2pListenPort(0)
.maxPeers(25)
.jsonRpcConfiguration(node.jsonRpcConfiguration())
.webSocketConfiguration(node.webSocketConfiguration())

@ -91,8 +91,8 @@ public class RunnerBuilder {
private boolean p2pEnabled = true;
private boolean discovery;
private EthNetworkConfig ethNetworkConfig;
private String discoveryHost;
private int listenPort;
private String p2pAdvertisedHost;
private int p2pListenPort;
private int maxPeers;
private JsonRpcConfiguration jsonRpcConfiguration;
private WebSocketConfiguration webSocketConfiguration;
@ -107,8 +107,8 @@ public class RunnerBuilder {
BytesValue nodeId = pantheonController.getLocalNodeKeyPair().getPublicKey().getEncodedBytes();
return EnodeURL.builder()
.nodeId(nodeId)
.ipAddress(discoveryHost)
.listeningPort(listenPort)
.ipAddress(p2pAdvertisedHost)
.listeningPort(p2pListenPort)
.build();
}
@ -137,13 +137,13 @@ public class RunnerBuilder {
return this;
}
public RunnerBuilder discoveryHost(final String discoveryHost) {
this.discoveryHost = discoveryHost;
public RunnerBuilder p2pAdvertisedHost(final String p2pAdvertisedHost) {
this.p2pAdvertisedHost = p2pAdvertisedHost;
return this;
}
public RunnerBuilder discoveryPort(final int listenPort) {
this.listenPort = listenPort;
public RunnerBuilder p2pListenPort(final int p2pListenPort) {
this.p2pListenPort = p2pListenPort;
return this;
}
@ -207,8 +207,8 @@ public class RunnerBuilder {
}
discoveryConfiguration =
DiscoveryConfiguration.create()
.setBindPort(listenPort)
.setAdvertisedHost(discoveryHost)
.setBindPort(p2pListenPort)
.setAdvertisedHost(p2pAdvertisedHost)
.setBootstrapPeers(bootstrap);
} else {
discoveryConfiguration = DiscoveryConfiguration.create().setActive(false);
@ -231,7 +231,7 @@ public class RunnerBuilder {
final NetworkingConfiguration networkConfig =
new NetworkingConfiguration()
.setRlpx(RlpxConfiguration.create().setBindPort(listenPort).setMaxPeers(maxPeers))
.setRlpx(RlpxConfiguration.create().setBindPort(p2pListenPort).setMaxPeers(maxPeers))
.setDiscovery(discoveryConfiguration)
.setClientId(PantheonInfo.version())
.setSupportedProtocols(subProtocols);

@ -231,14 +231,14 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option(
names = {"--p2p-host"},
paramLabel = MANDATORY_HOST_FORMAT_HELP,
description = "Host for P2P peer discovery to listen on (default: ${DEFAULT-VALUE})",
description = "Ip address this node advertises to its peers (default: ${DEFAULT-VALUE})",
arity = "1")
private String p2pHost = autoDiscoverDefaultIP().getHostAddress();
@Option(
names = {"--p2p-port"},
paramLabel = MANDATORY_PORT_FORMAT_HELP,
description = "Port for P2P peer discovery to listen on (default: ${DEFAULT-VALUE})",
description = "Port on which to listen for p2p communication (default: ${DEFAULT-VALUE})",
arity = "1")
private final Integer p2pPort = DEFAULT_PORT;
@ -942,8 +942,8 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
final boolean peerDiscoveryEnabled,
final EthNetworkConfig ethNetworkConfig,
final int maxPeers,
final String discoveryHost,
final int discoveryPort,
final String p2pAdvertisedHost,
final int p2pListenPort,
final JsonRpcConfiguration jsonRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
final MetricsConfiguration metricsConfiguration,
@ -962,8 +962,8 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
.p2pEnabled(p2pEnabled)
.discovery(peerDiscoveryEnabled)
.ethNetworkConfig(ethNetworkConfig)
.discoveryHost(discoveryHost)
.discoveryPort(discoveryPort)
.p2pAdvertisedHost(p2pAdvertisedHost)
.p2pListenPort(p2pListenPort)
.maxPeers(maxPeers)
.jsonRpcConfiguration(jsonRpcConfiguration)
.webSocketConfiguration(webSocketConfiguration)

@ -142,8 +142,8 @@ public final class RunnerTest {
new RunnerBuilder()
.vertx(Vertx.vertx())
.discovery(true)
.discoveryHost(listenHost)
.discoveryPort(0)
.p2pAdvertisedHost(listenHost)
.p2pListenPort(0)
.maxPeers(3)
.metricsSystem(noOpMetricsSystem)
.bannedNodeIds(emptySet())

@ -131,8 +131,8 @@ public abstract class CommandTestAbstract {
when(mockRunnerBuilder.pantheonController(any())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.discovery(anyBoolean())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.ethNetworkConfig(any())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.discoveryHost(anyString())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.discoveryPort(anyInt())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.p2pAdvertisedHost(anyString())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.p2pListenPort(anyInt())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.maxPeers(anyInt())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.p2pEnabled(anyBoolean())).thenReturn(mockRunnerBuilder);
when(mockRunnerBuilder.jsonRpcConfiguration(any())).thenReturn(mockRunnerBuilder);

@ -145,8 +145,8 @@ public class PantheonCommandTest extends CommandTestAbstract {
EthNetworkConfig.jsonConfig(MAINNET),
EthNetworkConfig.MAINNET_NETWORK_ID,
MAINNET_BOOTSTRAP_NODES));
verify(mockRunnerBuilder).discoveryHost(eq("127.0.0.1"));
verify(mockRunnerBuilder).discoveryPort(eq(30303));
verify(mockRunnerBuilder).p2pAdvertisedHost(eq("127.0.0.1"));
verify(mockRunnerBuilder).p2pListenPort(eq(30303));
verify(mockRunnerBuilder).maxPeers(eq(25));
verify(mockRunnerBuilder).jsonRpcConfiguration(eq(defaultJsonRpcConfiguration));
verify(mockRunnerBuilder).webSocketConfiguration(eq(defaultWebSocketConfiguration));
@ -280,8 +280,8 @@ public class PantheonCommandTest extends CommandTestAbstract {
verify(mockRunnerBuilder).discovery(eq(false));
verify(mockRunnerBuilder).ethNetworkConfig(ethNetworkConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).discoveryHost(eq("1.2.3.4"));
verify(mockRunnerBuilder).discoveryPort(eq(1234));
verify(mockRunnerBuilder).p2pAdvertisedHost(eq("1.2.3.4"));
verify(mockRunnerBuilder).p2pListenPort(eq(1234));
verify(mockRunnerBuilder).maxPeers(eq(42));
verify(mockRunnerBuilder).jsonRpcConfiguration(eq(jsonRpcConfiguration));
verify(mockRunnerBuilder).webSocketConfiguration(eq(webSocketConfiguration));
@ -597,8 +597,8 @@ public class PantheonCommandTest extends CommandTestAbstract {
EthNetworkConfig.jsonConfig(MAINNET),
EthNetworkConfig.MAINNET_NETWORK_ID,
MAINNET_BOOTSTRAP_NODES));
verify(mockRunnerBuilder).discoveryHost(eq("127.0.0.1"));
verify(mockRunnerBuilder).discoveryPort(eq(30303));
verify(mockRunnerBuilder).p2pAdvertisedHost(eq("127.0.0.1"));
verify(mockRunnerBuilder).p2pListenPort(eq(30303));
verify(mockRunnerBuilder).maxPeers(eq(25));
verify(mockRunnerBuilder).jsonRpcConfiguration(eq(jsonRpcConfiguration));
verify(mockRunnerBuilder).webSocketConfiguration(eq(webSocketConfiguration));
@ -981,8 +981,8 @@ public class PantheonCommandTest extends CommandTestAbstract {
final int port = 1234;
parseCommand("--p2p-host", host, "--p2p-port", String.valueOf(port));
verify(mockRunnerBuilder).discoveryHost(stringArgumentCaptor.capture());
verify(mockRunnerBuilder).discoveryPort(intArgumentCaptor.capture());
verify(mockRunnerBuilder).p2pAdvertisedHost(stringArgumentCaptor.capture());
verify(mockRunnerBuilder).p2pListenPort(intArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(stringArgumentCaptor.getValue()).isEqualTo(host);
@ -998,7 +998,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
final String host = "localhost";
parseCommand("--p2p-host", host);
verify(mockRunnerBuilder).discoveryHost(stringArgumentCaptor.capture());
verify(mockRunnerBuilder).p2pAdvertisedHost(stringArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(stringArgumentCaptor.getValue()).isEqualTo(host);
@ -1013,7 +1013,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
final String host = "2600:DB8::8545";
parseCommand("--p2p-host", host);
verify(mockRunnerBuilder).discoveryHost(stringArgumentCaptor.capture());
verify(mockRunnerBuilder).p2pAdvertisedHost(stringArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(stringArgumentCaptor.getValue()).isEqualTo(host);

Loading…
Cancel
Save