You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ji...@apache.org on 2023/07/05 08:18:47 UTC

[thrift] branch fix-kotlin-format created (now d108ced48)

This is an automated email from the ASF dual-hosted git repository.

jiayuliu pushed a change to branch fix-kotlin-format
in repository https://gitbox.apache.org/repos/asf/thrift.git


      at d108ced48 reformat kotlin files

This branch includes the following new commits:

     new d108ced48 reformat kotlin files

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[thrift] 01/01: reformat kotlin files

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jiayuliu pushed a commit to branch fix-kotlin-format
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit d108ced484a68322dcc8c852b12c9995976ebaa2
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) {