James Moger
2011-10-28 c75304637f5535e634e57d4ed933c0fdb594d890
tests/com/gitblit/tests/SyndicationUtilsTest.java
@@ -23,8 +23,10 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.client.GitblitFeed;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.SyndicationUtils;
import com.sun.syndication.feed.synd.SyndFeed;
public class SyndicationUtilsTest extends TestCase {
@@ -32,11 +34,20 @@
      Repository repository = GitBlitSuite.getHelloworldRepository();
      List<RevCommit> commits = JGitUtils.getRevLog(repository, 1);
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      SyndicationUtils.toRSS("http://localhost", "Title", "Description", "Repository", commits, os);
      SyndicationUtils.toRSS("http://localhost", "Title", "Description", "Repository", commits,
            os);
      String feed = os.toString();
      os.close();
      assertTrue(feed.length() > 100);
      assertTrue(feed.indexOf("<title>Title</title>") > -1);
      assertTrue(feed.indexOf("<description>Description</description>") > -1);
   }
   public void testFeedRead() throws Exception {
      GitblitFeed reader = new GitblitFeed("https://localhost:8443", "ticgit.git", "master");
      SyndFeed feed = reader.update(5, "admin", "admin".toCharArray());
      assertTrue(feed != null);
      assertTrue(feed.getEntries().size() > 0);
      assertEquals(5, feed.getEntries().size());
   }
}