Skip to content
Merged
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 @@ -40,10 +40,9 @@ Licensed to the Apache Software Foundation (ASF) under one

public class RSSGeneratorTest {

TestEngine m_testEngine = TestEngine.build( with( RSSGenerator.PROP_GENERATE_RSS, "true" ) );

@Test
public void testBlogRSS() throws Exception {
TestEngine m_testEngine = TestEngine.build( with( RSSGenerator.PROP_GENERATE_RSS, "true" ) );
final WeblogEntryPlugin plugin = new WeblogEntryPlugin();
m_testEngine.saveText( "TestBlog", "Foo1" );
String newPage = plugin.getNewEntryPage( m_testEngine, "TestBlog" );
Expand All @@ -57,29 +56,8 @@ public void testBlogRSS() throws Exception {
final List< Page > entries = blogplugin.findBlogEntries( m_testEngine, "TestBlog", new Date( 0 ), new Date( Long.MAX_VALUE ) );
final Feed feed = new RSS10Feed( context );
final String blog = gen.generateBlogRSS( context, entries, feed );

m_testEngine.shutdown();
Assertions.assertTrue( blog.contains( "<description>Foo</description>" ), "has Foo" );
Assertions.assertTrue( blog.contains( "&lt;b&gt;Bar&lt;/b&gt;" ), "has proper Bar" );
}

@Test
public void testBlogRSS2() throws Exception {
final WeblogEntryPlugin plugin = new WeblogEntryPlugin();
m_testEngine.saveText( "TestBlog", "Foo1" );
String newPage = plugin.getNewEntryPage( m_testEngine, "TestBlog" );
m_testEngine.saveText( newPage, "!Title1\r\nFoo \"blah\"." );
newPage = plugin.getNewEntryPage( m_testEngine, "TestBlog" );
m_testEngine.saveText( newPage, "!Title2\r\n__Bar__" );

final RSSGenerator gen = m_testEngine.getManager( RSSGenerator.class );
final Context context = Wiki.context().create( m_testEngine, m_testEngine.getManager( PageManager.class ).getPage( "TestBlog" ) );
final WeblogPlugin blogplugin = new WeblogPlugin();
final List< Page > entries = blogplugin.findBlogEntries( m_testEngine, "TestBlog", new Date( 0 ), new Date( Long.MAX_VALUE ) );
final Feed feed = new RSS20Feed( context );
final String blog = gen.generateBlogRSS( context, entries, feed );

Assertions.assertTrue( blog.contains( "<description>Foo &amp;quot;blah&amp;quot;.</description>" ), "has Foo" );
Assertions.assertTrue( blog.contains( "&lt;b&gt;Bar&lt;/b&gt;" ), "has proper Bar" );
}

}