Package hudson.plugins.selenium.callables

Source Code of hudson.plugins.selenium.callables.RemoteStopSelenium

package hudson.plugins.selenium.callables;

import hudson.remoting.Callable;
import hudson.remoting.Channel;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.openqa.grid.common.RegistrationRequest;
import org.openqa.grid.internal.utils.SelfRegisteringRemote;

public class RemoteStopSelenium implements Callable<String, Exception> {

    /**
   *
   */
    private static final long serialVersionUID = -5448989386458342771L;

    public String call() throws Exception {
        Logger LOG = Logger.getLogger(SelfRegisteringRemote.class.getName());

        Logger.getLogger("org").setLevel(Level.ALL);

        LOG.fine("instances " + PropertyUtils.getProperty(SeleniumConstants.PROPERTY_INSTANCE));
        SelfRegisteringRemote srr = PropertyUtils.getProperty(SeleniumConstants.PROPERTY_INSTANCE);
        String url = getRemoteURL(srr);
        srr.stopRemoteServer();

        Channel.current().setProperty(SeleniumConstants.PROPERTY_LOCK, new Object());
        return url;
    }

    private String getRemoteURL(SelfRegisteringRemote srr) {
        String host = (String) srr.getConfiguration().get(RegistrationRequest.HOST);
        Integer port = (Integer) srr.getConfiguration().get(RegistrationRequest.PORT);
        return "http://" + host + ":" + port;
    }

}
TOP

Related Classes of hudson.plugins.selenium.callables.RemoteStopSelenium

TOP
Copyright © 2018 www.massapi.com. 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.