@@ -86,15 +86,20 @@ public Thread newThread(Runnable r) {
8686 * @throws IOException if unable to acquire Grid details
8787 */
8888 public SeleniumGrid (SeleniumConfig config , URL hubUrl ) throws IOException {
89- LOGGER .debug ("Mapping structure of grid at: {}" , hubUrl );
9089 hubServer = new GridServer (hubUrl , GridRole .HUB );
91- for (String nodeEndpoint : GridUtility .getGridProxies (hubUrl )) {
92- URL nodeUrl = new URL (nodeEndpoint + GridServer .HUB_BASE );
93- nodeServers .put (nodeEndpoint , new GridServer (nodeUrl , GridRole .NODE ));
94- addNodePersonalities (config , hubServer .getUrl (), nodeEndpoint );
90+ List <String > nodeEndpoints = GridUtility .getGridProxies (hubUrl );
91+ if (nodeEndpoints .isEmpty ()) {
92+ LOGGER .debug ("Detected servlet container at: {}" , hubUrl );
93+ } else {
94+ LOGGER .debug ("Mapping structure of grid at: {}" , hubUrl );
95+ for (String nodeEndpoint : nodeEndpoints ) {
96+ URL nodeUrl = new URL (nodeEndpoint + GridServer .HUB_BASE );
97+ nodeServers .put (nodeEndpoint , new GridServer (nodeUrl , GridRole .NODE ));
98+ addNodePersonalities (config , hubServer .getUrl (), nodeEndpoint );
99+ }
100+ addPluginPersonalities (config );
101+ LOGGER .debug ("{}: Personalities => {}" , hubServer .getUrl (), personalities .keySet ());
95102 }
96- addPluginPersonalities (config );
97- LOGGER .debug ("{}: Personalities => {}" , hubServer .getUrl (), personalities .keySet ());
98103 }
99104
100105 /**
@@ -108,18 +113,19 @@ public SeleniumGrid(SeleniumConfig config, URL hubUrl) throws IOException {
108113 * @throws IOException if unable to acquire Grid details
109114 */
110115 public SeleniumGrid (SeleniumConfig config , GridServer hubServer , GridServer ... nodeServers ) throws IOException {
111- this .hubServer = Objects .requireNonNull (hubServer );
112- if (Objects .requireNonNull (nodeServers ).length == 0 ) {
113- throw new IllegalArgumentException ("[nodeServers] must be non-empty" );
114- }
115- LOGGER .debug ("Assembling graph of grid at: {}" , hubServer .getUrl ());
116- for (GridServer nodeServer : nodeServers ) {
117- String nodeEndpoint = "http://" + nodeServer .getUrl ().getAuthority ();
118- this .nodeServers .put (nodeEndpoint , nodeServer );
119- addNodePersonalities (config , hubServer .getUrl (), nodeEndpoint );
116+ this .hubServer = Objects .requireNonNull (hubServer , "[hubServer] must be non-null" );
117+ if (nodeServers .length == 0 ) {
118+ LOGGER .debug ("Defined servlet container at: {}" , hubServer .getUrl ());
119+ } else {
120+ LOGGER .debug ("Assembling graph of grid at: {}" , hubServer .getUrl ());
121+ for (GridServer nodeServer : nodeServers ) {
122+ String nodeEndpoint = "http://" + nodeServer .getUrl ().getAuthority ();
123+ this .nodeServers .put (nodeEndpoint , nodeServer );
124+ addNodePersonalities (config , hubServer .getUrl (), nodeEndpoint );
125+ }
126+ addPluginPersonalities (config );
127+ LOGGER .debug ("{}: Personalities => {}" , hubServer .getUrl (), personalities .keySet ());
120128 }
121- addPluginPersonalities (config );
122- LOGGER .debug ("{}: Personalities => {}" , hubServer .getUrl (), personalities .keySet ());
123129 }
124130
125131 /**
0 commit comments