Package org.apache.abdera.model

Examples of org.apache.abdera.model.IRI


    Person person = feed.getAuthor();
    assertNotNull(person);
    assertEquals(person.getName(), "John Doe");
    assertNull(person.getEmail());
    assertNull(person.getUri());
    IRI id = feed.getIdElement();
    assertNotNull(id);
    assertEquals(id.getValue(), new URI("urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"));
    List<Entry> entries = feed.getEntries();
    assertEquals(entries.size(), 1);
    for (Entry entry : entries) {
      title = entry.getTitleElement();
      assertNotNull(title);
      assertEquals(title.getTextType(), Text.Type.TEXT);
      value = title.getValue();
      assertEquals(value, "Atom-Powered Robots Run Amok");
      links = entry.getLinks();
      assertEquals(1, links.size());
      for (Link link : links) {
        assertNull(link.getRel()); // it's an alternate link
        assertEquals(link.getHref(), new URI("http://example.org/2003/12/13/atom03"));
        assertNull(link.getHrefLang());
        assertNull(link.getMimeType());
        assertNull(link.getTitle());
        assertEquals(link.getLength(),-1);
      }
      links = entry.getLinks(Link.REL_ALTERNATE);
      assertEquals(links.size(),1);
      links = entry.getLinks(Link.REL_RELATED);
      assertEquals(links.size(),0);
      id = entry.getIdElement();
      assertNotNull(id);
      assertEquals(id.getValue(), new URI("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
      assertNotNull(entry.getUpdatedElement());
      dte = entry.getUpdatedElement();
      dt = dte.getValue();
      assertNotNull(dt);
      c = dt.getCalendar();
View Full Code Here


    Feed feed = doc.getRoot();
    assertNotNull(feed);
    List<Entry> entries = feed.getEntries();
    assertNotNull(entries);
    for (Entry entry : entries) {
      IRI id = entry.getIdElement();
      assertNotNull(id);
      try {
        id.getValue();
      } catch (Exception e) {
        assertTrue(e instanceof URISyntaxException);
      }
    }
  }
View Full Code Here

    assertEquals(text.getQName(), Constants.TITLE);
    text = factory.newTitle(Text.Type.HTML);
    text.setValue("a");
    assertEquals(text.getValue(), "a");
    assertEquals(text.getTextType(), Text.Type.HTML);
    IRI iri = factory.newIcon();
    assertNotNull(iri);
    iri = factory.newIcon();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newIcon();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newID();
    assertNotNull(iri);
    iri = factory.newID();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newID();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newIRIElement(Constants.ID, null);
    assertNotNull(iri);
    iri = factory.newIRIElement(Constants.ID, null);
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newIRIElement(Constants.ID, null);
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    Link link = factory.newLink();
    assertNotNull(link);
    link = factory.newLink();
    link.setHref("http://example.org/foo");
    link.setRel("a");
    link.setMimeType("text/foo");
    link.setTitle("b");
    link.setHrefLang("en");
    link.setLength(10);
    assertEquals(link.getHref().toString(), "http://example.org/foo");
    assertEquals(link.getRel(), "a");
    assertEquals(link.getMimeType().toString(), "text/foo");
    assertEquals(link.getTitle(), "b");
    assertEquals(link.getHrefLang(), "en");
    assertEquals(link.getLength(), 10);
    link = factory.newLink();
    link.setHref("http://example.org/foo");
    link.setRel("a");
    link.setMimeType("text/foo");
    link.setTitle("b");
    link.setHrefLang("en");
    link.setLength(10);
    assertEquals(link.getHref().toString(), "http://example.org/foo");
    assertEquals(link.getRel(), "a");
    assertEquals(link.getMimeType().toString(), "text/foo");
    assertEquals(link.getTitle(), "b");
    assertEquals(link.getHrefLang(), "en");
    assertEquals(link.getLength(), 10);
    iri = factory.newLogo();
    assertNotNull(iri);
    iri = factory.newLogo();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newLogo();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    content = factory.newContent(new MimeType("text/foo"));
    content.setSrc("foo");
    assertNotNull(content);
    assertEquals(content.getMimeType().toString(), "text/foo");
    assertEquals(content.getSrc().toString(), "foo");
    content = factory.newContent(new MimeType("text/foo"));
    content.setDataHandler(new DataHandler(new ByteArrayDataSource("foo".getBytes())));
    assertEquals(content.getValue(), "Zm9v");
    assertEquals(content.getContentType(), Content.Type.MEDIA);
    el = factory.newName();
    assertNotNull(el);
    el = factory.newName();
    el.setText("a");
    assertEquals(el.getText(), "a");
    Parser parser = factory.newParser();
    assertNotNull(parser);
    Person person = factory.newPerson(Constants.AUTHOR, null);
    assertNotNull(person);
    assertEquals(person.getQName(), Constants.AUTHOR);
    person = factory.newPerson(Constants.AUTHOR, null);
    person.setName("a");
    person.setEmail("b");
    person.setUri("c");
    assertEquals(person.getName(),"a");
    assertEquals(person.getEmail(), "b");
    assertEquals(person.getUri().toString(), "c");
    person = factory.newPerson(Constants.AUTHOR, null);
    person.setName("a");
    person.setEmail("b");
    person.setUri("c");
    assertEquals(person.getName(),"a");
    assertEquals(person.getEmail(), "b");
    assertEquals(person.getUri().toString(), "c");
    now = new Date();
    dateTime = factory.newPublished();
    dateTime.setValue(AtomDate.valueOf(now));
    assertEquals(dateTime.getDate(), now);
    cal = Calendar.getInstance();
    dateTime = factory.newPublished();
    dateTime.setCalendar(cal);
    assertEquals(dateTime.getCalendar(), cal);
    dateTime = factory.newPublished();
    dateTime.setDate(now);
    assertEquals(dateTime.getDate(), now);
    dateTime = factory.newPublished();
    assertNotNull(dateTime);
    dateTime = factory.newPublished();
    dateTime.setTime(now.getTime());
    assertEquals(dateTime.getTime(), now.getTime());
    dateTime = factory.newPublished();
    dateTime.setString(AtomDate.format(now));
    assertEquals(dateTime.getString(), AtomDate.format(now));
    assertEquals(dateTime.getDate(), now);
    Service service = factory.newService();
    assertNotNull(service);
    Source source = factory.newSource();
    assertNotNull(source);
    el = factory.newElement(Constants.NAME);
    assertNotNull(el);
    assertEquals(el.getQName(), Constants.NAME);
    el = factory.newElement(Constants.NAME);
    el.setText("a");
    assertNotNull(el);
    assertEquals(el.getQName(), Constants.NAME);
    assertEquals(el.getText(), "a");
    text = factory.newText(Constants.TITLE, Text.Type.TEXT);
    assertNotNull(text);
    assertEquals(text.getTextType(), Text.Type.TEXT);
    text = factory.newRights();
    text.setValue("a");
    assertEquals(text.getValue(), "a");
    assertEquals(text.getTextType(), Text.Type.TEXT);
    text = factory.newSubtitle();
    text.setValue("a");
    assertEquals(text.getValue(), "a");
    assertEquals(text.getTextType(), Text.Type.TEXT);
    text = factory.newSummary();
    text.setValue("a");
    assertEquals(text.getValue(), "a");
    assertEquals(text.getTextType(), Text.Type.TEXT);
    text = factory.newText(Constants.TITLE, Text.Type.TEXT,null);
    text.setValue("a");
    assertEquals(text.getQName(), Constants.TITLE);
    assertEquals(text.getValue(), "a");
    assertEquals(text.getTextType(), Text.Type.TEXT);
    text = factory.newTitle();
    text.setValue("a");
    assertEquals(text.getValue(), "a");
    assertEquals(text.getTextType(), Text.Type.TEXT);
    content = factory.newContent(Content.Type.TEXT);
    content.setValue("a");
    assertEquals(content.getValue(), "a");
    assertEquals(content.getContentType(), Content.Type.TEXT);
    now = new Date();
    dateTime = factory.newUpdated();
    dateTime.setValue(AtomDate.valueOf(now));
    assertEquals(dateTime.getDate(), now);
    cal = Calendar.getInstance();
    dateTime = factory.newUpdated();
    dateTime.setCalendar(cal);
    assertEquals(dateTime.getCalendar(), cal);
    dateTime = factory.newUpdated();
    dateTime.setDate(now);
    assertEquals(dateTime.getDate(), now);
    dateTime = factory.newUpdated();
    assertNotNull(dateTime);
    dateTime = factory.newUpdated();
    dateTime.setTime(now.getTime());
    assertEquals(dateTime.getTime(), now.getTime());
    dateTime = factory.newUpdated();
    dateTime.setString(AtomDate.format(now));
    assertEquals(dateTime.getString(), AtomDate.format(now));
    assertEquals(dateTime.getDate(), now);
    iri = factory.newUri();
    assertNotNull(iri);
    iri = factory.newUri();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newUri();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    Workspace workspace = factory.newWorkspace();
    assertNotNull(workspace);
    div = factory.newDiv();
    content = factory.newContent(Content.Type.XHTML);
    content.setValueElement(div);
View Full Code Here

    else
      _removeChildren(ID, false);
  }

  public URI getId() throws URISyntaxException {
    IRI id = getIdElement();
    return (id != null) ? id.getValue() : null;
  }
View Full Code Here

  public IRI setId(String value, boolean normalize) throws URISyntaxException {
    if (value == null) {
      _removeChildren(ID, false);
      return null;
    }
    IRI id = getIdElement();
    if (id != null) {
      if (normalize) id.setNormalizedValue(value);
      else id.setValue(value);
      return id;
    } else {
      FOMFactory fomfactory = (FOMFactory) factory;
      IRI iri = fomfactory.newID(this);
      iri.setValue((normalize) ? URIHelper.normalize(value) : value);
      return iri;
    }
  }
View Full Code Here

    else
      _removeChildren(ID, false);
  }

  public URI getId() throws URISyntaxException {
    IRI id = getIdElement();
    return (id != null) ? id.getValue() : null;
  }
