Package hudson.model

Examples of hudson.model.TaskListener


            ListMultimap<String, String> argsMultimap = ArrayListMultimap.create();
            populateArgs(args, argsMap, argsMultimap);

            // Get the build and listener from the binding.
            AbstractBuild<?, ?> build = (AbstractBuild<?, ?>)this.getBinding().getVariable("build");
            TaskListener listener = (TaskListener)this.getBinding().getVariable("listener");

            return macro.evaluate(build, listener, name, argsMap, argsMultimap);
        }
        return String.format("[Could not find content token (check your usage): %s]", name);
    }
View Full Code Here


                reportFile.copyFrom(failedTestReport);

                return true;
            }
        });
        TaskListener listener = StreamTaskListener.fromStdout();
        project.scheduleBuild2(0).get();
        FailedTestsContent failedTestsContent = new FailedTestsContent();
        failedTestsContent.onlyRegressions = true;
        String content = failedTestsContent.evaluate(project.getLastBuild(), listener, FailedTestsContent.MACRO_NAME);
        assertTrue("The failing test should be reported the first time it fails", content.contains("hudson.plugins.emailext"));
View Full Code Here

    public JenkinsRule j = new JenkinsRule();

    @Test
    public void test1() throws Exception {
        FreeStyleProject project = j.createFreeStyleProject();
        TaskListener listener = StreamTaskListener.fromStdout();
        project.getBuildersList().add(new TestBuilder() {
            @Override
            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
                build.getWorkspace().child("foo").write("Hello, world!", "UTF-8");
                return true;
View Full Code Here

        try {
            new FilePath(bundle).write(
                    "#!/bin/bash -ex\n" +
                    "mkdir -p jdk1.6.0_dummy/bin\n" +
                    "touch jdk1.6.0_dummy/bin/java","ASCII");
            TaskListener l = StreamTaskListener.fromStdout();

            File d = env.temporaryDirectoryAllocator.allocate();

            new JDKInstaller("",true).install(new LocalLauncher(l),Platform.LINUX,
                    new JDKInstaller.FilePathFileSystem(hudson),l,d.getPath(),bundle.getPath());
View Full Code Here

        iOSDevice dev = devices.getDevice(device);
        if (dev==null)
            throw new AbortException("No such device found: "+device);

        TaskListener listener = new StreamTaskListener(stdout,getClientCharset());
        for (String bundle : files) {
            FilePath p = new FilePath(checkChannel(), bundle);
            listener.getLogger().println("Deploying "+ bundle);
            dev.deploy(new File(p.getRemote()), listener);
        }
        return 0;
    }
View Full Code Here

        try {
            // ensure we actually have a valid hudson launcher
            if (null == hudsonLauncher) {
                hudsonLauncher = Hudson.getInstance().createLauncher(new StreamTaskListener(System.out));
            }
            TaskListener listener = hudsonLauncher.getListener();

            // hudsonOut->p4in->reader
            FastPipedOutputStream hudsonOut = new FastPipedOutputStream();
            FastPipedInputStream p4in = new FastPipedInputStream(hudsonOut);
            //input = p4in;

            final OutputStream out = hudsonOut == null ? null : new RemoteOutputStream(hudsonOut);

            remoteCall.setEnv(env);
            remoteCall.setP4exe(p4exe);
            remoteCall.setOut(out);
            remoteCall.setWorkDir(filePath.getRemote());
            remoteCall.setListener(listener);
            remoteCall.setFilter(filter);
            remoteCall.setP4Ticket(p4ticket);
            LogPrinter logPrinter = new LogPrinter(listener.getLogger(), p4in);
            logPrinter.start();
            filePath.act(remoteCall);
            logPrinter.join();

        } catch (Exception e) {
View Full Code Here

    }

    private List<AbstractBuildParameters> getParameters(long from, long to, long step, SteppingValidationEnum validationFailure) throws IOException, InterruptedException, AbstractBuildParameters.DontTriggerException {
        AbstractBuild<?,?> build = mock(AbstractBuild.class);
        EnvVars vars = new EnvVars();
        TaskListener listener = mock(TaskListener.class);
        when(build.getEnvironment(listener)).thenReturn(vars);
        when(listener.getLogger()).thenReturn(System.out);
        CounterBuildParameterFactory counterFactory = new CounterBuildParameterFactory(from,to,step,"",validationFailure);

        return counterFactory.getParameters(build, listener);
    }
View Full Code Here

            final OutputStream out = hudsonOut == null ? null : new RemoteOutputStream(hudsonOut);
            final InputStream  in  = hudsonIn ==null ? null : new RemoteInputStream(hudsonIn);

            String remotePath = filePath.getRemote();
            TaskListener listener = hudsonLauncher.getListener();
            RemoteCall remoteCall = new RemoteCall(
                    Arrays.asList(cmd), env, in, out, null,
                    remotePath,
                    listener);
            Future future = channel.callAsync(remoteCall);
View Full Code Here

            }

            @Override public void onFailure(Throwable t) {
                try {
                    // TODO as in RetryStep, we cannot actually print the error message here
                    TaskListener listener = context.get(TaskListener.class);
                    if (t instanceof AbortException) {
                        listener.error(t.getMessage());
                    } else {
                        t.printStackTrace(listener.getLogger());
                    }
                    context.get(Run.class).setResult(Result.FAILURE);
                    context.onSuccess(null);
                } catch (Exception x) {
                    context.onFailure(x);
View Full Code Here

                    // Set up context for other steps inside this one.
                    Node node = computer.getNode();
                    if (node == null) {
                        throw new IllegalStateException("running computer lacks a node");
                    }
                    TaskListener listener = context.get(TaskListener.class);
                    Launcher launcher = node.createLauncher(listener);
                    Run<?,?> r = context.get(Run.class);
                    if (cookie == null) {
                        // First time around.
                        cookie = UUID.randomUUID().toString();
                        // Switches the label to a self-label, so if the executable is killed and restarted via ExecutorPickle, it will run on the same node:
                        label = computer.getName();
                        EnvVars env = computer.buildEnvironment(listener);
                        env.put(COOKIE_VAR, cookie);
                        synchronized (runningTasks) {
                            runningTasks.put(cookie, context);
                        }
                        // For convenience, automatically allocate a workspace, like WorkspaceStep would:
                        Job<?,?> j = r.getParent();
                        if (!(j instanceof TopLevelItem)) {
                            throw new Exception(j + " must be a top-level job");
                        }
                        FilePath p = node.getWorkspaceFor((TopLevelItem) j);
                        if (p == null) {
                            throw new IllegalStateException(node + " is offline");
                        }
                        WorkspaceList.Lease lease = computer.getWorkspaceList().allocate(p);
                        FilePath workspace = lease.path;
                        FlowNode flowNode = context.get(FlowNode.class);
                        flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode));
                        listener.getLogger().println("Running on " + computer.getDisplayName() + " in " + workspace); // TODO hyperlink
                        context.invokeBodyLater(exec, computer, env, workspace).addCallback(new Callback(cookie, lease));
                        LOGGER.log(Level.FINE, "started {0}", cookie);
                    } else {
                        // just rescheduled after a restart; wait for task to complete
                        LOGGER.log(Level.FINE, "resuming {0}", cookie);
View Full Code Here

TOP

Related Classes of hudson.model.TaskListener

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.