Package hudson

Examples of hudson.Proc$RemoteProc


    /**
     * Subversion externals to a file. Requires 1.6 workspace.
     */
    @Bug(7539)
    public void testExternalsToFile() throws Exception {
        Proc server = runSvnServe(getClass().getResource("HUDSON-7539.zip"));
        try {
            // enable 1.6 mode
            HtmlForm f = createWebClient().goTo("configure").getFormByName("config");
            f.getSelectByName("svn.workspaceFormat").setSelectedAttribute("10",true);
            submit(f);

            FreeStyleProject p = createFreeStyleProject();
            p.setScm(new SubversionSCM("svn://localhost/dir1"));
            FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0));
            System.out.println(getLog(b));

            assertTrue(b.getWorkspace().child("2").exists());
            assertTrue(b.getWorkspace().child("3").exists());
            assertTrue(b.getWorkspace().child("test.x").exists());

            assertBuildStatusSuccess(p.scheduleBuild2(0));
        } finally {
            server.kill();
        }
    }
View Full Code Here


    /**
     * There was a bug that credentials stored in the remote call context was serialized wrongly.
     */
    @Bug(8061)
    public void testRemoteBuild() throws Exception {
        Proc p = runSvnServe(SubversionSCMTest.class.getResource("HUDSON-1379.zip"));
        try {
            SystemCredentialsProvider.getInstance().setDomainCredentialsMap(Collections.singletonMap(Domain.global(),
                    Arrays.<Credentials>asList(
                            new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "1-alice", null, "alice", "alice")
                    )
            ));
            FreeStyleProject b = createFreeStyleProject();
            b.setScm(new SubversionSCM("svn://localhost/bob", "1-alice", "."));
            b.setAssignedNode(createSlave());

            buildAndAssertSuccess(b);
        } finally {
            p.kill();
        }
    }
