Skip to content
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

Merged
merged 54 commits into from
Aug 21, 2024

Conversation

diegomarquezp
Copy link
Contributor

@diegomarquezp diegomarquezp commented Jun 27, 2024

Adds a new module google-http-client-apache-v5, which is based in Apache Client/Core 5.x

The implementation was meant to keep the same functionality prescribed by the tests of google-http-client-apache-v2.

Before merging

  • Remove convenience integration tests from unit tests file

@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Jun 27, 2024
@diegomarquezp diegomarquezp added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed size: xl Pull request size is extra large. labels Jun 27, 2024
@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Jun 27, 2024
@diegomarquezp diegomarquezp changed the title chore: demo of classic API of Apache Core+Client 5.x feat: Introduce google-http-client-apache-v3 (Apache Client/Core 5.3) Aug 12, 2024
@diegomarquezp diegomarquezp changed the title feat: Introduce google-http-client-apache-v3 (Apache Client/Core 5.3) feat: Introduce google-http-client-apache-v3 (Apache Client/Core 5.x) Aug 12, 2024
@diegomarquezp
Copy link
Contributor Author

I excluded this module from the java 7 tests

mvn --batch-mode --show-version -ntp test \
--projects '!google-http-client-jackson2,!google-http-client-appengine,!samples/dailymotion-simple-cmdline-sample,!google-http-client-assembly,!google-http-client-apache-v5' \

…pclient-5.x' into google-http-client-apache-v3-httpclient-5.x
}

@Override
public void close() throws IOException {
Copy link

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?

Copy link
Contributor Author

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.

// 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 {
Copy link

@ldetmer ldetmer Aug 20, 2024

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?

Copy link
Contributor Author

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.

// 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());

@ldetmer
Copy link

ldetmer commented Aug 20, 2024

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?

@diegomarquezp
Copy link
Contributor Author

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.

[apache-http-transport]: https://googleapis.dev/java/google-http-client/latest/index.html?com/google/api/client/http/apache/v2/ApacheHttpTransport.html

Copy link

@ldetmer ldetmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@burkedavison
Copy link
Contributor

burkedavison commented Aug 21, 2024

Please make sure to resolve the "Before merge" task listed in the PR description.

  • Remove convenience integration tests from unit tests file

@diegomarquezp diegomarquezp added the automerge Merge the pull request once unit tests and other checks pass. label Aug 21, 2024
@gcf-merge-on-green gcf-merge-on-green bot merged commit 5d527dc into main Aug 21, 2024
19 of 21 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 21, 2024
@gcf-merge-on-green gcf-merge-on-green bot deleted the google-http-client-apache-v3-httpclient-5.x branch August 21, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants