summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.test
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2010-12-31 11:44:54 +0100
committerShawn O. Pearce <spearce@spearce.org>2010-12-31 14:00:05 -0800
commitd9e07a574a946693e491668e0d94619bc5d886a5 (patch)
tree5bce4e9d47090d6b427986de4db30be17cc99c6d /org.eclipse.jgit.http.test
parent7cf8b8812f7baa1636c138113f4ed015eed8cc31 (diff)
downloadjgit-d9e07a574a946693e491668e0d94619bc5d886a5.tar.gz
jgit-d9e07a574a946693e491668e0d94619bc5d886a5.zip
Convert all JGit unit tests to JUnit 4
Eclipse has some problem re-running single JUnit tests if the tests are in Junit 3 format, but the JUnit 4 launcher is used. This was quite unnecessary and the move was not completed. We still have no JUnit4 test. This completes the extermination of JUnit3. Most of the work was global searce/replace using regular expression, followed by numerous invocarions of quick-fix and organize imports and verification that we had the same number of tests before and after. - Annotations were introduced. - All references to JUnit3 classes removed - Half-good replacement for getting the test name. This was needed to make the TestRngs work. The initialization of TestRngs was also made lazily since we can not longer find out the test name in runtime in the @Before methods. - Renamed test classes to end with Test, with the exception of TestTranslateBundle, which fails from Maven - Moved JGitTestUtil to the junit support bundle Change-Id: Iddcd3da6ca927a7be773a9c63ebf8bb2147e2d13 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.http.test')
-rw-r--r--org.eclipse.jgit.http.test/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.jgit.http.test/org.eclipse.jgit.core.http--All-Tests (Java 6).launch (renamed from org.eclipse.jgit.http.test/org.eclipse.jgit.core.http --All-Tests (Java 6).launch)0
-rw-r--r--org.eclipse.jgit.http.test/org.eclipse.jgit.core.http--All-Tests.launch (renamed from org.eclipse.jgit.http.test/org.eclipse.jgit.core.http --All-Tests.launch)0
-rw-r--r--org.eclipse.jgit.http.test/org.eclipse.jgit.http--All-Tests.launch2
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java9
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java11
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java16
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java13
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java14
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java15
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ErrorServletTest.java18
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java11
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java18
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java10
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java9
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java18
16 files changed, 142 insertions, 23 deletions
diff --git a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
index 5283e8aeaa..ff4464e6c0 100644
--- a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
@@ -8,7 +8,6 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.servlet;version="[2.5.0,3.0.0)",
javax.servlet.http;version="[2.5.0,3.0.0)",
- junit.framework;version="[4.0.0,5.0.0)",
org.eclipse.jetty.continuation;version="[7.1.0,8.0.0)",
org.eclipse.jetty.http;version="[7.1.0,8.0.0)",
org.eclipse.jetty.http.security;version="[7.1.0,8.0.0)",
diff --git a/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http --All-Tests (Java 6).launch b/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http--All-Tests (Java 6).launch
index 9d2df634cb..9d2df634cb 100644
--- a/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http --All-Tests (Java 6).launch
+++ b/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http--All-Tests (Java 6).launch
diff --git a/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http --All-Tests.launch b/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http--All-Tests.launch
index 961272b020..961272b020 100644
--- a/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http --All-Tests.launch
+++ b/org.eclipse.jgit.http.test/org.eclipse.jgit.core.http--All-Tests.launch
diff --git a/org.eclipse.jgit.http.test/org.eclipse.jgit.http--All-Tests.launch b/org.eclipse.jgit.http.test/org.eclipse.jgit.http--All-Tests.launch
index 819e9827bc..f22dc4bbe9 100644
--- a/org.eclipse.jgit.http.test/org.eclipse.jgit.http--All-Tests.launch
+++ b/org.eclipse.jgit.http.test/org.eclipse.jgit.http--All-Tests.launch
@@ -9,7 +9,7 @@
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.jgit.http.test"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jgit.http.test"/>
</launchConfiguration>
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
index ddb32c94e5..4aa0919a1c 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
@@ -43,6 +43,9 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
@@ -70,13 +73,16 @@ import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;
+import org.junit.Before;
+import org.junit.Test;
public class AdvertiseErrorTest extends HttpTestCase {
private FileRepository remoteRepository;
private URIish remoteURI;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
@@ -120,6 +126,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
cfg.save();
}
+ @Test
public void testPush_CreateBranch() throws Exception {
final TestRepository src = createTestRepository();
final RevBlob Q_txt = src.blob("new text");
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
index 3442af94db..6bdb4969f5 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import javax.servlet.http.HttpServletRequestWrapper;
@@ -54,19 +56,23 @@ import org.eclipse.jgit.http.server.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
+import org.junit.Before;
+import org.junit.Test;
public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
private Repository db;
private AsIsFileService service;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
db = createBareRepository();
service = new AsIsFileService();
}
+ @Test
public void testDisabledSingleton() throws ServiceNotAuthorizedException {
service = AsIsFileService.DISABLED;
try {
@@ -84,12 +90,14 @@ public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_Default() throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
service.access(new R(null, "1.2.3.4"), db);
service.access(new R("bob", "1.2.3.4"), db);
}
+ @Test
public void testCreate_Disabled() throws ServiceNotAuthorizedException,
IOException {
final StoredConfig cfg = db.getConfig();
@@ -111,6 +119,7 @@ public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_Enabled() throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
db.getConfig().setBoolean("http", null, "getanyfile", true);
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
index 81d5f4f51d..ff6c43d454 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
@@ -43,6 +43,11 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import javax.servlet.http.HttpServletRequestWrapper;
@@ -57,19 +62,23 @@ import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.transport.ReceivePack;
+import org.junit.Before;
+import org.junit.Test;
public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
private Repository db;
private ReceivePackFactory factory;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
db = createBareRepository();
factory = new DefaultReceivePackFactory();
}
+ @Test
public void testDisabledSingleton() throws ServiceNotAuthorizedException {
factory = ReceivePackFactory.DISABLED;
@@ -95,6 +104,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_NullUser() throws ServiceNotEnabledException {
try {
factory.create(new R(null, "localhost"), db);
@@ -104,6 +114,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_EmptyStringUser() throws ServiceNotEnabledException {
try {
factory.create(new R("", "localhost"), db);
@@ -113,6 +124,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_AuthUser() throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack rp;
@@ -130,6 +142,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
assertEquals(author.getWhen(), id.getWhen());
}
+ @Test
public void testCreate_Disabled() throws ServiceNotAuthorizedException,
IOException {
final StoredConfig cfg = db.getConfig();
@@ -158,6 +171,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_Enabled() throws ServiceNotEnabledException,
ServiceNotAuthorizedException, IOException {
final StoredConfig cfg = db.getConfig();
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
index 24bf480dd2..def29dc027 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
@@ -43,6 +43,10 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import javax.servlet.http.HttpServletRequestWrapper;
@@ -56,19 +60,23 @@ import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.transport.UploadPack;
+import org.junit.Before;
+import org.junit.Test;
public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
private Repository db;
private UploadPackFactory factory;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
db = createBareRepository();
factory = new DefaultUploadPackFactory();
}
+ @Test
public void testDisabledSingleton() throws ServiceNotAuthorizedException {
factory = UploadPackFactory.DISABLED;
@@ -94,6 +102,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_Default() throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up;
@@ -107,6 +116,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
assertSame(db, up.getRepository());
}
+ @Test
public void testCreate_Disabled() throws ServiceNotAuthorizedException,
IOException {
final StoredConfig cfg = db.getConfig();
@@ -128,6 +138,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testCreate_Enabled() throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
db.getConfig().setBoolean("http", null, "uploadpack", true);
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java
index e6f763c918..5899dd41d2 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java
@@ -46,6 +46,11 @@ package org.eclipse.jgit.http.test;
import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT;
import static org.eclipse.jgit.util.HttpSupport.HDR_PRAGMA;
import static org.eclipse.jgit.util.HttpSupport.HDR_USER_AGENT;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -70,6 +75,8 @@ import org.eclipse.jgit.transport.HttpTransport;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.TransportHttp;
import org.eclipse.jgit.transport.URIish;
+import org.junit.Before;
+import org.junit.Test;
public class DumbClientDumbServerTest extends HttpTestCase {
private Repository remoteRepository;
@@ -80,7 +87,8 @@ public class DumbClientDumbServerTest extends HttpTestCase {
private RevCommit A, B;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
final TestRepository src = createTestRepository();
@@ -102,6 +110,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
src.update(master, B);
}
+ @Test
public void testListRemote() throws IOException {
Repository dst = createBareRepository();
@@ -164,6 +173,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
assertEquals(200, head.getStatus());
}
+ @Test
public void testInitialClone_Loose() throws Exception {
Repository dst = createBareRepository();
assertFalse(dst.hasObject(A_txt));
@@ -186,6 +196,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
assertEquals(200, loose.get(0).getStatus());
}
+ @Test
public void testInitialClone_Packed() throws Exception {
new TestRepository(remoteRepository).packAndPrune();
@@ -225,6 +236,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
assertEquals(200, event.getStatus());
}
+ @Test
public void testPushNotSupported() throws Exception {
final TestRepository src = createTestRepository();
final RevCommit Q = src.commit().create();
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java
index 92a1189043..2347d06cff 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java
@@ -47,6 +47,12 @@ import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT;
import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_TYPE;
import static org.eclipse.jgit.util.HttpSupport.HDR_PRAGMA;
import static org.eclipse.jgit.util.HttpSupport.HDR_USER_AGENT;
+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 static org.junit.Assert.fail;
import java.io.IOException;
import java.util.List;
@@ -75,6 +81,8 @@ import org.eclipse.jgit.transport.HttpTransport;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.TransportHttp;
import org.eclipse.jgit.transport.URIish;
+import org.junit.Before;
+import org.junit.Test;
public class DumbClientSmartServerTest extends HttpTestCase {
private Repository remoteRepository;
@@ -85,7 +93,8 @@ public class DumbClientSmartServerTest extends HttpTestCase {
private RevCommit A, B;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
final TestRepository src = createTestRepository();
@@ -118,6 +127,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
src.update(master, B);
}
+ @Test
public void testListRemote() throws IOException {
Repository dst = createBareRepository();
@@ -179,6 +189,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
assertEquals("text/plain", head.getResponseHeader(HDR_CONTENT_TYPE));
}
+ @Test
public void testInitialClone_Small() throws Exception {
Repository dst = createBareRepository();
assertFalse(dst.hasObject(A_txt));
@@ -204,6 +215,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
.getResponseHeader(HDR_CONTENT_TYPE));
}
+ @Test
public void testInitialClone_Packed() throws Exception {
new TestRepository(remoteRepository).packAndPrune();
@@ -239,6 +251,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
HDR_CONTENT_TYPE));
}
+ @Test
public void testPushNotSupported() throws Exception {
final TestRepository src = createTestRepository();
final RevCommit Q = src.commit().create();
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ErrorServletTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ErrorServletTest.java
index f92052d1c7..dab1074266 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ErrorServletTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ErrorServletTest.java
@@ -43,21 +43,24 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.assertEquals;
+
import java.net.HttpURLConnection;
import java.net.URI;
-import junit.framework.TestCase;
-
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jgit.http.server.glue.ErrorServlet;
import org.eclipse.jgit.junit.http.AppServer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class ErrorServletTest extends TestCase {
+public class ErrorServletTest {
private AppServer server;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
server = new AppServer();
@@ -68,13 +71,14 @@ public class ErrorServletTest extends TestCase {
server.setUp();
}
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
if (server != null) {
server.tearDown();
}
- super.tearDown();
}
+ @Test
public void testHandler() throws Exception {
final URI uri = server.getURI();
assertEquals(404, ((HttpURLConnection) uri.resolve("/404").toURL()
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
index d7ca5900f5..a7e31a5d4c 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
@@ -43,6 +43,13 @@
package org.eclipse.jgit.http.test;
+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 static org.junit.Assert.fail;
+
import java.io.File;
import java.io.IOException;
@@ -51,8 +58,10 @@ import org.eclipse.jgit.http.server.resolver.FileResolver;
import org.eclipse.jgit.http.server.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.Repository;
+import org.junit.Test;
public class FileResolverTest extends LocalDiskRepositoryTestCase {
+ @Test
public void testUnreasonableNames() throws ServiceNotEnabledException {
assertUnreasonable("");
assertUnreasonable("a\\b");
@@ -83,6 +92,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testExportOk() throws IOException {
final Repository a = createBareRepository();
final String name = a.getDirectory().getName();
@@ -116,6 +126,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
}
}
+ @Test
public void testNotAGitRepository() throws IOException,
ServiceNotEnabledException {
final Repository a = createBareRepository();
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java
index d6c1c46e53..78db5747f7 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java
@@ -43,30 +43,35 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.List;
import javax.servlet.ServletException;
-import junit.framework.TestCase;
-
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.junit.http.AppServer;
import org.eclipse.jgit.junit.http.MockServletConfig;
import org.eclipse.jgit.junit.http.RecordingLogger;
+import org.junit.After;
+import org.junit.Test;
-public class GitServletInitTest extends TestCase {
+public class GitServletInitTest {
private AppServer server;
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
if (server != null) {
server.tearDown();
server = null;
}
- super.tearDown();
}
+ @Test
public void testDefaultConstructor_NoBasePath() throws Exception {
GitServlet s = new GitServlet();
try {
@@ -77,6 +82,7 @@ public class GitServletInitTest extends TestCase {
}
}
+ @Test
public void testDefaultConstructor_WithBasePath() throws Exception {
MockServletConfig c = new MockServletConfig();
c.setInitParameter("base-path", ".");
@@ -87,6 +93,7 @@ public class GitServletInitTest extends TestCase {
s.destroy();
}
+ @Test
public void testInitUnderContainer_NoBasePath() throws Exception {
server = new AppServer();
@@ -104,6 +111,7 @@ public class GitServletInitTest extends TestCase {
assertTrue("Wanted base-path", why.getMessage().contains("base-path"));
}
+ @Test
public void testInitUnderContainer_WithBasePath() throws Exception {
server = new AppServer();
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
index b75735dea8..31f4bb4357 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
@@ -43,6 +43,10 @@
package org.eclipse.jgit.http.test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -75,13 +79,16 @@ import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;
+import org.junit.Before;
+import org.junit.Test;
public class HookMessageTest extends HttpTestCase {
private FileRepository remoteRepository;
private URIish remoteURI;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
@@ -130,6 +137,7 @@ public class HookMessageTest extends HttpTestCase {
cfg.save();
}
+ @Test
public void testPush_CreateBranch() throws Exception {
final TestRepository src = createTestRepository();
final RevBlob Q_txt = src.blob("new text");
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
index 6cf282f3be..063d9d4da6 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
@@ -43,6 +43,13 @@
package org.eclipse.jgit.http.test;
+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 static org.junit.Assert.fail;
+
import java.io.File;
import java.net.URI;
import java.util.List;
@@ -86,7 +93,7 @@ public class HttpClientTests extends HttpTestCase {
private URIish smartAuthBasicURI;
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
remoteRepository = createTestRepository();
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index f73f54ffba..e764fe5424 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -46,6 +46,12 @@ package org.eclipse.jgit.http.test;
import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_ENCODING;
import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_LENGTH;
import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_TYPE;
+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 static org.junit.Assert.fail;
import java.io.IOException;
import java.io.PrintWriter;
@@ -92,6 +98,8 @@ import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.TransportHttp;
import org.eclipse.jgit.transport.URIish;
+import org.junit.Before;
+import org.junit.Test;
public class SmartClientSmartServerTest extends HttpTestCase {
private static final String HDR_TRANSFER_ENCODING = "Transfer-Encoding";
@@ -106,7 +114,8 @@ public class SmartClientSmartServerTest extends HttpTestCase {
private RevCommit A, B;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
@@ -165,6 +174,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
src.update("refs/garbage/a/very/long/ref/name/to/compress", B);
}
+ @Test
public void testListRemote() throws IOException {
Repository dst = createBareRepository();
@@ -213,6 +223,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
assertEquals("gzip", info.getResponseHeader(HDR_CONTENT_ENCODING));
}
+ @Test
public void testInitialClone_Small() throws Exception {
Repository dst = createBareRepository();
assertFalse(dst.hasObject(A_txt));
@@ -257,6 +268,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
.getResponseHeader(HDR_CONTENT_TYPE));
}
+ @Test
public void testFetchUpdateExisting() throws Exception {
// Bootstrap by doing the clone.
//
@@ -336,6 +348,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
.getResponseHeader(HDR_CONTENT_TYPE));
}
+ @Test
public void testInitialClone_BrokenServer() throws Exception {
Repository dst = createBareRepository();
assertFalse(dst.hasObject(A_txt));
@@ -376,6 +389,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
.getResponseHeader(HDR_CONTENT_TYPE));
}
+ @Test
public void testPush_NotAuthorized() throws Exception {
final TestRepository src = createTestRepository();
final RevBlob Q_txt = src.blob("new text");
@@ -418,6 +432,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
assertEquals(401, info.getStatus());
}
+ @Test
public void testPush_CreateBranch() throws Exception {
final TestRepository src = createTestRepository();
final RevBlob Q_txt = src.blob("new text");
@@ -490,6 +505,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
.getResponseHeader(HDR_CONTENT_TYPE));
}
+ @Test
public void testPush_ChunkedEncoding() throws Exception {
final TestRepository<FileRepository> src = createTestRepository();
final RevBlob Q_bin = src.blob(new TestRng("Q").nextBytes(128 * 1024));