Package org.apache.abdera

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


public class XhtmlTest extends TestCase {
  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

    assertEquals(entry.getContentType(), Content.Type.HTML);
  }
 
  public void testSimpleExtension() throws Exception {
    Abdera abdera = new Abdera();
    Entry entry = abdera.newEntry();   
    entry.setDraft(true)// this will create an app:control element
    assertNull(entry.getControl().getSimpleExtension(new QName("urn:foo", "foo")));
  }
 
  public void testLang() throws Exception {
View Full Code Here

    assertNull(entry.getControl().getSimpleExtension(new QName("urn:foo", "foo")));
  }
 
  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.getPrimary(),"en");
View Full Code Here

 
  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

  }
 
  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

   
    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

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.