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


Java TestSession.getExternalKey方法代码示例

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


在下文中一共展示了TestSession.getExternalKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPost

import org.openqa.grid.internal.TestSession; //导入方法依赖的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

示例2: afterSession

import org.openqa.grid.internal.TestSession; //导入方法依赖的package包/类
@Override
public void afterSession(TestSession session) {
	super.afterSession(session);
	
	Map<String, Object> capabilities = session.getSlot().getCapabilities();

	if(session.getExternalKey() == null && workingCapabilities.contains(capabilities)) {
		// session creation failed on a slot we thought was working - we should do something about this
		System.out.println("Session creation failed, re-testing configuration: " + capabilities);
		setCapabilityAsBroken(capabilities);
		RemoteNodeTester.testRemoteNode(this, capabilities);
	}
}
 
开发者ID:aimmac23,项目名称:selenium-reliable-node-plugin,代码行数:14,代码来源:ReliableProxy.java


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