Examples of TextContent


Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

    @Test
    public void mail_textContent() throws Exception {
        // no text
        getAndAssertMail("textContent_empty", "GBK", null);

        TextContent content = (TextContent) builder.getContent();
        assertEquals("text/plain", content.getContentType());
        assertEquals("", content.getText());

        String eml = getMessageAsText();

        assertThat(eml, containsRegex("Subject: " + REGEX_EOL));
        assertThat(eml, containsRegex("Content-Type: text/plain; charset=GBK" + REGEX_EOL));
        assertThat(eml, containsRegex("Content-Transfer-Encoding: 8bit" + REGEX_EOL));
        assertThat(eml, containsRegex(REGEX_EOL + REGEX_EOL + "$"));

        // with text
        getAndAssertMail("textContent_withText", "GBK", null);

        content = (TextContent) builder.getContent();
        assertEquals("text/html", content.getContentType());
        assertEquals("hello, �й�", content.getText());

        eml = getMessageAsText();

        assertThat(eml, containsRegex("Subject: " + REGEX_EOL));
        assertThat(eml, containsRegex("Content-Type: text/html; charset=GBK" + REGEX_EOL));
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

    private MultipartContent multipart;
    private String multipartContentType;

    @Before
    public void init() throws Exception {
        content1 = new TextContent("content1");
        content2 = new TextContent("content2", "text/html");

        multipart = (MultipartContent) multipartClass.newInstance();
        multipart.addContent(content1);
        multipart.addContent(content2);
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

        attachable.setId("attachable");

        MultipartContent alternative = new AlternativeMultipartContent();
        alternative.setId("alternative");

        TextContent plainText = new TextContent("�Ұ��������д�", "text/plain");
        plainText.setId("plainText");

        TextContent htmlText = new TextContent("<���������д�>", "text/html");
        htmlText.setId("htmlText");

        TextTemplateContent plainTextTemplate = new TextTemplateContent("mail/mytemplate.vm", "text/plain");
        plainTextTemplate.setId("plainTextTemplate");

        AttachmentContent textAttachment = new AttachmentContent("testfile.txt");
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

    protected MailBuilder createMailBuilder(String subject, String addr) {
        MailBuilder builder = new MailBuilder();

        builder.setSubject(subject);
        builder.setContent(new TextContent());
        builder.setAddress(MailAddressType.TO, addr);

        return builder;
    }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

public class TextContentTests extends AbstractMailBuilderTests {
    private TextContent content;

    @Test
    public void empty_content() throws Exception {
        initContent(new TextContent());

        assertEquals("text/plain", content.getContentType()); // default content type

        assertThat(getMessageAsText(), containsAllRegex( //
                "Content-Type: text/plain; charset=UTF-8" + REGEX_EOL, //
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

                REGEX_EOL + REGEX_EOL + "$"));
    }

    @Test
    public void with_content() throws Exception {
        initContent(new TextContent("hello, world"));

        assertEquals("text/plain", content.getContentType()); // default content type

        assertThat(getMessageAsText(), containsAllRegex( //
                "Content-Type: text/plain; charset=UTF-8" + REGEX_EOL, //
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

                "hello, world$"));
    }

    @Test
    public void with_content_and_type() throws Exception {
        initContent(new TextContent("hello, world", "text/html"));

        assertEquals("text/html", content.getContentType());

        assertThat(getMessageAsText(), containsAllRegex( //
                "Content-Type: text/html; charset=UTF-8" + REGEX_EOL, //
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

                "hello, world$"));
    }

    @Test
    public void toString_defaultContentType() {
        initContent(new TextContent("hello, world"));

        String result = "";

        result += "TextContent {\n";
        result += "  contentType = text/plain\n";
View Full Code Here

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent

        assertEquals(result, content.toString());
    }

    @Test
    public void toString_specifiedContentType() {
        initContent(new TextContent("hello, world", "text/html"));

        String result = "";

        result += "TextContent {\n";
        result += "  contentType = text/html\n";
View Full Code Here

Examples of com.google.gdata.data.TextContent

    entry.setId(id);
    entry.setUpdated(DateTime.now());
    entry.addHtmlLink("http://0.0.0.0/" + id, "en", id);
    PlainTextConstruct construct = new PlainTextConstruct();
    construct.setText(id);
    TextContent content = new TextContent();
    content.setContent(construct);
    entry.setContent(content);
    return entry;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.