Skip to content

Commit

Permalink
custom configuration values take node config preference rather than t…
Browse files Browse the repository at this point in the history
…he hub, hubHost/hubPort in default json should use just 'hub'
  • Loading branch information
lukeis committed Mar 15, 2016
1 parent dc2063d commit ef580f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static RegistrationRequest getNewInstance(String json) throws JsonSyntaxE
JsonObject config = o.get("configuration").getAsJsonObject();
GridNodeConfiguration
configuration =
new JsonToBeanConverter().convert(GridNodeConfiguration.class, config);
new Gson().fromJson(config, GridNodeConfiguration.class);
request.setConfiguration(configuration);

if (o.has("id")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"host": "localhost",
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "localhost"
"hub": "http://localhost:4444"
}
}
2 changes: 2 additions & 0 deletions java/server/src/org/openqa/grid/internal/BaseRemoteProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public BaseRemoteProxy(RegistrationRequest request, Registry registry) {
this.config.merge(registry.getConfiguration());
this.config.host = request.getConfiguration().host;
this.config.port = request.getConfiguration().port;
// custom configurations from the remote need to 'override' the hub
this.config.custom.putAll(request.getConfiguration().custom);

String url = config.getRemoteHost();
String id = config.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ public void merge(GridNodeConfiguration other) {
if (other.downPollingLimit != null) {
downPollingLimit = other.downPollingLimit;
}
if (other.hub != null) {
hub = other.hub;
}
if (other.hubHost != null) {
hubHost = other.hubHost;
}
Expand Down

0 comments on commit ef580f7

Please sign in to comment.