Skip to content

Commit c053c80

Browse files
committed
server: Improving help message if -role option value is not recognized
1 parent 7510ff9 commit c053c80

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ public static GridRole find(String[] args) {
6464
return NODE;
6565
} else if ("hub".equals(role)) {
6666
return HUB;
67+
} else if ("standalone".equals(role)) {
68+
return NOT_GRID;
6769
} else {
68-
throw new GridConfigurationException("The role specified :" + role
69-
+ " doesn't match a recognized role for grid.");
70+
return null;
7071
}
7172
}
7273
}

java/server/src/org/openqa/grid/selenium/GridLauncher.java

+17-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ public class GridLauncher {
4545
public static void main(String[] args) throws Exception {
4646

4747
CommandLineOptionHelper helper = new CommandLineOptionHelper(args);
48+
GridRole role = GridRole.find(args);
49+
50+
if (role == null) {
51+
System.out.println(
52+
"\n" +
53+
"The role '" + helper.getParamValue("-role") + "' does not match a recognized role for Selenium server\n" +
54+
"\n" +
55+
"Selenium server can run in one of the following roles:\n" +
56+
" hub as a hub of a Selenium grid\n" +
57+
" node as a node of a Selenium grid\n" +
58+
" standalone as a standalone server not being a part of a grid\n" +
59+
"\n" +
60+
"If -role option is not specified the server runs standalone" +
61+
"\n");
62+
return;
63+
}
64+
4865
if (helper.isParamPresent("-help") || helper.isParamPresent("-h")){
4966
String separator = "\n----------------------------------\n";
5067
RemoteControlLauncher.usage(separator+"To use as a standalone server"+separator);
@@ -54,8 +71,6 @@ public static void main(String[] args) throws Exception {
5471

5572
configureLogging(helper);
5673

57-
GridRole role = GridRole.find(args);
58-
5974
switch (role) {
6075
case NOT_GRID:
6176
log.info("Launching a standalone Selenium Server");

0 commit comments

Comments
 (0)