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

Java SeleniumProtocol类代码示例

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

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



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

示例1: tabBrowsers

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
private String tabBrowsers() {
  StringBuilder builder = new StringBuilder();
  builder.append("<div type='browsers' class='content_detail'>");

  SlotsLines rcLines = new SlotsLines();
  SlotsLines wdLines = new SlotsLines();

  for (TestSlot slot : proxy.getTestSlots()) {
    if (slot.getProtocol() == SeleniumProtocol.Selenium) {
      rcLines.add(slot);
    } else {
      wdLines.add(slot);
    }
  }

  if (rcLines.getLinesType().size() != 0) {
    builder.append("<p class='protocol' >Remote Control (legacy)</p>");
    builder.append(getLines(rcLines));
  }
  if (wdLines.getLinesType().size() != 0) {
    builder.append("<p class='protocol' >WebDriver</p>");
    builder.append(getLines(wdLines));
  }
  builder.append("</div>");
  return builder.toString();
}
 
开发者ID:aimmac23,项目名称:selenium-reliable-node-plugin,代码行数:27,代码来源:WebProxyHtmlRendererBeta.java


示例2: testRequestNodeExpiredState

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that a node in the Expired state is not considered as a free resource
public void testRequestNodeExpiredState() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),10);
    node.updateStatus(AutomationDynamicNode.STATUS.EXPIRED);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    List<TestSlot> testSlots = new ArrayList<TestSlot>();
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    testSlots.add(new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities));
    proxy.setTestSlots(testSlots);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    AutomationRequestMatcher requestMatcher = new AutomationRequestMatcher();
    int freeThreads = requestMatcher.getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Thread count should be correct due to an expired node", 0, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:27,代码来源:AutomationRequestMatcherTest.java


示例3: testRequestNodeTerminatedNoInstanceId

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that a node in the Terminated state without an instance id is still considered a valid resource
public void testRequestNodeTerminatedNoInstanceId() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),10);
    node.updateStatus(AutomationDynamicNode.STATUS.TERMINATED);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    proxy.setMaxNumberOfConcurrentTestSessions(5);
    Map<String,Object> config = new HashMap<>();
    proxy.setConfig(config);
    List<TestSlot> testSlots = new ArrayList<TestSlot>();
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    testSlots.add(new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities));
    proxy.setTestSlots(testSlots);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    AutomationRequestMatcher requestMatcher = new AutomationRequestMatcher();
    int freeThreads = requestMatcher.getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Node should be available since instance id was not on the node", 1, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:27,代码来源:AutomationRequestMatcherTest.java


