• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RemoteProxy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openqa.grid.internal.RemoteProxy的典型用法代码示例。如果您正苦于以下问题:Java RemoteProxy类的具体用法?Java RemoteProxy怎么用?Java RemoteProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RemoteProxy类属于org.openqa.grid.internal包,在下文中一共展示了RemoteProxy类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPlatform

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
/**
 * return the platform for the proxy. It should be the same for all slots of the proxy, so checking that.
 * @return Either the platform name, "Unknown", "mixed OS", or "not specified".
 */
public static String getPlatform(RemoteProxy proxy) {
  Platform res = null;
  if (proxy.getTestSlots().size() == 0) {
    return "Unknown";
  } else {
    res = getPlatform(proxy.getTestSlots().get(0));

  }

  for (TestSlot slot : proxy.getTestSlots()) {
    Platform tmp = getPlatform(slot);
    if (tmp != res) {
      return "mixed OS";
    } else {
      res = tmp;
    }
  }
  if (res == null) {
    return "not specified";
  } else {
    return res.toString();
  }
}
 
开发者ID:aimmac23,项目名称:selenium-reliable-node-plugin,代码行数:28,代码来源:WebProxyHtmlRendererBeta.java


示例2: getNumInProgressTests

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int getNumInProgressTests(ProxySet proxySet, AutomationRunRequest runRequest) {
    int inProgressTests = 0;
    for(RemoteProxy proxy : proxySet) {
        for(TestSlot testSlot : proxy.getTestSlots() ) {
            TestSession session = testSlot.getSession();
            if(session != null) {
                if(runRequest.matchesCapabilities(session.getRequestedCapabilities())) {
                    inProgressTests++;
                }
            }
        }
    }
    return inProgressTests;
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:19,代码来源:AutomationRequestMatcher.java


示例3: isNodeCurrentlyEmpty

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
/**
 * Returns true if the specified node is empty and has no runs on it, and false otherwise
 * @param instanceToFind
 * @return
 */
public boolean isNodeCurrentlyEmpty(String instanceToFind) {
    ProxySet proxySet = getProxySet();
    for(RemoteProxy proxy : proxySet){
        List<TestSlot> slots = proxy.getTestSlots();
        Object instanceId = proxy.getConfig().get(AutomationConstants.INSTANCE_ID);
        // If the instance id's do not match, this means this is not the node we are looking for
        // and we should continue on to the next one
        if(!instanceToFind.equals(instanceId)) {
            continue;
        }
        // Now that we found the matching node, iterate over all its test slots to see if any sessions are running
        for (TestSlot testSlot : slots) {
            // If we find a running session, this means the node is occupied, so we should return false
            if(testSlot.getSession() != null) {
                return false;
            }
        }
        // If we reached this point, this means we found our target node AND it had no sessions, meaning the node was empty
        return true;
    }
    // If we didn't find a matching node, we're going to say the nodes is empty so we can terminate it
    log.warn("No matching node was found in the proxy set.  Instance id: " + instanceToFind);
    return true;
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:30,代码来源:AutomationNodeCleanupTask.java


示例4: getResponse

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
private JSONObject getResponse() throws IOException, JSONException {
  JSONObject requestJSON = new JSONObject();
  ProxySet proxies = this.getRegistry().getAllProxies();
  Iterator<RemoteProxy> iterator = proxies.iterator();
  JSONArray busyProxies = new JSONArray();
  JSONArray freeProxies = new JSONArray();
  while (iterator.hasNext()) {
    RemoteProxy eachProxy = iterator.next();
    if (eachProxy.isBusy()) {
      busyProxies.put(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON());
    } else {
      freeProxies.put(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON());
    }
  }
  requestJSON.put("BusyProxies", busyProxies);
  requestJSON.put("FreeProxies", freeProxies);

  return requestJSON;
}
 
开发者ID:nicegraham,项目名称:selenium-grid2-api,代码行数:20,代码来源:ProxyStatusJsonServlet.java


示例5: doPost

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
      SeleniumBasedRequest request = new OurRegistrationRequest(req, getRegistry());
      
      Map<String, Object> capabilities = request.extractDesiredCapability();
      String proxyId = (String)capabilities.get("proxyId");
      RemoteProxy proxyById = getRegistry().getProxyById(proxyId);
      
      if(proxyById == null) {
    	  resp.sendError(HttpStatus.SC_BAD_REQUEST, "Remote proxy not found: " + proxyId);
    	  return;
      }
      
      TestSession session = proxyById.getNewSession(capabilities);
      
      if(session == null) {
    	  log.warning("Test slot requested on proxy is unavailable. Proxy: " + proxyId + " capabilities: " + capabilities);
    	  resp.sendError(429, "Test Slot Unavailable");
    	  return;
      }
      
      session.forward(request, resp, true);
      	      
      if(session.getExternalKey() != null) {
    	  log.info("Created session successfully for proxy " + proxyId + " - cleaning up session");
    	  session.sendDeleteSessionRequest();
    	  
    	  // This will log a warning, about couldn't find a session
    	  getRegistry().terminate(session, SessionTerminationReason.CLIENT_STOPPED_SESSION);
      }
      else {
    	  log.warning("Could not create session on proxy for " + proxyId);
      }

}
 
开发者ID:aimmac23,项目名称:selenium-reliable-node-plugin,代码行数:37,代码来源:NodeTestingServlet.java


示例6: doWork

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
@Override
public void doWork() {
    log.info("Looking for unregistered nodes");
    ProxySet proxySet = getProxySet();
    if(proxySet != null && proxySet.size() > 0) {
        for(RemoteProxy proxy : proxySet) {
            Map<String,Object> config = proxy.getConfig();
            // If the config has an instanceId in it, this means this node was dynamically started and we should
            // track it if we are not already
            if(config.containsKey(AutomationConstants.INSTANCE_ID)) {
                String instanceId = (String)config.get(AutomationConstants.INSTANCE_ID);
                AutomationRunContext context = AutomationContext.getContext();
                // If this node is already in our context, that means we are already tracking this node to terminate
                if(!context.nodeExists(instanceId)) {
                    Date createdDate = getDate(config);
                    // If we couldn't parse the date out, we are sort of out of luck
                    if(createdDate == null) {
                        break;
                    }
                    proxy.getConfig();
                    String uuid = (String)config.get(AutomationConstants.UUID);
                    int threadCount = (Integer)config.get(AutomationConstants.CONFIG_MAX_SESSION);
                    String browser = (String)config.get(AutomationConstants.CONFIG_BROWSER);
                    String os = (String)config.get(AutomationConstants.CONFIG_OS);
                    AutomationDynamicNode node = new AutomationDynamicNode(uuid,instanceId,browser,os,createdDate,threadCount);
                    log.info("Unregistered dynamic node found: " + node);
                    context.addNode(node);
                }
            }
        }
    }
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:33,代码来源:AutomationNodeRegistryTask.java


示例7: getResponse

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
private JSONObject getResponse() throws IOException, JSONException {
  JSONObject requestJSON = new JSONObject();
  ProxySet proxies = this.getRegistry().getAllProxies();
  Iterator<RemoteProxy> iterator = proxies.iterator();
  JSONArray p = new JSONArray();
  while (iterator.hasNext()) {
    RemoteProxy eachProxy = iterator.next();
    p.put(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON());
  }
  requestJSON.put("Proxies", p);

  return requestJSON;
}
 
开发者ID:nicegraham,项目名称:selenium-grid2-api,代码行数:14,代码来源:AllProxiesJsonServlet.java


示例8: ProxiedTestSlot

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
public ProxiedTestSlot(RemoteProxy proxy, SeleniumProtocol protocol, Map<String, Object> capabilities) {
    super(proxy, protocol, capabilities);
}
 
开发者ID:RationaleEmotions,项目名称:just-ask,代码行数:4,代码来源:ProxiedTestSlot.java


示例9: WebProxyHtmlRendererBeta

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
public WebProxyHtmlRendererBeta(RemoteProxy proxy) {
  this.proxy = proxy;
}
 
开发者ID:aimmac23,项目名称:selenium-reliable-node-plugin,代码行数:4,代码来源:WebProxyHtmlRendererBeta.java


示例10: WebProxyJsonRenderer

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
public WebProxyJsonRenderer(RemoteProxy proxy) {
    this.proxy = proxy;
}
 
开发者ID:jabbrwcky,项目名称:selenium-api,代码行数:4,代码来源:WebProxyJsonRenderer.java


示例11: getIcon

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
private String getIcon(Map<String, Object> capabilities,RemoteProxy proxy) {
    return BrowserNameUtils.getConsoleIconPath(new DesiredCapabilities(capabilities),
            proxy.getRegistry());
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:5,代码来源:StatusServlet.java


示例12: cleanUpRunRequests

import org.openqa.grid.internal.RemoteProxy; //导入依赖的package包/类
/**
 * Clean up any requests with no remaining running tests.
 *
 * @param  proxySet
 */
public void cleanUpRunRequests(final ProxySet proxySet) {
    AutomationRunContext context = AutomationContext.getContext();
    Set<String> uuidsToRemove = new HashSet<String>();
    synchronized (requests) {
        Iterator<String> requestsIterator = requests.keySet().iterator();
        if (requestsIterator.hasNext()) {

            // Grab our current date to use on all the requests we check
            while (requestsIterator.hasNext()) {
                String targetUuid = requestsIterator.next();
                AutomationRunRequest request = requests.get(targetUuid);
                if (!isRunOld(request)) {
                    log.info(String.format("Run [%s] is not at least [%d] seconds old.  Will not analyze.",
                            targetUuid, AutomationRunContext.CLEANUP_LIFE_LENGTH_IN_SECONDS));
                    continue;
                }

                boolean uuidFound = false;
                for (RemoteProxy proxy : proxySet) {
                    List<TestSlot> slots = proxy.getTestSlots();

                    // Once we find at least one test run with the given UUID, we want to break out
                    // as we are looking for runs with NO running tests with a matching UUID
                    for (int i = 0; !uuidFound && i < slots.size(); i++) {
                        TestSession testSession = slots.get(i).getSession();
                        if (testSession != null) {

                            // Check the session UUID instead of the node UUID as the node UUID is going to be the
                            // test run UUID that caused
                            // the node to be started, but will not necessarily be the run that is currently
                            // running on the node
                            Object sessionUuid = testSession.getRequestedCapabilities().get(
                                    AutomationConstants.UUID);
                            if (targetUuid.equals(sessionUuid)) {
                                uuidFound = true;
                                break;
                            }
                        }
                    }

                    // If we found the UUID on this node, we don't need to check any other nodes as we only need
                    // to know about
                    // at least run test still running in order to know we don't need to remove this run
                    if (uuidFound) {
                        break;
                    }
                }

                // If we didn't find a test belonging to this uuid, go ahead and remove the run
                if (!uuidFound) {
                    log.info(String.format(
                            "Tracked test run [%s] found with no running tests.  Adding to set for removal.",
                            targetUuid));
                    uuidsToRemove.add(targetUuid);
                }
                // Otherwise go ahead and continue to look at our other registered runs
                else {
                    continue;
                }
            }
        }
    }

    if (uuidsToRemove.size() == 0) {
        log.warn("No runs found to clean up");
    }

    for (String uuidToRemove : uuidsToRemove) {
        log.warn(String.format("Removing run because it has no more running test slots. UUID [%s]", uuidToRemove));
        context.deleteRun(uuidToRemove);
    }
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:78,代码来源:AutomationRunContext.java


示例13: compareTo

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParseException类代码示例发布时间:2022-05-23
下一篇:
Java Item类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap