Documentation. Unit testing. Checkstyle. Findbugs.
1 files added
35 files modified
| | |
| | | - updated: MarkdownPapers 1.1.0
|
| | | - updated: Jetty 7.4.3
|
| | |
|
| | | issues & binaries @ [Google Code][googlecode]<br/>
|
| | | issues, binaries, and sources @ [Google Code][googlecode]<br/>
|
| | | sources @ [Github][gitbltsrc]
|
| | |
|
| | | ### License
|
| | |
| | | * doFilter does the actual work of preprocessing the request to ensure that
|
| | | * the user may proceed.
|
| | | *
|
| | | * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
|
| | | * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
|
| | | * javax.servlet.ServletResponse, javax.servlet.FilterChain)
|
| | | */
|
| | | @Override
|
| | | public void doFilter(final ServletRequest request, final ServletResponse response,
|
| | |
| | |
|
| | | public static final String BORDER = "***********************************************************";
|
| | |
|
| | | /**
|
| | | * Enumeration representing the 4 access restriction levels.
|
| | | */
|
| | | public static enum AccessRestrictionType {
|
| | | NONE, PUSH, CLONE, VIEW;
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * JCommander Parameters class for GitBlitServer.
|
| | | */
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | |
| | | jc.usage();
|
| | | }
|
| | | File keystore = new File("keystore");
|
| | | generateSelfSignedCertificate(params.hostname, keystore, params.storePassword, params.subject);
|
| | | generateSelfSignedCertificate(params.hostname, keystore, params.storePassword,
|
| | | params.subject);
|
| | | }
|
| | |
|
| | | public static void generateSelfSignedCertificate(String hostname, File keystore,
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * JCommander Parameters class for MakeCertificate.
|
| | | */
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | |
| | | */
|
| | | public class Build {
|
| | |
|
| | | /**
|
| | | * BuildType enumeration representing compile-time or runtime. This is used
|
| | | * to download dependencies either for Gitblit GO runtime or for setting up
|
| | | * a development environment.
|
| | | */
|
| | | public static enum BuildType {
|
| | | RUNTIME, COMPILETIME;
|
| | | }
|
| | |
| | | System.out.print("] " + url);
|
| | | }
|
| | |
|
| | | /**
|
| | | * MavenObject represents a complete maven artifact (binary, sources, and
|
| | | * javadoc). MavenObjects can be downloaded and checksummed to confirm
|
| | | * authenticity.
|
| | | */
|
| | | private static class MavenObject {
|
| | |
|
| | | public static final MavenObject JCOMMANDER = new MavenObject("jCommander", "com/beust",
|
| | |
| | | */
|
| | | public class BuildSite {
|
| | |
|
| | | private final static String CASE_SENSITIVE = "CASE-SENSITIVE";
|
| | | private static final String CASE_SENSITIVE = "CASE-SENSITIVE";
|
| | |
|
| | | private final static String RESTART_REQUIRED = "RESTART REQUIRED";
|
| | | private static final String RESTART_REQUIRED = "RESTART REQUIRED";
|
| | |
|
| | | private final static String SINCE = "SINCE";
|
| | | private static final String SINCE = "SINCE";
|
| | |
|
| | | public static void main(String... args) {
|
| | | Params params = new Params();
|
| | |
| | | if (endCode == 0) {
|
| | | strippedContent.append(markdownContent.substring(0, beginCode));
|
| | | } else {
|
| | | strippedContent.append(markdownContent.substring(endCode, beginCode));
|
| | | strippedContent.append(markdownContent
|
| | | .substring(endCode, beginCode));
|
| | | }
|
| | | strippedContent.append(nomarkdownKey);
|
| | | endCode = markdownContent.indexOf(endToken, beginCode);
|
| | |
| | |
|
| | | // get remainder of text
|
| | | if (endCode < markdownContent.length()) {
|
| | | strippedContent.append(markdownContent.substring(endCode, markdownContent.length()));
|
| | | strippedContent.append(markdownContent.substring(endCode,
|
| | | markdownContent.length()));
|
| | | }
|
| | | markdownContent = strippedContent.toString();
|
| | | nmd++;
|
| | |
| | | for (String comment : setting.comments) {
|
| | | if (comment.contains(SINCE) || comment.contains(RESTART_REQUIRED)
|
| | | || comment.contains(CASE_SENSITIVE)) {
|
| | | sb.append(MessageFormat.format("<span style=\"color:#004000;\"># <i>{0}</i></span>", transformMarkdown(comment)));
|
| | | sb.append(MessageFormat.format(
|
| | | "<span style=\"color:#004000;\"># <i>{0}</i></span>",
|
| | | transformMarkdown(comment)));
|
| | | } else {
|
| | | sb.append(MessageFormat.format("<span style=\"color:#004000;\"># {0}</span>", transformMarkdown(comment)));
|
| | | sb.append(MessageFormat.format("<span style=\"color:#004000;\"># {0}</span>",
|
| | | transformMarkdown(comment)));
|
| | | }
|
| | | sb.append("<br/>\n");
|
| | | }
|
| | | if (!StringUtils.isEmpty(setting.name)) {
|
| | | sb.append(MessageFormat.format("<span style=\"color:#000080;\">{0}</span> = <span style=\"color:#800000;\">{1}</span>", setting.name, StringUtils.escapeForHtml(setting.value, false)));
|
| | | sb.append(MessageFormat
|
| | | .format("<span style=\"color:#000080;\">{0}</span> = <span style=\"color:#800000;\">{1}</span>",
|
| | | setting.name, StringUtils.escapeForHtml(setting.value, false)));
|
| | | }
|
| | | sb.append("<br/>\n");
|
| | | }
|
| | |
| | | System.exit(0);
|
| | | }
|
| | |
|
| | | /**
|
| | | * Setting represents a setting with its comments from the properties file.
|
| | | */
|
| | | private static class Setting {
|
| | | final String name;
|
| | | final String value;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * JCommander Parameters class for BuildSite.
|
| | | */
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | |
| | | */
|
| | | public static void createImageThumbnail(String sourceFolder, String destinationFolder,
|
| | | int maxDimension) {
|
| | | if (maxDimension <= 0)
|
| | | if (maxDimension <= 0) {
|
| | | return;
|
| | | }
|
| | | File source = new File(sourceFolder);
|
| | | File destination = new File(destinationFolder);
|
| | | destination.mkdirs();
|
| | |
| | | }
|
| | | }
|
| | | } finally {
|
| | | if (in != null)
|
| | | if (in != null) {
|
| | | in.close();
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * JCommander Parameters class for BuildThumbnails.
|
| | | */
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | |
| | | return key.startsWith(Keys.server._ROOT);
|
| | | }
|
| | |
|
| | | /**
|
| | | * Setting represents a setting and its comments from the properties file.
|
| | | */
|
| | | private static class Setting {
|
| | | final String name;
|
| | | final String value;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * JCommander Parameters class for BuildWebXml.
|
| | | */
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | |
| | |
|
| | | private static final Logger LOGGER = LoggerFactory.getLogger(DiffUtils.class);
|
| | |
|
| | | /**
|
| | | * Enumeration for the diff output types.
|
| | | */
|
| | | public static enum DiffOutputType {
|
| | | PLAIN, GITWEB, GITBLIT;
|
| | |
|
| | |
| | | }
|
| | | long length = 0;
|
| | | for (File file : directory.listFiles()) {
|
| | | if (file.isFile())
|
| | | if (file.isFile()) {
|
| | | length += file.length();
|
| | | else
|
| | | } else {
|
| | | length += folderSize(file);
|
| | | }
|
| | | }
|
| | | return length;
|
| | | }
|
| | | }
|
| | |
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.models.RefModel;
|
| | |
|
| | | /**
|
| | | * Collection of static methods for retrieving information from a repository.
|
| | | * |
| | | * @author James Moger
|
| | | * |
| | | */
|
| | | public class JGitUtils {
|
| | |
|
| | | static final Logger LOGGER = LoggerFactory.getLogger(JGitUtils.class);
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Enumeration of the search types.
|
| | | */
|
| | | public static enum SearchType {
|
| | | AUTHOR, COMMITTER, COMMIT;
|
| | |
|
| | |
| | | */
|
| | | public static String transformMarkdown(String markdown) throws java.text.ParseException {
|
| | | try {
|
| | | return transformMarkdown(new StringReader(markdown));
|
| | | StringReader reader = new StringReader(markdown);
|
| | | String html = transformMarkdown(reader);
|
| | | reader.close();
|
| | | return html;
|
| | | } catch (NullPointerException p) {
|
| | | throw new java.text.ParseException("Markdown string is null!", 0);
|
| | | }
|
| | |
| | | } catch (ParseException p) {
|
| | | throw new java.text.ParseException(p.getMessage(), 0);
|
| | | } finally {
|
| | | try {
|
| | | markdownReader.close();
|
| | | } catch (IOException e) {
|
| | | // IGNORE
|
| | | }
|
| | | try {
|
| | | writer.close();
|
| | | } catch (IOException e) {
|
| | |
| | | return patch.toString();
|
| | | }
|
| | |
|
| | | /**
|
| | | * Class that represents the number of insertions and deletions from a
|
| | | * chunk.
|
| | | */
|
| | | private static class PatchTouple {
|
| | | int insertions;
|
| | | int deletions;
|
| | |
| | | * @return the string representation of the duration OR the css class
|
| | | */
|
| | | private static String timeAgo(Date date, boolean css) {
|
| | | String ago = null;
|
| | | if (isToday(date) || isYesterday(date)) {
|
| | | int mins = minutesAgo(date, true);
|
| | | if (mins >= 120) {
|
| | |
| | | }
|
| | | int hours = hoursAgo(date, true);
|
| | | if (hours > 23) {
|
| | | ago = "yesterday";
|
| | | return "yesterday";
|
| | | } else {
|
| | | ago = hours + " hours ago";
|
| | | return hours + " hours ago";
|
| | | }
|
| | | } else {
|
| | | }
|
| | | if (css) {
|
| | | return "age0";
|
| | | }
|
| | | ago = mins + " min" + (mins > 1 ? "s" : "") + " ago";
|
| | | }
|
| | | return mins + " min" + (mins > 1 ? "s" : "") + " ago";
|
| | | } else {
|
| | | if (css) {
|
| | | return "age2";
|
| | |
| | | int days = daysAgo(date, true);
|
| | | if (days < 365) {
|
| | | if (days <= 30) {
|
| | | ago = days + " days ago";
|
| | | return days + " days ago";
|
| | | } else if (days <= 90) {
|
| | | int weeks = days / 7;
|
| | | if (weeks == 12) {
|
| | | ago = "3 months ago";
|
| | | return "3 months ago";
|
| | | } else {
|
| | | ago = weeks + " weeks ago";
|
| | | return weeks + " weeks ago";
|
| | | }
|
| | | } else if (days > 90) {
|
| | | }
|
| | | int months = days / 30;
|
| | | int weeks = (days % 30) / 7;
|
| | | if (weeks >= 2) {
|
| | | months++;
|
| | | }
|
| | | ago = months + " months ago";
|
| | | }
|
| | | return months + " months ago";
|
| | | } else if (days == 365) {
|
| | | ago = "1 year ago";
|
| | | return "1 year ago";
|
| | | } else {
|
| | | int yr = days / 365;
|
| | | days = days % 365;
|
| | | int months = (yr * 12) + (days / 30);
|
| | | if (months > 23) {
|
| | | ago = yr + " years ago";
|
| | | return yr + " years ago";
|
| | | } else {
|
| | | ago = months + " months ago";
|
| | | return months + " months ago";
|
| | | }
|
| | | }
|
| | | }
|
| | | return ago;
|
| | | }
|
| | | }
|
| | |
| | | import org.apache.wicket.Session;
|
| | | import org.apache.wicket.markup.html.WebPage;
|
| | | import org.apache.wicket.protocol.http.WebApplication;
|
| | | import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | |
| | | package com.gitblit.wicket;
|
| | |
|
| | | import org.apache.wicket.Page;
|
| | | import org.apache.wicket.protocol.http.WicketURLDecoder;
|
| | | import org.apache.wicket.protocol.http.WicketURLEncoder;
|
| | | import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | |
| | | * Panel fragment for displaying login or logout/change_password links.
|
| | | *
|
| | | */
|
| | | class UserFragment extends Fragment {
|
| | | static class UserFragment extends Fragment {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | |
| | | throw new RestartResponseException(getApplication().getHomePage());
|
| | | }
|
| | |
|
| | | if (!GitBlit.getBoolean(Keys.web.authenticateAdminPages, true) && !GitBlit.getBoolean(Keys.web.authenticateViewPages, false)) {
|
| | | if (!GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)
|
| | | && !GitBlit.getBoolean(Keys.web.authenticateViewPages, false)) {
|
| | | // no authentication enabled
|
| | | throw new RestartResponseException(getApplication().getHomePage());
|
| | | }
|
| | |
| | |
|
| | | public LogoutPage() {
|
| | | GitBlitWebSession.get().invalidate();
|
| | | GitBlit.self().setCookie(((WebResponse) getResponse()), null);
|
| | | GitBlit.self().setCookie((WebResponse) getResponse(), null);
|
| | | setRedirect(true);
|
| | | setResponsePage(getApplication().getHomePage());
|
| | | }
|
| | |
| | | InputStream is = res.getResourceStream().getInputStream();
|
| | | InputStreamReader reader = new InputStreamReader(is);
|
| | | message = MarkdownUtils.transformMarkdown(reader);
|
| | | reader.close();
|
| | | } catch (Throwable t) {
|
| | | message = "Failed to read default welcome message!";
|
| | | error(message, t, false);
|
| | |
| | | add(new Label("repositoryDescription", getRepositoryModel().description));
|
| | | add(new Label("repositoryOwner", getRepositoryModel().owner));
|
| | |
|
| | | add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r, null),
|
| | | getTimeZone()));
|
| | | add(WicketUtils.createTimestampLabel("repositoryLastChange",
|
| | | JGitUtils.getLastChange(r, null), getTimeZone()));
|
| | | if (metricsTotal == null) {
|
| | | add(new Label("branchStats", ""));
|
| | | } else {
|
| | |
| | |
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("branchAuthor", "list", author,
|
| | | SearchPage.class, WicketUtils.newSearchParameter(model.name, entry.getName(),
|
| | | author, SearchType.AUTHOR));
|
| | | SearchPage.class, WicketUtils.newSearchParameter(model.name,
|
| | | entry.getName(), author, SearchType.AUTHOR));
|
| | | setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
|
| | | item.add(authorLink);
|
| | |
|
| | | // short message
|
| | | String shortMessage = entry.getShortMessage();
|
| | | String trimmedMessage = StringUtils.trimShortLog(shortMessage);
|
| | | LinkPanel shortlog = new LinkPanel("branchLog", "list subject",
|
| | | trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
|
| | | model.name, entry.getName()));
|
| | | LinkPanel shortlog = new LinkPanel("branchLog", "list subject", trimmedMessage,
|
| | | CommitPage.class, WicketUtils.newObjectParameter(model.name,
|
| | | entry.getName()));
|
| | | if (!shortMessage.equals(trimmedMessage)) {
|
| | | WicketUtils.setHtmlTooltip(shortlog, shortMessage);
|
| | | }
|
| | |
| | | row.add(new LinkPanel("repositoryDescription", "list", entry.description,
|
| | | SummaryPage.class, pp));
|
| | | if (showSize) {
|
| | | row.add(new Label("repositorySize", byteFormat.format(GitBlit.self().calculateSize(entry))));
|
| | | row.add(new Label("repositorySize", byteFormat.format(GitBlit.self()
|
| | | .calculateSize(entry))));
|
| | | } else {
|
| | | row.add(new Label("repositorySize").setVisible(false));
|
| | | }
|
| | |
| | | // New repository
|
| | | row.add(new Label("repositoryName", entry.name));
|
| | | row.add(new Label("repositoryDescription", entry.description));
|
| | | row.add(new Label("repositorySize", "<span class='empty'>(empty)</span>").setEscapeModelStrings(false));
|
| | | row.add(new Label("repositorySize", "<span class='empty'>(empty)</span>")
|
| | | .setEscapeModelStrings(false));
|
| | | }
|
| | |
|
| | | if (entry.useTickets) {
|
New file |
| | |
| | | /*
|
| | | * 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 java.io.File;
|
| | |
|
| | | import com.gitblit.utils.FileUtils;
|
| | |
|
| | | import junit.framework.TestCase;
|
| | |
|
| | | public class FileUtilsTest extends TestCase {
|
| | |
|
| | | public void testReadContent() throws Exception {
|
| | | File dir = new File(System.getProperty("user.dir"));
|
| | | String rawContent = FileUtils.readContent(new File(dir, "LICENSE"), "\n");
|
| | | assertTrue(rawContent.trim().startsWith("Apache License"));
|
| | | }
|
| | |
|
| | | public void testFolderSize() throws Exception {
|
| | | assertEquals(-1, FileUtils.folderSize(null));
|
| | | assertEquals(-1, FileUtils.folderSize(new File(System.getProperty("user.dir"), "pretend")));
|
| | |
|
| | | File dir = new File(System.getProperty("user.dir"), "distrib");
|
| | | long size = FileUtils.folderSize(dir);
|
| | | assertTrue("size is actually " + size, size >= 470000L);
|
| | |
|
| | | File file = new File(System.getProperty("user.dir"), "LICENSE");
|
| | | size = FileUtils.folderSize(file);
|
| | | assertTrue("size is actually " + size, size == 11556L);
|
| | |
|
| | | }
|
| | | } |
| | |
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.storage.file.FileRepository;
|
| | |
|
| | | import com.gitblit.FileUserService;
|
| | | import com.gitblit.FileSettings;
|
| | | import com.gitblit.FileUserService;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.GitBlitException;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | |
| | |
|
| | | public static Test suite() {
|
| | | TestSuite suite = new TestSuite();
|
| | | suite.addTestSuite(FileUtilsTest.class);
|
| | | suite.addTestSuite(TimeUtilsTest.class);
|
| | | suite.addTestSuite(StringUtilsTest.class);
|
| | | suite.addTestSuite(ByteFormatTest.class);
|
| | |
| | | assertTrue("Helloworld model is null!", model != null);
|
| | | assertTrue(model.toString().equals(
|
| | | GitBlitSuite.getHelloworldRepository().getDirectory().getName()));
|
| | | assertEquals("" + GitBlit.self().calculateSize(model), GitBlit.self().calculateSize(model),
|
| | | 22004L);
|
| | | }
|
| | |
|
| | | public void testUserModel() throws Exception {
|
| | |
| | | assertFalse("Admin can still access repository!", model.canAccessRepository(repository));
|
| | | model.addRepository(repository);
|
| | | assertTrue("Admin can't access repository!", model.canAccessRepository(repository));
|
| | | assertEquals(GitBlit.self().getRepositoryModel(model, "pretend"), null);
|
| | | assertNotNull(GitBlit.self().getRepositoryModel(model, repository));
|
| | | assertTrue(GitBlit.self().getRepositoryModels(model).size() > 0);
|
| | | }
|
| | |
|
| | | public void testAccessRestrictionTypes() throws Exception {
|
| | |
| | |
|
| | | public void testFileSettings() throws Exception {
|
| | | FileSettings settings = new FileSettings("distrib/gitblit.properties");
|
| | | assertTrue(settings.getBoolean("missing", true) == true);
|
| | | assertTrue(settings.getBoolean("missing", true));
|
| | | assertTrue(settings.getString("missing", "default").equals("default"));
|
| | | assertTrue(settings.getInteger("missing", 10) == 10);
|
| | | assertTrue(settings.getInteger("realm.realmFile", 5) == 5);
|
| | |
|
| | | assertTrue(settings.getBoolean("git.enableGitServlet", false) == true);
|
| | | assertTrue(settings.getBoolean("git.enableGitServlet", false));
|
| | | assertTrue(settings.getString("realm.userService", null).equals("users.properties"));
|
| | | assertTrue(settings.getInteger("realm.minPasswordLength", 0) == 5);
|
| | | List<String> mdExtensions = settings.getStrings("web.markdownExtensions");
|
| | |
| | | List<String> keys = settings.getAllKeys("server");
|
| | | assertTrue(keys.size() > 0);
|
| | | assertTrue(keys.contains("server.httpsPort"));
|
| | |
|
| | | assertTrue(settings.getChar("web.forwardSlashCharacter", ' ') == '/');
|
| | | }
|
| | |
|
| | | public void testGitblitSettings() throws Exception {
|
| | | // These are already tested by above test method.
|
| | | assertTrue(GitBlit.getBoolean("missing", true) == true);
|
| | | assertTrue(GitBlit.getBoolean("missing", true));
|
| | | assertTrue(GitBlit.getString("missing", "default").equals("default"));
|
| | | assertTrue(GitBlit.getInteger("missing", 10) == 10);
|
| | | assertTrue(GitBlit.getInteger("realm.userService", 5) == 5);
|
| | |
|
| | | assertTrue(GitBlit.getBoolean("git.enableGitServlet", false) == true);
|
| | | assertTrue(GitBlit.getBoolean("git.enableGitServlet", false));
|
| | | assertTrue(GitBlit.getString("realm.userService", null).equals("users.properties"));
|
| | | assertTrue(GitBlit.getInteger("realm.minPasswordLength", 0) == 5);
|
| | | List<String> mdExtensions = GitBlit.getStrings("web.markdownExtensions");
|
| | |
| | | List<String> keys = GitBlit.getAllKeys("server");
|
| | | assertTrue(keys.size() > 0);
|
| | | assertTrue(keys.contains("server.httpsPort"));
|
| | |
|
| | | assertTrue(GitBlit.getChar("web.forwardSlashCharacter", ' ') == '/');
|
| | | assertFalse(GitBlit.isDebugMode());
|
| | | }
|
| | |
|
| | | public void testAuthentication() throws Exception {
|
| | |
| | | public class MetricUtilsTest extends TestCase {
|
| | |
|
| | | public void testMetrics() throws Exception {
|
| | | Repository repository = GitBlitSuite.getHelloworldRepository();
|
| | | testMetrics(GitBlitSuite.getHelloworldRepository());
|
| | | testMetrics(GitBlitSuite.getBluezGnomeRepository());
|
| | | }
|
| | |
|
| | | private void testMetrics(Repository repository) throws Exception {
|
| | | List<Metric> metrics = MetricUtils.getDateMetrics(repository, null, true, null);
|
| | | repository.close();
|
| | | assertTrue("No date metrics found!", metrics.size() > 0);
|
| | |
| | | Repository repository = GitBlitSuite.getHelloworldRepository();
|
| | | List<RevCommit> commits = JGitUtils.getRevLog(repository, 1);
|
| | | ByteArrayOutputStream os = new ByteArrayOutputStream();
|
| | | SyndicationUtils.toRSS("http://localhost", "Title", "Description", "Repository", commits, os);
|
| | | SyndicationUtils.toRSS("http://localhost", "Title", "Description", "Repository", commits,
|
| | | os);
|
| | | String feed = os.toString();
|
| | | os.close();
|
| | | assertTrue(feed.length() > 100);
|