Package org.openqa.grid.common

Examples of org.openqa.grid.common.RegistrationRequest


    // because this method is called asynchronously and no one waits for the completion,
    // exception needs to be reported explicitly.
    public Void call() throws Exception {
        try {
            RegistrationRequest c = RegistrationRequest.build(args);
            for (DesiredCapabilities dc : c.getCapabilities()) {
                JenkinsCapabilityMatcher.enhanceCapabilities(dc, nodeName);
            }
            SelfRegisteringRemote remote = new SelfRegisteringRemote(c);
            PropertyUtils.setProperty(SeleniumConstants.PROPERTY_INSTANCE, remote);
            remote.startRemoteServer();
View Full Code Here


    gridHubConfig.setPort(MY_SERVER_HOST_PORT);

    hub = new Hub(gridHubConfig);
    hub.start();

    RegistrationRequest request = new RegistrationRequest();
    request.loadFromJSON("src/main/resources/node.json");
    request.getAssociatedJSON();

    SelfRegisteringRemote registration = new SelfRegisteringRemote(request);
    registration.startRemoteServer();
    registration.startRegistrationProcess();
View Full Code Here

  private SelfRegisteringRemote registration;

  @Override
  public void startHub() throws Exception {

    RegistrationRequest request = new RegistrationRequest();
    request.loadFromJSON("src/main/resources/nodeRemote.json");
    request.getAssociatedJSON();

    registration = new SelfRegisteringRemote(request);
    registration.startRemoteServer();
    registration.startRegistrationProcess();
View Full Code Here

  private SelfRegisteringRemote attachNodeToHub(DesiredCapabilities capability,
      GridRole role, int nodePort, SeleniumProtocol protocol) throws Exception {

    SelfRegisteringRemote node = null;
    RegistrationRequest registrationRequest = RegistrationRequest
        .localWebdriverNoCapabilities();
    capability.setCapability("seleniumProtocol", protocol);
    capability.setCapability(
        RegistrationRequest.UNREGISTER_IF_STILL_DOWN_AFTER, 1);
    // capability.setCapability(RegistrationRequest.MAX_TESTS_BEFORE_CLEAN, 5);
    // capability.setCapability(RegistrationRequest.MAX_INSTANCES, 5);

    registrationRequest.addDesiredCapability(capability);
    registrationRequest.setRole(role);
    // registrationRequest.loadFromJSON(resource);
    registrationRequest.setConfiguration(fetchNodeConfiguration(role, nodePort,
        protocol));

    node = new SelfRegisteringRemote(registrationRequest);

    node.startRemoteServer();
View Full Code Here

  @Override
  public void run() {
    while (active) {
      try {
        RegistrationRequest latest = createRegistrationRequest();
        if (latest == null) {
          noResponse++;
          proxy.setAvailable(false);
          if (noResponse >= 30) {
            active = false;
            removeNode();
          }
          continue;
        }
        noResponse = 0;
        proxy.setAvailable(true);
        List<DesiredCapabilities> latestCapabilities = latest.getCapabilities();
        if (!registeredCapabilities.toString().equals(latestCapabilities.toString())) {
          log.info("New capabilities registered on " + node.toString() + ". Updating...");
          updateCapabilities(latest);
        }
        Thread.sleep(2000);
View Full Code Here

      }
    }
  }

  private RegistrationRequest createRegistrationRequest() throws Exception {
    RegistrationRequest registrationRequest = new RegistrationRequest();

    List<DesiredCapabilities> capabilities = service.getNodeCapabilities();

    if (capabilities == null) {
      return null;
    }
    for (DesiredCapabilities cap : capabilities) {
      registrationRequest.addDesiredCapability(cap);
    }

    registrationRequest.getConfiguration().put(RegistrationRequest.AUTO_REGISTER, true);
    registrationRequest.getConfiguration().put(RegistrationRequest.PROXY_CLASS,this.getClass().getCanonicalName());

    registrationRequest.getConfiguration()
        .put(RegistrationRequest.HUB_HOST, proxy.getRegistry().getHub().getHost());
    registrationRequest.getConfiguration()
        .put(RegistrationRequest.HUB_PORT, proxy.getRegistry().getHub().getPort());
    registrationRequest.getConfiguration()
        .put(RegistrationRequest.REMOTE_HOST, "http://" + node.getHost() + ":" + node.getPort());
    registrationRequest.getConfiguration().put(RegistrationRequest.MAX_SESSION, 1);

    return registrationRequest;
  }
View Full Code Here

TOP

Related Classes of org.openqa.grid.common.RegistrationRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.