You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by yu...@apache.org on 2023/08/21 00:29:03 UTC
[thrift] 01/06: reformat kotlin files
This is an automated email from the ASF dual-hosted git repository.
yuxuan pushed a commit to branch 0.19.0
in repository https://gitbox.apache.org/repos/asf/thrift.git
commit fd60a9a3a167154fdb1b9f10685197a6f469a52f
Author: Jiayu Liu <ji...@hey.com>
AuthorDate: Wed Jul 5 08:18:26 2023 +0000
reformat kotlin files
---
.../main/kotlin/org/apache/thrift/test/TestClient.kt | 18 ++++++++++++------
.../main/kotlin/org/apache/thrift/test/TestServer.kt | 17 ++++++++++-------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/lib/kotlin/cross-test-client/src/main/kotlin/org/apache/thrift/test/TestClient.kt b/lib/kotlin/cross-test-client/src/main/kotlin/org/apache/thrift/test/TestClient.kt
index 39500dfbb..c238d0b42 100644
--- a/lib/kotlin/cross-test-client/src/main/kotlin/org/apache/thrift/test/TestClient.kt
+++ b/lib/kotlin/cross-test-client/src/main/kotlin/org/apache/thrift/test/TestClient.kt
@@ -101,9 +101,12 @@ class TestClient : CliktCommand() {
private fun createProtocol(transport: TTransport): TProtocol =
when (protocolType) {
- ProtocolType.Binary, ProtocolType.Multi -> TBinaryProtocol(transport)
- ProtocolType.Compact, ProtocolType.MultiCompact -> TCompactProtocol(transport)
- ProtocolType.Json, ProtocolType.MultiJson -> TJSONProtocol(transport)
+ ProtocolType.Binary,
+ ProtocolType.Multi -> TBinaryProtocol(transport)
+ ProtocolType.Compact,
+ ProtocolType.MultiCompact -> TCompactProtocol(transport)
+ ProtocolType.Json,
+ ProtocolType.MultiJson -> TJSONProtocol(transport)
}
private fun createTransport(): TNonblockingTransport =
@@ -283,7 +286,8 @@ class TestClient : CliktCommand() {
if (whoa.size == 2 && whoa.containsKey(1L) && whoa.containsKey(2L)) {
val firstMap = whoa[1L]!!
val secondMap = whoa[2L]!!
- if (firstMap.size == 2 &&
+ if (
+ firstMap.size == 2 &&
firstMap.containsKey(Numberz.TWO) &&
firstMap.containsKey(Numberz.THREE) &&
secondMap.size == 1 &&
@@ -361,7 +365,8 @@ class TestClient : CliktCommand() {
private suspend fun multiplexTest(returnCode: Int): Int {
var code = returnCode
- if (protocolType == ProtocolType.Multi ||
+ if (
+ protocolType == ProtocolType.Multi ||
protocolType == ProtocolType.MultiJson ||
protocolType == ProtocolType.MultiCompact
) {
@@ -574,7 +579,8 @@ private suspend fun ThriftTestClient.nestedMapTest(returnCode: Int): Int {
} else {
val m1 = mm[4]!!
val m2 = mm[-4]!!
- if (m1[1] != 1 ||
+ if (
+ m1[1] != 1 ||
m1[2] != 2 ||
m1[3] != 3 ||
m1[4] != 4 ||
diff --git a/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestServer.kt b/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestServer.kt
index 566e53dac..315d12e72 100644
--- a/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestServer.kt
+++ b/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestServer.kt
@@ -226,11 +226,12 @@ class TestServerCommand : CliktCommand() {
private fun getProtocolFactory(): TProtocolFactory =
when (protocolType) {
- ProtocolType.Json, ProtocolType.MultiJson -> TJSONProtocol.Factory()
- ProtocolType.Compact, ProtocolType.MultiCompact ->
- TCompactProtocol.Factory(stringLimit, containerLimit)
- ProtocolType.Binary, ProtocolType.Multi ->
- TBinaryProtocol.Factory(stringLimit, containerLimit)
+ ProtocolType.Json,
+ ProtocolType.MultiJson -> TJSONProtocol.Factory()
+ ProtocolType.Compact,
+ ProtocolType.MultiCompact -> TCompactProtocol.Factory(stringLimit, containerLimit)
+ ProtocolType.Binary,
+ ProtocolType.Multi -> TBinaryProtocol.Factory(stringLimit, containerLimit)
}
}
@@ -258,7 +259,8 @@ private fun getServerEngine(
multiplexedProcessor.registerProcessor("ThriftTest", testProcessor)
multiplexedProcessor.registerProcessor("SecondService", secondProcessor)
when (serverType) {
- ServerType.NonBlocking, ServerType.ThreadedSelector -> {
+ ServerType.NonBlocking,
+ ServerType.ThreadedSelector -> {
val tNonblockingServerSocket =
TNonblockingServerSocket(NonblockingAbstractServerSocketArgs().port(port))
when (serverType) {
@@ -283,7 +285,8 @@ private fun getServerEngine(
}
}
}
- ServerType.Simple, ServerType.ThreadPool -> {
+ ServerType.Simple,
+ ServerType.ThreadPool -> {
// SSL socket
val tServerSocket: TServerSocket =
if (ssl) {