From 0e44acbb2fec928a1606dc60f427a148fff405c9 Mon Sep 17 00:00:00 2001
From: Mohamed Ragab <moragab@gmail.com>
Date: Wed, 02 May 2012 11:15:01 -0400
Subject: [PATCH] Added a script to facilitate setting the proxy host and port and no proxy hosts, and then it concatenates all the java system properties for setting the java proxy configurations and puts the resulting string in an environment variable JAVA_PROXY_CONFIG, modified the scirpts gitblit, gitblit-ubuntu, and gitblit-centos to source the java-proxy-config.sh script and then include the resulting java proxy configuration in the java command
---
tests/com/gitblit/tests/DiffUtilsTest.java | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/tests/com/gitblit/tests/DiffUtilsTest.java b/tests/com/gitblit/tests/DiffUtilsTest.java
index 34cb853..53eff31 100644
--- a/tests/com/gitblit/tests/DiffUtilsTest.java
+++ b/tests/com/gitblit/tests/DiffUtilsTest.java
@@ -15,17 +15,31 @@
*/
package com.gitblit.tests;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.junit.Test;
+import com.gitblit.models.AnnotatedLine;
import com.gitblit.utils.DiffUtils;
+import com.gitblit.utils.DiffUtils.DiffOutputType;
import com.gitblit.utils.JGitUtils;
-import com.gitblit.utils.JGitUtils.DiffOutputType;
-public class DiffUtilsTest extends TestCase {
+public class DiffUtilsTest {
+ @Test
+ public void testDiffOutputTypes() throws Exception {
+ assertEquals(DiffOutputType.PLAIN, DiffOutputType.forName("plain"));
+ assertEquals(DiffOutputType.GITWEB, DiffOutputType.forName("gitweb"));
+ assertEquals(DiffOutputType.GITBLIT, DiffOutputType.forName("gitblit"));
+ assertEquals(null, DiffOutputType.forName(null));
+ }
+
+ @Test
public void testParentCommitDiff() throws Exception {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit commit = JGitUtils.getCommit(repository,
@@ -37,6 +51,7 @@
assertTrue(diff.indexOf(expected) > -1);
}
+ @Test
public void testArbitraryCommitDiff() throws Exception {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit baseCommit = JGitUtils.getCommit(repository,
@@ -50,6 +65,7 @@
assertTrue(diff.indexOf(expected) > -1);
}
+ @Test
public void testPlainFileDiff() throws Exception {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit commit = JGitUtils.getCommit(repository,
@@ -61,6 +77,7 @@
assertTrue(diff.indexOf(expected) > -1);
}
+ @Test
public void testFilePatch() throws Exception {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit commit = JGitUtils.getCommit(repository,
@@ -72,6 +89,7 @@
assertTrue(patch.indexOf(expected) > -1);
}
+ @Test
public void testArbitraryFilePatch() throws Exception {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit baseCommit = JGitUtils.getCommit(repository,
@@ -85,6 +103,7 @@
assertTrue(patch.indexOf(expected) > -1);
}
+ @Test
public void testArbitraryCommitPatch() throws Exception {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit baseCommit = JGitUtils.getCommit(repository,
@@ -97,4 +116,14 @@
String expected = "- system.out.println(\"Hello World\");\n+ System.out.println(\"Hello World\"";
assertTrue(patch.indexOf(expected) > -1);
}
+
+ @Test
+ public void testBlame() throws Exception {
+ Repository repository = GitBlitSuite.getHelloworldRepository();
+ List<AnnotatedLine> lines = DiffUtils.blame(repository, "java.java",
+ "1d0c2933a4ae69c362f76797d42d6bd182d05176");
+ repository.close();
+ assertTrue(lines.size() > 0);
+ assertEquals("c6d31dccf5cc75e8e46299fc62d38f60ec6d41e0", lines.get(0).commitId);
+ }
}
--
Gitblit v1.9.1