当前位置: 首页>>代码示例>>Java>>正文


Java RegistrationRequest类代码示例

本文整理汇总了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;
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:23,代码来源:SeleniumConfig.java

示例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;
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:26,代码来源:GridUtility.java

示例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);
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:18,代码来源:SeleniumConfigTest.java

示例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;
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:35,代码来源:SeleniumConfig.java

示例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;
    }
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:17,代码来源:GridUtility.java

示例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";
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:8,代码来源:NodeProxy.java

示例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);
}
 
开发者ID:jabbrwcky,项目名称:selenium-api,代码行数:16,代码来源:MonitoringWebProxy.java

示例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();
}
 
开发者ID:selendroid,项目名称:selendroid,代码行数:37,代码来源:SelendroidNodeHtmlRenderer.java

示例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());
}
 
开发者ID:RationaleEmotions,项目名称:just-ask,代码行数:5,代码来源:GhostProxy.java

示例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 ....");
}
 
开发者ID:bharathkumar-gopalan,项目名称:grid-video-recorder,代码行数:6,代码来源:ScreenRecordingProxy.java

示例11: ReliableProxy

import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public ReliableProxy(RegistrationRequest request, Registry registry) {
	super(request, registry);
}
 
开发者ID:aimmac23,项目名称:selenium-reliable-node-plugin,代码行数:4,代码来源:ReliableProxy.java

示例12: getOriginalRegistrationRequest

import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
@Override
public RegistrationRequest getOriginalRegistrationRequest() {
    return null;
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:5,代码来源:MockRemoteProxy.java

示例13: MobileRemoteProxy

import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public MobileRemoteProxy(RegistrationRequest request, Registry registry) {
	super(request, registry);
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:4,代码来源:MobileRemoteProxy.java

示例14: SelendroidSessionProxy

import org.openqa.grid.common.RegistrationRequest; //导入依赖的package包/类
public SelendroidSessionProxy(RegistrationRequest request, Registry registry) {
  super(request, registry);
}
 
开发者ID:selendroid,项目名称:selendroid,代码行数:4,代码来源:SelendroidSessionProxy.java

示例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);
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:10,代码来源:GridUtility.java


注:本文中的org.openqa.grid.common.RegistrationRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。