From 78c568331e22829adeb5526c8c61ae5245ee8014 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 29 Dec 2008 12:39:07 +0000 Subject: [PATCH] added test channel to /xml/feed.rss can be obtained with http://localhost:8080/xml/feed.rss?set=TEST returns always a single feed entry with a fresh date git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5416 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/xml/feed.java | 17 +++++++++++++++++ source/de/anomic/xml/RSSFeed.java | 1 + 2 files changed, 18 insertions(+) diff --git a/htroot/xml/feed.java b/htroot/xml/feed.java index 48490c548..0e33475aa 100755 --- a/htroot/xml/feed.java +++ b/htroot/xml/feed.java @@ -26,6 +26,8 @@ package xml; +import java.util.Date; + import de.anomic.http.httpRequestHeader; import de.anomic.plasma.plasmaSwitchboard; import de.anomic.server.serverObjects; @@ -60,6 +62,21 @@ public class feed { // prevent that unauthorized access to this servlet get results from private data if ((!authorized) && (RSSFeed.privateChannels.contains(channels[channelIndex]))) continue channelIteration; // allow only public channels if not authorized + if (channels[channelIndex].equals("TEST")) { + // for interface testing return at least one single result + prop.putXML("channel_title", "YaCy News Testchannel"); + prop.putXML("channel_description", ""); + prop.put("channel_pubDate", (new Date()).toString()); + prop.putXML("item_" + messageCount + "_title", channels[channelIndex] + ": " + "YaCy Test Entry " + (new Date()).toString()); + prop.putXML("item_" + messageCount + "_description", "abcdefg"); + prop.putXML("item_" + messageCount + "_link", "http://yacy.net"); + prop.put("item_" + messageCount + "_pubDate", (new Date()).toString()); + prop.put("item_" + messageCount + "_guid", System.currentTimeMillis()); + messageCount++; + messageMaxCount--; + continue channelIteration; + } + // read the channel feed = RSSFeed.channels(channels[channelIndex]); if ((feed == null) || (feed.size() == 0)) continue channelIteration; diff --git a/source/de/anomic/xml/RSSFeed.java b/source/de/anomic/xml/RSSFeed.java index 7c1ac2808..14d4f2128 100644 --- a/source/de/anomic/xml/RSSFeed.java +++ b/source/de/anomic/xml/RSSFeed.java @@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class RSSFeed implements Iterable { // static channel names of feeds + public static final String TEST = "TEST"; public static final String PEERNEWS = "PEERNEWS"; public static final String REMOTESEARCH = "REMOTESEARCH"; public static final String LOCALSEARCH = "LOCALSEARCH";