本文整理汇总了Java中org.openqa.grid.common.RegistrationRequest类的典型用法代码示例。如果您正苦于以下问题:Java RegistrationRequest类的具体用法?Java RegistrationRequest怎么用?Java RegistrationRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistrationRequest类属于org.openqa.grid.common包,在下文中一共展示了RegistrationRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveNodeSettings
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
/**
* Resolve Selenium Grid node settings for host, port, and hub.
*
* @param nodeConfig node configuration with unresolved settings
* @return node configuration with resolved settings
*/
private RegistrationRequest resolveNodeSettings(RegistrationRequest nodeConfig) {
Map<String, Object> config = nodeConfig.getConfiguration();
String nodeHost = getString(SeleniumSettings.NODE_HOST.key());
if (nodeHost != null) {
config.put("host", nodeHost);
}
if (config.get("host") == null) {
config.put("host", getLocalHost());
}
config.put("port", getInteger(SeleniumSettings.NODE_PORT.key(), DEFAULT_NODE_PORT));
config.put("hub", "http://" + getHubConfig().getHost() + ":" + getHubConfig().getPort() + "/grid/register/");
return nodeConfig;
}
示例2: stopGridNode
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
/**
* Stop the configured Selenium Grid node server.
*
* @param localOnly 'true' to target only local Grid node server
* @return 'false' if [localOnly] and node is remote; otherwise 'true'
*/
public static boolean stopGridNode(boolean localOnly) {
if (localOnly && !isLocalNode()) {
return false;
}
RegistrationRequest nodeConfig = SeleniumConfig.getConfig().getNodeConfig();
if (isNodeActive(nodeConfig)) {
HttpHost nodeHost = GridUtility.getNodeHost(nodeConfig);
try {
GridUtility.getHttpResponse(nodeHost, NODE_SHUTDOWN);
new UrlChecker().waitUntilUnavailable(SHUTDOWN_DELAY, TimeUnit.SECONDS, URI.create(nodeHost.toURI()).toURL());
} catch (IOException | TimeoutException e) {
throw UncheckedThrow.throwUnchecked(e);
}
}
setNodeProcess(null);
return true;
}
示例3: testNodeConfig
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
@Test
public void testNodeConfig() {
SeleniumConfig config = SeleniumConfig.getConfig();
RegistrationRequest nodeConfig = config.getNodeConfig();
assertNotNull(nodeConfig);
assertEquals(nodeConfig.getConfiguration().get("role"), "node");
assertEquals(nodeConfig.getRole(), GridRole.NODE);
boolean hasPhantomJS = false;
for (DesiredCapabilities capability : nodeConfig.getCapabilities()) {
if ("phantomjs".equals(capability.getBrowserName())) {
hasPhantomJS = true;
break;
}
}
assertTrue(hasPhantomJS);
}
示例4: getBrowserCaps
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
/**
* Convert the configured browser specification from JSON to {@link Capabilities} object.
*
* @return {@link Capabilities} object for the configured browser specification
*/
public Capabilities getBrowserCaps() {
if (browserCaps == null) {
String jsonStr = null;
String nameStr = getString(SeleniumSettings.BROWSER_NAME.key());
if (nameStr != null) {
InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(nameStr + "Caps.json");
if (inputStream != null) {
try {
jsonStr = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
} catch (IOException eaten) {
LOGGER.warn("Unable to get browser configuration file contents: {}", eaten.getMessage());
}
}
if (jsonStr == null) {
jsonStr = String.format(CAPS_PATTERN, nameStr);
}
}
if (jsonStr == null) {
jsonStr = getString(SeleniumSettings.BROWSER_CAPS.key());
}
RegistrationRequest config = RegistrationRequest.getNewInstance(JSON_HEAD + jsonStr + JSON_TAIL);
browserCaps = config.getCapabilities().get(0);
}
return browserCaps;
}
示例5: isLocalNode
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
/**
* Determine if the configured Selenium Grid node server is the local host.
*
* @return 'true' if Grid node is local host; otherwise 'false'
*/
public static boolean isLocalNode() {
RegistrationRequest nodeConfig = SeleniumConfig.getConfig().getNodeConfig();
HttpHost nodeHost = GridUtility.getNodeHost(nodeConfig);
try {
InetAddress nodeAddr = InetAddress.getByName(nodeHost.getHostName());
return (GridUtility.isThisMyIpAddress(nodeAddr));
} catch (UnknownHostException e) {
LOGGER.warn("Unable to get IP address for '{}'", nodeHost.getHostName(), e);
return false;
}
}
示例6: NodeProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public NodeProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
remoteHost = new HttpHost(getRemoteHost().getHost(), getRemoteHost().getPort());
HttpClientFactory httpClientFactory = new HttpClientFactory();
client = httpClientFactory.getHttpClient();
serviceUrl = getRemoteHost() + "/extra/RecorderServlet";
}
示例7: MonitoringWebProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public MonitoringWebProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
final String addr = request.getConfiguration().host;
remoteHostName = addr.toLowerCase();
try {
remoteHostName = InetAddress.getByName(addr).getCanonicalHostName().toLowerCase();
} catch (Exception e) {
LOG.info(format("Unable to lookup name for remote address '%s", addr));
}
LOG.info(String.format("Initializing monitoring WebProxy for %s: %s.", remoteHostName, request.toJson()));
nodeReporter = EXECUTOR.scheduleAtFixedRate(new NodeReporter(remoteHostName, INFLUX_DB, DATABASE, this), 0, 5, TimeUnit.SECONDS);
}
示例8: renderSummary
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public String renderSummary() {
StringBuilder builder = new StringBuilder();
builder.append("<fieldset>");
builder
.append("<legend>")
.append(
"<img width='30' src='/grid/resources/images/mac.png' style='vertical-align:middle;' title='"
+ proxy.getClass().getSimpleName() + "'/>")
.append(proxy.getClass().getSimpleName()).append("</legend>");
builder.append("<div id='browsers'>");
for (TestSlot slot : proxy.getTestSlots()) {
builder.append("<a href='#' ");
builder.append(" title='").append(slot.getCapabilities()).append("' ");
builder.append(" >");
String icon = null;
if (BROWSER_NAME.equals(slot.getCapabilities().get(RegistrationRequest.BROWSER))) {
icon = "selendroid";
} else {
icon =
BrowserNameUtils.consoleIconName(new DesiredCapabilities(slot.getCapabilities()),
proxy.getRegistry());
}
builder.append("<img src='/grid/resources/images/" + icon + ".png' height='20px' ");
builder.append("</a>");
}
builder.append("</div>");
builder.append("</fieldset>");
return builder.toString();
}
示例9: GhostProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public GhostProxy(RegistrationRequest request, GridRegistry registry) {
super(request, registry);
LOG.info("Maximum sessions supported : " + ConfigReader.getInstance().getMaxSession());
}
示例10: ScreenRecordingProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public ScreenRecordingProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
this.nodeUrl = this.getRemoteHost().toString();
System.out.println("Registering screen recording proxy ....");
}
示例11: ReliableProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public ReliableProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
}
示例12: getOriginalRegistrationRequest
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
@Override
public RegistrationRequest getOriginalRegistrationRequest() {
return null;
}
示例13: MobileRemoteProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public MobileRemoteProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
}
示例14: SelendroidSessionProxy
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public SelendroidSessionProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
}
示例15: isNodeActive
import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
/**
* Determine if the configured Selenium Grid node is active.
*
* @param nodeConfig node configuration object
* @return 'true' if configured node is active; otherwise 'false'
*/
static boolean isNodeActive(RegistrationRequest nodeConfig) {
return isHostActive(getNodeHost(nodeConfig), NODE_STATUS);
}