federation.proposalsFolder = proposals
federation.defaultFrequency = 60 mins
federation.sets = animal mineral vegetable
-federation.example1.url = https://go.gitblit.com
-federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
-federation.example1.frequency = 120 mins
-federation.example1.folder =
-federation.example1.bare = true
-federation.example1.mirror = true
-federation.example1.mergeAccounts = true
+#federation.example1.url = https://go.gitblit.com
+#federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
+#federation.example1.frequency = 120 mins
+#federation.example1.folder =
+#federation.example1.bare = true
+#federation.example1.mirror = true
+#federation.example1.mergeAccounts = true
server.tempFolder = temp
server.useNio = true
return new FileRepository(new File(REPOSITORIES, "test/jgit.git"));\r
}\r
\r
- public static Repository getBluezGnomeRepository() throws Exception {\r
- return new FileRepository(new File(REPOSITORIES, "test/bluez-gnome.git"));\r
- }\r
-\r
public static Repository getAmbitionRepository() throws Exception {\r
return new FileRepository(new File(REPOSITORIES, "test/ambition.git"));\r
}\r
public static Repository getIssuesTestRepository() throws Exception {\r
return new FileRepository(new File(REPOSITORIES, "gb-issues.git"));\r
}\r
+ \r
+ public static Repository getGitectiveRepository() throws Exception {\r
+ return new FileRepository(new File("test/gitective.git"));\r
+ }\r
\r
public static boolean startGitblit() throws Exception {\r
if (started.get()) {\r
cloneOrFetch("test/helloworld.git", "https://github.com/git/hello-world.git");\r
cloneOrFetch("test/ambition.git", "https://github.com/defunkt/ambition.git");\r
cloneOrFetch("test/theoretical-physics.git", "https://github.com/certik/theoretical-physics.git");\r
+ cloneOrFetch("test/gitective.git", "https://github.com/kevinsawicki/gitective.git");\r
\r
JGitUtils.createRepository(REPOSITORIES, "gb-issues.git").close();\r
\r
public class IssuesTest {\r
\r
@Test\r
- public void testCreation() throws Exception {\r
+ public void testLifecycle() throws Exception {\r
Repository repository = GitBlitSuite.getIssuesTestRepository();\r
- // create and insert the issue\r
+ \r
+ // create and insert an issue\r
Change c1 = newChange("testCreation() " + Long.toHexString(System.currentTimeMillis()));\r
IssueModel issue = IssueUtils.createIssue(repository, c1);\r
assertNotNull(issue.id);\r
compare(issue, constructed);\r
\r
assertEquals(1, constructed.changes.size());\r
- }\r
-\r
- @Test\r
- public void testUpdates() throws Exception {\r
- Repository repository = GitBlitSuite.getIssuesTestRepository();\r
+ \r
// C1: create the issue\r
- Change c1 = newChange("testUpdates() " + Long.toHexString(System.currentTimeMillis()));\r
- IssueModel issue = IssueUtils.createIssue(repository, c1);\r
+ c1 = newChange("testUpdates() " + Long.toHexString(System.currentTimeMillis()));\r
+ issue = IssueUtils.createIssue(repository, c1);\r
assertNotNull(issue.id);\r
\r
- IssueModel constructed = IssueUtils.getIssue(repository, issue.id);\r
+ constructed = IssueUtils.getIssue(repository, issue.id);\r
compare(issue, constructed);\r
+ assertEquals(1, constructed.changes.size());\r
\r
// C2: set owner\r
Change c2 = new Change("C2");\r
assertEquals(5, constructed.changes.size());\r
assertTrue(constructed.status.isClosed());\r
\r
- repository.close();\r
- }\r
-\r
- @Test\r
- public void testQuery() throws Exception {\r
- Repository repository = GitBlitSuite.getIssuesTestRepository();\r
List<IssueModel> allIssues = IssueUtils.getIssues(repository, null);\r
-\r
List<IssueModel> openIssues = IssueUtils.getIssues(repository, new IssueFilter() {\r
@Override\r
public boolean accept(IssueModel issue) {\r
return !issue.status.isClosed();\r
}\r
});\r
-\r
List<IssueModel> closedIssues = IssueUtils.getIssues(repository, new IssueFilter() {\r
@Override\r
public boolean accept(IssueModel issue) {\r
}\r
});\r
\r
- repository.close();\r
assertTrue(allIssues.size() > 0);\r
assertEquals(1, openIssues.size());\r
assertEquals(1, closedIssues.size());\r
- }\r
-\r
- @Test\r
- public void testLuceneIndexAndQuery() throws Exception { \r
- Repository repository = GitBlitSuite.getIssuesTestRepository();\r
+ \r
+ // build a new Lucene index\r
LuceneUtils.deleteIndex(repository);\r
- List<IssueModel> allIssues = IssueUtils.getIssues(repository, null);\r
- assertTrue(allIssues.size() > 0);\r
- for (IssueModel issue : allIssues) {\r
- LuceneUtils.index(repository, issue, false);\r
+ for (IssueModel anIssue : allIssues) {\r
+ LuceneUtils.index(repository, anIssue, false);\r
}\r
List<SearchResult> hits = LuceneUtils.search("working", 10, repository);\r
assertTrue(hits.size() > 0);\r
\r
// reindex an issue\r
- IssueModel issue = allIssues.get(0);\r
+ issue = allIssues.get(0);\r
Change change = new Change("reindex");\r
change.comment("this is a test of reindexing an issue");\r
IssueUtils.updateIssue(repository, issue.id, change);\r
issue = IssueUtils.getIssue(repository, issue.id);\r
LuceneUtils.index(repository, issue, true);\r
- \r
- LuceneUtils.close();\r
- repository.close();\r
- }\r
- \r
- @Test\r
- public void testLuceneQuery() throws Exception {\r
- Repository repository = GitBlitSuite.getIssuesTestRepository();\r
- List<SearchResult> hits = LuceneUtils.search("working", 10, repository);\r
- LuceneUtils.close();\r
- repository.close();\r
- assertTrue(hits.size() > 0);\r
- }\r
-\r
\r
- @Test\r
- public void testDelete() throws Exception {\r
- Repository repository = GitBlitSuite.getIssuesTestRepository();\r
- List<IssueModel> allIssues = IssueUtils.getIssues(repository, null);\r
// delete all issues\r
- for (IssueModel issue : allIssues) {\r
- assertTrue(IssueUtils.deleteIssue(repository, issue.id, "D"));\r
+ for (IssueModel anIssue : allIssues) {\r
+ assertTrue(IssueUtils.deleteIssue(repository, anIssue.id, "D"));\r
}\r
+ \r
+ LuceneUtils.close();\r
repository.close();\r
}\r
-\r
+ \r
@Test\r
public void testChangeComment() throws Exception {\r
Repository repository = GitBlitSuite.getIssuesTestRepository();\r
}\r
repository.close();\r
\r
- repository = GitBlitSuite.getBluezGnomeRepository();\r
+ repository = GitBlitSuite.getGitectiveRepository();\r
for (RefModel model : JGitUtils.getTags(repository, true, -1)) {\r
- if (model.getObjectId().getName().equals("728643ec0c438c77e182898c2f2967dbfdc231c8")) {\r
+ if (model.getObjectId().getName().equals("035254295a9bba11f72b1f9d6791a6b957abee7b")) {\r
assertFalse(model.isAnnotatedTag());\r
- assertTrue(model.getAuthorIdent().getEmailAddress().equals("marcel@holtmann.org"));\r
- assertEquals("Update changelog and bump version number\n", model.getFullMessage());\r
+ assertTrue(model.getAuthorIdent().getEmailAddress().equals("kevinsawicki@gmail.com"));\r
+ assertEquals("Add scm and issue tracker elements to pom.xml\n", model.getFullMessage());\r
}\r
}\r
repository.close();\r
LuceneUtils.index(repository);\r
repository.close();\r
\r
- // reindex bluez-gnome\r
- repository = GitBlitSuite.getBluezGnomeRepository();\r
+ // reindex JGit\r
+ repository = GitBlitSuite.getJGitRepository();\r
LuceneUtils.index(repository);\r
repository.close();\r
\r
Repository repository = GitBlitSuite.getHelloworldRepository();\r
List<SearchResult> results = LuceneUtils.search("ada", 10, repository);\r
assertEquals(2, results.size());\r
+ for (SearchResult res : results) {\r
+ assertEquals("refs/heads/master", res.branch);\r
+ }\r
\r
// author test\r
results = LuceneUtils.search("author: tinogomes", 10, repository);\r
assertEquals(1, results.size());\r
assertEquals("Ondrej Certik", results.get(0).author);\r
assertEquals("2648c0c98f2101180715b4d432fc58d0e21a51d7", results.get(0).id);\r
+ assertEquals("refs/heads/gh-pages", results.get(0).branch);\r
\r
// tag test\r
results = LuceneUtils.search("\"qft split\"", 10, repository);\r
repository.close();\r
\r
// annotated tag test\r
- repository = GitBlitSuite.getBluezGnomeRepository();\r
- results = LuceneUtils.search("\"release 1.8\"", 10, repository);\r
+ repository = GitBlitSuite.getJGitRepository();\r
+ results = LuceneUtils.search("I663208919f297836a9c16bf458e4a43ffaca4c12", 10, repository);\r
assertEquals(1, results.size());\r
- assertEquals("[1.8]", results.get(0).labels.toString());\r
+ assertEquals("[v1.3.0.201202151440-r]", results.get(0).labels.toString());\r
\r
repository.close();\r
\r
public void testMultiSearch() throws Exception {\r
List<SearchResult> results = LuceneUtils.search("test", 10,\r
GitBlitSuite.getHelloworldRepository(), \r
- GitBlitSuite.getBluezGnomeRepository());\r
+ GitBlitSuite.getJGitRepository());\r
LuceneUtils.close();\r
assertEquals(10, results.size());\r
}\r
@Test\r
public void testMetrics() throws Exception {\r
testMetrics(GitBlitSuite.getHelloworldRepository());\r
- testMetrics(GitBlitSuite.getBluezGnomeRepository());\r
+ testMetrics(GitBlitSuite.getJGitRepository());\r
}\r
\r
private void testMetrics(Repository repository) throws Exception {\r