Package hudson.util

Examples of hudson.util.StreamTaskListener


    assertTrue(secondHttpSample.isSuccessful());
  }

  private PerformanceReport parseOneJMeter(File f) throws IOException {
    return new JMeterParser("").parse(null, Collections.singleton(f),
        new StreamTaskListener(System.out)).iterator().next();
  }
View Full Code Here


        new StreamTaskListener(System.out)).iterator().next();
  }

  private PerformanceReport parseOneJUnit(File f) throws IOException {
    return new JUnitParser("").parse(null, Collections.singleton(f),
        new StreamTaskListener(System.out)).iterator().next();
  }
View Full Code Here

  @Before
  public void before() {
    parser = new WrkSummarizerParser(null);
    logger = System.out;
    listener = new StreamTaskListener((java.io.OutputStream) System.out);
  }
View Full Code Here

    public void testSymlink() throws Exception {
        if (Functions.isWindows())     return;

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        StreamTaskListener l = new StreamTaskListener(baos);
        File d = Util.createTempDir();
        try {
            new FilePath(new File(d, "a")).touch(0);
            Util.createSymlink(d,"a","x", l);
            assertEquals("a",Util.resolveSymlink(new File(d,"x"),l));
View Full Code Here

    public void restart() throws IOException, InterruptedException {
        File me = getHudsonWar();
        File home = me.getParentFile();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        StreamTaskListener task = new StreamTaskListener(baos);
        task.getLogger().println("Restarting a service");
        int r = new LocalLauncher(task).launch().cmds(new File(home, "hudson.exe"), "restart")
                .stdout(task).pwd(home).join();
        if(r!=0)
            throw new IOException(baos.toString());
    }
View Full Code Here

            if(!hudsonWar.getCanonicalFile().equals(new File(dir,"hudson.war").getCanonicalFile()))
                copy(req, rsp, dir, hudsonWar.toURI().toURL(), "hudson.war");

            // install as a service
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            StreamTaskListener task = new StreamTaskListener(baos);
            task.getLogger().println("Installing a service");
            int r = WindowsSlaveInstaller.runElevated(
                    new File(dir, "hudson.exe"), "install", task, dir);
            if(r!=0) {
                sendError(baos.toString(),req,rsp);
                return;
View Full Code Here

                                    mv.setTodir(installationDir);
                                    mv.setFailOnError(false); // plugins can also fail to move
                                    mv.execute();
                                }
                                LOGGER.info("Starting a Windows service");
                                StreamTaskListener task = StreamTaskListener.fromStdout();
                                int r = WindowsSlaveInstaller.runElevated(
                                        new File(installationDir, "hudson.exe"), "start", task, installationDir);
                                task.getLogger().println(r==0?"Successfully started":"start service failed. Exit code="+r);
                            } catch (IOException e) {
                                e.printStackTrace();
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
View Full Code Here

            if(!dstSlaveJar.exists()) // perhaps slave.jar is already there?
                FileUtils.copyURLToFile(slaveJar,dstSlaveJar);

            // install as a service
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            StreamTaskListener task = new StreamTaskListener(baos);
            r = runElevated(slaveExe,"install",task,dir);
            if(r!=0) {
                JOptionPane.showMessageDialog(
                    dialog,baos.toString(),"Error", ERROR_MESSAGE);
                return;
            }

            r = JOptionPane.showConfirmDialog(dialog,
                    Messages.WindowsSlaveInstaller_InstallationSuccessful(),
                    Messages.WindowsInstallerLink_DisplayName(), OK_CANCEL_OPTION);
            if(r!=JOptionPane.OK_OPTION)    return;

            // let the service start after we close our connection, to avoid conflicts
            Runtime.getRuntime().addShutdownHook(new Thread("service starter") {
                public void run() {
                    try {
                        StreamTaskListener task = StreamTaskListener.fromStdout();
                        int r = runElevated(slaveExe,"start",task,dir);
                        task.getLogger().println(r==0?"Successfully started":"start service failed. Exit code="+r);
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
View Full Code Here

        Node node = exec.getOwner().getNode();

        if (t instanceof NodeSpecific) {
            NodeSpecific n = (NodeSpecific) t;
            t = (ToolInstallation)n.forNode(node,new StreamTaskListener(stderr));
        }
        if (t instanceof EnvironmentSpecific) {
            EnvironmentSpecific e = (EnvironmentSpecific) t;
            t = (ToolInstallation)e.forEnvironment(EnvVars.getRemote(channel));
        }
View Full Code Here

        /**
         * Returns true if the executable exists.
         */
        public boolean getExists() {
            try {
                return getExecutable(new LocalLauncher(new StreamTaskListener(new NullStream())))!=null;
            } catch (IOException e) {
                return false;
            } catch (InterruptedException e) {
                return false;
            }
View Full Code Here

TOP

Related Classes of hudson.util.StreamTaskListener

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.