View Full Code Here

            Launcher.ProcStarter ps = new Launcher.LocalLauncher(listener).launch();
            ps.envs(env).stdin(input).stdout(output).cmds(cmdList);
            if (workDir != null) {
                ps.pwd(workDir);
            }
            Proc p;
            try {
                p = ps.start();
                Integer ret = p.join();
                //return ret;
            } catch (InterruptedException e) {
                if (output != null && closePipes) {
                    IOUtils.closeQuietly(output);
                }
View Full Code Here

    /**
     * Make sure we are actually listing tags correctly.
     */
    @Bug(11933)
    public void testListTags() throws Exception {
        Proc p = runSvnServe(getClass().getResource("JENKINS-11933.zip"));
        try {
            ListSubversionTagsParameterDefinition def = new ListSubversionTagsParameterDefinition("FOO", "svn://localhost/", null, "", "", "", false, false);
            List<String> tags = def.getTags(null);
            List<String> expected = Arrays.asList("trunk", "tags/a", "tags/b", "tags/c");
           
            if (!expected.equals(tags))  {
                // retry. Maybe the svnserve just didn't start up correctly, yet
                System.out.println("First attempt failed. Retrying.");
                Thread.sleep(3000L);
                tags = def.getTags(null);
                if (!expected.equals(tags))  {
                    /* Just throws SVNException: svn: E210003: connection refused by the server:
                    dumpRepositoryContents();
                    */
                    if (tags.size() == 1 && tags.get(0).startsWith("!")) {
                        System.err.println("failed to contact SVN server; skipping test");
                        return;
                    }
                    Assert.fail("Expected " + expected + ", but got " + tags);
                }
            }
           
        } finally {
            p.kill();
        }
    }
View Full Code Here

            Launcher.ProcStarter ps = new LocalLauncher(listener).launch();
            ps.cmds(cmd).envs(env).stdin(in).stdout(out);
            if(err != null) ps.stderr(err);
            if(workDir!=null)   ps.pwd(workDir);

            Proc p;
            try {
                p = ps.start();
                Integer ret = p.join();
                if(out!=null) out.close();
                if(err!=null) err.close();
                return ret;
            } catch (InterruptedException e) {
                if(out!=null) out.close();
View Full Code Here

     * record the log and its exit code, then call it a build.
     */
    public void run(final String[] cmd) {
        run(new Runner() {
            public Result run(BuildListener listener) throws Exception {
                Proc proc = new Proc.LocalProc(cmd,getEnvironment(listener),System.in,new DualOutputStream(System.out,listener.getLogger()));
                return proc.join()==0?Result.SUCCESS:Result.FAILURE;
            }

            public void post(BuildListener listener) {
                // do nothing
            }
View Full Code Here

        final Thread t1 = new StreamCopyThread("stdout copier: "+name, proc.getInputStream(), ps.stdout(),false);
        t1.start();
        final Thread t2 = new StreamCopyThread("stdin copier: "+name,ps.stdin(), proc.getOutputStream(),true);
        t2.start();

        return new Proc() {
            public boolean isAlive() throws IOException, InterruptedException {
                try {
                    proc.exitValue();
                    return false;
                } catch (IllegalThreadStateException e) {
View Full Code Here

    FilePath moduleRoot = build.getModuleRoot();
    ScheduledFuture<?> future = null;
    Map<String, String> env = build.getEnvironment(listener);
    try {
      Proc proc = launcher.launch().cmds(args).envs(env).stdout(listener).pwd(moduleRoot).start();
      FilePath debugLog = this.getDebugLog(moduleRoot);
      if (debugLog != null) {
        Runnable watchdog = new WatdogTask(debugLog, proc, listener.getLogger());
        future = EXECUTOR.scheduleAtFixedRate(watchdog, 500L, 500L, TimeUnit.MILLISECONDS);
      }
      int r = proc.join();
      this.appendDebugLog(moduleRoot, listener);
      return r == 0;
    } catch (IOException e) {
      this.appendDebugLog(moduleRoot, listener);
      Util.displayIOException(e, listener);
View Full Code Here

  private boolean startVm(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener,
      ArgumentListBuilder args, Map<String, String> env) throws InterruptedException, IOException {
    FilePath moduleRoot = build.getModuleRoot();
    ScheduledFuture<?> future = null;
    try {
      Proc proc = launcher.launch().cmds(args).envs(env).stdout(listener).pwd(moduleRoot).start();
      FilePath debugLog = this.getDebugLog(moduleRoot);
      if (debugLog != null) {
        Runnable watchdog = new WatdogTask(debugLog, proc, listener.getLogger());
        future = EXECUTOR.scheduleAtFixedRate(watchdog, 500L, 500L, TimeUnit.MILLISECONDS);
      } else {
        // FIXME
        listener.getLogger().println("debug log doesn't exist");
      }
      int r = proc.join();
      // FIXME
      listener.getLogger().println("returned: " + r);
      return r == 0;
    } catch (IOException e) {
      // FIXME
View Full Code Here

    FilePath moduleRoot = build.getModuleRoot();
    ScheduledFuture<?> future = null;
    Map<String, String> env = build.getEnvironment(listener);
    try {
      Proc proc = launcher.launch().cmds(args).envs(env).stdout(listener).pwd(moduleRoot).start();
      FilePath debugLog = this.getDebugLog(moduleRoot);
      if (debugLog != null) {
        Runnable watchdog = new WatdogTask(debugLog, proc, listener.getLogger());
        future = EXECUTOR.scheduleAtFixedRate(watchdog, 500L, 500L, TimeUnit.MILLISECONDS);
      }
      int r = proc.join();
      this.appendDebugLog(moduleRoot, listener);
      return r == 0;
    } catch (IOException e) {
      this.appendDebugLog(moduleRoot, listener);
      Util.displayIOException(e, listener);
View Full Code Here

TOP

Related Classes of hudson.Proc$RemoteProc

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.