Skip to content

Commit

Permalink
[grid] More configuration tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Aug 8, 2018
1 parent 8193e98 commit a6d4cde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static java.util.Optional.ofNullable;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;

import org.openqa.grid.common.RegistrationRequest;
import org.openqa.grid.common.SeleniumProtocol;
Expand All @@ -34,6 +35,7 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -166,7 +168,7 @@ public GridNodeConfiguration() {
public GridNodeConfiguration(NodeJsonConfiguration jsonConfig) {
super(jsonConfig);
role = ROLE;
capabilities = jsonConfig.getCapabilities();
ofNullable(jsonConfig.getCapabilities()).ifPresent(v -> capabilities = new ArrayList<>(v));
maxSession = jsonConfig.getMaxSession();
register = jsonConfig.getRegister();
registerCycle = jsonConfig.getRegisterCycle();
Expand Down Expand Up @@ -352,7 +354,9 @@ public static GridNodeConfiguration loadFromJSON(JsonInput jsonInput) {
GridNodeConfiguration result = new GridNodeConfiguration(); // defaults
result.merge(fromJson);
// copy non-mergeable fields
result.hub = String.format("http://%s:%s", fromJson.getHubHostPort(), fromJson.getHubPort());
if (fromJson.getHubHostPort() != null) {
result.hub = String.format("http://%s:%s", fromJson.getHubHostPort(), fromJson.getHubPort());
}
if (fromJson.hub != null) {
result.hub = fromJson.hub;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.openqa.selenium.json.Json.MAP_TYPE;
import static org.openqa.selenium.testing.TestUtilities.catchThrowable;

import com.google.common.collect.ImmutableMap;

Expand Down

0 comments on commit a6d4cde

Please sign in to comment.