Package org.apache.abdera.model

Examples of org.apache.abdera.model.Feed


       
        // lets check if the Atom reader is asking for a set of records which has already been
        // converted to Feed
       
        synchronized (feeds) {
            Feed f = feeds.get(page);
            if (f != null) {
                return f;
            }
        }
       
        Feed feed = null;
        SearchCondition<LogRecord> condition = getCurrentCondition();
        synchronized (records) {
            List<LogRecord> list = new LinkedList<LogRecord>();
            int lastPage = fillSubList(list, page, condition);
            Collections.sort(list, new LogRecordComparator());
            feed = (Feed)new CustomFeedConverter(page).convert(list).get(0);
            setFeedPageProperties(feed, page, lastPage);
        }
        // if at the moment we've converted n < pageSize number of records only and
        // persist a Feed keyed by a page then another reader requesting the same page
        // may miss latest records which might've been added since the original request
        if (condition == null && feed.getEntries().size() == pageSize) {
            synchronized (feeds) {
                feeds.put(page, feed);
            }
        }
        return feed;
View Full Code Here


  public static void testSection12PrefixedNamespace() throws Exception {
    //http://feedvalidator.org/testcases/atom/1.2/prefixed-namespace.xml
    IRI uri = baseURI.resolve("1.2/prefixed-namespace.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    assertNotNull(feed);
    assert(feed.getQName().getPrefix().equals("atom"));
  }
View Full Code Here

  public static void testSection2InfosetAttrOrder() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/infoset-attr-order.xml
    IRI uri = baseURI.resolve("2/infoset-attr-order.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    assertNotNull(feed);
    List<Link> links = feed.getLinks(Link.REL_ALTERNATE);
    assertEquals(links.size(),2);
    for (Link link : links) {
      assertEquals(link.getRel(), "alternate");
      assertNotNull(link.getHref());
    }
View Full Code Here

  public static void testSection2InfosetCDATA() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/infoset-cdata.xml
    IRI uri = baseURI.resolve("2/infoset-cdata.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    List<Entry> entries = feed.getEntries();
    for (Entry entry : entries) {
      Text summary = entry.getSummaryElement();
      assertNotNull(summary);
      assertEquals(summary.getTextType(), Text.Type.TEXT);
      String value = summary.getValue();
View Full Code Here

  public static void testSection2InfosetCharRef() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/infoset-char-ref.xml
    IRI uri = baseURI.resolve("2/infoset-char-ref.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    List<Entry> entries = feed.getEntries();
    for (Entry entry : entries) {
      DateTime updated = entry.getUpdatedElement();
      assertNotNull(updated);
      assertNotNull(updated.getValue());
      assertNotNull(updated.getValue().getDate());
View Full Code Here

  public static void testSection2InfosetElementWhitespace() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/infoset-element-whitespace.xml
    IRI uri = baseURI.resolve("2/infoset-element-whitespace.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    assertNotNull(feed);
    Link link = feed.getAlternateLink();
    assertEquals(link.getResolvedHref(), new IRI("http://example.org/"));
    // the feed has a second alternate link that we will ignore
  }
View Full Code Here

  public static void testSection2InfosetEmpty1() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/infoset-empty1.xml
    IRI uri = baseURI.resolve("2/infoset-empty1.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    assertNotNull(feed);
    Entry entry = feed.getEntries().get(0);
    assertEquals(entry.getTitle(),"");
  }
View Full Code Here

  public static void testSection2InfosetEmpty2() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/infoset-empty2.xml
    IRI uri = baseURI.resolve("2/infoset-empty2.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    assertNotNull(feed);
    Entry entry = feed.getEntries().get(0);
    assertEquals(entry.getTitle(),"");
  }
View Full Code Here

  public static void testSection2InvalidXmlBase() throws Exception {
    //http://feedvalidator.org/testcases/atom/2/invalid-xml-base.xml
    IRI uri = baseURI.resolve("2/invalid-xml-base.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    try {
      feed.getBaseUri();
    } catch (Exception e) {
      assertTrue(e instanceof IRISyntaxException);
    }
  }
View Full Code Here

    //http://feedvalidator.org/testcases/atom/2/iri.xml
    IRI uri = baseURI.resolve("2/iri.xml");
    Document<Feed> doc = get(uri);
    assertNotNull(doc);
   
    Feed feed = doc.getRoot();
    assertNotNull(feed);
    assertNotNull(feed.getIdElement().getValue());
    assertNotNull(feed.getAuthor().getUriElement().getValue());
    assertNotNull(feed.getAuthor().getUriElement().getValue().toASCIIString());
  }
View Full Code Here

TOP

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

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.