Package hudson

Examples of hudson.MarkupText


    assertTrue(input + " does not match" + Maven3MojoNote.PATTERN, Maven3MojoNote.PATTERN.matcher(input).matches());
    assertEquals(decorated, annotate(input));
  }

    private String annotate(String text) {
        final MarkupText markupText = new MarkupText(text);
        new Maven3MojoNote().annotate(new Object(), markupText, 0);
        return markupText.toString(true);
    }
View Full Code Here


* @author Alan Harder
*/
public class UrlAnnotatorTest extends TestCase {
    public void testAnnotate() {
        ConsoleAnnotator ca = new UrlAnnotator().newInstance(null);
        MarkupText text = new MarkupText("Hello <foo>http://foo/</foo> Bye");
        ca.annotate(null, text);
        assertEquals("Hello &lt;foo><a href='http://foo/'>http://foo/</a>&lt;/foo> Bye",
                     text.toString(true));
        text = new MarkupText("Hello [foo]http://foo/bar.txt[/foo] Bye");
        ca.annotate(null, text);
        assertEquals("Hello [foo]<a href='http://foo/bar.txt'>http://foo/bar.txt</a>[/foo] Bye",
                     text.toString(true));
        text = new MarkupText(
                "Hello 'http://foo' or \"ftp://bar\" or <https://baz/> or (http://a.b.c/x.y) Bye");
        ca.annotate(null, text);
        assertEquals("Hello '<a href='http://foo'>http://foo</a>' or \"<a href='ftp://bar'>"
                + "ftp://bar</a>\" or &lt;<a href='https://baz/'>https://baz/</a>> or (<a "
                + "href='http://a.b.c/x.y'>http://a.b.c/x.y</a>) Bye",
                text.toString(true));
        text = new MarkupText("Fake 'http://foo or \"ftp://bar or <https://baz/ or (http://a.b.c/x.y Bye");
        ca.annotate(null, text);
        assertEquals("Fake '<a href='http://foo'>http://foo</a> or \"<a href='ftp://bar'>"
                + "ftp://bar</a> or &lt;<a href='https://baz/'>https://baz/</a> or (<a "
                + "href='http://a.b.c/x.y'>http://a.b.c/x.y</a> Bye",
                text.toString(true));
        text = new MarkupText("Punctuation: http://foo/.");
        ca.annotate(null, text);
        assertEquals("Punctuation: <a href='http://foo/'>http://foo/</a>.", text.toString(true));
    }
View Full Code Here

    /**
     * Mark up of URL should consider surrounding markers, if any.
     */
    public void test2() throws Exception {
        MarkupText m = new MarkupText("{abc='http://url/',def='ghi'}");
        new UrlAnnotator().newInstance(null).annotate(null,m);
        String html = m.toString(false);
        assertTrue(html.contains("<a href='http://url/'>http://url/</a>"));
        System.out.println(html);
    }
View Full Code Here

        /**
         * Gets the text fully marked up by {@link ChangeLogAnnotator}.
         */
        public String getMsgAnnotated() {
            MarkupText markup = new MarkupText(getMsg());
            for (ChangeLogAnnotator a : ChangeLogAnnotator.all())
                a.annotate(parent.build,this,markup);

            return markup.toString(false);
        }
View Full Code Here

                ann = ConsoleAnnotator.combine(annotators);
            }
        }

        lineOut.flush();
        MarkupText mt = new MarkupText(strBuf.toString());
        if (ann!=null)
            ann = ann.annotate(context,mt);
        out.write(mt.toString(true)); // this perform escapes
    }
View Full Code Here

    /**
     * Gets {@linkplain #getComment() the comment} fully marked up by {@link ChangeLogAnnotator}.
     */
    public String getCommentAnnotated() {
        MarkupText markup = new MarkupText(getComment());
        for (ChangeLogAnnotator a : ChangeLogAnnotator.all()) {
            a.annotate(getParent().build, this, markup);
        }

        return markup.toString(false);
    }
View Full Code Here

                        + "issues/9876/find'>close #9876</a> link");
    }

    private void assertAnnotatedTextEquals(final String originalText,
            final String expectedAnnotatedText) {
        MarkupText markupText = new MarkupText(originalText);

        GithubLinkAnnotator annotator = new GithubLinkAnnotator();
        annotator.annotate(new GithubUrl(GITHUB_URL), markupText, null);

        assertEquals(expectedAnnotatedText, markupText.toString());
    }
View Full Code Here

        AntTargetNote.ENABLED = false;
        assertEquals("TARGET:", annotate("TARGET:"));
    }

    private String annotate(String text) {
        MarkupText markupText = new MarkupText(text);
        new AntTargetNote().annotate(new Object(), markupText, 0);
        return markupText.toString(true);
    }
View Full Code Here

* @author Alan Harder
*/
public class UrlAnnotatorTest extends TestCase {
    public void testAnnotate() {
        ConsoleAnnotator ca = new UrlAnnotator().newInstance(null);
        MarkupText text = new MarkupText("Hello <foo>http://foo/</foo> Bye");
        ca.annotate(null, text);
        assertEquals("Hello &lt;foo><a href='http://foo/'>http://foo/</a>&lt;/foo> Bye",
                     text.toString(true));
        text = new MarkupText("Hello [foo]http://foo/bar.txt[/foo] Bye");
        ca.annotate(null, text);
        assertEquals("Hello [foo]<a href='http://foo/bar.txt'>http://foo/bar.txt</a>[/foo] Bye",
                     text.toString(true));
        text = new MarkupText(
                "Hello 'http://foo' or \"ftp://bar\" or <https://baz/> or (http://a.b.c/x.y) Bye");
        ca.annotate(null, text);
        assertEquals("Hello '<a href='http://foo'>http://foo</a>' or \"<a href='ftp://bar'>"
                + "ftp://bar</a>\" or &lt;<a href='https://baz/'>https://baz/</a>> or (<a "
                + "href='http://a.b.c/x.y'>http://a.b.c/x.y</a>) Bye",
                text.toString(true));
        text = new MarkupText("Fake 'http://foo or \"ftp://bar or <https://baz/ or (http://a.b.c/x.y Bye");
        ca.annotate(null, text);
        assertEquals("Fake '<a href='http://foo'>http://foo</a> or \"<a href='ftp://bar'>"
                + "ftp://bar</a> or &lt;<a href='https://baz/'>https://baz/</a> or (<a "
                + "href='http://a.b.c/x.y'>http://a.b.c/x.y</a> Bye",
                text.toString(true));
    }
View Full Code Here

        /**
         * Gets the text fully marked up by {@link ChangeLogAnnotator}.
         */
        public String getMsgAnnotated() {
            MarkupText markup = new MarkupText(getMsg());
            for (ChangeLogAnnotator a : ChangeLogAnnotator.all())
                a.annotate(parent.build,this,markup);

            return markup.toString(false);
        }
View Full Code Here

TOP

Related Classes of hudson.MarkupText

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.