Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-08-11 20:37:48 +0000
committerThomas Wolf2019-08-26 20:53:10 +0000
commit308bdb5d1b3a675f134dd5c038b29bfa1a671d19 (patch)
treeb52fadca70e9c42d38bfef64d8681abd7bba32e3 /org.eclipse.jgit.http.apache/src/org/eclipse
parentcb208fb3ca130a2241bef3f3a33d54269d3a14ba (diff)
downloadjgit-308bdb5d1b3a675f134dd5c038b29bfa1a671d19.tar.gz
jgit-308bdb5d1b3a675f134dd5c038b29bfa1a671d19.tar.xz
jgit-308bdb5d1b3a675f134dd5c038b29bfa1a671d19.zip
Apache HTTP: run more tests
Factor out the test parameterization to use both connection factories into a common super class and use it in more tests. This made HttpClientTests.testV2HttpSubsequentResponse() fail for Apache HTTP. The test used the pattern - create POST connection - setDoOutput(true) - connect() - write output stream - get & read input stream This pattern is never used in JGit, which actually calls connect() only in one case in LFS, and that's on a HEAD request. The above pattern works on JDK, but fails on Apache HTTP because with Apache HTTP a connect() actually executes the full request including writing the entity. To work with Apache HTTP, the pattern would need to be - create POST connection - setDoOutput(true) - write output stream - connect() - get & read input stream which is fine for both. JDK connects implicitly in getOutputStream() and treats the later explicit connect() as a no-op, and Apache works because the entity is written when connect() is called. Because JDK connects implicitly on getOutputStream(), the following pattern also works with JDK: - create POST connection - setDoOutput(true) - write output stream - get & read input stream Support this with Apache HTTP too: let getInputStream() execute the request if it wasn't executed already. Remove explicit connect() calls from test code, since JGit doesn't do those either. Change-Id: Ica038c00a7b8edcc01d5660d18e961146305b87f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.http.apache/src/org/eclipse')
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
index 4ac81a54df..f92c5df792 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
+++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
@@ -345,6 +345,7 @@ public class HttpClientConnection implements HttpConnection {
/** {@inheritDoc} */
@Override
public InputStream getInputStream() throws IOException {
+ execute();
return resp.getEntity().getContent();
}

Back to the top