* Place {@link ConsoleNote}s and make sure it works.
*/
public void testConsoleAnnotation() throws Exception {
final SequenceLock lock = new SequenceLock();
WebClient wc = createWebClient();
FreeStyleProject p = createFreeStyleProject();
p.getBuildersList().add(new TestBuilder() {
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
lock.phase(0);
// make sure the build is now properly started
lock.phase(2);
listener.getLogger().print("abc");
listener.annotate(new DollarMark());
listener.getLogger().println("def");
lock.phase(4);
listener.getLogger().print("123");
listener.annotate(new DollarMark());
listener.getLogger().print("456");
listener.annotate(new DollarMark());
listener.getLogger().println("789");
lock.phase(6);
return true;
}
});
Future<FreeStyleBuild> f = p.scheduleBuild2(0);
// discard the initial header portion
lock.phase(1);
FreeStyleBuild b = p.getBuildByNumber(1);
ProgressiveLogClient plc = new ProgressiveLogClient(wc,b);
plc.next();
lock.phase(3);
assertEquals("abc$$$def\r\n",plc.next());