Package de.nava.informa.impl.basic

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


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

  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


    String ch_title = "The Great Demo Channel";
    String ch_desc = "Just a very simple short description.";
   
    // 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;
    ChannelExporterIF exporter = new RSS_0_91_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();
    assertEquals(2, items.size());
    Iterator it = items.iterator();
    ItemIF item = (ItemIF) it.next();
    if (item.equals(itemA)) {
      assertEquals(item, itemA);
View Full Code Here

   
    String ch_title = "The Great Demo Channel";
    String ch_desc = "Just a very simple short description.";
   
    // create dummy channel
    ChannelIF channel = new Channel(ch_title);
    channel.setDescription(ch_desc);
    channel.setSite(new URL("http://nava.de"));
    channel.setLocation(new URL("http://nava.de/news.rdf"));
    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-rss10.xml";
    String exp_file = getOutputDir() + FS + basename;
    ChannelExporterIF exporter = new RSS_1_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();
    assertEquals(2, items.size());
    Iterator it = items.iterator();
    ItemIF item = (ItemIF) it.next();
    if (item.equals(itemA)) {
      assertEquals(item, itemA);
View Full Code Here

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

  protected void setUp() throws MalformedURLException {
    ChannelIF channelA = new Channel("example.org");
    channelId = channelA.getId();
    itemA = new Item("Java 1.5 out", "Long awaited...",
                     new URL("http://example.org/1234"));
    channelA.addItem(itemA);
    ItemIF itemB = new Item("XML virus found", "All about it here.",
                            new URL("http://example.org/2345"));
    channelA.addItem(itemB);
    ItemIF itemC = new Item("Quiet Slashdot", "No news today.",
                            new URL("http://example.org/3456"));
    channelA.addItem(itemC);
    channels = new ChannelGroup("Default");
    channels.add(channelA);
  }
View Full Code Here

        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();
        assertEquals(2, items.size());
        Iterator it = items.iterator();
        ItemIF item = (ItemIF) it.next();
        if (item.equals(itemA)) {
            assertEquals(item, itemA);
View Full Code Here

TOP

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

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.