Package hudson.plugins.selenium

Examples of hudson.plugins.selenium.RemoteRunningStatus


   *
   */
    private static final long serialVersionUID = 2047557797415325512L;

    public String invoke(File f, VirtualChannel channel) throws IOException {
        RemoteRunningStatus status = (RemoteRunningStatus) PropertyUtils.getMapProperty(SeleniumConstants.PROPERTY_STATUS, config);

        if (status != null && status.isRunning()) {
            // listener.getLogger().println("Skipping Selenium RC execution because this slave has already started its RCs");
            return null;
        }

        // listener.getLogger().println("Copy grid jar");
        File localJar = new File(f, seleniumJar.getName());
        if (localJar.lastModified() != jarTimestamp) {
            try {
                seleniumJar.copyTo(new FilePath(localJar));
                localJar.setLastModified(jarTimestamp);
            } catch (InterruptedException e) {
                throw new IOException2("Failed to copy grid jar", e);
            }
        }

        try {

            // listener.getLogger().println("Creating selenium VM");
            Channel jvm = SeleniumProcessUtils.createSeleniumRCVM(localJar, listener, options.getJVMArguments(), options.getEnvironmentVariables());
            status = new RemoteRunningStatus(jvm, options);
            status.setStatus(SeleniumConstants.STARTING);

            List<String> arguments = new ArrayList<String>(options.getSeleniumArguments().size());
            for (ProcessArgument arg : options.getSeleniumArguments()) {
                arguments.addAll(arg.toArgumentsList());
            }

            // listener.getLogger().println("Starting the selenium process");
            jvm.callAsync(new RemoteControlLauncher(nodeName, (String[]) ArrayUtils.addAll(defaultArgs, arguments.toArray(new String[0]))));
            status.setStatus(SeleniumConstants.STARTED);
            status.setRunning(true);
        } catch (Exception t) {
            status.setRunning(false);
            status.setStatus(SeleniumConstants.ERROR);
            LOGGER.log(Level.WARNING, "Selenium launch failed", t);
            // listener.getLogger().println( "Selenium launch failed" + t.getMessage());

            throw new IOException2("Selenium launch interrupted", t);
        }
View Full Code Here


    /**
     *
     */
    public String call() throws Exception {
        RemoteRunningStatus rs = getRunningStatus();
        rs.setStatus("Stopping");
        String url = callOnSubProcess(new RemoteStopSelenium(), null);
        rs.setStatus("Stopped");
        rs.setRunning(false);
        rs.getSeleniumChannel().close();
        return url;
    }
View Full Code Here

    private RemoteRunningStatus getRunningStatus() {
        return ((RemoteRunningStatus) PropertyUtils.getMapProperty(SeleniumConstants.PROPERTY_STATUS, name));
    }

    private <T, V extends Exception> T callOnSubProcess(Callable<T, V> call, T defaultValue) throws Exception {
        RemoteRunningStatus opt = (RemoteRunningStatus) PropertyUtils.getMapProperty(SeleniumConstants.PROPERTY_STATUS, name);
        if (opt == null)
            return defaultValue;
        return opt.getSeleniumChannel().call(call);
    }
View Full Code Here

TOP

Related Classes of hudson.plugins.selenium.RemoteRunningStatus

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.