Skip to content

Commit 9bfdc37

Browse files
mach6lukeis
authored andcommitted
Fix #2721 and cleanup/refactor node registration request (#2789)
- Fix serialization/deserialization of List<DesiredCapabilities> for GridNodeCofiguration - Change the format of node config files for Selenium V3 - There is no need to have the redundant configuration { ... } section. - Change the message in RegistrationRequest such that it does not contain dupicative information in separate json objects .. "id" and "capabilities" are part of "configuration" in Selenium V3 - Cleanup the api for RegistraionRequest -- will break compilation for people moving from 2.x -- removed the ability to change the GridNodeConfiguration reference via the RegistrationRequest object and removed all other setters. - Add ability to handle booleans in BrowseDesiredCapabilityConverter - Add GridRole#toString() Override - Update/Add tests
1 parent db9a71a commit 9bfdc37

32 files changed

+646
-490
lines changed

java/server/src/org/openqa/grid/common/GridRole.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,46 @@
2020
public enum GridRole {
2121
NOT_GRID, HUB, NODE;
2222

23+
private static final String WD_S = "wd";
24+
private static final String WEBDRIVER_S = "webdriver";
25+
private static final String NODE_S = "node";
26+
private static final String HUB_S = "hub";
27+
private static final String STANDALONE_S = "standalone";
28+
2329
public static GridRole get(String role) {
2430
if (role == null || role.equals("")) {
2531
return NOT_GRID;
2632
}
2733
switch (role) {
28-
case "wd":
29-
case "webdriver":
30-
case "node":
34+
case WD_S:
35+
case WEBDRIVER_S:
36+
case NODE_S:
3137
return NODE;
3238

33-
case "hub":
39+
case HUB_S:
3440
return HUB;
3541

36-
case "standalone":
42+
case STANDALONE_S:
3743
return NOT_GRID;
3844

3945
default:
4046
return null;
4147
}
4248
}
49+
50+
public String toString() {
51+
switch (this) {
52+
case NODE:
53+
return NODE_S;
54+
55+
case HUB:
56+
return HUB_S;
57+
58+
case NOT_GRID:
59+
return STANDALONE_S;
60+
61+
default:
62+
throw new IllegalStateException("Unrecognized GridRole");
63+
}
64+
}
4365
}

0 commit comments

Comments
 (0)