示例4: testRequestMatchingBrowsers

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Happy path that browsers matching shows correct free node count
 public void testRequestMatchingBrowsers() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));

    Assert.assertEquals("Thread count should be correct due to matching browser", 10, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java


示例5: testRequestNonMatchingBrowsers

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Test that non-matching browsers do not contribute to the free node count
public void testRequestNonMatchingBrowsers() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"doesntMatch");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));

    Assert.assertEquals("Thread count should be correct due to matching OS", 0, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java


示例6: testRequestAllTestSlotsIncluded

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Makes sure that all matching slots will be included to match
public void testRequestAllTestSlotsIncluded() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(10);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("There should be no matching threads since the node limit was reached",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:25,代码来源:AutomationRequestMatcherTest.java


示例7: testRequestAllTestSlotsIncludedGreaterNodeLimit

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that the correct number of slots match even when the max session config on node is less than
// the slot number
public void testRequestAllTestSlotsIncludedGreaterNodeLimit() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(15);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("There should be no matching threads since the node limit was reached",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java


示例8: testRequestAllTestSlotsIncludedLessThanNodeLimit

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that the correct number of slots match even when the max session config on node is greater than
// the slot number
public void testRequestAllTestSlotsIncludedLessThanNodeLimit() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(5);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("There should be no matching threads since the node limit was reached",5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java


示例9: testRequestNewRunNotStarted

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Test to make sure an in progress counts against the free node count
public void testRequestNewRunNotStarted() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox"));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("No nodes should be free since existing run hasn't started",0,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:27,代码来源:AutomationRequestMatcherTest.java


示例10: testNodesFreeNoUuid

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that the correct node count is returned when tests don't have a UUID
public void testNodesFreeNoUuid() {
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot,5);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals(5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:19,代码来源:AutomationRunContextTest.java


示例11: testNodesFreeWithUuid

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that the correct node count is returned when tests don't have a UUID
public void testNodesFreeWithUuid() {
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    capabilities.put(AutomationConstants.UUID,"testUuid");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot,5);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals(5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:20,代码来源:AutomationRunContextTest.java


示例12: testNewRunIsCounted

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that a new run is counted instead of tests in progress
public void testNewRunIsCounted() {
    String uuid = "testUuid";
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    capabilities.put(AutomationConstants.UUID,uuid);
    AutomationRunRequest request = new AutomationRunRequest(uuid,10,"chrome");
    runContext.addRun(request);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot,5);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals(0,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:23,代码来源:AutomationRunContextTest.java


示例13: testOldRunInProgress

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that for an old run, the in progress tests are counted
public void testOldRunInProgress() {
    String uuid = "testUuid";
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    capabilities.put(AutomationConstants.UUID,uuid);
    AutomationRunRequest request = new AutomationRunRequest(uuid,10,"chrome","23","linux", AutomationUtils.modifyDate(new Date(),-5,Calendar.MINUTE));
    runContext.addRun(request);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    int inProgressTests = 5;
    proxy.setMultipleTestSlots(testSlot,inProgressTests);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals("Free threads should reflect in progress test count",inProgressTests,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:24,代码来源:AutomationRunContextTest.java


示例14: testRequestNodeTerminatedState

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that a node in the Terminated state is not considered as a free resource
public void testRequestNodeTerminatedState() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),10);
    node.updateStatus(AutomationDynamicNode.STATUS.TERMINATED);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(5);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    List<TestSlot> testSlots = new ArrayList<TestSlot>();
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    testSlots.add(new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities));
    proxy.setTestSlots(testSlots);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    AutomationRequestMatcher requestMatcher = new AutomationRequestMatcher();
    int freeThreads = requestMatcher.getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("No threads should be available since the node was set to terminated", 0, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationRequestMatcherTest.java


示例15: testRequestMatchingOs

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that OS matching on a node works correctly
public void testRequestMatchingOs() throws IOException, ServletException {
    String browser = "firefox";
    String os = "linux";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    capabilities.put(CapabilityType.PLATFORM,os);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(null,null,browser,null,os));

    Assert.assertEquals("Thread count should be correct due to matching OS", 10, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationRequestMatcherTest.java


示例16: testRequestNonMatchingOs

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that OS NOT matching on a node works correctly
public void testRequestNonMatchingOs() throws IOException, ServletException {
    String browser = "firefox";
    String os = "linux";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    capabilities.put(CapabilityType.PLATFORM,"doesntMatch");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(null,null,browser,null,os));

    Assert.assertEquals("Thread count should be 0 due to non-matching OS", 0, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationRequestMatcherTest.java


示例17: testRequestNewRunNotStartedDifferentBrowser

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Test to make sure an in progress run only counts against the free nodes if the in progress run's browser
// matches the requested browser
public void testRequestNewRunNotStartedDifferentBrowser() throws IOException, ServletException{
    String nonMatchingBrowser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox"));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy nonMatchingProxy = new MockRemoteProxy();
    nonMatchingProxy.setMaxNumberOfConcurrentTestSessions(50);
    nonMatchingProxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    nonMatchingProxy.setConfig(config);
    Map<String,Object> nonMatchingCapabilities = new HashMap<String,Object>();
    nonMatchingCapabilities.put(CapabilityType.BROWSER_NAME, nonMatchingBrowser);
    TestSlot nonMatchingTestSlot = new TestSlot(nonMatchingProxy, SeleniumProtocol.WebDriver,null,nonMatchingCapabilities);
    nonMatchingProxy.setMultipleTestSlots(nonMatchingTestSlot, 10);
    proxySet.add(nonMatchingProxy);
    String matchingBrowser = "chrome";

    MockRemoteProxy matchingProxy = new MockRemoteProxy();
    proxySet.add(matchingProxy);
    matchingProxy.setMaxNumberOfConcurrentTestSessions(50);
    matchingProxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    matchingProxy.setConfig(config);
    Map<String,Object> matchingCapabilities = new HashMap<String,Object>();
    matchingCapabilities.put(CapabilityType.BROWSER_NAME, matchingBrowser);
    TestSlot matchingTestSlot = new TestSlot(nonMatchingProxy, SeleniumProtocol.WebDriver,null,matchingCapabilities);
    matchingProxy.setMultipleTestSlots(matchingTestSlot, 10);

    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(matchingBrowser));
    Assert.assertEquals("Nodes should be free even though run is in progress as browsers do not match",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:41,代码来源:AutomationRequestMatcherTest.java


示例18: testRequestNewRunInProgress

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests that a new run is still calculated with the total run threads and not what is in progress
public void testRequestNewRunInProgress() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox"));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(15);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    // Associate the run UUID with the test slots to mimic a test run that is partially underway
    capabilities.put(AutomationConstants.UUID,runId);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    // Assign a session to the test slot
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot,5);
    Map<String,Object> capabilities2 = new HashMap<String,Object>();
    capabilities2.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot2 = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities2);
    proxy.setMultipleTestSlots(testSlot2, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Free nodes should be including total run count",5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:35,代码来源:AutomationRequestMatcherTest.java


示例19: testRequestOldRunInProgress

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Test to make sure that an old run that never started is not subtracted from the free node count
public void testRequestOldRunInProgress() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox",null,null,AutomationUtils.modifyDate(new Date(),-2, Calendar.MINUTE)));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    // Associate the run UUID with the test slots to mimic a test run that is still in progress
    capabilities.put(AutomationConstants.UUID,runId);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    // Assign a session to the test slot
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot, 5);
    Map<String,Object> capabilities2 = new HashMap<String,Object>();
    capabilities2.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot2 = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities2);
    proxy.setMultipleTestSlots(testSlot2, 5);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Nodes should be considered free since run is considered old at this point ",5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:35,代码来源:AutomationRequestMatcherTest.java


示例20: testRequestOldRunFinished

import org.openqa.grid.common.SeleniumProtocol; //导入依赖的package包/类
@Test
// Tests when a run is considered old that the threads are not considered in use
public void testRequestOldRunFinished() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    // Add an old run that will not be included in the available resource logic
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId, 10, "firefox", null,null,AutomationUtils.modifyDate(new Date(), -2, Calendar.MINUTE)));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Free nodes should be correct since the run has finished at this point",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationRequestMatcherTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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