提交 33735a49 编写于 作者: J Jesse Glick

When overriding UserIdCause.getShortDescription, you need to override print as well.

Noticed via failure in BuildCommandTest.testConsoleOutput.
https://github.com/jenkinsci/jenkins/pull/522
上级 0c32a8ff
......@@ -32,7 +32,9 @@ import hudson.model.ParametersDefinitionProperty;
import hudson.model.ParameterDefinition;
import hudson.Extension;
import hudson.AbortException;
import hudson.console.ModelHyperlinkNote;
import hudson.model.Item;
import hudson.model.TaskListener;
import hudson.model.queue.QueueTaskFuture;
import hudson.scm.PollingResult.Change;
import hudson.util.EditDistance;
......@@ -158,6 +160,12 @@ public class BuildCommand extends CLICommand {
return "Started by command line by " + startedBy;
}
@Override
public void print(TaskListener listener) {
listener.getLogger().println("Started by command line by " +
ModelHyperlinkNote.encodeTo("/user/"+getUserId(), getUserName()));
}
@Override
public boolean equals(Object o) {
return o instanceof CLICause;
......
......@@ -105,7 +105,7 @@ public class BuildCommandTest extends HudsonTestCase {
def o = new ByteArrayOutputStream()
cli.execute(["build","-s","-v",p.name],System.in,new TeeOutputStream(System.out,o),System.err)
assertBuildStatusSuccess(p.getBuildByNumber(1))
assertTrue(o.toString().contains("Started by command line by anonymous"))
assertTrue(o.toString(), o.toString().contains("Started by command line by anonymous"))
assertTrue(o.toString().contains("Finished: SUCCESS"))
} finally {
cli.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册