-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mobile: Rewrite the JNI code for XdsTestServer (#33197)
Rewrite JNI code for XdsTestServer Signed-off-by: Fredy Wijaya <[email protected]>
- Loading branch information
Showing
11 changed files
with
179 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
mobile/test/common/integration/xds_test_server_interface.cc
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
mobile/test/common/integration/xds_test_server_interface.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
mobile/test/java/io/envoyproxy/envoymobile/engine/testing/TestJni.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
mobile/test/java/io/envoyproxy/envoymobile/engine/testing/XdsTestServerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.envoyproxy.envoymobile.engine.testing; | ||
|
||
/** An xDS test server factory. */ | ||
public class XdsTestServerFactory { | ||
/** The instance of {@link XdsTestServer}. */ | ||
public static class XdsTestServer { | ||
private final long handle; // Used by the native code. | ||
private final String host; | ||
private final int port; | ||
|
||
private XdsTestServer(long handle, String host, int port) { | ||
this.handle = handle; | ||
this.host = host; | ||
this.port = port; | ||
} | ||
|
||
/** Starts the xDS server. */ | ||
public native void start(); | ||
|
||
/** Gets the xDS host. */ | ||
public String getHost() { return host; } | ||
|
||
/** Gets the xDS port. */ | ||
public int getPort() { return port; } | ||
|
||
/** | ||
* Sends a static `envoy::service::discovery::v3::DiscoveryResponse` message with the specified | ||
* cluster name. | ||
* | ||
* TODO(fredyw): Update to take a DiscoveryResponse proto. | ||
*/ | ||
public native void sendDiscoveryResponse(String clusterName); | ||
|
||
/** Shuts down the xDS server. */ | ||
public native void shutdown(); | ||
} | ||
|
||
static { System.loadLibrary("envoy_jni_xds_test_server_factory"); } | ||
|
||
/** Creates a new instance of {@link XdsTestServer}. */ | ||
public static native XdsTestServer create(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.