From 5dd8057b49803a7c1b84112418dcfca7b256fce0 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 6 Sep 2013 18:01:33 -0400 Subject: Remove incomplete and deprecated TicGit feature Change-Id: Idb7de272589e086da9b2b3a241dcd082c1c8f27b --- src/test/java/com/gitblit/tests/GitBlitSuite.java | 33 ++++---- .../java/com/gitblit/tests/TicgitUtilsTest.java | 87 ---------------------- 2 files changed, 17 insertions(+), 103 deletions(-) delete mode 100644 src/test/java/com/gitblit/tests/TicgitUtilsTest.java (limited to 'src/test/java') diff --git a/src/test/java/com/gitblit/tests/GitBlitSuite.java b/src/test/java/com/gitblit/tests/GitBlitSuite.java index c198e57a..51f05a91 100644 --- a/src/test/java/com/gitblit/tests/GitBlitSuite.java +++ b/src/test/java/com/gitblit/tests/GitBlitSuite.java @@ -43,21 +43,21 @@ import com.gitblit.utils.JGitUtils; * The GitBlitSuite uses test-gitblit.properties and test-users.conf. The suite * is fairly comprehensive for all lower-level functionality. Wicket pages are * currently not unit-tested. - * + * * This suite starts a Gitblit server instance within the same JVM instance as * the unit tests. This allows the unit tests to access the GitBlit static * singleton while also being able to communicate with the instance via tcp/ip * for testing rpc requests, federation requests, and git servlet operations. - * + * * @author James Moger - * + * */ @RunWith(Suite.class) @SuiteClasses({ ArrayUtilsTest.class, FileUtilsTest.class, TimeUtilsTest.class, StringUtilsTest.class, Base64Test.class, JsonUtilsTest.class, ByteFormatTest.class, ObjectCacheTest.class, PermissionsTest.class, UserServiceTest.class, LdapUserServiceTest.class, MarkdownUtilsTest.class, JGitUtilsTest.class, SyndicationUtilsTest.class, - DiffUtilsTest.class, MetricUtilsTest.class, TicgitUtilsTest.class, X509UtilsTest.class, + DiffUtilsTest.class, MetricUtilsTest.class, X509UtilsTest.class, GitBlitTest.class, FederationTests.class, RpcTests.class, GitServletTest.class, GitDaemonTest.class, GroovyScriptTest.class, LuceneExecutorTest.class, IssuesTest.class, RepositoryModelTest.class, FanoutServiceTest.class, Issue0259Test.class, Issue0271Test.class, HtpasswdUserServiceTest.class, @@ -65,9 +65,9 @@ import com.gitblit.utils.JGitUtils; public class GitBlitSuite { public static final File REPOSITORIES = new File("data/git"); - + public static final File SETTINGS = new File("src/test/config/test-gitblit.properties"); - + public static final File USERSCONF = new File("src/test/config/test-users.conf"); static int port = 8280; @@ -102,11 +102,11 @@ public class GitBlitSuite { JGitUtils.createRepository(REPOSITORIES, "gb-issues.git").close(); return getRepository("gb-issues.git"); } - + public static Repository getGitectiveRepository() throws Exception { return getRepository("test/gitective.git"); } - + private static Repository getRepository(String name) throws Exception { File gitDir = FileKey.resolve(new File(REPOSITORIES, name), FS.DETECTED); Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build(); @@ -118,11 +118,12 @@ public class GitBlitSuite { // already started return false; } - + GitServletTest.deleteWorkingFolders(); - + // Start a Gitblit instance Executors.newSingleThreadExecutor().execute(new Runnable() { + @Override public void run() { GitBlitServer.main("--httpPort", "" + port, "--httpsPort", "0", "--shutdownPort", "" + shutdownPort, "--gitPort", "" + gitPort, "--repositoriesFolder", @@ -158,13 +159,13 @@ public class GitBlitSuite { cloneOrFetch("test/helloworld.git", "https://github.com/git/hello-world.git"); cloneOrFetch("test/ambition.git", "https://github.com/defunkt/ambition.git"); cloneOrFetch("test/gitective.git", "https://github.com/kevinsawicki/gitective.git"); - + enableTickets("ticgit.git"); enableDocs("ticgit.git"); showRemoteBranches("ticgit.git"); automaticallyTagBranchTips("ticgit.git"); showRemoteBranches("test/jgit.git"); - automaticallyTagBranchTips("test/jgit.git"); + automaticallyTagBranchTips("test/jgit.git"); } } @@ -212,7 +213,7 @@ public class GitBlitSuite { g.printStackTrace(); } } - + private static void automaticallyTagBranchTips(String repositoryName) { try { RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName); @@ -222,7 +223,7 @@ public class GitBlitSuite { g.printStackTrace(); } } - + public static void close(File repository) { try { File gitDir = FileKey.resolve(repository, FS.detect()); @@ -233,11 +234,11 @@ public class GitBlitSuite { e.printStackTrace(); } } - + public static void close(Git git) { close(git.getRepository()); } - + public static void close(Repository r) { RepositoryCache.close(r); diff --git a/src/test/java/com/gitblit/tests/TicgitUtilsTest.java b/src/test/java/com/gitblit/tests/TicgitUtilsTest.java deleted file mode 100644 index 74f9e44e..00000000 --- a/src/test/java/com/gitblit/tests/TicgitUtilsTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2011 gitblit.com. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.gitblit.tests; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.eclipse.jgit.lib.Repository; -import org.junit.Test; - -import com.gitblit.models.RefModel; -import com.gitblit.models.TicketModel; -import com.gitblit.models.TicketModel.Comment; -import com.gitblit.utils.TicgitUtils; - -public class TicgitUtilsTest { - - @Test - public void testTicgitBranch() throws Exception { - Repository repository = GitBlitSuite.getTicgitRepository(); - RefModel branch = TicgitUtils.getTicketsBranch(repository); - repository.close(); - assertNotNull("Ticgit branch does not exist!", branch); - - repository = GitBlitSuite.getHelloworldRepository(); - branch = TicgitUtils.getTicketsBranch(repository); - repository.close(); - assertNull("Ticgit branch exists!", branch); - } - - @Test - public void testRetrieveTickets() throws Exception { - Repository repository = GitBlitSuite.getTicgitRepository(); - List ticketsA = TicgitUtils.getTickets(repository); - List ticketsB = TicgitUtils.getTickets(repository); - repository.close(); - assertTrue("No tickets found!", ticketsA.size() > 0); - for (int i = 0; i < ticketsA.size(); i++) { - TicketModel ticketA = ticketsA.get(i); - TicketModel ticketB = ticketsB.get(i); - assertTrue("Tickets are not equal!", ticketA.equals(ticketB)); - assertFalse(ticketA.equals("")); - assertTrue(ticketA.hashCode() == ticketA.id.hashCode()); - for (int j = 0; j < ticketA.comments.size(); j++) { - Comment commentA = ticketA.comments.get(j); - Comment commentB = ticketB.comments.get(j); - assertTrue("Comments are not equal!", commentA.equals(commentB)); - assertFalse(commentA.equals("")); - assertEquals(commentA.hashCode(), commentA.text.hashCode()); - } - } - - repository = GitBlitSuite.getHelloworldRepository(); - List ticketsC = TicgitUtils.getTickets(repository); - repository.close(); - assertNull(ticketsC); - } - - @Test - public void testReadTicket() throws Exception { - Repository repository = GitBlitSuite.getTicgitRepository(); - List tickets = TicgitUtils.getTickets(repository); - TicketModel ticket = TicgitUtils - .getTicket(repository, tickets.get(tickets.size() - 1).name); - repository.close(); - assertNotNull(ticket); - assertEquals("1206206148_add-attachment-to-ticket_138", ticket.name); - } -} \ No newline at end of file -- cgit v1.2.3