View Full Code Here

  public IRI setId(String value, boolean normalize) throws URISyntaxException {
    if (value == null) {
      _removeChildren(ID, false);
      return null;
    }
    IRI id = getIdElement();
    if (id != null) {
      if (normalize) id.setNormalizedValue(value);
      else id.setValue(value);
      return id;
    } else {
      FOMFactory fomfactory = (FOMFactory) factory;
      IRI iri = fomfactory.newID(this);
      iri.setValue((normalize) ? URIHelper.normalize(value) : value);
      return iri;
    }
  }
View Full Code Here

    if (value == null) {
      _removeChildren(ICON, false);
      return null;
    }
    FOMFactory fomfactory = (FOMFactory) factory;
    IRI iri = fomfactory.newIcon(this);
    iri.setValue(value);
    return iri;
  }
View Full Code Here

    iri.setValue(value);
    return iri;
  }
 
  public URI getIcon() throws URISyntaxException {
    IRI iri = getIconElement();
    return (iri != null) ? iri.getValue() : null;
  }
View Full Code Here

    if (value == null) {
      _removeChildren(LOGO, false);
      return null;
    }
    FOMFactory fomfactory = (FOMFactory) factory;
    IRI iri = fomfactory.newLogo(this);
    iri.setValue(value);
    return iri;
  }
View Full Code Here

TOP

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

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.