Package org.apache.abdera.model

Examples of org.apache.abdera.model.Entry


   public static void testSection4133ContentJpegValidBase64() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-jpeg-valid-base64.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-jpeg-valid-base64.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     assertEquals(entry.getContentType(), Content.Type.MEDIA);
     DataHandler dh = entry.getContentElement().getDataHandler();
     ByteArrayInputStream in = (ByteArrayInputStream) dh.getContent();
     ByteArrayOutputStream out = new ByteArrayOutputStream();
     int n = -1;
     while ((n = in.read()) != -1) { out.write(n); }
     out.flush();
View Full Code Here


    //CHECKSTYLE:ON   
        Object[] arr = collectionCls.isArray() ? (Object[])collection : ((Collection<?>)collection).toArray();
        Class<?> memberClass = InjectionUtils.getActualType(collectionType);
       
        for (Object o : arr) {
            Entry entry = createEntryFromObject(factory, o, memberClass);
            feed.addEntry(entry);
        }
        if (!writerUsed) {
            setFeedProperties(factory, feed, wrapper, wrapperCls, collection, collectionCls, collectionType);
        }
View Full Code Here

   public static void testSection4133ContentNoTypeEscapedHtml() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-no-type-escaped-html.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-no-type-escaped-html.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     assertEquals(entry.getContent(), "Some <b>bold</b> text.");
     assertEquals(entry.getContentType(), Content.Type.TEXT);
   }
View Full Code Here

    }
   
   
   
    protected Entry createEntryFromObject(Factory factory, Object o, Class<?> cls) throws Exception {
        Entry entry = factory.getAbdera().newEntry();
       
        if (!buildEntry(entry, o, cls)) {
            setEntryProperties(factory, entry, o, cls);
        }
       
        if (entry.getContentElement() == null
            && entry.getExtensions().size() == 0) {
            createEntryContent(factory, entry, o, cls);   
        }
        return entry;
   
    }
View Full Code Here

   public static void testSection4133ContentNoTypeWithChildren() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-no-type-with-children.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-no-type-with-children.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     assertEquals(entry.getContent().trim(), "Some  text");
     assertEquals(entry.getContentType(), Content.Type.TEXT);
   }  
View Full Code Here

        if (isFeed) {
            return readFromFeedOrEntry(cls, mt, headers, is);
        } else {
            AtomEntryProvider p = new AtomEntryProvider();
            p.setAutodetectCharset(autodetectCharset);
            Entry entry = p.readFrom(Entry.class, Entry.class,
                                     new Annotation[]{}, mt, headers, is);
            return readFromEntry(entry, cls);
        }
    }
View Full Code Here

   public static void testSection4133ContentPlainWithChildren() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-plain-with-children.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-plain-with-children.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     assertEquals(entry.getContent().trim(), "Some  text.");
     assertEquals(entry.getContentType(), Content.Type.MEDIA);
   }  
View Full Code Here

   public static void testSection4133ContentSvgMixed() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-svg-mixed.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-svg-mixed.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     Content content = entry.getContentElement();
     assertNotNull(content.getValueElement()); // we're pretty forgiving
     assertEquals(content.getContentType(), Content.Type.XML);
   }
View Full Code Here

   public static void testSection4133ContentTextHtml() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-text-html.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-text-html.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     assertEquals(entry.getContentType(), Content.Type.MEDIA);
   }
View Full Code Here

   public static void testSection4133ContentTextWithChildren() throws Exception {
     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-text-with-children.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-text-with-children.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     assertEquals(entry.getContentType(), Content.Type.TEXT);
     assertEquals(entry.getContent().trim(), "Some  text");
   }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Entry

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.