Skip to content

Commit 1c58dfe

Browse files
committed
Fix code consistency for experimental -enablePassThrough config option
1 parent 58ac131 commit 1c58dfe

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

java/server/src/org/openqa/grid/common/defaults/DefaultStandalone.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"role": "standalone",
44
"debug": false,
55
"browserTimeout": 0,
6-
"timeout": 1800
6+
"timeout": 1800,
7+
"enablePassThrough": false
78
}

java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class StandaloneConfiguration {
7171
@VisibleForTesting
7272
static final Boolean DEFAULT_DEBUG_TOGGLE = false;
7373

74+
7475
/*
7576
* config parameters which do not serialize or deserialize to/from json
7677
*/
@@ -200,12 +201,16 @@ public class StandaloneConfiguration {
200201
)
201202
public Integer timeout = DEFAULT_TIMEOUT;
202203

204+
/**
205+
* Whether or not to use experimental passthrough mode on a hub or a standalone
206+
*/
203207
@Expose
204208
@Parameter(
205209
names = "-enablePassThrough",
206210
description = "<Boolean>: Whether or not to use the experimental passthrough mode. Defaults to false."
207211
)
208-
public boolean newHandler = false;
212+
// initially defaults to false from boolean primitive type
213+
public boolean enablePassThrough;
209214

210215

211216
/**
@@ -255,7 +260,8 @@ public void merge(StandaloneConfiguration other) {
255260
if (isMergeAble(other.timeout, timeout)) {
256261
timeout = other.timeout;
257262
}
258-
// role, port, log, debug, version, and help are not merged, they are only consumed by the immediately running node and can't affect a remote
263+
// role, port, log, debug, version, enablePassThrough, and help are not merged, they are only consumed by the
264+
// immediately running process and should never affect a remote
259265
}
260266

261267
/**
@@ -306,6 +312,7 @@ public String toString(String format) {
306312
sb.append(toString(format, "port", port));
307313
sb.append(toString(format, "role", role));
308314
sb.append(toString(format, "timeout", timeout));
315+
sb.append(toString(format, "enablePassThrough", enablePassThrough));
309316
return sb.toString();
310317
}
311318

java/server/src/org/openqa/grid/web/Hub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void addDefaultServlets(ServletContextHandler handler) {
104104
// add mandatory default servlets
105105
handler.addServlet(RegistrationServlet.class.getName(), "/grid/register/*");
106106

107-
if (config.newHandler) {
107+
if (config.enablePassThrough) {
108108
log.info("Using the experimental passthrough mode");
109109
handler.addServlet(DriverServlet.class.getName(), "/wd/hub/*");
110110
handler.addServlet(DriverServlet.class.getName(), "/selenium-server/driver/*");

java/server/src/org/openqa/selenium/remote/server/SeleniumServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void boot() {
128128
new SystemClock());
129129
handler.setAttribute(DriverServlet.SESSIONS_KEY, driverSessions);
130130
handler.setContextPath("/");
131-
if (configuration.newHandler) {
131+
if (configuration.enablePassThrough) {
132132
LOG.info("Using the experimental passthrough mode handler");
133133
handler.addServlet(WebDriverServlet.class, "/wd/hub/*");
134134
handler.addServlet(WebDriverServlet.class, "/webdriver/*");

java/server/test/org/openqa/grid/internal/utils/configuration/GridNodeConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public void testAsJson() {
186186
+ "\"port\":5555,"
187187
+ "\"role\":\"node\","
188188
+ "\"timeout\":1800,"
189-
+ "\"newHandler\":false}", gnc.toJson().toString());
189+
+ "\"enablePassThrough\":false}", gnc.toJson().toString());
190190
}
191191

192192
@Test

0 commit comments

Comments
 (0)