Skip to content

Commit f17b39b

Browse files
committed
Add async nonblocking ssl support in java client
1 parent b8f7e5b commit f17b39b

File tree

10 files changed

+1524
-24
lines changed

10 files changed

+1524
-24
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ jobs:
274274
if-no-files-found: error
275275
path: |
276276
lib/java/build/functionalTestJar/
277+
lib/java/build/runnonblockingclient
277278
lib/java/build/runclient
278279
lib/java/build/runnonblockingserver
279280
lib/java/build/runserver
@@ -320,21 +321,21 @@ jobs:
320321
- name: Set up .NET SDK (via install script)
321322
run: |
322323
# remove any existing install
323-
sudo apt remove dotnet*
324+
sudo apt remove dotnet*
324325
# install key
325326
sudo apt install gpg
326327
wget https://dot.net/v1/dotnet-install.asc
327-
gpg --import dotnet-install.asc
328+
gpg --import dotnet-install.asc
328329
# download and verify
329330
wget https://dot.net/v1/dotnet-install.sh
330331
wget https://dot.net/v1/dotnet-install.sig
331-
gpg --verify dotnet-install.sig dotnet-install.sh
332+
gpg --verify dotnet-install.sig dotnet-install.sh
332333
# run install script
333334
chmod +x dotnet-install.sh
334-
./dotnet-install.sh --channel 10.0
335+
./dotnet-install.sh --channel 10.0
335336
# export env vars
336337
export DOTNET_ROOT=$HOME/.dotnet
337-
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
338+
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
338339
dotnet --list-sdks
339340
340341
# the sdk is installed by default, but keep this step for reference

lib/java/gradle/functionalTests.gradle

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dependencies {
6464
shadowJar {
6565
description = 'Assemble a test JAR file for cross-check execution'
6666
// make sure the runners are created when this runs
67-
dependsOn 'generateRunnerScriptForClient', 'generateRunnerScriptForServer', 'generateRunnerScriptForNonblockingServer', 'generateRunnerScriptForTServletServer'
67+
dependsOn 'generateRunnerScriptForClient', 'generateRunnerScriptForNonblockingClient', 'generateRunnerScriptForServer', 'generateRunnerScriptForNonblockingServer', 'generateRunnerScriptForTServletServer'
6868
archiveBaseName.set('functionalTest')
6969
destinationDirectory = file("$buildDir/functionalTestJar")
7070
// We do not need a version number for this internal jar
@@ -119,6 +119,26 @@ ${scriptHead}
119119
}
120120
}
121121

122+
task generateRunnerScriptForNonblockingClient(group: 'Build') {
123+
description = 'Generate a runner script for cross-check tests with TestNonblockingClient'
124+
125+
def clientFile = file("$buildDir/runnonblockingclient${scriptExt}")
126+
127+
def runClientText = """\
128+
${scriptHead}
129+
130+
"${javaExe}" -cp "$jarPath" "-Djavax.net.ssl.keyStore=$clientKeyStore" -Djavax.net.ssl.keyStorePassword=thrift "-Djavax.net.ssl.trustStore=$trustStore" -Djavax.net.ssl.trustStorePassword=thrift org.apache.thrift.test.TestNonblockingClient $args
131+
"""
132+
inputs.property 'runClientText', runClientText
133+
outputs.file clientFile
134+
135+
doLast {
136+
clientFile.parentFile.mkdirs()
137+
clientFile.text = runClientText
138+
clientFile.setExecutable(true, false)
139+
}
140+
}
141+
122142
task generateRunnerScriptForServer(group: 'Build') {
123143
description = 'Generate a runner script for cross-check tests with TestServer'
124144

lib/java/src/crossTest/java/org/apache/thrift/test/TestClient.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@
6262
*/
6363
public class TestClient {
6464

65-
private static int ERR_BASETYPES = 1;
66-
private static int ERR_STRUCTS = 2;
67-
private static int ERR_CONTAINERS = 4;
68-
private static int ERR_EXCEPTIONS = 8;
69-
private static int ERR_PROTOCOLS = 16;
70-
private static int ERR_UNKNOWN = 64;
65+
static int ERR_BASETYPES = 1;
66+
static int ERR_STRUCTS = 2;
67+
static int ERR_CONTAINERS = 4;
68+
static int ERR_EXCEPTIONS = 8;
69+
static int ERR_PROTOCOLS = 16;
70+
static int ERR_UNKNOWN = 64;
7171

7272
public static void main(String[] args) {
7373
String host = "localhost";
@@ -819,7 +819,7 @@ public static void main(String[] args) {
819819
System.exit(returnCode);
820820
}
821821

822-
private static byte[] getBytesData() {
822+
static byte[] getBytesData() {
823823
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(256);
824824
IntStream.range(-128, 128).forEach(byteArrayOutputStream::write);
825825
return byteArrayOutputStream.toByteArray();

0 commit comments

Comments
 (0)