Package org.apache.abdera.model

Examples of org.apache.abdera.model.Document


  protected void setUp() throws Exception {
    baseURI = new IRI("http://www.feedparser.org/tests/wellformed/atom10/");
  }

  public void testAtom10Namespace() throws Exception {
    Document doc = parse(baseURI.resolve("atom10_namespace.xml"));
    assertNotNull(doc);
  }
View Full Code Here


    Document doc = parse(baseURI.resolve("atom10_namespace.xml"));
    assertNotNull(doc);
  }
 
  public void testEntryAuthorEmail() throws Exception {
    Document doc = parse(baseURI.resolve("entry_author_email.xml"));
    Feed feed = (Feed) doc.getRoot();
    Entry entry = feed.getEntries().get(0);
    Person person = entry.getAuthor();
    assertEquals(person.getEmail(), "me@example.com");
  }
View Full Code Here

    Person person = entry.getAuthor();
    assertEquals(person.getEmail(), "me@example.com");
  }
 
  public void testEntryAuthorName() throws Exception {
    Document doc = parse(baseURI.resolve("entry_author_name.xml"));
    Feed feed = (Feed) doc.getRoot();
    Entry entry = feed.getEntries().get(0);
    Person person = entry.getAuthor();
    assertEquals(person.getName(), "Example author");   
  }
View Full Code Here

    Person person = entry.getAuthor();
    assertEquals(person.getName(), "Example author");   
  }
 
  public void testEntryContentBase64() throws Exception {
    Document doc = parse(baseURI.resolve("entry_content_base64.xml"));
    Feed feed = (Feed)doc.getRoot();
    Entry entry = feed.getEntries().get(0);
    Content mediaContent = entry.getContentElement();
    assertEquals(mediaContent.getMimeType().toString(), "application/octet-stream");
    DataHandler dataHandler = mediaContent.getDataHandler();
    InputStream in = (ByteArrayInputStream) dataHandler.getContent();
View Full Code Here

    while ((n = in.read()) > -1) { baos.write(n); }
    assertEquals(baos.toString(), "Example <b>Atom</b>");
  }
 
  public void testEntryContentBase642() throws Exception {
    Document doc = parse(baseURI.resolve("entry_content_base64_2.xml"));
    Feed feed = (Feed)doc.getRoot();
    Entry entry = feed.getEntries().get(0);
    Content mediaContent = entry.getContentElement();
    assertEquals(mediaContent.getMimeType().toString(), "application/octet-stream");
    DataHandler dataHandler = mediaContent.getDataHandler();
    InputStream in = (ByteArrayInputStream) dataHandler.getContent();
View Full Code Here

            MimeType type = new MimeType(request.getContentType());
            String charset = type.getParameter("charset");
            String uri = AppTest.INSTANCE.getBase() + "/collections/entries";
            ParserOptions options = getParser().getDefaultParserOptions();
            options.setCharset(charset);
            Document doc = getParser().parse(request.getInputStream(), uri, options);
            if (doc.getRoot() instanceof Entry) {
              Entry entry = (Entry) doc.getRoot().clone();
              String newID = AppTest.INSTANCE.getBase() + "/collections/entries/" + feed.getRoot().getEntries().size();
              entry.setId(newID);
              entry.setUpdated(new Date());
              entry.addLink(entry.getId().toString(), "edit");
              entry.addLink(entry.getId().toString(), "self");
View Full Code Here

                MimeType type = new MimeType(request.getContentType());
                String charset = type.getParameter("charset");
                String uri = AppTest.INSTANCE.getBase() + "/collections/entries/" + target;
                ParserOptions options = getParser().getDefaultParserOptions();
                options.setCharset(charset);
                Document doc = getParser().parse(request.getInputStream(), uri, options);
                if (doc.getRoot() instanceof Entry) {
                  Entry newentry = (Entry) doc.getRoot().clone();
                  if (newentry.getId().equals(entry.getId())) {
                    newentry.setUpdated(new Date());
                    entry.discard();
                    feed.getRoot().insertEntry(newentry);
                    response.setStatus(HttpServletResponse.SC_NO_CONTENT);
View Full Code Here

                            .getLink("edit-media")
                            .getHref().toString();
      media = entry_doc.getRoot().getContentElement().getSrc().toString();
   
      // edit the entry
      Document doc = response.getDocument();
      entry = (Entry) doc.getRoot().clone();
      entry.setTitle("New title");
    } finally {
      response.release();
    }
View Full Code Here

                            .getLink("edit-media")
                            .getHref().toString();
      media = entry_doc.getRoot().getContentElement().getSrc().toString();
   
      // edit the entry
      Document doc = response.getDocument();
      entry = (Entry) doc.getRoot().clone();
      entry.setTitle("New title");
    } finally {
      response.release();
    }
View Full Code Here

            MimeType type = new MimeType(request.getContentType());
            String charset = type.getParameter("charset");
            String uri = AppTest.INSTANCE.getBase() + "/collections/entries";
            ParserOptions options = getParser().getDefaultParserOptions();
            options.setCharset(charset);
            Document doc = getParser().parse(request.getInputStream(), uri, options);
            if (doc.getRoot() instanceof Entry) {
              Entry entry = (Entry) doc.getRoot().clone();
              String newID = AppTest.INSTANCE.getBase() + "/collections/entries/" + feed.getRoot().getEntries().size();
              entry.setId(newID);
              entry.setUpdated(new Date());
              entry.addLink(entry.getId().toString(), "edit");
              entry.addLink(entry.getId().toString(), "self");
View Full Code Here

TOP

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

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.