| | |
| | |
|
| | | import com.gitblit.FileSettings;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.GitBlitException;
|
| | | import com.gitblit.JettyLoginService;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | |
|
| | | public class GitBlitSuite extends TestSetup {
|
| | | public static final File REPOSITORIES = new File("git");
|
| | |
| | | suite.addTestSuite(TimeUtilsTest.class);
|
| | | suite.addTestSuite(StringUtilsTest.class);
|
| | | suite.addTestSuite(ByteFormatTest.class);
|
| | | suite.addTestSuite(MarkdownUtilsTest.class);
|
| | | suite.addTestSuite(JGitUtilsTest.class);
|
| | | suite.addTestSuite(DiffUtilsTest.class);
|
| | | suite.addTestSuite(MetricUtilsTest.class);
|
| | |
| | |
|
| | | @Override
|
| | | protected void setUp() throws Exception {
|
| | | 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);
|
| | | }
|
| | | 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);
|
| | |
|
| | | 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);
|
| | |
|
| | | enableTickets("ticgit.git");
|
| | | enableDocs("ticgit.git");
|
| | | showRemoteBranches("ticgit.git");
|
| | | }
|
| | | }
|
| | |
|
| | | private void cloneOrFetch(String toFolder, String fromUrl, boolean bare) throws Exception {
|
| | |
| | | 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);
|
| | | } 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);
|
| | | } 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);
|
| | | } catch (GitBlitException g) {
|
| | | g.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|