Package de.nava.informa.impl.basic

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


  public void testObserve() {
    ChannelIF channel = new Channel("Niko's log");
    SimpleChannelObserver observer = new SimpleChannelObserver();
    ((ChannelObservableIF) channel).addObserver(observer);
    assertEquals(0, channel.getItems().size());
    ItemIF item = new Item("Bongo", "Rongoo", null);
    channel.addItem(item);
    assertEquals(1, channel.getItems().size());
    assertTrue(channel.getItems().contains(item));
    assertEquals(item, observer.getMyAddedItem());
   
View Full Code Here


    assertNotNull(channel_mark.getSite());
    assertEquals("http://diveintomark.org/",channel_mark.getSite().toExternalForm());

    // test link for first item
    java.util.Iterator itemsColl = channel_mark.getItems().iterator();
    Item item = (Item) itemsColl.next();
    assertEquals("http://diveintomark.org/archives/2004/05/12/copy-editor".trim(),item.getLink().toExternalForm());

    assertEquals(ChannelFormat.ATOM_0_3, channel_mark.getFormat());
  }
View Full Code Here

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

    // check each item that for null values
    java.util.Iterator itemsIterator = channel.getItems().iterator();
    while (itemsIterator.hasNext()) {
      Item item = (Item) itemsIterator.next();
      assertNotNull(item.getDate());
      assertNotNull(item.getDescription());
      assertNotNull(item.getLink());
      assertNotNull(item.getTitle());
    }
  }
View Full Code Here

    ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile);
    java.util.Iterator itemsColl = channel.getItems().iterator();
    // skip first entry
    itemsColl.next();
    while( itemsColl.hasNext() ) {
      Item item = (Item) itemsColl.next();
      //System.out.println("TC title :*"+item.getTitle()+"*"+item.getTitle().length());
      assertEquals("History of the <blink> tag",item.getTitle());
    }
    }
View Full Code Here

    ChannelIF feed = FeedParser.parse(new ChannelBuilder(), inpFile);

    Collection items = feed.getItems();
    assertEquals(1, items.size());

    Item item = (Item) items.iterator().next();
    assertEquals("Tilden <b>Hike</b>", item.getTitle());
    assertEquals("A hike in Tilden Park...", item.getDescription());
  }
View Full Code Here

        // 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;
View Full Code Here

   
    // 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());
    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());
    channel.addItem(itemB);
    assertEquals(2, channel.getItems().size());
    // export this channel to file (encoding: utf-8)
    String basename = "export-rss091.xml";
    String exp_file = getOutputDir() + FS + basename;
View Full Code Here

    Date date = ParserUtils.getDate(dateString);
    java.util.Iterator itemsIterator = channel.getItems().iterator();
    boolean found = false;

    while (itemsIterator.hasNext()) {
      Item item = (Item) itemsIterator.next();

      if (item.getDate().equals(date)) {
        found = true;

        if (title != null) {
          assertEquals(title, item.getTitle());
        }

        if (content != null) {
          assertTrue(item.getDescription().indexOf(content) >= 0);
        }

        if (link != null) {
          assertEquals(link, item.getLink().toString());
        }
      }
    }

    assertTrue(found);
View Full Code Here

    // check each item that for null values
    java.util.Iterator itemsIterator = channel.getItems().iterator();

    while (itemsIterator.hasNext()) {
      Item item = (Item) itemsIterator.next();

      assertNotNull(item.getDate());
      assertNotNull(item.getDescription());
      assertNotNull(item.getLink());
      assertNotNull(item.getTitle());
    }
  }
View Full Code Here

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

    assertEquals(1, channel.getItems().size());

    //first item
    Item item = (Item) channel.getItems().toArray()[0];

    assertEquals(item.getTitle(), "Atom 1.0");
    assertEquals(item.getDate(), ParserUtils.getDate("2005-07-15T12:00:00Z"));
    assertTrue(item.getDescription().contains("<h1>Show Notes</h1>"));
    assertTrue(item.getDescription()
                   .contains("<li>00:01:00 -- Introduction</li>"));
    assertTrue(item.getDescription()
                   .contains("<li>00:15:00 -- Talking about Atom 1.0</li>"));
    assertTrue(item.getDescription().contains("<li>00:30:00 -- Wrapping up</li>"));
    assertEquals("http://www.example.org/entries/1", item.getLink().toString());
  }
View Full Code Here

TOP

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

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.