forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Grid] Add support for customizing the Grid Registry
- Make the grid registry an interface -- GridRegistry. - Introduce BaseGridRegistry which is intended to be extended by GridRegistry implementations. - Introduce DefaultGridRegistry which replaces the pre-existing (now deprecated) Registry class. Most of the _real_ code from Registry was moved to DefaultGridRegistry. - Deprecated Registry. Replaced underlying implementation of new DefaultGridRegistry. Also make Registry implement GridRegistry. Changes here intended to ease migration and allow old code paths to continue to compile/work in the interim. - Change the return type to T extends GridRegistry for some methods. - Increase visibility of some additional methods and/or types which the existing DefaultGridRegistry takes advantage of -- allowing reuse. - Add 'registryClass' arugment to '-role hub' for specifying custom registry implmentation on the CLASSPATH - Update test code to use DefaultGridRegistry and GridRegistry
- Loading branch information
Showing
76 changed files
with
1,118 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
java/server/src/org/openqa/grid/internal/BaseGridRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.grid.internal; | ||
|
||
import org.openqa.grid.internal.utils.configuration.GridHubConfiguration; | ||
import org.openqa.grid.web.Hub; | ||
import org.openqa.selenium.remote.internal.HttpClientFactory; | ||
|
||
public abstract class BaseGridRegistry implements GridRegistry { | ||
protected final HttpClientFactory httpClientFactory; | ||
@Deprecated | ||
protected GridHubConfiguration configuration; | ||
|
||
// The following needs to be volatile because we expose a public setters | ||
protected volatile Hub hub; | ||
|
||
public BaseGridRegistry(Hub hub) { | ||
this.httpClientFactory = new HttpClientFactory(); | ||
this.hub = hub; | ||
|
||
this.configuration = (hub != null) ? | ||
hub.getConfiguration() : new GridHubConfiguration(); | ||
} | ||
|
||
/** | ||
* @see GridRegistry#getConfiguration() | ||
*/ | ||
@Deprecated | ||
public GridHubConfiguration getConfiguration() { | ||
return (hub != null) ? hub.getConfiguration() : | ||
(configuration != null) ? configuration : new GridHubConfiguration(); | ||
} | ||
|
||
/** | ||
* @see GridRegistry#getHub() | ||
*/ | ||
public Hub getHub() { | ||
return hub; | ||
} | ||
|
||
/** | ||
* @see GridRegistry#setHub(Hub) | ||
*/ | ||
public void setHub(Hub hub) { | ||
this.hub = hub; | ||
if (hub != null) { | ||
this.configuration = hub.getConfiguration(); | ||
} | ||
} | ||
|
||
/** | ||
* @see GridRegistry#getHttpClientFactory() | ||
*/ | ||
public HttpClientFactory getHttpClientFactory() { | ||
return httpClientFactory; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.