Skip to content

Commit 7213e08

Browse files
committed
[grid] Unifying hub parameter name.
So it is the same one on the cli and when used in the toml config. This makes documenting it easier, and also easier to understand for users.
1 parent 63371ba commit 7213e08

File tree

5 files changed

+27
-25
lines changed

5 files changed

+27
-25
lines changed

java/src/org/openqa/selenium/events/zeromq/ZeroMqEventBus.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.openqa.selenium.events.zeromq;
1919

20+
import static org.openqa.selenium.events.zeromq.UnboundZmqEventBus.REJECTED_EVENT;
21+
2022
import org.openqa.selenium.events.EventBus;
2123
import org.openqa.selenium.events.EventListener;
2224
import org.openqa.selenium.events.EventName;
@@ -33,8 +35,6 @@
3335
import java.net.URISyntaxException;
3436
import java.util.function.Consumer;
3537

36-
import static org.openqa.selenium.events.zeromq.UnboundZmqEventBus.REJECTED_EVENT;
37-
3838
/**
3939
* An {@link EventBus} backed by ZeroMQ.
4040
*/
@@ -56,7 +56,7 @@ public static EventBus create(ZContext context, String publish, String subscribe
5656
public static EventBus create(Config config) {
5757
String publish = config.get(EVENTS_SECTION, "publish")
5858
.orElseGet(() -> {
59-
URI uri = config.get("node", "hub-address")
59+
URI uri = config.get("node", "hub")
6060
.map(Urls::from)
6161
.orElseThrow(() -> new IllegalArgumentException(
6262
"Unable to find address to publish events to."));
@@ -65,7 +65,7 @@ public static EventBus create(Config config) {
6565

6666
String subscribe = config.get(EVENTS_SECTION, "subscribe")
6767
.orElseGet(() -> {
68-
URI uri = config.get("node", "hub-address")
68+
URI uri = config.get("node", "hub")
6969
.map(Urls::from)
7070
.orElseThrow(() -> new IllegalArgumentException(
7171
"Unable to find address to subscribe for events from."));
@@ -109,14 +109,6 @@ public static class RejectedEvent {
109109
this.data = data;
110110
}
111111

112-
public EventName getName() {
113-
return name;
114-
}
115-
116-
public Object getData() {
117-
return data;
118-
}
119-
120112
private static RejectedEvent fromJson(JsonInput input) {
121113
EventName name = null;
122114
Object data = null;
@@ -141,5 +133,13 @@ private static RejectedEvent fromJson(JsonInput input) {
141133

142134
return new RejectedEvent(name, data);
143135
}
136+
137+
public EventName getName() {
138+
return name;
139+
}
140+
141+
public Object getData() {
142+
return data;
143+
}
144144
}
145145
}

java/src/org/openqa/selenium/grid/node/config/NodeFlags.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ public class NodeFlags implements HasRoles {
113113
@Parameter(
114114
names = {"--hub"},
115115
description = "The address of the Hub in a Hub-and-Node configuration. This can " +
116-
"be a plain hostname or IP address (`hostname`), in which case the Hub will be " +
117-
"assumed to be `http://hostname:4444`, the `--grid-url` will be the same, " +
118-
"`--publish-events` will be `tcp://hostname:4442` and `--subscribe-events` will " +
119-
"be `tcp://hostname:4443`. If `hostname` contains a port number, that will be used " +
120-
"for `--grid-url` but the URIs for the event bus will remain the same. Any of these " +
121-
"default values may be overridden but setting the correct flags. If the hostname has " +
122-
"a protocol (such as `https`) that will be used too.")
123-
@ConfigValue(section = NODE_SECTION, name = "hub-address", example = "hub.grid.example.com")
116+
"be a plain hostname or IP address (`hostname`), in which case the Hub will be " +
117+
"assumed to be `http://hostname:4444`, the `--grid-url` will be the same, " +
118+
"`--publish-events` will be `tcp://hostname:4442` and `--subscribe-events` " +
119+
"will be `tcp://hostname:4443`. If `hostname` contains a port number, that " +
120+
"will be used for `--grid-url` but the URIs for the event bus will remain " +
121+
"the same. Any of these default values may be overridden but setting the " +
122+
"correct flags. If the hostname has a protocol (such as `https`) that will " +
123+
"be used too.")
124+
@ConfigValue(section = NODE_SECTION, name = "hub", example = "hub.grid.example.com")
124125
public String hub;
125126

126127
@Parameter(

java/src/org/openqa/selenium/grid/node/config/NodeOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public Optional<URI> getPublicGridUri() {
102102
return gridUri;
103103
}
104104

105-
Optional<String> hubAddress = config.get(NODE_SECTION, "hub-address");
105+
Optional<String> hubAddress = config.get(NODE_SECTION, "hub");
106106
if (!hubAddress.isPresent()) {
107107
return Optional.empty();
108108
}

java/src/org/openqa/selenium/grid/node/httpd/DefaultNodeConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DefaultNodeConfig extends MapConfig {
2929
// We use this instead of setting the default ports for
3030
// the publish and subscribe ports of the event bus so
3131
// that people can use the `--hub` flag safely.
32-
"hub-address", "http://0.0.0.0:4444"
32+
"hub", "http://0.0.0.0:4444"
3333
),
3434
"server", ImmutableMap.of(
3535
"port", 5555)));

java/test/org/openqa/selenium/grid/node/config/NodeOptionsTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,13 @@ public void canOverrideMaxSessionsWithFlag() {
463463
public void settingTheHubFlagSetsTheGridUrlAndEventBusFlags() {
464464
String[] rawConfig = new String[]{
465465
"[node]",
466-
"hub-address = \"cheese.com\"",
467-
};
466+
"hub = \"cheese.com\"",
467+
};
468468
Config config = new TomlConfig(new StringReader(String.join("\n", rawConfig)));
469469

470470
NodeOptions nodeOptions = new NodeOptions(config);
471-
assertThat(nodeOptions.getPublicGridUri()).isEqualTo(Optional.of(URI.create("http://cheese.com:4444")));
471+
assertThat(nodeOptions.getPublicGridUri())
472+
.isEqualTo(Optional.of(URI.create("http://cheese.com:4444")));
472473
}
473474

474475
private Condition<? super List<? extends Capabilities>> supporting(String name) {

0 commit comments

Comments
 (0)