commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bur...@apache.org
Subject cvs commit: jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test TestProbeLocator.java
Date Thu, 23 Sep 2004 01:51:26 GMT
burton      2004/09/22 18:51:26

  Modified:    feedparser/src/java/org/apache/commons/feedparser/test
                        TestProbeLocator.java
  Log:
  ...
  
  Revision  Changes    Path
  1.5       +490 -1290 jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test/TestProbeLocator.java
  
  Index: TestProbeLocator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test/TestProbeLocator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestProbeLocator.java	5 Sep 2004 22:01:33 -0000	1.4
  +++ TestProbeLocator.java	23 Sep 2004 01:51:26 -0000	1.5
  @@ -31,1351 +31,551 @@
    * @version $Id$
    */
   public class TestProbeLocator extends TestCase {
  -
  -    public TestProbeLocator( String name ) throws Exception {
  -        super( name );
  +    public static boolean NO_ATOM_FEED = false;
  +    public static boolean HAS_ATOM_FEED = true;
  +    
  +    public static boolean NO_RSS_FEED = false;
  +    public static boolean HAS_RSS_FEED = true;
  +    
  +    public TestProbeLocator(String name) throws Exception {
  +        super(name);
           ProbeLocator.AGGRESIVE_PROBING_ENABLED = true;
           ProbeLocator.BLOG_SERVICE_PROBING_ENABLED = true;
  +    }
  +    
  +    public static void main( String[] args ) throws Exception {
  +        TestProbeLocator test = new TestProbeLocator( null );
   
  +        test.testBlogger();
  +        test.testLiveJournal();
  +        test.testDiaryLand();
  +        test.testMovableType();
  +        test.testXanga();
  +        test.testWordPress();
  +        test.testAOLJournal();
  +        test.testTypePad();
  +        test.testGreyMatter();
  +        test.testPMachine();
  +        test.testBlosxom();
  +        test.testRadioUserland();
  +        test.testTextPattern();
  +        test.testTextAmerica();
       }
   
  -    public void testBlogger() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference atomFeed, rssFeed;
  -
  -        // This site should have one Atom feed
  -        resource = "http://edpro.blogspot.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOGGER);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "atom.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "atom.xml");
  -        
  -        // This site should have one Atom feed
  -        resource = "http://carolinascl.blogspot.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOGGER);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "atom.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "atom.xml");
  -        
  -        // This site should have one Atom feed
  -        resource = "http://azizindia.blogspot.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOGGER);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "atom.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "atom.xml");
  +    public void testBlogger() throws Exception {   
  +        System.out.println("\nTesting Blogger...");
  +        testSite("http://edpro.blogspot.com/", BlogService.BLOGGER, 1, 
  +                 new String[] { FeedReference.ATOM_MEDIA_TYPE },
  +                 new String[] { "http://edpro.blogspot.com/atom.xml" },
  +                 HAS_ATOM_FEED, "http://edpro.blogspot.com/atom.xml",
  +                 NO_RSS_FEED, null);
  +        
  +        testSite("http://carolinascl.blogspot.com/", BlogService.BLOGGER, 1, 
  +                 new String[] { FeedReference.ATOM_MEDIA_TYPE },
  +                 new String[] { "http://carolinascl.blogspot.com/atom.xml" },
  +                 HAS_ATOM_FEED, "http://carolinascl.blogspot.com/atom.xml", 
  +                 NO_RSS_FEED, null);
  +        
  +        testSite("http://azizindia.blogspot.com/", BlogService.BLOGGER, 1, 
  +                 new String[] { FeedReference.ATOM_MEDIA_TYPE },
  +                 new String[] { "http://azizindia.blogspot.com/atom.xml" },
  +                 HAS_ATOM_FEED, "http://azizindia.blogspot.com/atom.xml", 
  +                 NO_RSS_FEED, null);
           
           // This site has no blogs
  -        resource = "http://davebarry.blogspot.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOGGER);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 0);
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNull(rssFeed);
  +        testSite("http://davebarry.blogspot.com/", BlogService.BLOGGER, 0, 
  +                 new String[] { },
  +                 new String[] { },
  +                 NO_ATOM_FEED, null, 
  +                 NO_RSS_FEED, null);
       }
  -    
  +
       public void testLiveJournal() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -        
  -        // This site should have an Atom feed and an RSS feed
  -        resource = "http://www.livejournal.com/community/indiexiankids/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.LIVEJOURNAL);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 2);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 2);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "data/atom");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, resource + "data/rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "data/atom");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "data/rss");
  -        
  -        //  This site should have an Atom feed and an RSS feed
  -        resource = "http://www.livejournal.com/community/ajoyforever/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.LIVEJOURNAL);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 2);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 2);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "data/atom");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, resource + "data/rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "data/atom");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "data/rss");
  -        
  -        //  This site should have an Atom feed and an RSS feed
  -        resource = "http://www.livejournal.com/users/_jb_/12332.html";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.LIVEJOURNAL);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 2);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 2);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://www.livejournal.com/users/_jb_/data/atom");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, "http://www.livejournal.com/users/_jb_/data/rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, "http://www.livejournal.com/users/_jb_/data/atom");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://www.livejournal.com/users/_jb_/data/rss");
  +       System.out.println("\nTesting LiveJournal...");
  +       testSite("http://www.livejournal.com/community/indiexiankids/", 
  +                BlogService.LIVEJOURNAL, 2, 
  +                new String[] { 
  +                               FeedReference.ATOM_MEDIA_TYPE, 
  +                               FeedReference.RSS_MEDIA_TYPE 
  +                             },
  +                new String[] { 
  +                               "http://www.livejournal.com/community/indiexiankids/data/atom",
  +                               "http://www.livejournal.com/community/indiexiankids/data/rss"
  +                             },
  +                HAS_ATOM_FEED, "http://www.livejournal.com/community/indiexiankids/data/atom",
  +                HAS_RSS_FEED, "http://www.livejournal.com/community/indiexiankids/data/rss");
  +
  +       testSite("http://www.livejournal.com/community/ajoyforever/", 
  +                BlogService.LIVEJOURNAL, 2, 
  +                new String[] { 
  +                               FeedReference.ATOM_MEDIA_TYPE, 
  +                               FeedReference.RSS_MEDIA_TYPE 
  +                             },
  +                new String[] { 
  +                               "http://www.livejournal.com/community/ajoyforever/data/atom",
  +                               "http://www.livejournal.com/community/ajoyforever/data/rss"
  +                             },
  +                HAS_ATOM_FEED, "http://www.livejournal.com/community/ajoyforever/data/atom",
  +                HAS_RSS_FEED, "http://www.livejournal.com/community/ajoyforever/data/rss");
  +
  +        testSite("http://www.livejournal.com/users/_jb_/12332.html", 
  +                 BlogService.LIVEJOURNAL, 2, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE, 
  +                                FeedReference.RSS_MEDIA_TYPE 
  +                              },
  +                 new String[] { 
  +                                "http://www.livejournal.com/users/_jb_/data/atom",
  +                                "http://www.livejournal.com/users/_jb_/data/rss"
  +                              },
  +                 HAS_ATOM_FEED, "http://www.livejournal.com/users/_jb_/data/atom",
  +                 HAS_RSS_FEED, "http://www.livejournal.com/users/_jb_/data/rss");
       }
  -    
  +
       public void testDiaryLand() throws Exception {
  +        System.out.println("\nTesting DiaryLand...");
           // FIXME: Test this
       }
  -    
  +
       public void testMovableType() throws Exception {
  +        System.out.println("\nTesting MovableType...");
           // FIXME: Test this
       }
  -    
  -    public void testXanga() throws Exception {
   
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -        
  -//         // This site should have an RSS feed
  -//         resource = "http://www.xanga.com/home.aspx?user=lithium98";
  -//         content = getContent(resource);
  -//         assertNotNull(content);
  -//         blogService = BlogServiceDiscovery.discover(resource, content);
  -//         assertEquals(blogService, BlogService.XANGA);
  -//         list = new FeedList();
  -//         ProbeLocator.locate(resource, content, list);
  -//         assertEquals(list.size(), 1);
  -//         feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -//         assertEquals(feeds.length, 1);
  -//         assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -//         assertNull(feeds[0].title, null);
  -//         assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -//         assertEquals(feeds[0].resource, "http://www.xanga.com/rss.aspx?user=lithium98");
  -//         /* test through the FeedLocator */
  -//         list = FeedLocator.locate(resource);
  -//         atomFeed = list.getAdAtomFeed();
  -//         rssFeed = list.getAdRSSFeed();
  -//         assertNull(atomFeed);
  -//         assertNotNull(rssFeed);
  -//         assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -//         assertEquals(rssFeed.resource, "http://www.xanga.com/rss.aspx?user=lithium98");
  -        
  -//         //  This site should have an RSS feed
  -//         resource = "http://www.xanga.com/home.aspx?user=ChUnSA_86";
  -//         content = getContent(resource);
  -//         assertNotNull(content);
  -//         blogService = BlogServiceDiscovery.discover(resource, content);
  -//         assertEquals(blogService, BlogService.XANGA);
  -//         list = new FeedList();
  -//         ProbeLocator.locate(resource, content, list);
  -//         assertEquals(list.size(), 1);
  -//         feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -//         assertEquals(feeds.length, 1);
  -//         assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -//         assertNull(feeds[0].title, null);
  -//         assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -//         assertEquals(feeds[0].resource, "http://www.xanga.com/rss.aspx?user=ChUnSA_86");
  -//         /* test through the FeedLocator */
  -//         list = FeedLocator.locate(resource);
  -//         atomFeed = list.getAdAtomFeed();
  -//         rssFeed = list.getAdRSSFeed();
  -//         assertNull(atomFeed);
  -//         assertNotNull(rssFeed);
  -//         assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -//         assertEquals(rssFeed.resource, "http://www.xanga.com/rss.aspx?user=ChUnSA_86");
  -        
  -//         //  This site should have an RSS feed
  -//         resource = "http://www.xanga.com/home.aspx?user=wdfphillz";
  -//         content = getContent(resource);
  -//         assertNotNull(content);
  -//         blogService = BlogServiceDiscovery.discover(resource, content);
  -//         assertEquals(blogService, BlogService.XANGA);
  -//         list = new FeedList();
  -//         ProbeLocator.locate(resource, content, list);
  -//         assertEquals(list.size(), 1);
  -//         feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -//         assertEquals(feeds.length, 1);
  -//         assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -//         assertNull(feeds[0].title, null);
  -//         assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -//         assertEquals(feeds[0].resource, "http://www.xanga.com/rss.aspx?user=wdfphillz");
  -//         /* test through the FeedLocator */
  -//         list = FeedLocator.locate(resource);
  -//         atomFeed = list.getAdAtomFeed();
  -//         rssFeed = list.getAdRSSFeed();
  -//         assertNull(atomFeed);
  -//         assertNotNull(rssFeed);
  -//         assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -//         assertEquals(rssFeed.resource, "http://www.xanga.com/rss.aspx?user=wdfphillz");
  -        
  -        // This site should have an RSS feed
  -
  -        resource = "http://xanga.com/home.aspx?user=joe";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.XANGA);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://www.xanga.com/rss.aspx?user=lithium98");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://www.xanga.com/rss.aspx?user=lithium98");
  -
  -        // This site should have an RSS feed
  -        resource = "http://www.xanga.com/home.aspx?user=ChUnSA_86";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.XANGA);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://www.xanga.com/rss.aspx?user=ChUnSA_86");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://www.xanga.com/rss.aspx?user=ChUnSA_86");
  -
  -        // This site should have an RSS feed
  -        resource = "http://www.xanga.com/home.aspx?user=wdfphillz";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.XANGA);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://www.xanga.com/rss.aspx?user=wdfphillz");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://www.xanga.com/rss.aspx?user=wdfphillz");
  +    public void testXanga() throws Exception {
  +        System.out.println("\nTesting Xanga...");
  +        testSite("http://www.xanga.com/home.aspx?user=lithium98", 
  +                 BlogService.XANGA, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.xanga.com/rss.aspx?user=lithium98" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.xanga.com/rss.aspx?user=lithium98");
  +
  +        testSite("http://www.xanga.com/home.aspx?user=ChUnSA_86", 
  +                 BlogService.XANGA, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.xanga.com/rss.aspx?user=ChUnSA_86" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.xanga.com/rss.aspx?user=ChUnSA_86");
  +        
  +        testSite("http://www.xanga.com/home.aspx?user=wdfphillz", 
  +                 BlogService.XANGA, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.xanga.com/rss.aspx?user=wdfphillz" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.xanga.com/rss.aspx?user=wdfphillz");
   
  -        // This site should have an RSS feed
           // FIXME: We should be able to pass this test when we
           // expand resources inside of the Feed Parser; we don't
           // currently do this yet, Brad Neuberg, bkn3@columbia.edu
  -        /*resource = "http://xanga.com/home.aspx?user=joe";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.XANGA);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://xanga.com/rss.aspx?user=joe");*/
  -        /* test through the FeedLocator */
  -        /*list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://xanga.com/rss.aspx?user=joe");*/
  -    }
  -
  -    public FeedList test( String resource,
  -                          BlogService service,
  -                          int numFeeds ) throws Exception {
  -
  -        ResourceRequest request = ResourceRequestFactory.getResourceRequest( resource );
  -
  -        String content = request.getInputStreamAsString();
  -        resource = request.getResource();
  -
  -        System.out.println( "resource: " + resource );
  -        
  -        assertNotNull(content);
  -
  -        BlogService s = BlogServiceDiscovery.discover( resource, content );
  -
  -        assertEquals( s, service );
  -
  -        FeedList list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -
  -        assertEquals( list.size(), numFeeds );
  -
  -        System.out.println( "list: " + list );
  -        
  -        return list;
  -        
  -    }
  -
  -    public static void main( String[] args ) throws Exception {
  -        
  -        TestProbeLocator test = new TestProbeLocator( null );
  -
  -        test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        /*test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();*/
  -        //test.testXanga();
  -        /*test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();*/
  +        /*testSite("http://xanga.com/home.aspx?user=joe", 
  +                 BlogService.XANGA, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.xanga.com/rss.aspx?user=joe" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.xanga.com/rss.aspx?user=joe");*/
       }
   
       public void testWordPress() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -
  -        // This site should have an Atom feed and two RSS feeds
  -        resource = "http://synflood.at/blog/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.WORDPRESS);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 3);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 3);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "wp-atom.php");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, resource + "wp-rss2.php");
  -        assertEquals(feeds[2].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[2].title, null);
  -        assertEquals(feeds[2].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[2].resource, resource + "wp-rss.php");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "wp-atom.php");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "wp-rss2.php");
  -        
  -        // This site should have an Atom feed and two RSS feeds
  -        resource = "http://holmes.hgen.pitt.edu/~dweeks/wordpress/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.WORDPRESS);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 3);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 3);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "wp-atom.php");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, resource + "wp-rss2.php");
  -        assertEquals(feeds[2].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[2].title, null);
  -        assertEquals(feeds[2].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[2].resource, resource + "wp-rss.php");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "wp-atom.php");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "wp-rss2.php");
  +        System.out.println("\nTesting WordPress...");
  +        testSite("http://synflood.at/blog/", 
  +                 BlogService.WORDPRESS, 3, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE, 
  +                                FeedReference.RSS_MEDIA_TYPE,
  +                                FeedReference.RSS_MEDIA_TYPE 
  +                              },
  +                 new String[] { 
  +                                "http://synflood.at/blog/wp-atom.php",
  +                                "http://synflood.at/blog/wp-rss2.php",
  +                                "http://synflood.at/blog/wp-rss.php"
  +                              },
  +                 HAS_ATOM_FEED, "http://synflood.at/blog/wp-atom.php",
  +                 HAS_RSS_FEED, "http://synflood.at/blog/wp-rss2.php");
  +        
  +        testSite("http://holmes.hgen.pitt.edu/~dweeks/wordpress/", 
  +                 BlogService.WORDPRESS, 3, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE, 
  +                                FeedReference.RSS_MEDIA_TYPE,
  +                                FeedReference.RSS_MEDIA_TYPE 
  +                              },
  +                 new String[] { 
  +                                "http://holmes.hgen.pitt.edu/~dweeks/wordpress/wp-atom.php",
  +                                "http://holmes.hgen.pitt.edu/~dweeks/wordpress/wp-rss2.php",
  +                                "http://holmes.hgen.pitt.edu/~dweeks/wordpress/wp-rss.php"
  +                              },
  +                 HAS_ATOM_FEED, "http://holmes.hgen.pitt.edu/~dweeks/wordpress/wp-atom.php",
  +                 HAS_RSS_FEED, "http://holmes.hgen.pitt.edu/~dweeks/wordpress/wp-rss2.php");
       }
  -    
  +
       public void testAOLJournal() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -
  -        // This site should have a single RSS feed
  -        resource = "http://journals.aol.com/redhdka/BrandNewDay/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.AOL_JOURNAL);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "rss.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://journals.aol.com/redhdka/brandnewday/rss.xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://journals.aol.com/goldenchildnc/GCS/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.AOL_JOURNAL);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "rss.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://journals.aol.com/goldenchildnc/gcs/rss.xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://journals.aol.com/mkgninja/MelissasMisunderstandingsofLife/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.AOL_JOURNAL);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "rss.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://journals.aol.com/mkgninja/melissasmisunderstandingsoflife/rss.xml");
  +        System.out.println("\nTesting AOL Journal...");
  +        /* AOL recently turned on experimental Atom support, but it is still 
  +           buggy; it turns out we can "see" it through autodiscovery but not
  +           through aggresive link probing, since their server returns a 500
  +           HTTP internal server error if we do a HEAD request.  For this
  +           reason we have to divide our testing between the probe locator
  +           and feed locator because they give different results for this
  +           kind of blog service currently.
  +        */
  +        testProbeLocator(
  +                 "http://journals.aol.com/redhdka/BrandNewDay/", 
  +                 BlogService.AOL_JOURNAL, 1, 
  +                 new String[] { 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://journals.aol.com/redhdka/BrandNewDay/rss.xml" 
  +                              },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://journals.aol.com/redhdka/brandnewday/rss.xml");
  +        testFeedLocator(
  +                 "http://journals.aol.com/redhdka/BrandNewDay/", 
  +                 BlogService.AOL_JOURNAL, 2, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE,
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://journals.aol.com/redhdka/BrandNewDay/atom.xml",
  +                                "http://journals.aol.com/redhdka/BrandNewDay/rss.xml" 
  +                              },
  +                 HAS_ATOM_FEED, "http://journals.aol.com/redhdka/brandnewday/atom.xml",
  +                 HAS_RSS_FEED, "http://journals.aol.com/redhdka/brandnewday/rss.xml");
  +        
  +        testProbeLocator(
  +                 "http://journals.aol.com/goldenchildnc/GCS/", 
  +                 BlogService.AOL_JOURNAL, 1, 
  +                 new String[] { 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://journals.aol.com/goldenchildnc/GCS/rss.xml" 
  +                              },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://journals.aol.com/goldenchildnc/GCS/rss.xml");
  +        testFeedLocator(
  +                 "http://journals.aol.com/goldenchildnc/GCS/", 
  +                 BlogService.AOL_JOURNAL, 2, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE,
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://journals.aol.com/goldenchildnc/gcs/atom.xml",
  +                                "http://journals.aol.com/goldenchildnc/gcs/rss.xml" 
  +                              },
  +                 HAS_ATOM_FEED, "http://journals.aol.com/goldenchildnc/gcs/atom.xml",
  +                 HAS_RSS_FEED, "http://journals.aol.com/goldenchildnc/gcs/rss.xml");
  +
  +        
  +        testProbeLocator(
  +                 "http://journals.aol.com/mkgninja/MelissasMisunderstandingsofLife/", 
  +                 BlogService.AOL_JOURNAL, 1, 
  +                 new String[] { 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://journals.aol.com/mkgninja/MelissasMisunderstandingsofLife/rss.xml" 
  +                              },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://journals.aol.com/mkgninja/MelissasMisunderstandingsofLife/rss.xml");
  +        testFeedLocator(
  +                 "http://journals.aol.com/mkgninja/MelissasMisunderstandingsofLife/", 
  +                 BlogService.AOL_JOURNAL, 2, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE,
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://journals.aol.com/mkgninja/melissasmisunderstandingsoflife/atom.xml",
  +                                "http://journals.aol.com/mkgninja/melissasmisunderstandingsoflife/rss.xml" 
  +                              },
  +                 HAS_ATOM_FEED, "http://journals.aol.com/mkgninja/melissasmisunderstandingsoflife/atom.xml",
  +                 HAS_RSS_FEED, "http://journals.aol.com/mkgninja/melissasmisunderstandingsoflife/rss.xml");
       }
  -    
  -    public void testTypePad() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
   
  +    public void testTypePad() throws Exception {
  +        System.out.println("\nTesting TypePad...");
           // This site has no feed that we can link probe for (it's in a different
  -        // location then usual)
  -        resource = "http://lynikers.typepad.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.TYPEPAD);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 0);
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        // we get a feed here, because this site correctly uses autodiscovery
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, "http://lynikers.typepad.com/on_buck_lake/atom.xml");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://lynikers.typepad.com/on_buck_lake/index.rdf");
  -        
  +        // location then usual).
  +        // However, we get a feed when we go through the FeedParser since
  +        // the site has autodiscovery
  +        testSite("http://lynikers.typepad.com/", 
  +                 BlogService.TYPEPAD, 0, 
  +                 new String[] { },
  +                 new String[] { },
  +                 HAS_ATOM_FEED, "http://lynikers.typepad.com/on_buck_lake/atom.xml",
  +                 HAS_RSS_FEED, "http://lynikers.typepad.com/on_buck_lake/index.rdf");
  +
           // This site has no feed that we can link probe for (it's in a different
  -        // location then usual)
  -        resource = "http://emmeke.typepad.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.TYPEPAD);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 0);
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        // we get a feed here, because this site correctly uses autodiscovery
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://emmeke.typepad.com/blog/index.rdf");
  -        
  -        // This site should have an Atom feed and one RSS feed
  -        resource = "http://www.prettypolitical.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.TYPEPAD);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 2);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 2);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "atom.xml");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, resource + "index.rdf");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "atom.xml");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "index.rdf");
  +        // location then usual).
  +        testSite("http://emmeke.typepad.com/", 
  +                 BlogService.TYPEPAD, 0, 
  +                 new String[] { },
  +                 new String[] { },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://emmeke.typepad.com/blog/index.rdf");
  +
  +        testSite("http://www.prettypolitical.com/", 
  +                 BlogService.TYPEPAD, 2, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE, 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://www.prettypolitical.com/atom.xml",
  +                                "http://www.prettypolitical.com/index.rdf"
  +                              },
  +                 HAS_ATOM_FEED, "http://www.prettypolitical.com/atom.xml",
  +                 HAS_RSS_FEED, "http://www.prettypolitical.com/index.rdf");
       }
  -    
  -    public void testGreyMatter() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
   
  +    public void testGreyMatter() throws Exception {
  +        System.out.println("\nTesting GreyMatter...");
           // No feeds supported
  -        resource = "http://www.chattbike.com/gilligan/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.GREYMATTER);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 0);
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNull(rssFeed);
  -        
  -        // No feeds supported
  -        resource = "http://www.electricedge.com/greymatter/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.GREYMATTER);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 0);
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNull(rssFeed);
  -    }
  -    
  -    public void testPMachine() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bamph.com";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.UNKNOWN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bamph.com/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bamph.com/index.xml");
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bamph.com";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.UNKNOWN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bamph.com/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bamph.com/index.xml");
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bamph.com";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.UNKNOWN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bamph.com/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bamph.com/index.xml");
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bamph.com";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.UNKNOWN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bamph.com/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bamph.com/index.xml");
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bamph.com";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.UNKNOWN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bamph.com/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bamph.com/index.xml");
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bucsfishingreport.com/pMachine/weblog.php";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.PMACHINE);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bucsfishingreport.com/pMachine/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bucsfishingreport.com/pMachine/index.xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://www.simplekindoflife.com/pMachine/weblog.php";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.PMACHINE);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://www.simplekindoflife.com/pMachine/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://www.simplekindoflife.com/pMachine/index.xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://www.mondfish.net/pmachine/weblog.php";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.PMACHINE);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://www.mondfish.net/pmachine/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://www.mondfish.net/pmachine/index.xml");
  -
  -        // This site should have a single RSS feed
  -        resource = "http://bamph.com";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.UNKNOWN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, "http://bamph.com/index.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, "http://bamph.com/index.xml");
  -    }
  -    
  -    public void testBlosxom() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -
  -        // This site should have a single RSS feed
  -        resource = "http://mikemason.ca/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOSXOM);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "index.rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "index.rss");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://www.foobargeek.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOSXOM);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "index.rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -    public static void main( String[] args ) throws Exception {
  +        testSite("http://www.chattbike.com/gilligan/", 
  +                 BlogService.GREYMATTER, 0, 
  +                 new String[] { },
  +                 new String[] { },
  +                 NO_ATOM_FEED, null,
  +                 NO_RSS_FEED, null);
   
  -        TestProbeLocator test = new TestProbeLocator( null );
  -
  -        /*test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );*/
  -
  -        test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();
  -        test.testXanga();
  -        test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();
  +        // No feeds supported
  +        testSite("http://www.electricedge.com/greymatter/", 
  +                 BlogService.GREYMATTER, 0, 
  +                 new String[] { },
  +                 new String[] { },
  +                 NO_ATOM_FEED, null,
  +                 NO_RSS_FEED, null);
       }
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "index.rss");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://www.pipetree.com/qmacro/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOSXOM);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "index.rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -    public static void main( String[] args ) throws Exception {
  -
  -        TestProbeLocator test = new TestProbeLocator( null );
   
  -        /*test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );*/
  -
  -        test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();
  -        test.testXanga();
  -        test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();
  +    public void testPMachine() throws Exception {
  +        System.out.println("\nTesting PMachine...");
  +        testSite("http://bamph.com", 
  +                 BlogService.UNKNOWN, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://bamph.com/index.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://bamph.com/index.xml");
  +        
  +        testSite("http://bucsfishingreport.com/pMachine/weblog.php", 
  +                 BlogService.PMACHINE, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://bucsfishingreport.com/pMachine/index.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://bucsfishingreport.com/pMachine/index.xml");
  +        
  +        testSite("http://www.simplekindoflife.com/pMachine/weblog.php", 
  +                 BlogService.PMACHINE, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.simplekindoflife.com/pMachine/index.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.simplekindoflife.com/pMachine/index.xml");
  +        
  +        testSite("http://www.mondfish.net/pmachine/weblog.php", 
  +                 BlogService.PMACHINE, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.mondfish.net/pmachine/index.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.mondfish.net/pmachine/index.xml");
       }
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        // gets a different location
  -        assertEquals(rssFeed.resource, "http://www.pipetree.com/qmacro/xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://www.bitbucketheaven.com/cgi-bin/blosxom.cgi";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.BLOSXOM);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "/index.rss");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -    public static void main( String[] args ) throws Exception {
  -
  -        TestProbeLocator test = new TestProbeLocator( null );
   
  -        /*test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );*/
  -
  -        test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();
  -        test.testXanga();
  -        test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();
  -    }
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        // gets a different location
  -        assertEquals(rssFeed.resource, resource + "/index.rss");
  +    public void testBlosxom() throws Exception {
  +        System.out.println("\nTesting Blosxom...");
  +        testSite("http://mikemason.ca/", 
  +                 BlogService.BLOSXOM, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://mikemason.ca/index.rss" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://mikemason.ca/index.rss");
  +        
  +        testSite("http://www.foobargeek.com/", 
  +                 BlogService.BLOSXOM, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.foobargeek.com/index.rss" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.foobargeek.com/index.rss");
  +        
  +        // The FeedParser gets a different location for the XML file then
  +        // through the aggresive prober for this feed
  +        testSite("http://www.pipetree.com/qmacro/", 
  +                 BlogService.BLOSXOM, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.pipetree.com/qmacro/index.rss" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.pipetree.com/qmacro/xml");
  +
  +        testSite("http://www.bitbucketheaven.com/cgi-bin/blosxom.cgi", 
  +                 BlogService.BLOSXOM, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://www.bitbucketheaven.com/cgi-bin/blosxom.cgi/index.rss" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://www.bitbucketheaven.com/cgi-bin/blosxom.cgi/index.rss");
       }
       
       public void testRadioUserland() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -
  -        // This site should have a single RSS feed
  -        resource = "http://radio.weblogs.com/0131722/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.RADIO_USERLAND);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -    public static void main( String[] args ) throws Exception {
  -
  -        TestProbeLocator test = new TestProbeLocator( null );
  -
  -        /*test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );*/
  -
  -        test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();
  -        test.testXanga();
  -        test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();
  -    }
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "rss.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "rss.xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://radio.weblogs.com/0131724/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.RADIO_USERLAND);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -    public static void main( String[] args ) throws Exception {
  -
  -        TestProbeLocator test = new TestProbeLocator( null );
  -
  -        /*test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );*/
  -
  -        test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();
  -        test.testXanga();
  -        test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();
  -    }
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "rss.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "rss.xml");
  -        
  -        // This site should have a single RSS feed
  -        resource = "http://radio.weblogs.com/0131734/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.RADIO_USERLAND);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 1);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 1);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "rss.xml");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "rss.xml");
  +        System.out.println("\nTesting Radio Userland...");
  +        testSite("http://radio.weblogs.com/0131722/", 
  +                 BlogService.RADIO_USERLAND, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://radio.weblogs.com/0131722/rss.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://radio.weblogs.com/0131722/rss.xml");
  +        
  +        testSite("http://radio.weblogs.com/0131724/", 
  +                 BlogService.RADIO_USERLAND, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://radio.weblogs.com/0131724/rss.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://radio.weblogs.com/0131724/rss.xml");
  +        
  +        testSite("http://radio.weblogs.com/0131734/", 
  +                 BlogService.RADIO_USERLAND, 1, 
  +                 new String[] { FeedReference.RSS_MEDIA_TYPE },
  +                 new String[] { "http://radio.weblogs.com/0131734/rss.xml" },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://radio.weblogs.com/0131734/rss.xml");
       }
       
       public void testTextPattern() throws Exception {
  -        FeedList list = null;
  -        String resource = null, content = null;
  -        BlogService blogService = null;
  -        FeedReference feeds[] = null;
  -        FeedReference rssFeed, atomFeed;
  -        
  -        // This site should have an Atom feed and one RSS feed
  -        resource = "http://www.digitalmediaminute.com/";
  -        content = getContent(resource);
  -        assertNotNull(content);
  -        blogService = BlogServiceDiscovery.discover(resource, content);
  -        assertEquals(blogService, BlogService.TEXTPATTERN);
  -        list = new FeedList();
  -        ProbeLocator.locate(resource, content, list);
  -        assertEquals(list.size(), 2);
  -        feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  -        assertEquals(feeds.length, 2);
  -        assertEquals(feeds[0].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[0].title, null);
  -        assertEquals(feeds[0].type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(feeds[0].resource, resource + "?atom=1");
  -        assertEquals(feeds[1].method, FeedReference.METHOD_PROBE_DISCOVERY);
  -        assertNull(feeds[1].title, null);
  -        assertEquals(feeds[1].type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(feeds[1].resource, resource + "?rss=1");
  -        /* test through the FeedLocator */
  -        list = FeedLocator.locate(resource);
  -        atomFeed = list.getAdAtomFeed();
  -        rssFeed = list.getAdRSSFeed();
  -        assertNotNull(atomFeed);
  -        assertNotNull(rssFeed);
  -        assertEquals(atomFeed.type, FeedReference.ATOM_MEDIA_TYPE);
  -        assertEquals(atomFeed.resource, resource + "?atom=1");
  -        assertEquals(rssFeed.type, FeedReference.RSS_MEDIA_TYPE);
  -        assertEquals(rssFeed.resource, resource + "?rss=1");
  +        System.out.println("\nTesting TextPattern...");
  +        testSite("http://www.digitalmediaminute.com/", 
  +                 BlogService.TEXTPATTERN, 2, 
  +                 new String[] { 
  +                                FeedReference.ATOM_MEDIA_TYPE, 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://www.digitalmediaminute.com/?atom=1",
  +                                "http://www.digitalmediaminute.com/?rss=1"
  +                              },
  +                 HAS_ATOM_FEED, "http://www.digitalmediaminute.com/?atom=1",
  +                 HAS_RSS_FEED, "http://www.digitalmediaminute.com/?rss=1");
  +    }
  +    
  +    public void testTextAmerica() throws Exception {
  +        System.out.println("\nTesting TextAmerica...");
  +        testSite("http://morganwebb.textamerica.com/", 
  +                 BlogService.TEXTAMERICA, 1, 
  +                 new String[] { 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://morganwebb.textamerica.com/rss.aspx"
  +                              },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://morganwebb.textamerica.com/rss.aspx");
  +        
  +        testSite("http://northlan.textamerica.com/", 
  +                 BlogService.TEXTAMERICA, 1, 
  +                 new String[] { 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://northlan.textamerica.com/rss.aspx"
  +                              },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://northlan.textamerica.com/rss.aspx");
  +        
  +        testSite("http://mycamphone.textamerica.com/", 
  +                 BlogService.TEXTAMERICA, 1, 
  +                 new String[] { 
  +                                FeedReference.RSS_MEDIA_TYPE
  +                              },
  +                 new String[] { 
  +                                "http://mycamphone.textamerica.com/rss.aspx"
  +                              },
  +                 NO_ATOM_FEED, null,
  +                 HAS_RSS_FEED, "http://mycamphone.textamerica.com/rss.aspx");
       }
  -    
  +
       /** Grabs all the content for a weblog for testing purposes. */
       protected String getContent(String resource) throws Exception {
   
  -        //FIXME: use the IO package from NewsMonster forfor this.
  -        
  +        //FIXME: use the IO package from NewsMonster for this.
  +
           URL resourceURL = new URL(resource);
           URLConnection con = resourceURL.openConnection();
           con.connect();
  -        BufferedReader in = new BufferedReader(
  -                                new InputStreamReader(con.getInputStream()));
  +        BufferedReader in = new BufferedReader(new InputStreamReader(con
  +                                        .getInputStream()));
           StringBuffer results = new StringBuffer();
           String line = null;
  -        
  -        while ( (line = in.readLine()) != null) {
  +
  +        while ((line = in.readLine()) != null) {
               results.append(line);
           }
  -        
  +
           return results.toString();
       }
  -
  -    public static void main( String[] args ) throws Exception {
  -
  -        TestProbeLocator test = new TestProbeLocator( null );
  -
  -        /*test.test( "http://xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );
  -
  -        test.test( "http://www.xanga.com/home.aspx?user=joe",
  -                   BlogService.XANGA,
  -                   1 );*/
  -
  -        test.testBlogger();
  -        test.testLiveJournal();
  -        test.testDiaryLand();
  -        test.testMovableType();
  -        test.testXanga();
  -        test.testWordPress();
  -        test.testAOLJournal();
  -        test.testTypePad();
  -        test.testGreyMatter();
  -        test.testPMachine();
  -        test.testBlosxom();
  -        test.testRadioUserland();
  -        test.testTextPattern();
  +    
  +    private void testSite(String resource, BlogService correctBlogService,
  +                          int numberOfFeeds, String feedType[],
  +                          String feedURL[], boolean hasAtomFeed,
  +                          String atomFeedURL, boolean hasRSSFeed,
  +                          String rssFeedURL) throws Exception {
  +        System.out.println("Testing " + resource + "...");
  +        /* Test through the probe locator */
  +        testProbeLocator(resource, correctBlogService, numberOfFeeds, 
  +                         feedType, feedURL, hasAtomFeed,
  +                         atomFeedURL, hasRSSFeed, rssFeedURL);
  +        
  +        /* Test through the FeedLocator */
  +        testFeedLocator(resource, correctBlogService, numberOfFeeds, 
  +                        feedType, feedURL, hasAtomFeed,
  +                        atomFeedURL, hasRSSFeed, rssFeedURL);
  +    }
  +    
  +    private void testProbeLocator(String resource, BlogService correctBlogService,
  +                                  int numberOfFeeds, String feedType[],
  +                                  String feedURL[], boolean hasAtomFeed,
  +                                  String atomFeedURL, boolean hasRSSFeed,
  +                                  String rssFeedURL) throws Exception {
  +        String content = getContent(resource);
  +        assertNotNull(content);
  +        
  +        BlogService blogService = BlogServiceDiscovery.discover(resource, content);
  +        assertEquals(correctBlogService, blogService);
  +        
  +        FeedList list = new FeedList();
  +        ProbeLocator.locate(resource, content, list);
  +        assertEquals(numberOfFeeds, list.size());
  +        
  +        FeedReference[] feeds = (FeedReference[])list.toArray(new FeedReference[list.size()]);
  +        assertEquals(numberOfFeeds, feeds.length);
  +        
  +        for (int i = 0; i < feeds.length; i++) {
  +            assertEquals(FeedReference.METHOD_PROBE_DISCOVERY, feeds[i].method);
  +            assertNull(null, feeds[i].title);
  +            assertEquals(feedType[i], feeds[i].type);
  +            assertEquals(feedURL[i], feeds[i].resource);
  +        }
  +    }
  +    
  +    private void testFeedLocator(String resource, BlogService correctBlogService,
  +                                 int numberOfFeeds, String feedType[],
  +                                 String feedURL[], boolean hasAtomFeed,
  +                                 String atomFeedURL, boolean hasRSSFeed,
  +                                 String rssFeedURL) throws Exception {
  +        FeedList list = FeedLocator.locate(resource);
  +        FeedReference atomFeed = list.getAdAtomFeed();
  +        FeedReference rssFeed = list.getAdRSSFeed();
  +        if (hasAtomFeed) {
  +            assertNotNull(atomFeed);
  +            assertEquals(FeedReference.ATOM_MEDIA_TYPE, atomFeed.type);
  +            assertEquals(atomFeedURL, atomFeed.resource);
  +        }
  +        else
  +            assertNull(atomFeed);
  +        
  +        if (hasRSSFeed) {
  +            assertNotNull(rssFeed);
  +            assertEquals(FeedReference.RSS_MEDIA_TYPE, rssFeed.type);
  +            assertEquals(rssFeedURL, rssFeed.resource);
  +        }
  +        else
  +            assertNull(rssFeed);
       }
   }
  -
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message