From eef13e8f6ac2476f2d5ffa575ffbd6c6d1d043c0 Mon Sep 17 00:00:00 2001 From: w3stling Date: Sat, 12 Aug 2023 06:13:09 +0200 Subject: [PATCH] Author not mapped for Atom feed --- .../rssreader/AbstractRssReader.java | 1 + .../RssReaderIntegrationTest.java | 8 ++++ src/test/resources/atom-feed.xml | 45 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 src/test/resources/atom-feed.xml diff --git a/src/main/java/com/apptasticsoftware/rssreader/AbstractRssReader.java b/src/main/java/com/apptasticsoftware/rssreader/AbstractRssReader.java index 3c463f13..565ce0cb 100644 --- a/src/main/java/com/apptasticsoftware/rssreader/AbstractRssReader.java +++ b/src/main/java/com/apptasticsoftware/rssreader/AbstractRssReader.java @@ -136,6 +136,7 @@ protected void registerItemTags() { itemTags.put("content", Item::setDescription); itemTags.put("link", Item::setLink); itemTags.put("author", Item::setAuthor); + itemTags.put("/feed/entry/author/name", Item::setAuthor); itemTags.put("category", Item::addCategory); itemTags.put("pubDate", Item::setPubDate); itemTags.put("published", Item::setPubDate); diff --git a/src/test/java/com/apptasticsoftware/integrationtest/RssReaderIntegrationTest.java b/src/test/java/com/apptasticsoftware/integrationtest/RssReaderIntegrationTest.java index 30a87a72..203c5e90 100644 --- a/src/test/java/com/apptasticsoftware/integrationtest/RssReaderIntegrationTest.java +++ b/src/test/java/com/apptasticsoftware/integrationtest/RssReaderIntegrationTest.java @@ -595,6 +595,14 @@ void testCloseTwice() throws IOException { } } + @Test + void testAtomFeed() { + var items = new RssReader().read(fromFile("atom-feed.xml")) + .collect(Collectors.toList()); + assertEquals(1, items.size()); + assertEquals("Mark Pilgrim", items.get(0).getAuthor().orElse(null)); + } + @Test void testReadFromFile() { long count = new RssReader().read(fromFile("itunes-podcast.xml")).count(); diff --git a/src/test/resources/atom-feed.xml b/src/test/resources/atom-feed.xml new file mode 100644 index 00000000..c566ae56 --- /dev/null +++ b/src/test/resources/atom-feed.xml @@ -0,0 +1,45 @@ + + + dive into mark + + A <em>lot</em> of effort + went into making this effortless + + 2005-07-31T12:29:29Z + tag:example.org,2003:3 + + + Copyright (c) 2003, Mark Pilgrim + + Example Toolkit + + + Atom draft-07 snapshot + + + tag:example.org,2003:3.2397 + 2005-07-31T12:29:29Z + 2003-12-13T08:29:29-04:00 + + Mark Pilgrim + http://example.org/ + f8dy@example.com + + + Sam Ruby + + + Joe Gregorio + + +
+

[Update: The Atom draft is finished.]

+
+
+
+
\ No newline at end of file