| | |
| | | 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 {
|
| | |
|
| | |
| | | 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());
|
| | | }
|
| | | } |