Package org.apache.abdera

Examples of org.apache.abdera.Abdera.newEntry()


    @Test
    public void testSetContent2() throws Exception {

        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        InputStream in = new ByteArrayInputStream("tóst".getBytes("utf-16"));

        Document<Entry> edoc = entry.getDocument();
        entry.setContent(in, "text/plain;charset=\"utf-16\"");
View Full Code Here


    @Test
    public void testXhtml() throws Exception {

        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        entry.setContentAsXhtml("<p>Test</p>");
        assertNotNull(entry.getContent());
        assertEquals(Content.Type.XHTML, entry.getContentType());
        Element el = entry.getContentElement().getValueElement();
        assertTrue(el instanceof Div);
View Full Code Here

        assertNotNull(entry.getContent());
        assertEquals(Content.Type.XHTML, entry.getContentType());
        Element el = entry.getContentElement().getValueElement();
        assertTrue(el instanceof Div);

        entry = abdera.newEntry();
        entry.setContent("<a><b><c/></b></a>", Content.Type.XML);
        assertNotNull(entry.getContent());
        assertEquals(Content.Type.XML, entry.getContentType());
        assertNotNull(entry.getContentElement().getValueElement());
View Full Code Here

    }

    @Test
    public void testSpecialCharacters() {
        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        entry.setContentAsXhtml("<p>&Auml;sthetik</p>");
        assertNotNull(entry.getContent());
        assertEquals(Content.Type.XHTML, entry.getContentType());
        Element el = entry.getContentElement().getValueElement();
        char umlaut = ((Element)el.getFirstChild()).getText().charAt(0);
View Full Code Here

public class EncodingTest {

    @Test
    public void testContentEncoding() throws Exception {
        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        entry.setId("http://example.com/entry/1");
        entry.setTitle("Whatever");
        entry.setUpdated(new Date());
        Content content = entry.getFactory().newContent(Content.Type.XML);
        String s = "<x>" + new Character((char)224) + "</x>";
View Full Code Here

     * Passes if the test does not throw a parse exception
     */
    @Test
    public void testCompressionCodec() throws Exception {
        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStream cout = CompressionUtil.getEncodedOutputStream(out, CompressionCodec.GZIP);
        entry.writeTo(cout);
        cout.close();
        byte[] bytes = out.toByteArray();
View Full Code Here

     * Passes if the test does not throw any exceptions
     */
    @Test
    public void testWriterOptions() throws Exception {
        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        entry.setTitle("1");

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        WriterOptions writeoptions = entry.getDefaultWriterOptions();
        writeoptions.setCompressionCodecs(CompressionCodec.DEFLATE);
View Full Code Here

    public static void main(String... args) throws Exception {

        ID id = new ID("myblog", "entries", "abc123xyz");

        Abdera abdera = Abdera.getInstance();
        Entry entry = abdera.newEntry();
        entry.setId(Template.expandAnnotated(id));
        entry.setTitle("This is a test");
        entry.writeTo("prettyxml", System.out);

    }
View Full Code Here

                                  
     }

  public static Entry newEntry(String value) {
    Abdera abdera = new Abdera();
    Entry entry = abdera.newEntry();
    entry.setTitle("customer " + value);

    Content content = abdera.getFactory().newContent();
    content.setContentType(Content.Type.TEXT);
    content.setValue(value);
View Full Code Here

    }

    public static Entry newEntry(String value) {
        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        entry.setTitle("customer " + value);

        Content content = abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
        content.setValue(value);
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.