Browse Source

Enabled unit tests in HttpClientTests

Change-Id: I92ae117f1dcfc569e27c66c191e090a60fbe2bb6
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
stable-1.0
Christian Halstrick 14 years ago
parent
commit
0359184f4e
  1. 13
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java

13
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java

@ -81,6 +81,8 @@ import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.transport.resolver.RepositoryResolver; import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.Before;
import org.junit.Test;
public class HttpClientTests extends HttpTestCase { public class HttpClientTests extends HttpTestCase {
private TestRepository<FileRepository> remoteRepository; private TestRepository<FileRepository> remoteRepository;
@ -93,6 +95,7 @@ public class HttpClientTests extends HttpTestCase {
private URIish smartAuthBasicURI; private URIish smartAuthBasicURI;
@Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
@ -149,6 +152,7 @@ public class HttpClientTests extends HttpTestCase {
return db.getDirectory().getName(); return db.getDirectory().getName();
} }
@Test
public void testRepositoryNotFound_Dumb() throws Exception { public void testRepositoryNotFound_Dumb() throws Exception {
URIish uri = toURIish("/dumb.none/not-found"); URIish uri = toURIish("/dumb.none/not-found");
Repository dst = createBareRepository(); Repository dst = createBareRepository();
@ -167,6 +171,7 @@ public class HttpClientTests extends HttpTestCase {
} }
} }
@Test
public void testRepositoryNotFound_Smart() throws Exception { public void testRepositoryNotFound_Smart() throws Exception {
URIish uri = toURIish("/smart.none/not-found"); URIish uri = toURIish("/smart.none/not-found");
Repository dst = createBareRepository(); Repository dst = createBareRepository();
@ -185,6 +190,7 @@ public class HttpClientTests extends HttpTestCase {
} }
} }
@Test
public void testListRemote_Dumb_DetachedHEAD() throws Exception { public void testListRemote_Dumb_DetachedHEAD() throws Exception {
Repository src = remoteRepository.getRepository(); Repository src = remoteRepository.getRepository();
RefUpdate u = src.updateRef(Constants.HEAD, true); RefUpdate u = src.updateRef(Constants.HEAD, true);
@ -209,6 +215,7 @@ public class HttpClientTests extends HttpTestCase {
assertEquals(Q, head.getObjectId()); assertEquals(Q, head.getObjectId());
} }
@Test
public void testListRemote_Dumb_NoHEAD() throws Exception { public void testListRemote_Dumb_NoHEAD() throws Exception {
FileRepository src = remoteRepository.getRepository(); FileRepository src = remoteRepository.getRepository();
File headref = new File(src.getDirectory(), Constants.HEAD); File headref = new File(src.getDirectory(), Constants.HEAD);
@ -231,6 +238,7 @@ public class HttpClientTests extends HttpTestCase {
assertNull("has no " + Constants.HEAD, head); assertNull("has no " + Constants.HEAD, head);
} }
@Test
public void testListRemote_Smart_DetachedHEAD() throws Exception { public void testListRemote_Smart_DetachedHEAD() throws Exception {
Repository src = remoteRepository.getRepository(); Repository src = remoteRepository.getRepository();
RefUpdate u = src.updateRef(Constants.HEAD, true); RefUpdate u = src.updateRef(Constants.HEAD, true);
@ -255,6 +263,7 @@ public class HttpClientTests extends HttpTestCase {
assertEquals(Q, head.getObjectId()); assertEquals(Q, head.getObjectId());
} }
@Test
public void testListRemote_Smart_WithQueryParameters() throws Exception { public void testListRemote_Smart_WithQueryParameters() throws Exception {
URIish myURI = toURIish("/snone/do?r=1&p=test.git"); URIish myURI = toURIish("/snone/do?r=1&p=test.git");
Repository dst = createBareRepository(); Repository dst = createBareRepository();
@ -283,6 +292,7 @@ public class HttpClientTests extends HttpTestCase {
assertEquals(404, info.getStatus()); assertEquals(404, info.getStatus());
} }
@Test
public void testListRemote_Dumb_NeedsAuth() throws Exception { public void testListRemote_Dumb_NeedsAuth() throws Exception {
Repository dst = createBareRepository(); Repository dst = createBareRepository();
Transport t = Transport.open(dst, dumbAuthBasicURI); Transport t = Transport.open(dst, dumbAuthBasicURI);
@ -300,6 +310,7 @@ public class HttpClientTests extends HttpTestCase {
} }
} }
@Test
public void testListRemote_Dumb_Auth() throws Exception { public void testListRemote_Dumb_Auth() throws Exception {
Repository dst = createBareRepository(); Repository dst = createBareRepository();
Transport t = Transport.open(dst, dumbAuthBasicURI); Transport t = Transport.open(dst, dumbAuthBasicURI);
@ -325,6 +336,7 @@ public class HttpClientTests extends HttpTestCase {
} }
} }
@Test
public void testListRemote_Smart_UploadPackNeedsAuth() throws Exception { public void testListRemote_Smart_UploadPackNeedsAuth() throws Exception {
Repository dst = createBareRepository(); Repository dst = createBareRepository();
Transport t = Transport.open(dst, smartAuthBasicURI); Transport t = Transport.open(dst, smartAuthBasicURI);
@ -342,6 +354,7 @@ public class HttpClientTests extends HttpTestCase {
} }
} }
@Test
public void testListRemote_Smart_UploadPackDisabled() throws Exception { public void testListRemote_Smart_UploadPackDisabled() throws Exception {
FileRepository src = remoteRepository.getRepository(); FileRepository src = remoteRepository.getRepository();
final FileBasedConfig cfg = src.getConfig(); final FileBasedConfig cfg = src.getConfig();

Loading…
Cancel
Save