Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Author field not mapped for Atom feed #108

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
45 changes: 45 additions & 0 deletions src/test/resources/atom-feed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">dive into mark</title>
<subtitle type="html">
A &lt;em&gt;lot&lt;/em&gt; of effort
went into making this effortless
</subtitle>
<updated>2005-07-31T12:29:29Z</updated>
<id>tag:example.org,2003:3</id>
<link rel="alternate" type="text/html"
hreflang="en" href="http://example.org/"/>
<link rel="self" type="application/atom+xml"
href="http://example.org/feed.atom"/>
<rights>Copyright (c) 2003, Mark Pilgrim</rights>
<generator uri="http://www.example.com/" version="1.0">
Example Toolkit
</generator>
<entry>
<title>Atom draft-07 snapshot</title>
<link rel="alternate" type="text/html"
href="http://example.org/2005/04/02/atom"/>
<link rel="enclosure" type="audio/mpeg" length="1337"
href="http://example.org/audio/ph34r_my_podcast.mp3"/>
<id>tag:example.org,2003:3.2397</id>
<updated>2005-07-31T12:29:29Z</updated>
<published>2003-12-13T08:29:29-04:00</published>
<author>
<name>Mark Pilgrim</name>
<uri>http://example.org/</uri>
<email>[email protected]</email>
</author>
<contributor>
<name>Sam Ruby</name>
</contributor>
<contributor>
<name>Joe Gregorio</name>
</contributor>
<content type="xhtml" xml:lang="en"
xml:base="http://diveintomark.org/">
<div xmlns="http://www.w3.org/1999/xhtml">
<p><i>[Update: The Atom draft is finished.]</i></p>
</div>
</content>
</entry>
</feed>