summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-06-10 10:14:28 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2020-06-10 10:33:50 +0200
commit4887894ffd637030a311ca8d60b78515b1a5cf35 (patch)
treea890edb80b54f5c5078a10b938b37f04ee12edca /org.eclipse.jgit.http.test
parent629fa260c03a54cac35836010df34b565d13fe85 (diff)
parent0ec6e4b3d5becf0025dcf83e8b843c9c34043ba0 (diff)
downloadjgit-4887894ffd637030a311ca8d60b78515b1a5cf35.tar.gz
jgit-4887894ffd637030a311ca8d60b78515b1a5cf35.zip
Merge branch 'master' into next
* master: SimpleMergeTest: Clean up code style Prepare 5.8.1-SNAPSHOT builds Handle Fragment-Host declaration when updating version JGit v5.8.0.202006091008-r Prepare 5.9.0-SNAPSHOT builds Handle Fragment-Host declaration when updating version Add benchmark for strategies how to move a file Add getter for unpackErrorHandler in ReceivePack Upgrade maven-project-info-reports-plugin to 3.1.0 Upgrade maven-shade-plugin to 3.2.4 ObjectDirectoryInserter: Open FileOutputStream in try-with-resource ObjectDirectoryInserter: Remove redundant 'throws' declarations ObjectDirectory: Further clean up insertUnpackedObject Add Git#shutdown for releasing resources held by JGit process ApplyCommand: use context lines to determine hunk location GPG: don't prompt for a passphrase for unprotected keys Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST Fix ProtectedMembersInFinalClass warning flagged by error prone Use version range to define fragment host bundle version ObjectDirectory: Explicitly handle NoSuchFileException ObjectDirectory: Fail immediately when atomic move is not supported Fix jgit packaging Fix InvalidInlineTag error flagged by error prone Fix BadComparable error flagged by error prone Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash() Update Orbit to R20200529191137 for final Eclipse release 2020-06 Organize manifest of org.eclipse.jgit.pgm Do not include log4j implementation in jgit Decouple JSch from JGit Core Decouple BouncyCastle from JGit Core Verify that the user home directory is valid WindowCache: conditional JMX setup RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace Revert "PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex" Update jetty to 9.4.28.v20200408 Add 4.16 staging target platform In-memory SSH keys for the "no files" sshd tests Builder API to configure SshdSessionFactories TransportHttp: abort on time-out or on SocketException Ignore core.eol if core.autocrlf=input Attributes: fix handling of text=auto in combination with eol Bazel: Remove superfluous dependencies flagged by unused_deps Log stack trace if CachingKeyPairProvider hits unexpected exception Update Orbit to S20200519202422 and ant to 1.10.8 Include full IssuerFingerprint in GPG signature Bazel: Fix src_sha1 of bcpg-jdk15on Suppress API error for new method BitmapIndex.Bitmap#retrieveCompressed Fix wrong @since tags added in dcb0265 PackBitmapIndex: Set distance threshold PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex PackBitmapIndex: Remove convertedBitmaps in the Remapper PackBitmapIndex: Reduce memory usage in GC PackBitmapIndex: Add AddToBitmapWithCacheFilter class PackBitmapIndex: Add util methods and builder to BitmapCommit PackBitmapIndex: Move BitmapCommit to a top-level class Refactor: Make retriveCompressed an method of the Bitmap class Fix downloading LFS Object fails behind proxy Allow for using custom s3 host with lfs server ReceivePack: adding IterativeConnectivityChecker Moving transport/internal -> internal/transport Fix error occurring during checkout Change-Id: Ic11286e16ed6a72c6372297b310336dd040689d1
Diffstat (limited to 'org.eclipse.jgit.http.test')
-rw-r--r--org.eclipse.jgit.http.test/BUILD2
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java76
2 files changed, 76 insertions, 2 deletions
diff --git a/org.eclipse.jgit.http.test/BUILD b/org.eclipse.jgit.http.test/BUILD
index 09316adc6f..732b4fae2c 100644
--- a/org.eclipse.jgit.http.test/BUILD
+++ b/org.eclipse.jgit.http.test/BUILD
@@ -37,9 +37,7 @@ java_library(
deps = [
"//lib:junit",
"//lib:servlet-api",
- "//org.eclipse.jgit.http.server:jgit-servlet",
"//org.eclipse.jgit:jgit",
- "//org.eclipse.jgit.junit.http:junit-http",
"//org.eclipse.jgit.junit:junit",
],
)
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 51a7a8ddc1..8d1870a87e 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
@@ -112,6 +112,10 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
private URIish authOnPostURI;
+ private URIish slowURI;
+
+ private URIish slowAuthURI;
+
private RevBlob A_txt;
private RevCommit A, B, unreachableCommit;
@@ -152,6 +156,10 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
ServletContextHandler authOnPost = addAuthContext(gs, "pauth", "POST");
+ ServletContextHandler slow = addSlowContext(gs, "slow", false);
+
+ ServletContextHandler slowAuth = addSlowContext(gs, "slowAuth", true);
+
server.setUp();
remoteRepository = src.getRepository();
@@ -160,6 +168,8 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
redirectURI = toURIish(redirect, srcName);
authURI = toURIish(auth, srcName);
authOnPostURI = toURIish(authOnPost, srcName);
+ slowURI = toURIish(slow, srcName);
+ slowAuthURI = toURIish(slowAuth, srcName);
A_txt = src.blob("A");
A = src.commit().add("A_txt", A_txt).create();
@@ -372,6 +382,43 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
return redirect;
}
+ private ServletContextHandler addSlowContext(GitServlet gs, String path,
+ boolean auth) {
+ ServletContextHandler slow = server.addContext('/' + path);
+ slow.addFilter(new FilterHolder(new Filter() {
+
+ @Override
+ public void init(FilterConfig filterConfig)
+ throws ServletException {
+ // empty
+ }
+
+ // Simply delays the servlet for two seconds. Used for timeout
+ // tests, which use a one-second timeout.
+ @Override
+ public void doFilter(ServletRequest request,
+ ServletResponse response, FilterChain chain)
+ throws IOException, ServletException {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new IOException(e);
+ }
+ chain.doFilter(request, response);
+ }
+
+ @Override
+ public void destroy() {
+ // empty
+ }
+ }), "/*", EnumSet.of(DispatcherType.REQUEST));
+ slow.addServlet(new ServletHolder(gs), "/*");
+ if (auth) {
+ return server.authBasic(slow);
+ }
+ return slow;
+ }
+
@Test
public void testListRemote() throws IOException {
assertEquals("http", remoteURI.getScheme());
@@ -489,6 +536,35 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
}
@Test
+ public void testTimeoutExpired() throws Exception {
+ try (Repository dst = createBareRepository();
+ Transport t = Transport.open(dst, slowURI)) {
+ t.setTimeout(1);
+ TransportException expected = assertThrows(TransportException.class,
+ () -> t.fetch(NullProgressMonitor.INSTANCE,
+ mirror(master)));
+ assertTrue("Unexpected exception message: " + expected.toString(),
+ expected.getMessage().contains("time"));
+ }
+ }
+
+ @Test
+ public void testTimeoutExpiredWithAuth() throws Exception {
+ try (Repository dst = createBareRepository();
+ Transport t = Transport.open(dst, slowAuthURI)) {
+ t.setTimeout(1);
+ t.setCredentialsProvider(testCredentials);
+ TransportException expected = assertThrows(TransportException.class,
+ () -> t.fetch(NullProgressMonitor.INSTANCE,
+ mirror(master)));
+ assertTrue("Unexpected exception message: " + expected.toString(),
+ expected.getMessage().contains("time"));
+ assertFalse("Unexpected exception message: " + expected.toString(),
+ expected.getMessage().contains("auth"));
+ }
+ }
+
+ @Test
public void testInitialClone_Small() throws Exception {
try (Repository dst = createBareRepository();
Transport t = Transport.open(dst, remoteURI)) {