Package de.nava.informa.impl.basic

Examples of de.nava.informa.impl.basic.ChannelBuilder


  }

  public void testParseBloggerMyLetterOfTheDayCheckItems()
                                                  throws Exception {
    File inpFile = new File(getDataDir(), "atom-1.0-myletteroftheday.xml");
    ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile);

    assertEquals(ChannelFormat.ATOM_1_0, channel.getFormat());
    assertEquals(9, channel.getItems().size());

    existsEntry(channel,
View Full Code Here


                "2006-08-16T21:08:00.000-04:00");
  }

  public void testParsePodcastingExample() throws Exception {
    File inpFile = new File(getDataDir(), "atom-1.0-podcastingexample.xml");
    ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile);

    assertEquals(ChannelFormat.ATOM_1_0, channel.getFormat());

    assertEquals(1, channel.getItems().size());
View Full Code Here

    // clean channel object
    channel = null;
   
    // read in again
    File inpFile = new File(exp_file);
    channel = FeedParser.parse(new ChannelBuilder(), inpFile);

    assertEquals(ch_title, channel.getTitle());
    assertEquals(ch_desc, channel.getDescription());
   
    Collection items = channel.getItems();
View Full Code Here

    this.method_name = name;
  }

  public void testParseW3CSynd() throws Exception {
    File inpFile = new File(getDataDir(), "juancolecom.rss");
    ChannelIF channel_juan = FeedParser.parse(new ChannelBuilder(), inpFile);
    assertEquals("Juan Cole   *  Informed Comment  *", channel_juan.getTitle());
    assertEquals(25, channel_juan.getItems().size());
    // TODO: For the time being RSS 0.92 is handled by the RSS 0.91 parser
    assertEquals(ChannelFormat.RSS_0_91, channel_juan.getFormat());
  }
View Full Code Here

  public TestChannelRegistry(String name) {
    super("TestChannelRegistry", name);
  }

  public void XXXtestCreate() throws Exception {
    ChannelRegistry reg = new ChannelRegistry(new ChannelBuilder());
    // first channel
    File inpFile = new File(getDataDir(), "xmlhack-0.91.xml");
    ChannelIF chA = reg.addChannel(inpFile.toURL(), 2, true);
    Date dateA = chA.getLastUpdated();
    assertNull("channel shouldn't be parsed now", dateA);
View Full Code Here

    assertNotNull("channel should have been updated in the meantime",
                  chA.getLastUpdated());
  }

  public void testParseProblem() throws Exception {
    ChannelRegistry reg = new ChannelRegistry(new ChannelBuilder());
    reg.setAcceptNrOfErrors(1);
    // first channel
    File inpFile = new File(getDataDir(), "xmlhack-0.91.xml");
    File chFile = new File(getOutputDir(), "xmlhack-0.91.xml");
    synchronized(chFile) {
View Full Code Here

            throws IOException, MalformedURLException, ParseException {

        String ch_title = "The Great Demo Channel";
        String ch_desc = "Just a very simple short description.";

        ChannelBuilder builder = new ChannelBuilder();

        // create dummy channel
        ChannelIF channel = new Channel(ch_title);
        channel.setDescription(ch_desc);
        channel.setSite(new URL("http://nava.de"));
        ItemIF itemA = new Item("Bugo", "All about it!",
                new URL("http://nava.de/huhu2002"));
        itemA.setFound(new Date());
        CategoryIF cat1 = builder.createCategory(null, "cat1");
        CategoryIF cat1a = builder.createCategory(cat1, "cat1a");
        builder.createCategory(cat1a, "cat1aa");
        CategoryIF cat1ab = builder.createCategory(cat1a, "cat1ab");
        builder.createCategory(cat1ab, "cat1aba");
        builder.createCategory(cat1ab, "cat1abb");
        builder.createCategory(cat1a, "cat1ac");
        builder.createCategory(cat1, "cat1b");
        CategoryIF cat1c = builder.createCategory(cat1, "cat1c");
        builder.createCategory(cat1c, "cat1ca");
        CategoryIF cat2 = builder.createCategory(null, "cat2");
        itemA.addCategory(cat1);
        itemA.addCategory(cat2);
        assertEquals(2, itemA.getCategories().size());
        channel.addItem(itemA);
        // TODO: what about markup here ???
        ItemIF itemB = new Item("SoCool",
                "????**$12 @??? # <strong>should</strong> work",
                new URL("http://nava.de/very/nested/98"));
        itemB.setFound(new Date());
        CategoryIF catX = builder.createCategory(null, "catX");
        itemB.addCategory(catX);
        assertEquals(1, itemB.getCategories().size());
        channel.addItem(itemB);
        assertEquals(2, channel.getItems().size());
        // export this channel to file (encoding: utf-8)
        String basename = "export-rss20.xml";
        String exp_file = getOutputDir() + FS + basename;
        RSS_2_0_Exporter exporter = new RSS_2_0_Exporter(exp_file);
        exporter.write(channel);

        // clean channel object
        channel = null;

        // read in again
        File inpFile = new File(exp_file);
        channel = FeedParser.parse(new ChannelBuilder(), inpFile);

        assertEquals(ch_title, channel.getTitle());
        assertEquals(ch_desc, channel.getDescription());

        Collection items = channel.getItems();
View Full Code Here

      Hashtable children) {
    // Assuming category hierarchy for each category element
    // is already mapped out into Hashtable tree;  Hense the children Hashtable

    // create channel builder to help create CategoryIF objects
    ChannelBuilder builder = new ChannelBuilder();

    // create current CategoryIF object; Parent may be null if at top level
    CategoryIF cat = builder.createCategory(parent, title);
    // iterate off list of keys from children list
    Enumeration itChild = children.keys();
    while (itChild.hasMoreElements()) {
      String childKey = (String) itChild.nextElement();
      // don't need to keep track of return CategoryIF since it will be added as child of another instance
View Full Code Here

    this.builder = builder;
    this.info = info;

    // builder that is passed in on construction *may* be for persistent Channels.
    // tempBuilder is forced to be memory only so it will not be persisted.
    tempBuilder = new ChannelBuilder();
  }
View Full Code Here

  public void testaddFeed() throws Exception {
    FeedManager FM = new FeedManager();

    File inpFile = new File(getDataDir(), "xmlhack-0.91.xml");
    ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile);
    String url = new Feed(channel).getLocation().toString();
    FeedIF feed = FM.addFeed(url);
    assertEquals(feed, FM.addFeed(url)); // same reference
  }
View Full Code Here

TOP

Related Classes of de.nava.informa.impl.basic.ChannelBuilder

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.