@Test public void testSpecialPlugin() throws Exception { final Collection requestors = context.mock(Collection.class); final String url = "www.example.com/example.rss"; context.checking(new Expectations() { { oneOf(plugin2).execute(url, requestors, HOST, PORT, TIMEOUT); will(returnValue(pluginResult)); } }); Map<String, SyndFeed> result = sut.getSyndicatedFeed(url, requestors); context.assertIsSatisfied(); assertSame(pluginResult, result); }
public Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors) throws Exception { for (PluginFeedFetcherStrategy ps : siteStratagies) { if (Pattern.compile(ps.getSiteUrlRegEx()).matcher(inFeedUrl.toString()).find()) { if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from special site " + inFeedUrl); } return ps.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } } if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from normal site " + inFeedUrl); } return defaultFetcher.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); }
FeedFactory { public Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors) throws Exception { for (PluginFeedFetcherStrategy ps : siteStratagies) { if (Pattern.compile(ps.getSiteUrlRegEx()).matcher(inFeedUrl.toString()).find()) { if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from special site " + inFeedUrl); } return ps.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } } if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from normal site " + inFeedUrl); } return defaultFetcher.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } }
FeedFactory { public Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors) throws Exception { for (PluginFeedFetcherStrategy ps : siteStratagies) { if (Pattern.compile(ps.getSiteUrlRegEx()).matcher(inFeedUrl.toString()).find()) { if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from special site " + inFeedUrl); } return ps.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } } if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from normal site " + inFeedUrl); } return defaultFetcher.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } FeedFactory(final List<PluginFeedFetcherStrategy> inSiteStratagies,
            final PluginFeedFetcherStrategy inDefaultFetcher, final String inProxyHost, final String inProxyPort,
            final int inTimeout); }
FeedFactory { public Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors) throws Exception { for (PluginFeedFetcherStrategy ps : siteStratagies) { if (Pattern.compile(ps.getSiteUrlRegEx()).matcher(inFeedUrl.toString()).find()) { if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from special site " + inFeedUrl); } return ps.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } } if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from normal site " + inFeedUrl); } return defaultFetcher.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } FeedFactory(final List<PluginFeedFetcherStrategy> inSiteStratagies,
            final PluginFeedFetcherStrategy inDefaultFetcher, final String inProxyHost, final String inProxyPort,
            final int inTimeout); Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors); }
FeedFactory { public Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors) throws Exception { for (PluginFeedFetcherStrategy ps : siteStratagies) { if (Pattern.compile(ps.getSiteUrlRegEx()).matcher(inFeedUrl.toString()).find()) { if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from special site " + inFeedUrl); } return ps.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } } if (logger.isDebugEnabled()) { logger.debug("Feed being fetched from normal site " + inFeedUrl); } return defaultFetcher.execute(inFeedUrl, inRequestors, proxyHost, proxyPort, timeout); } FeedFactory(final List<PluginFeedFetcherStrategy> inSiteStratagies,
            final PluginFeedFetcherStrategy inDefaultFetcher, final String inProxyHost, final String inProxyPort,
            final int inTimeout); Map<String, SyndFeed> getSyndicatedFeed(final String inFeedUrl, final Collection<String> inRequestors);  }