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