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

mobile: Rewrite the JNI code for XdsTestServer #33197

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

fredyw
Copy link
Member

@fredyw fredyw commented Mar 28, 2024

This PR rewrites the JNI implementation for XdsTestServer to follow a similar style as HttpTestServer and HttpProxyTestServer. This PR also eliminates the use of YAML in the test.

Risk Level: low (test only)
Testing: unit test
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #33197 was opened by fredyw.

see: more, trace.

@fredyw fredyw changed the title mobile: Rewrite JNI code for XdsTestServer mobile: Rewrite the JNI code for XdsTestServer Mar 28, 2024
@fredyw
Copy link
Member Author

fredyw commented Mar 28, 2024

/retest

@fredyw fredyw marked this pull request as ready for review March 28, 2024 21:58
@fredyw
Copy link
Member Author

fredyw commented Mar 28, 2024

/assign @abeyad

/** An xDS test server factory. */
public class XdsTestServerFactory {
/** The instance of {@link XdsTestServer}. */
public static class XdsTestServer {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if it would be better to have the XdsTestServer as a top-level class, outside of XdsTestServerFactory? Same for the other HTTP servers from previous PRs. I think it'll make the code easier to read, but just a personal preference. I consider the XdsTestServer to be a top level construct, not dependent on XdsTestServerFactory. It's just that XdsTestServerFactory gives us XdsTestServer instances

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately it's not possible to do it in Java unless we create two separate files. Having a single file is better IMO.

Copy link
Member Author

@fredyw fredyw Mar 29, 2024

Choose a reason for hiding this comment

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

Another reason Xds|Http|HttpProxy is inside the factory is so that it can have a private constructor. That's because there's no way to manually create the instance without having to use the factory (the handle will need to come from the native code). If we were about to make Xds|Http|HttpProxy outside, the constructor would have to be public. IOW, we want the Factory to be the only way to create the instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, yeah agree, this is better then, thanks for the explanation!

@abeyad abeyad merged commit 279e469 into envoyproxy:main Mar 29, 2024
35 checks passed
@fredyw fredyw deleted the jni_xds_test_server branch March 29, 2024 15:55
alyssawilk pushed a commit to alyssawilk/envoy that referenced this pull request Apr 29, 2024
Rewrite JNI code for XdsTestServer

Signed-off-by: Fredy Wijaya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants