File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\test\java\hudson\tasks\test\TrivialTestResultRecorder.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2009, Yahoo!, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson.tasks.test;
25
26 import hudson.Extension;
27 import hudson.Launcher;
28 import hudson.model.AbstractBuild;
29 import hudson.model.AbstractProject;
30 import hudson.model.BuildListener;
31 import hudson.tasks.BuildStepDescriptor;
32 import hudson.tasks.BuildStepMonitor;
33 import hudson.tasks.Publisher;
34 import hudson.tasks.Recorder;
35
36 import java.io.IOException;
37 import java.io.Serializable;
38
39
40 /**
41 * A class to exercise the TestResult extension mechanism.
42 */
43 public class TrivialTestResultRecorder extends Recorder implements Serializable {
44 @Override
45 public boolean perform(AbstractBuild<?, ?> build,
46 Launcher launcher, BuildListener listener)
47 throws InterruptedException, IOException {
48 System.out.println("performing TrviialTestResultRecorder");
49 listener.getLogger().println("perfoming TrivialTestResultRecorder");
50 TrivialTestResult r = new TrivialTestResult("gubernatorial");
51 TrivialTestResultAction action = new TrivialTestResultAction(build, r);
52 r.setParentAction(action);
53 build.getActions().add(action);
54 listener.getLogger().println("done with TrivialTestResultRecorder");
55 System.out.println("done with TrivialTestResultRecorder");
56 return true;
57 }
58
59 public BuildStepMonitor getRequiredMonitorService() {
60 return BuildStepMonitor.NONE;
61 }
62
63 @Extension
64 public static class DescriptorImpl extends BuildStepDescriptor<Publisher> {
65
66 /**
67 * Returns true if this task is applicable to the given project.
68 *
69 * @return true to allow user to configure this post-promotion task for the given project.
70 * @see hudson.model.AbstractProject.AbstractProjectDescriptor#isApplicable(hudson.model.Descriptor)
71 */
72 @Override
73 public boolean isApplicable(Class<? extends AbstractProject> jobType) {
74 return true;
75 }
76
77 /**
78 * Human readable name of this kind of configurable object.
79 */
80 @Override
81 public String getDisplayName() {
82 return "trivialtestrecorder";
83 }
84 }
85
86 }
87