Examples of Title


Examples of buri.ddmsence.ddms.resource.Title

      Elements components = element.getChildElements(Identifier.getName(version), namespace);
      for (int i = 0; i < components.size(); i++)
        _identifiers.add(new Identifier(components.get(i)));
      components = element.getChildElements(Title.getName(version), namespace);
      for (int i = 0; i < components.size(); i++)
        _titles.add(new Title(components.get(i)));
      components = element.getChildElements(Subtitle.getName(version), namespace);
      for (int i = 0; i < components.size(); i++)
        _subtitles.add(new Subtitle(components.get(i)));
      component = getChild(Description.getName(version));
      if (component != null)
View Full Code Here

Examples of com.cardence.lawshelf.cfr.jaxb.TITLE

    // this.sectionTracker.addNewChildHeadingForParentReference(null, null);
    this.codeCollectionId = collectionModel.getId();
  }

  private void processAndStoreCode() {
    final TITLE title = cfr.getTITLE();
    final CfrCode titleCode = new CfrTitleCodeAdapter(title);
    final CfrCodeModel titleCodeModel = new CfrCodeModel(titleCode);
    titleCodeModel.setCodeCollectionId(this.codeCollectionId);

    this.persistenceHelper.storeCode(titleCodeModel);
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

  @Test
  public void testReadTitle() {
    try {
      reader = XMLInputFactory.newInstance().createXMLStreamReader(
          new StringReader(title1));
      Title title = feedReader.readTitle(reader);
      assertTrue(title.getText().equals(
          "Less: <xhtml:em> &lt; and &amp; </xhtml:em>"));
      assertTrue(title.getAttributes() != null);
      assertTrue(title.getAttributes().size() == 2);
      assertTrue(title.getAttributes().get(1).getName().equals("type"));
      assertTrue(title.getAttributes().get(1).getValue().equals("xhtml"));
      assertTrue(title.getAttributes().get(0).getName().equals(
          "xmlns:xhtml"));
      assertTrue(title.getAttributes().get(0).getValue().equals(
          "http://www.w3.org/1999/xhtml"));

      // test reading html
      reader = XMLInputFactory.newInstance().createXMLStreamReader(
          new StringReader(title1HTML));
      title = feedReader.readTitle(reader);
      assertEquals(title.getText(),
          "Less: &lt;b&gt;Bold Text&lt;/b&gt;  &lt;hr /&gt;");
      assertTrue(title.getAttributes() != null);
      assertTrue(title.getAttributes().size() == 1);
      assertTrue(title.getAttributes().get(0).getName().equals("type"));
      assertTrue(title.getAttributes().get(0).getValue().equals("html"));

    } catch (Exception e) {
      e.printStackTrace();
      fail("could not read title fragment.");
    }
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

          "http://www.colorfulsoftware.com/atom.xml");

      Updated updated = feedDoc.buildUpdated(null, Calendar.getInstance()
          .getTime().toString());

      Title title = feedDoc.buildTitle("test feed", null);

      Generator generator = feedDoc.getLibVersion();

      List<Author> authors = new LinkedList<Author>();
      authors.add(feedDoc.buildAuthor(feedDoc.buildName("Bill Brown"),
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

          "http://www.colorfulsoftware.com/atom.xml");

      Updated updated = feedDoc.buildUpdated(null, Calendar.getInstance()
          .getTime().toString());

      Title title = feedDoc.buildTitle("test feed", null);

      List<Contributor> contributors = new LinkedList<Contributor>();
      Contributor contributor = feedDoc.buildContributor(new Name(
          "Mad Dog"), null, feedDoc.buildEmail("info@maddog.net"),
          null, null);
      contributors.add(contributor);

      Rights rights = feedDoc.buildRights("GPL 1.0", null);

      Icon icon = feedDoc.buildIcon(null, "http://host/images/icon.png");

      Logo logo = feedDoc.buildLogo(null, "http://host/images/logo.png");

      List<Attribute> catAttrs = new LinkedList<Attribute>();
      catAttrs.add(feedDoc.buildAttribute("term", "music"));
      catAttrs.add(feedDoc.buildAttribute("scheme",
          "http://mtv.com/genere"));
      catAttrs.add(feedDoc.buildAttribute("label", "music"));
      List<Category> categories = new LinkedList<Category>();
      Category category = feedDoc.buildCategory(catAttrs, null);
      categories.add(category);

      List<Attribute> linkAttrs = new LinkedList<Attribute>();
      linkAttrs.add(feedDoc
          .buildAttribute("href", "http://www.yahoo.com"));
      linkAttrs.add(feedDoc.buildAttribute("rel", "self"));
      linkAttrs.add(feedDoc.buildAttribute("hreflang", "en-US"));
      List<Link> links = new LinkedList<Link>();
      Link link = feedDoc.buildLink(linkAttrs, null);
      links.add(link);

      Attribute extAttr = feedDoc.buildAttribute("xmlns:xhtml",
          "http://www.w3.org/1999/xhtml");
      List<Attribute> extAttrs = new LinkedList<Attribute>();
      extAttrs.add(extAttr);

      // the base feed attributes.
      List<Attribute> feedAttrs = new LinkedList<Attribute>();
      feedAttrs.add(feedDoc.getAtomBase());
      feedAttrs.add(feedDoc.getLangEn());
      feedAttrs.addAll(extAttrs);

      List<Extension> extensions = new LinkedList<Extension>();
      Extension extension = feedDoc.buildExtension("xhtml:div", null,
          "<span style='color:red;'>hello there</span>");
      extensions.add(extension);

      List<Author> authors = new LinkedList<Author>();
      authors.add(feedDoc.buildAuthor(feedDoc.buildName("Bill Brown"),
          null, null, null, null));
      Entry entry = feedDoc
          .buildEntry(
              feedDoc
                  .buildId(null,
                      "http://www.colorfulsoftware.com/atom.xml#entry1"),
              feedDoc.buildTitle("an example atom entry", null),
              feedDoc.buildUpdated(null, Calendar.getInstance()
                  .getTime().toString()),
              null,
              feedDoc
                  .buildContent(
                      "Hello World.  Welcome to the atomsphere feed builder for atom 1.0 builds.  I hope it is useful for you.",
                      null), authors, null, null, null,
              null, null, null, null, null);

      List<Entry> entries = new LinkedList<Entry>();
      entries.add(entry);

      Feed feed = feedDoc.buildFeed(id, title, updated, rights, authors,
          categories, contributors, links, feedAttrs, extensions,
          generator, null, icon, logo, entries);

      assertNotNull(feed);
      assertNotNull(feed.getAttribute("xml:lang"));
      assertNull(feed.getAttribute("bunk"));

      // read and write a full feed.
      feed = feedDoc.readFeedToBean(mega);
      assertNotNull(feedDoc.getLibVersion());
      BufferedWriter out = new BufferedWriter(new FileWriter(
          "target/mega.xml"));
      out.write(feed.toString());
      out.flush();
      out.close();
      feedDoc.writeFeedDoc(new FileOutputStream(new File(
          "target/mega2.xml")), feed, feedDoc.getEncoding(), feedDoc
          .getXmlVersion());
      assertNotNull(feed.getId());
      assertNull(feed.getGenerator().getAttribute("notHere"));
      assertNotNull(feed.getAuthor("Bill Brown"));
      assertNotNull(feed.getContributor("Bill Brown"));
      assertNotNull(feed.getLink("self"));
      assertNull(feed.getLink("self").getContent());
      assertNull(feed.getLink(null));
      assertNotNull(feed.getId().getAttribute("local:something"));
      assertNull(feed.getId().getAttribute("bunk"));
      assertNull(feed.getCategory("math").getAttribute("anythingWrong"));
      assertNull(feed.getCategory("math").getContent());
      assertNotNull(feed.getIcon().getAttribute("local:testAttr"));
      assertNotNull(feed.getLogo().getAttribute("local:testAttr"));
      assertNotNull(feed.getRights().getAttribute("xmlns"));
      assertNull(feed.getRights().getAttribute("sayWhat"));
      assertNotNull(feed.getUpdated().getDateTime());
      assertNull(feed.getSubtitle().getAttribute("sayWhat"));

      // sort the entries:
      feed = feedDoc.sortEntries(feed, Summary.class, "asc");
      feed = feedDoc.sortEntries(feed, Title.class, "desc");
      feed = feedDoc.sortEntries(feed, Updated.class, "asc");
      // this wont sort anything.
      try {
        feed = feedDoc.sortEntries(feed, Author.class, "asc");
        fail("should not get here.");
      } catch (AtomSpecException e) {
        assertEquals(e.getMessage(),
            "The feed entries cannot be sorted by an invalid type 'Author'.");
      }

      XMLStreamWriter writer = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/dump1.xml"));
      feedDoc.writeFeedDoc(writer, feed, null, null);

      int fileName = 1;
      for (Entry ent : feed.getEntries()) {
        out = new BufferedWriter(new FileWriter("target/"
            + (fileName++) + ".xml"));
        out.write(ent.toString());
        out.flush();
        out.close();
        if (ent
            .getId()
            .getAtomUri()
            .equals(
                "http://colorfulsoftware.localhost/colorfulsoftware/projects/atomsphere/atom.xml#About")) {
          Author auth = ent.getAuthor("Bill Brown");
          assertNotNull(ent.getAttribute("xmlns"));
          assertNotNull(auth);
          assertNotNull(auth.getAttribute("local:testAttr"));
          Attribute attr1 = auth.getAttribute("local:testAttr");
          assertFalse(attr1.equals(auth.getAttribute("local:blank")));
          assertNull(auth.getAttribute("local:blank"));
          assertNotNull(auth.getExtension("test:test"));
          assertNull(auth.getExtension("local:bunky"));
          assertNull(ent.getAuthor("some other dude"));
          assertNotNull(ent.getContributor("Bill Brown"));
          assertNull(ent.getContributor("some other dude"));
          assertNotNull(ent.getCategory("science"));
          assertNull(ent.getCategory("nothing"));
          assertNotNull(ent.getLink("alternate"));
          assertNull(ent.getLink("http://www.fakeness.net"));
          assertNotNull(ent.getExtension("local:element"));
          assertNull(ent.getExtension("local:notthere"));
          assertNotNull(ent.getPublished().getAttribute("xmlns"));
          assertNotNull(ent.getPublished().getDateTime());
          assertNull(ent.getSummary().getAttribute("sayWhat"));

          Contributor cont = ent.getContributor("Bill Brown");
          assertNotNull(cont);
          assertNotNull(cont.getExtension("test:test"));
          assertNotNull(cont.getAttribute("local:testAttr"));
          attr1 = cont.getAttribute("local:testAttr");
          assertFalse(attr1.equals(auth.getAttribute("local:blank")));
          assertNull(auth.getAttribute("local:blank"));
          assertNotNull(auth.getExtension("test:test"));
          assertNull(auth.getExtension("local:bunky"));
          assertNull(ent.getAuthor("some other dude"));
          assertNotNull(ent.getContributor("Bill Brown"));
          assertNull(ent.getContributor("some other dude"));
          assertNotNull(ent.getCategory("science"));
          assertNull(ent.getCategory("nothing"));
          assertNotNull(ent.getLink("alternate"));
          assertNull(ent.getLink("http://www.fakeness.net"));
          assertNotNull(ent.getExtension("local:element"));
          assertNull(ent.getExtension("local:notthere"));
        }

        // test the source attribute
        if (ent.getSource() != null) {
          Source source = ent.getSource();
          assertNotNull(source.getAttribute("xmlns:sort"));
          assertNotNull(source.getAuthor("The Minority Directory"));
          assertNotNull(source.getContributor("The People"));
          assertNotNull(source.getCategory("purpose"));
          assertNotNull(source.getLink("self"));
          assertNotNull(source.getExtension("sort:asc"));
        }
      }

      // re read the written feed and check the data.
      feed = feedDoc.readFeedToBean(new File("target/dump1.xml"));

      assertNotNull(feed);
      assertNotNull(feed.getCategories());
      List<Category> cats = feed.getCategories();
      for (Category cat : cats) {
        assertNotNull(cat.getTerm());
        if (!cat.getTerm().getValue().equals("thing")
            && !cat.getTerm().getValue().equals("undefined")) {
          assertNotNull(cat.getLabel());
          assertNotNull(cat.getScheme());
        }
      }

      List<Link> lnks = feed.getLinks();
      for (Link lnk : lnks) {
        assertNotNull(lnk.getHref());
        assertNotNull(lnk.getHreflang());
        assertNotNull(lnk.getTitle());
        assertNotNull(lnk.getType());
        assertNotNull(lnk.getRel());
      }

    } catch (Exception e) {
      e.printStackTrace();
      fail("Issue building feed doc.");
    }

    // test a plain attribute
    try {
      feedDoc.buildAttribute(null, "null");
      fail("should not get here.");
    } catch (Exception e) {
      assertTrue(e instanceof AtomSpecException);
      assertEquals(e.getMessage(), "Attribute names SHOULD NOT be blank.");
    }

    Id id = null;
    Title title = null;
    Updated updated = null;
    List<Entry> entries = null;
    try {
      id = feedDoc.buildId(null, "http://www.test.com");
      title = feedDoc.buildTitle("title", null);
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

  public void testGetContentType() {
    try {
      List<Attribute> attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "image/gif"));

      Title title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.OTHER);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "text"));
      title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.TEXT);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "html"));
      title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.HTML);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "xhtml"));
      title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.XHTML);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("src",
          "http://www.colorfulsoftware.com/images/logo.gif"));
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

  @Test
  public void testReadTitle() {
    try {
      reader = XMLInputFactory.newInstance().createXMLStreamReader(
          new StringReader(title1));
      Title title = feedReader.readTitle(reader);
      assertTrue(title.getText().equals(
          "Less: <xhtml:em> &lt; and &amp; </xhtml:em>"));
      assertTrue(title.getAttributes() != null);
      assertTrue(title.getAttributes().size() == 2);
      assertTrue(title.getAttributes().get(1).getName().equals("type"));
      assertTrue(title.getAttributes().get(1).getValue().equals("xhtml"));
      assertTrue(title.getAttributes().get(0).getName().equals(
          "xmlns:xhtml"));
      assertTrue(title.getAttributes().get(0).getValue().equals(
          "http://www.w3.org/1999/xhtml"));

      // test reading html
      reader = XMLInputFactory.newInstance().createXMLStreamReader(
          new StringReader(title1HTML));
      title = feedReader.readTitle(reader);
      assertEquals(title.getText(),
          "Less: &lt;b&gt;Bold Text&lt;/b&gt;  &lt;hr /&gt;");
      assertTrue(title.getAttributes() != null);
      assertTrue(title.getAttributes().size() == 1);
      assertTrue(title.getAttributes().get(0).getName().equals("type"));
      assertTrue(title.getAttributes().get(0).getValue().equals("html"));

    } catch (Exception e) {
      e.printStackTrace();
      fail("could not read title fragment.");
    }
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

          "http://www.colorfulsoftware.com/atom.xml");

      Updated updated = feedDoc.buildUpdated(null, Calendar.getInstance()
          .getTime().toString());

      Title title = feedDoc.buildTitle("test feed", null);

      Generator generator = feedDoc.getLibVersion();

      List<Author> authors = new LinkedList<Author>();
      authors.add(feedDoc.buildAuthor(feedDoc.buildName("Bill Brown"),
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

          "http://www.colorfulsoftware.com/atom.xml");

      Updated updated = feedDoc.buildUpdated(null, Calendar.getInstance()
          .getTime().toString());

      Title title = feedDoc.buildTitle("test feed", null);

      List<Contributor> contributors = new LinkedList<Contributor>();
      Contributor contributor = feedDoc.buildContributor(new Name(
          "Mad Dog"), null, feedDoc.buildEmail("info@maddog.net"),
          null, null);
      contributors.add(contributor);

      Rights rights = feedDoc.buildRights("GPL 1.0", null);

      Icon icon = feedDoc.buildIcon(null, "http://host/images/icon.png");

      Logo logo = feedDoc.buildLogo(null, "http://host/images/logo.png");

      List<Attribute> catAttrs = new LinkedList<Attribute>();
      catAttrs.add(feedDoc.buildAttribute("term", "music"));
      catAttrs.add(feedDoc.buildAttribute("scheme",
          "http://mtv.com/genere"));
      catAttrs.add(feedDoc.buildAttribute("label", "music"));
      List<Category> categories = new LinkedList<Category>();
      Category category = feedDoc.buildCategory(catAttrs, null);
      categories.add(category);

      List<Attribute> linkAttrs = new LinkedList<Attribute>();
      linkAttrs.add(feedDoc
          .buildAttribute("href", "http://www.yahoo.com"));
      linkAttrs.add(feedDoc.buildAttribute("rel", "self"));
      linkAttrs.add(feedDoc.buildAttribute("hreflang", "en-US"));
      List<Link> links = new LinkedList<Link>();
      Link link = feedDoc.buildLink(linkAttrs, null);
      links.add(link);

      Attribute extAttr = feedDoc.buildAttribute("xmlns:xhtml",
          "http://www.w3.org/1999/xhtml");
      List<Attribute> extAttrs = new LinkedList<Attribute>();
      extAttrs.add(extAttr);

      // the base feed attributes.
      List<Attribute> feedAttrs = new LinkedList<Attribute>();
      feedAttrs.add(feedDoc.getAtomBase());
      feedAttrs.add(feedDoc.getLangEn());
      feedAttrs.addAll(extAttrs);

      List<Extension> extensions = new LinkedList<Extension>();
      Extension extension = feedDoc.buildExtension("xhtml:div", null,
          "<span style='color:red;'>hello there</span>");
      extensions.add(extension);

      List<Author> authors = new LinkedList<Author>();
      authors.add(feedDoc.buildAuthor(feedDoc.buildName("Bill Brown"),
          null, null, null, null));
      Entry entry = feedDoc
          .buildEntry(
              feedDoc
                  .buildId(null,
                      "http://www.colorfulsoftware.com/atom.xml#entry1"),
              feedDoc.buildTitle("an example atom entry", null),
              feedDoc.buildUpdated(null, Calendar.getInstance()
                  .getTime().toString()),
              null,
              feedDoc
                  .buildContent(
                      "Hello World.  Welcome to the atomsphere feed builder for atom 1.0 builds.  I hope it is useful for you.",
                      null), authors, null, null, null,
              null, null, null, null, null);

      List<Entry> entries = new LinkedList<Entry>();
      entries.add(entry);

      Feed feed = feedDoc.buildFeed(id, title, updated, rights, authors,
          categories, contributors, links, feedAttrs, extensions,
          generator, null, icon, logo, entries);

      assertNotNull(feed);
      assertNotNull(feed.getAttribute("xml:lang"));
      assertNull(feed.getAttribute("bunk"));

      // read and write a full feed.
      feed = feedDoc.readFeedToBean(mega);
      assertNotNull(feedDoc.getLibVersion());
      BufferedWriter out = new BufferedWriter(new FileWriter(
          "target/mega.xml"));
      out.write(feed.toString());
      out.flush();
      out.close();
      feedDoc.writeFeedDoc(new FileOutputStream(new File(
          "target/mega2.xml")), feed, feedDoc.getEncoding(), feedDoc
          .getXmlVersion());
      assertNotNull(feed.getId());
      assertNull(feed.getGenerator().getAttribute("notHere"));
      assertNotNull(feed.getAuthor("Bill Brown"));
      assertNotNull(feed.getContributor("Bill Brown"));
      assertNotNull(feed.getLink("self"));
      assertNull(feed.getLink("self").getContent());
      assertNull(feed.getLink(null));
      assertNotNull(feed.getId().getAttribute("local:something"));
      assertNull(feed.getId().getAttribute("bunk"));
      assertNull(feed.getCategory("math").getAttribute("anythingWrong"));
      assertNull(feed.getCategory("math").getContent());
      assertNotNull(feed.getIcon().getAttribute("local:testAttr"));
      assertNotNull(feed.getLogo().getAttribute("local:testAttr"));
      assertNotNull(feed.getRights().getAttribute("xmlns"));
      assertNull(feed.getRights().getAttribute("sayWhat"));
      assertNotNull(feed.getUpdated().getDateTime());
      assertNull(feed.getSubtitle().getAttribute("sayWhat"));

      // sort the entries:
      feed = feedDoc.sortEntries(feed, Summary.class, "asc");
      feed = feedDoc.sortEntries(feed, Title.class, "desc");
      feed = feedDoc.sortEntries(feed, Updated.class, "asc");
      // this wont sort anything.
      try {
        feed = feedDoc.sortEntries(feed, Author.class, "asc");
        fail("should not get here.");
      } catch (AtomSpecException e) {
        assertEquals(e.getMessage(),
            "The feed entries cannot be sorted by an invalid type 'Author'.");
      }

      XMLStreamWriter writer = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/dump1.xml"));
      feedDoc.writeFeedDoc(writer, feed, null, null);

      int fileName = 1;
      for (Entry ent : feed.getEntries()) {
        out = new BufferedWriter(new FileWriter("target/"
            + (fileName++) + ".xml"));
        out.write(ent.toString());
        out.flush();
        out.close();
        if (ent
            .getId()
            .getAtomUri()
            .equals(
                "http://colorfulsoftware.localhost/colorfulsoftware/projects/atomsphere/atom.xml#About")) {
          Author auth = ent.getAuthor("Bill Brown");
          assertNotNull(ent.getAttribute("xmlns"));
          assertNotNull(auth);
          assertNotNull(auth.getAttribute("local:testAttr"));
          Attribute attr1 = auth.getAttribute("local:testAttr");
          assertFalse(attr1.equals(auth.getAttribute("local:blank")));
          assertNull(auth.getAttribute("local:blank"));
          assertNotNull(auth.getExtension("test:test"));
          assertNull(auth.getExtension("local:bunky"));
          assertNull(ent.getAuthor("some other dude"));
          assertNotNull(ent.getContributor("Bill Brown"));
          assertNull(ent.getContributor("some other dude"));
          assertNotNull(ent.getCategory("science"));
          assertNull(ent.getCategory("nothing"));
          assertNotNull(ent.getLink("alternate"));
          assertNull(ent.getLink("http://www.fakeness.net"));
          assertNotNull(ent.getExtension("local:element"));
          assertNull(ent.getExtension("local:notthere"));
          assertNotNull(ent.getPublished().getAttribute("xmlns"));
          assertNotNull(ent.getPublished().getDateTime());
          assertNull(ent.getSummary().getAttribute("sayWhat"));

          Contributor cont = ent.getContributor("Bill Brown");
          assertNotNull(cont);
          assertNotNull(cont.getExtension("test:test"));
          assertNotNull(cont.getAttribute("local:testAttr"));
          attr1 = cont.getAttribute("local:testAttr");
          assertFalse(attr1.equals(auth.getAttribute("local:blank")));
          assertNull(auth.getAttribute("local:blank"));
          assertNotNull(auth.getExtension("test:test"));
          assertNull(auth.getExtension("local:bunky"));
          assertNull(ent.getAuthor("some other dude"));
          assertNotNull(ent.getContributor("Bill Brown"));
          assertNull(ent.getContributor("some other dude"));
          assertNotNull(ent.getCategory("science"));
          assertNull(ent.getCategory("nothing"));
          assertNotNull(ent.getLink("alternate"));
          assertNull(ent.getLink("http://www.fakeness.net"));
          assertNotNull(ent.getExtension("local:element"));
          assertNull(ent.getExtension("local:notthere"));
        }

        // test the source attribute
        if (ent.getSource() != null) {
          Source source = ent.getSource();
          assertNotNull(source.getAttribute("xmlns:sort"));
          assertNotNull(source.getAuthor("The Minority Directory"));
          assertNotNull(source.getContributor("The People"));
          assertNotNull(source.getCategory("purpose"));
          assertNotNull(source.getLink("self"));
          assertNotNull(source.getExtension("sort:asc"));
        }
      }

      // re read the written feed and check the data.
      feed = feedDoc.readFeedToBean(new File("target/dump1.xml"));

      assertNotNull(feed);
      assertNotNull(feed.getCategories());
      List<Category> cats = feed.getCategories();
      for (Category cat : cats) {
        assertNotNull(cat.getTerm());
        if (!cat.getTerm().getValue().equals("thing")
            && !cat.getTerm().getValue().equals("undefined")) {
          assertNotNull(cat.getLabel());
          assertNotNull(cat.getScheme());
        }
      }

      List<Link> lnks = feed.getLinks();
      for (Link lnk : lnks) {
        assertNotNull(lnk.getHref());
        assertNotNull(lnk.getHreflang());
        assertNotNull(lnk.getTitle());
        assertNotNull(lnk.getType());
        assertNotNull(lnk.getRel());
      }

    } catch (Exception e) {
      e.printStackTrace();
      fail("Issue building feed doc.");
    }

    // test a plain attribute
    try {
      feedDoc.buildAttribute(null, "null");
      fail("should not get here.");
    } catch (Exception e) {
      assertTrue(e instanceof AtomSpecException);
      assertEquals(e.getMessage(), "Attribute names SHOULD NOT be blank.");
    }

    Id id = null;
    Title title = null;
    Updated updated = null;
    List<Entry> entries = null;
    try {
      id = feedDoc.buildId(null, "http://www.test.com");
      title = feedDoc.buildTitle("title", null);
View Full Code Here

Examples of com.colorfulsoftware.atom.Title

  public void testGetContentType() {
    try {
      List<Attribute> attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "image/gif"));

      Title title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.OTHER);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "text"));
      title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.TEXT);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "html"));
      title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.HTML);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("type", "xhtml"));
      title = feedDoc.buildTitle(null, attrs);
      assertEquals(title.getContentType(),
          AtomTextConstruct.ContentType.XHTML);

      attrs = new LinkedList<Attribute>();
      attrs.add(feedDoc.buildAttribute("src",
          "http://www.colorfulsoftware.com/images/logo.gif"));
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.