-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce google-http-client-apache-v5 (Apache Client/Core 5.x) #1960
feat: Introduce google-http-client-apache-v5 (Apache Client/Core 5.x) #1960
Conversation
...client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpTransport.java
Outdated
Show resolved
Hide resolved
...client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpTransport.java
Outdated
Show resolved
Hide resolved
google-http-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/Main.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...nt-apache-v3/src/test/java/com/google/api/client/http/apache/v3/ApacheHttpTransportTest.java
Outdated
Show resolved
Hide resolved
classic
API of Apache Core+Client 5.x
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpTransport.java
Outdated
Show resolved
Hide resolved
...client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpTransport.java
Outdated
Show resolved
Hide resolved
...client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpTransport.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpTransport.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
...ient-apache-v3/src/test/java/com/google/api/client/http/apache/v3/ApacheHttpRequestTest.java
Outdated
Show resolved
Hide resolved
...p-client-apache-v3/src/main/java/com/google/api/client/http/apache/v3/ApacheHttpRequest.java
Outdated
Show resolved
Hide resolved
I excluded this module from the java 7 tests google-http-java-client/.github/workflows/ci-java7.yaml Lines 57 to 58 in fe1ef0a
|
…pclient-5.x' into google-http-client-apache-v3-httpclient-5.x
...ent-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5ResponseContent.java
Show resolved
Hide resolved
...ent-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5ResponseContent.java
Show resolved
Hide resolved
...client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpResponse.java
Outdated
Show resolved
Hide resolved
...client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpResponse.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Override | ||
public void close() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a test that verifies that the response gets closed if we close the stream. Can you point me to it, or add one if it doesn't exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added one test to verify that the response is closed when closing the content stream.
Lines 126 to 129 in d8c7f67
// we close the response's content stream and confirm the response is also closed | |
assertEquals(0, closedResponseCounter.get()); | |
response.getContent().close(); | |
assertEquals(1, closedResponseCounter.get()); |
import org.apache.hc.core5.http.protocol.HttpContext; | ||
import org.junit.Test; | ||
|
||
public class Apache5HttpRequestTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test here , or in TransportTest to check that the response content stream contains the apache 5 response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, added a @VisibleForTesting
method that will expose the response and a test to confirm it.
Lines 121 to 124 in d8c7f67
// we confirm that the classic response we prepared in this test is the same as the content's | |
// response | |
assertTrue(response.getContent() instanceof Apache5ResponseContent); | |
assertEquals(classicResponse, ((Apache5ResponseContent) response.getContent()).getResponse()); |
I think this readme has to be updated: https://github.com/googleapis/google-http-java-client/blob/afd6afc1dbfaba403d67469431d7ac8db5630e86/docs/http-transport.md, does that happen as part of this PR? or some other process? |
@ldetmer I modified the docs to offer our new Apache5HttpTransport. One follow up is to update the link to one hosted in googleapis.dev. See example for Apache4HttpTransport.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please make sure to resolve the "Before merge" task listed in the PR description.
|
Adds a new module
google-http-client-apache-v5
, which is based in Apache Client/Core 5.xThe implementation was meant to keep the same functionality prescribed by the tests of
google-http-client-apache-v2
.Before merging