From 0d3e3ca5b85d7e81066030a5081ea3a9cbe76607 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Thu, 21 Jul 2011 14:48:15 -0400 Subject: [PATCH] Rollback to Jetty 7.4.3 for now. --- tests/com/gitblit/tests/GitBlitSuite.java | 62 ++++++++++++++---------------- 1 files changed, 29 insertions(+), 33 deletions(-) diff --git a/tests/com/gitblit/tests/GitBlitSuite.java b/tests/com/gitblit/tests/GitBlitSuite.java index 97e46c9..bbf7c4b 100644 --- a/tests/com/gitblit/tests/GitBlitSuite.java +++ b/tests/com/gitblit/tests/GitBlitSuite.java @@ -21,16 +21,15 @@ import junit.framework.Test; import junit.framework.TestSuite; -import org.eclipse.jgit.api.CloneCommand; -import org.eclipse.jgit.api.Git; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.storage.file.FileRepository; +import com.gitblit.FileUserService; import com.gitblit.FileSettings; import com.gitblit.GitBlit; import com.gitblit.GitBlitException; -import com.gitblit.JettyLoginService; import com.gitblit.models.RepositoryModel; +import com.gitblit.utils.JGitUtils; public class GitBlitSuite extends TestSetup { public static final File REPOSITORIES = new File("git"); @@ -46,6 +45,7 @@ suite.addTestSuite(ByteFormatTest.class); suite.addTestSuite(MarkdownUtilsTest.class); suite.addTestSuite(JGitUtilsTest.class); + suite.addTestSuite(SyndicationUtilsTest.class); suite.addTestSuite(DiffUtilsTest.class); suite.addTestSuite(MetricUtilsTest.class); suite.addTestSuite(TicgitUtilsTest.class); @@ -61,71 +61,67 @@ return new FileRepository(new File(REPOSITORIES, "ticgit.git")); } + public static Repository getJGitRepository() throws Exception { + return new FileRepository(new File(REPOSITORIES, "test/jgit.git")); + } + + public static Repository getBluezGnomeRepository() throws Exception { + return new FileRepository(new File(REPOSITORIES, "test/bluez-gnome.git")); + } + @Override protected void setUp() throws Exception { FileSettings settings = new FileSettings("distrib/gitblit.properties"); GitBlit.self().configureContext(settings); - JettyLoginService loginService = new JettyLoginService(new File("distrib/users.properties")); - loginService.loadUsers(); - GitBlit.self().setLoginService(loginService); + FileUserService loginService = new FileUserService(new File("distrib/users.properties")); + GitBlit.self().setUserService(loginService); if (REPOSITORIES.exists() || REPOSITORIES.mkdirs()) { - cloneOrFetch("helloworld.git", "https://github.com/git/hello-world.git", true); - cloneOrFetch("nested/helloworld.git", "https://github.com/git/hello-world.git", true); - cloneOrFetch("ticgit.git", "https://github.com/jeffWelling/ticgit.git", true); + cloneOrFetch("helloworld.git", "https://github.com/git/hello-world.git"); + cloneOrFetch("ticgit.git", "https://github.com/jeffWelling/ticgit.git"); + cloneOrFetch("test/bluez-gnome.git", + "https://git.kernel.org/pub/scm/bluetooth/bluez-gnome.git"); + cloneOrFetch("test/jgit.git", "https://github.com/eclipse/jgit.git"); + cloneOrFetch("test/helloworld.git", "https://github.com/git/hello-world.git"); enableTickets("ticgit.git"); enableDocs("ticgit.git"); showRemoteBranches("ticgit.git"); + showRemoteBranches("test/jgit.git"); } } - private void cloneOrFetch(String toFolder, String fromUrl, boolean bare) throws Exception { - File folder = new File(REPOSITORIES, toFolder + (bare ? "" : "/.git")); - if (folder.exists()) { - System.out.print("Updating " + (bare ? "bare " : " ") + toFolder + "... "); - FileRepository repository = new FileRepository(new File(REPOSITORIES, toFolder)); - Git git = new Git(repository); - git.fetch().call(); - repository.close(); - System.out.println("done."); - } else { - System.out.println("Cloning " + (bare ? "bare " : " ") + toFolder + "... "); - CloneCommand clone = new CloneCommand(); - clone.setBare(bare); - clone.setCloneAllBranches(true); - clone.setURI(fromUrl); - clone.setDirectory(folder); - clone.call(); - System.out.println("done."); - } + private void cloneOrFetch(String name, String fromUrl) throws Exception { + System.out.print("Fetching " + name + "... "); + JGitUtils.cloneRepository(REPOSITORIES, name, fromUrl); + System.out.println("done."); } private void enableTickets(String repositoryName) { try { RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName); model.useTickets = true; - GitBlit.self().editRepositoryModel(model.name, model, false); + GitBlit.self().updateRepositoryModel(model.name, model, false); } catch (GitBlitException g) { g.printStackTrace(); } } - + private void enableDocs(String repositoryName) { try { RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName); model.useDocs = true; - GitBlit.self().editRepositoryModel(model.name, model, false); + GitBlit.self().updateRepositoryModel(model.name, model, false); } catch (GitBlitException g) { g.printStackTrace(); } } - + private void showRemoteBranches(String repositoryName) { try { RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName); model.showRemoteBranches = true; - GitBlit.self().editRepositoryModel(model.name, model, false); + GitBlit.self().updateRepositoryModel(model.name, model, false); } catch (GitBlitException g) { g.printStackTrace(); } -- Gitblit v1.9.1