@Test public void renderFeed() throws Exception { when(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")) .thenReturn("FeedTitle"); when(this.modelBridge.getDocumentURL( any(), any(), any())).thenReturn("url"); when(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedDescription")) .thenReturn("FeedDescription"); SyndFeed feed = this.mocker.getComponentUnderTest().renderFeed(Collections.EMPTY_LIST); assertEquals("FeedTitle", feed.getTitle()); assertEquals("FeedDescription", feed.getDescription()); assertEquals("url", feed.getLink()); assertEquals(0, feed.getEntries().size()); }
@Override public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn("Unable to render RSS entry for CompositeEvent [{}] : [{}]", event, ExceptionUtils.getRootCauseMessage(e)); } } feed.setEntries(entries); return feed; }
DefaultNotificationRSSManager implements NotificationRSSManager { @Override public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn("Unable to render RSS entry for CompositeEvent [{}] : [{}]", event, ExceptionUtils.getRootCauseMessage(e)); } } feed.setEntries(entries); return feed; } }
DefaultNotificationRSSManager implements NotificationRSSManager { @Override public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn("Unable to render RSS entry for CompositeEvent [{}] : [{}]", event, ExceptionUtils.getRootCauseMessage(e)); } } feed.setEntries(entries); return feed; }  }
DefaultNotificationRSSManager implements NotificationRSSManager { @Override public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn("Unable to render RSS entry for CompositeEvent [{}] : [{}]", event, ExceptionUtils.getRootCauseMessage(e)); } } feed.setEntries(entries); return feed; }  @Override SyndFeed renderFeed(List<CompositeEvent> events); }
DefaultNotificationRSSManager implements NotificationRSSManager { @Override public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn("Unable to render RSS entry for CompositeEvent [{}] : [{}]", event, ExceptionUtils.getRootCauseMessage(e)); } } feed.setEntries(entries); return feed; }  @Override SyndFeed renderFeed(List<CompositeEvent> events);  }