Package org.apache.abdera

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


  }
 
  @Test
  public void testLang() throws Exception {
    Abdera abdera = new Abdera();
    Entry entry = abdera.newEntry();
    entry.setLanguage("en-US");
    assertEquals(entry.getLanguage(),"en-US");
    Lang lang = entry.getLanguageTag();
    assertNotNull(lang);
    assertEquals(lang.getLanguage().getName(),"en");
View Full Code Here


  @Test
  public void testSetContent() throws Exception {
   
    Abdera abdera = new Abdera();
   
    Entry entry = abdera.newEntry();
    Document<Element> foodoc = abdera.getParser().parse(
      new ByteArrayInputStream("<a><b><c/></b></a>".getBytes()));
    Element foo = foodoc.getRoot();
    entry.setContent(foo, "application/foo+xml");
    assertEquals(entry.getContentElement().getValueElement(),foo);
View Full Code Here

 
  @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();
View Full Code Here

   
    assertNotNull(LicenseHelper.addUnspecifiedLicense(entry));

    assertFalse(LicenseHelper.hasLicense(entry, license, true));
   
    entry = abdera.newEntry();
    entry.setSource(feed.getAsSource());
   
    assertFalse(LicenseHelper.hasLicense(entry, license, false));
    assertTrue(LicenseHelper.hasLicense(entry, license, true));
   
View Full Code Here

    assertEquals(BidiHelper.getDirection(feed.getTitleElement()), Direction.RTL);
    assertEquals(BidiHelper.getDirection(feed.getSubtitleElement()), Direction.LTR);
    assertEquals(BidiHelper.getBidiElementText(feed.getTitleElement()), BidiHelper.getBidiText(Direction.RTL, "Testing"));
    assertEquals(BidiHelper.getBidiElementText(feed.getSubtitleElement()), BidiHelper.getBidiText(Direction.LTR, "Testing"));
   
    Entry entry = abdera.newEntry();
    entry.setLanguage("az-arab");
    assertEquals(BidiHelper.guessDirectionFromLanguage(entry), Direction.RTL);
   
    entry.setLanguage("az-latn");
    assertEquals(BidiHelper.guessDirectionFromLanguage(entry), Direction.UNSPECIFIED);
View Full Code Here

   
    assertFalse(LicenseHelper.hasLicense(entry, license, false));
    assertTrue(LicenseHelper.hasLicense(entry, license, true));
   
    boolean died = false;
    entry = abdera.newEntry();
    LicenseHelper.addLicense(entry, license);
    try {
      // will die because the license already exists
      LicenseHelper.addLicense(entry, license);
    } catch(IllegalStateException e) {
View Full Code Here

      died = true;
    }
    assertTrue(died);
   
    died = false;
    entry = abdera.newEntry();
    LicenseHelper.addUnspecifiedLicense(entry);
    try {
      // will die because the unspecified license already exists
      LicenseHelper.addLicense(entry, license);
    } catch (IllegalStateException e) {
View Full Code Here

      died = true;
    }
    assertTrue(died);
   
    died = false;
    entry = abdera.newEntry();
    LicenseHelper.addUnspecifiedLicense(entry);
    try {
      // will die because the unspecified license already exists
      LicenseHelper.addUnspecifiedLicense(entry);
    } catch (IllegalStateException e) {
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(entry.getContentType(), Content.Type.XHTML);
    Element el = entry.getContentElement().getValueElement();
    assertTrue(el instanceof Div);
View Full Code Here

    assertNotNull(entry.getContent());
    assertEquals(entry.getContentType(), Content.Type.XHTML);
    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(entry.getContentType(), Content.Type.XML);
    assertNotNull(entry.getContentElement().getValueElement());
   
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.