From 9ff0c16b05cb0eb7c3cc63eda763b0f75d84853c Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 8 May 2014 13:09:08 -0400 Subject: Change enum name and unit test RSS tag queries --- .../com/gitblit/tests/SyndicationUtilsTest.java | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/test/java/com/gitblit') diff --git a/src/test/java/com/gitblit/tests/SyndicationUtilsTest.java b/src/test/java/com/gitblit/tests/SyndicationUtilsTest.java index d206bbdb..b4bb044f 100644 --- a/src/test/java/com/gitblit/tests/SyndicationUtilsTest.java +++ b/src/test/java/com/gitblit/tests/SyndicationUtilsTest.java @@ -21,7 +21,10 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import com.gitblit.Constants.SearchType; @@ -30,6 +33,20 @@ import com.gitblit.utils.SyndicationUtils; public class SyndicationUtilsTest extends GitblitUnitTest { + private static final AtomicBoolean started = new AtomicBoolean(false); + + @BeforeClass + public static void startGitblit() throws Exception { + started.set(GitBlitSuite.startGitblit()); + } + + @AfterClass + public static void stopGitblit() throws Exception { + if (started.get()) { + GitBlitSuite.stopGitblit(); + } + } + @Test public void testSyndication() throws Exception { List entries = new ArrayList(); @@ -60,7 +77,7 @@ public class SyndicationUtilsTest extends GitblitUnitTest { } @Test - public void testFeedRead() throws Exception { + public void testFeedReadCommits() throws Exception { Set links = new HashSet(); for (int i = 0; i < 2; i++) { List feed = SyndicationUtils.readFeed(GitBlitSuite.url, "ticgit.git", @@ -76,6 +93,23 @@ public class SyndicationUtilsTest extends GitblitUnitTest { assertEquals("Feed pagination failed", 10, links.size()); } + @Test + public void testFeedReadTags() throws Exception { + Set links = new HashSet(); + for (int i = 0; i < 2; i++) { + List feed = SyndicationUtils.readTags(GitBlitSuite.url, "test/gitective.git", + 5, i, GitBlitSuite.account, GitBlitSuite.password.toCharArray()); + assertTrue(feed != null); + assertTrue(feed.size() > 0); + assertEquals(5, feed.size()); + for (FeedEntryModel entry : feed) { + links.add(entry.link); + } + } + // confirm we have 10 unique tags + assertEquals("Feed pagination failed", 10, links.size()); + } + @Test public void testSearchFeedRead() throws Exception { List feed = SyndicationUtils -- cgit v1.2.3