Bump com.ncorti.ktfmt.gradle from 0.19.0 to 0.20.1 in /lib/kotlin (#3031)
* Bump com.ncorti.ktfmt.gradle from 0.19.0 to 0.20.1 in /lib/kotlin
Bumps com.ncorti.ktfmt.gradle from 0.19.0 to 0.20.1.
---
updated-dependencies:
- dependency-name: com.ncorti.ktfmt.gradle
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Fix formatting
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
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 a9241da..5178b55 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
@@ -66,14 +66,14 @@
Json("json"),
MultiJson("multij"),
Compact("compact"),
- MultiCompact("multic")
+ MultiCompact("multic"),
}
enum class TransportType(val key: String) {
Buffered("buffered"),
Framed("framed"),
FastFramed("fastframed"),
- Http("http")
+ Http("http"),
}
class TestClient : CliktCommand() {
@@ -114,7 +114,8 @@
TransportType.Framed -> TNonblockingSocket(host, port, socketTimeout)
else ->
throw UnsupportedOperationException(
- "only frame transport type is supported for now, got $transportType")
+ "only frame transport type is supported for now, got $transportType"
+ )
}
private val clientManager = TAsyncClientManager()
@@ -272,7 +273,8 @@
if (xtructs != null) {
for ((string_thing, byte_thing, i32_thing, i64_thing) in xtructs) {
print(
- "{\"$string_thing\", $byte_thing, $i32_thing, $i64_thing}, ")
+ "{\"$string_thing\", $byte_thing, $i32_thing, $i64_thing}, "
+ )
}
}
print("}")
@@ -284,13 +286,15 @@
if (whoa.size == 2 && whoa.containsKey(1L) && whoa.containsKey(2L)) {
val firstMap = whoa[1L]!!
val secondMap = whoa[2L]!!
- if (firstMap.size == 2 &&
- firstMap.containsKey(Numberz.TWO) &&
- firstMap.containsKey(Numberz.THREE) &&
- secondMap.size == 1 &&
- secondMap.containsKey(Numberz.SIX) &&
- insane == firstMap[Numberz.TWO] &&
- insane == firstMap[Numberz.THREE]) {
+ if (
+ firstMap.size == 2 &&
+ firstMap.containsKey(Numberz.TWO) &&
+ firstMap.containsKey(Numberz.THREE) &&
+ secondMap.size == 1 &&
+ secondMap.containsKey(Numberz.SIX) &&
+ insane == firstMap[Numberz.TWO] &&
+ insane == firstMap[Numberz.THREE]
+ ) {
val six = secondMap[Numberz.SIX]!!
// Cannot use "new Insanity().equals(six)" because as of now,
// struct/container
@@ -361,9 +365,11 @@
private suspend fun multiplexTest(returnCode: Int): Int {
var code = returnCode
- if (protocolType == ProtocolType.Multi ||
- protocolType == ProtocolType.MultiJson ||
- protocolType == ProtocolType.MultiCompact) {
+ if (
+ protocolType == ProtocolType.Multi ||
+ protocolType == ProtocolType.MultiJson ||
+ protocolType == ProtocolType.MultiCompact
+ ) {
val secondClient: SecondServiceClient = createSecondServiceClient()
print("secondtestString(\"Test2\")")
val s = secondClient.secondtestString("Test2")
@@ -432,7 +438,7 @@
private suspend fun exceptionTest(
testClient: ThriftTestClient,
- returnCode: Int
+ returnCode: Int,
): Pair<Int, ThriftTestClient> {
var client = testClient
var code = returnCode
@@ -467,7 +473,7 @@
private suspend fun multiExceptionTest(
testClient: ThriftTestClient,
- returnCode: Int
+ returnCode: Int,
): Pair<Int, ThriftTestClient> {
var client = testClient
var code = returnCode
@@ -523,7 +529,8 @@
out.i64_thing = -5
val input: Xtruct = testStruct(out)
print(
- """ = {"${input.string_thing}",${input.byte_thing}, ${input.i32_thing}, ${input.i64_thing}}""")
+ """ = {"${input.string_thing}",${input.byte_thing}, ${input.i32_thing}, ${input.i64_thing}}"""
+ )
if (input != out) {
code = code or ERR_STRUCTS
println("*** FAILURE ***\n")
@@ -572,14 +579,16 @@
} else {
val m1 = mm[4]!!
val m2 = mm[-4]!!
- if (m1[1] != 1 ||
- m1[2] != 2 ||
- m1[3] != 3 ||
- m1[4] != 4 ||
- m2[-1] != -1 ||
- m2[-2] != -2 ||
- m2[-3] != -3 ||
- m2[-4] != -4) {
+ if (
+ m1[1] != 1 ||
+ m1[2] != 2 ||
+ m1[3] != 3 ||
+ m1[4] != 4 ||
+ m2[-1] != -1 ||
+ m2[-2] != -2 ||
+ m2[-3] != -3 ||
+ m2[-4] != -4
+ ) {
returnCode1 = returnCode1 or ERR_CONTAINERS
println("*** FAILURE ***\n")
}
@@ -639,7 +648,8 @@
val input = xstruct2.struct_thing!!
print(
""" = {${xstruct2.byte_thing}, {"${input.string_thing}", ${input.byte_thing}, ${input.i32_thing}, ${input.i64_thing}}, ${xstruct2.i32_thing}}
- """)
+ """
+ )
if (xstruct2 != out2) {
code = code or ERR_STRUCTS
println("*** FAILURE ***\n")
diff --git a/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestHandler.kt b/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestHandler.kt
index 160097e..425d46b 100644
--- a/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestHandler.kt
+++ b/lib/kotlin/cross-test-server/src/main/kotlin/org/apache/thrift/test/TestHandler.kt
@@ -96,7 +96,8 @@
override suspend fun testStruct(thing: Xtruct): Xtruct {
logger.info(
- """testStruct({"${thing.string_thing}", ${thing.byte_thing}, ${thing.i32_thing}, ${thing.i64_thing}})""")
+ """testStruct({"${thing.string_thing}", ${thing.byte_thing}, ${thing.i32_thing}, ${thing.i64_thing}})"""
+ )
return thing
}
@@ -104,7 +105,8 @@
val thing2: Xtruct = thing.struct_thing!!
logger.info(
"""testNest({${thing.byte_thing}, {"${thing2.string_thing}", ${thing2.byte_thing}, ${thing2.i32_thing}, ${thing2.i64_thing}}, ${thing.i32_thing}})"""
- .trimIndent())
+ .trimIndent()
+ )
return thing
}
@@ -200,7 +202,7 @@
arg2: Long,
arg3: Map<Short, String>,
arg4: Numberz,
- arg5: Long
+ arg5: Long,
): Xtruct {
logger.info("testMulti()\n")
val hello = Xtruct()
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 e79420b..706083f 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
@@ -84,7 +84,8 @@
}
} catch (e: Exception) {
throw RuntimeException(
- "The context is not a wrapper and does not implement the interface")
+ "The context is not a wrapper and does not implement the interface"
+ )
}
}
@@ -98,7 +99,8 @@
override fun preServe() {
println(
- "TServerEventHandler.preServe - called only once before server starts accepting connections")
+ "TServerEventHandler.preServe - called only once before server starts accepting connections"
+ )
}
override fun createContext(input: TProtocol, output: TProtocol): ServerContext {
@@ -108,32 +110,35 @@
println(
"TServerEventHandler.createContext - connection #" +
ctx.connectionId +
- " established")
+ " established"
+ )
return ctx
}
override fun deleteContext(
serverContext: ServerContext,
input: TProtocol,
- output: TProtocol
+ output: TProtocol,
) {
val ctx = serverContext.unwrap(TestServerContext::class.java)
println(
"TServerEventHandler.deleteContext - connection #" +
ctx.connectionId +
- " terminated")
+ " terminated"
+ )
}
override fun processContext(
serverContext: ServerContext,
inputTransport: TTransport,
- outputTransport: TTransport
+ outputTransport: TTransport,
) {
val ctx = serverContext.unwrap(TestServerContext::class.java)
println(
"TServerEventHandler.processContext - connection #" +
ctx.connectionId +
- " is ready to process next request")
+ " is ready to process next request"
+ )
}
}
}
@@ -142,7 +147,7 @@
Simple("simple"),
ThreadPool("thread-pool"),
NonBlocking("nonblocking"),
- ThreadedSelector("threaded-selector")
+ ThreadedSelector("threaded-selector"),
}
enum class ProtocolType(val key: String) {
@@ -151,14 +156,14 @@
Json("json"),
MultiJson("multij"),
Compact("compact"),
- MultiCompact("multic")
+ MultiCompact("multic"),
}
enum class TransportType(val key: String) {
Buffered("buffered"),
FastFramed("fastframed"),
Framed("framed"),
- Zlib("zlib")
+ Zlib("zlib"),
}
class TestServerCommand : CliktCommand() {
@@ -193,12 +198,14 @@
protocolType,
getProtocolFactory(),
getTransportFactory(),
- useSSL)
+ useSSL,
+ )
// Set server event handler
serverEngine.setServerEventHandler(TestServer.TestServerEventHandler())
// Run it
println(
- "Starting the ${if (useSSL) "ssl server" else "server"} [$protocolType/$transportType/$serverType] on port $port")
+ "Starting the ${if (useSSL) "ssl server" else "server"} [$protocolType/$transportType/$serverType] on port $port"
+ )
serverEngine.serve()
}
@@ -241,7 +248,7 @@
protocolType: ProtocolType,
tProtocolFactory: TProtocolFactory,
tTransportFactory: TTransportFactory,
- ssl: Boolean
+ ssl: Boolean,
): TServer {
val isMulti =
protocolType == ProtocolType.Multi ||
@@ -261,7 +268,8 @@
ServerType.NonBlocking -> {
val tNonblockingServerArgs = TNonblockingServer.Args(tNonblockingServerSocket)
tNonblockingServerArgs.processor(
- if (isMulti) multiplexedProcessor else testProcessor)
+ if (isMulti) multiplexedProcessor else testProcessor
+ )
tNonblockingServerArgs.protocolFactory(tProtocolFactory)
tNonblockingServerArgs.transportFactory(tTransportFactory)
return TNonblockingServer(tNonblockingServerArgs)
@@ -270,7 +278,8 @@
val tThreadedSelectorServerArgs =
TThreadedSelectorServer.Args(tNonblockingServerSocket)
tThreadedSelectorServerArgs.processor(
- if (isMulti) multiplexedProcessor else testProcessor)
+ if (isMulti) multiplexedProcessor else testProcessor
+ )
tThreadedSelectorServerArgs.protocolFactory(tProtocolFactory)
tThreadedSelectorServerArgs.transportFactory(tTransportFactory)
return TThreadedSelectorServer(tThreadedSelectorServerArgs)
@@ -297,7 +306,8 @@
else -> {
val tThreadPoolServerArgs = TThreadPoolServer.Args(tServerSocket)
tThreadPoolServerArgs.processor(
- if (isMulti) multiplexedProcessor else testProcessor)
+ if (isMulti) multiplexedProcessor else testProcessor
+ )
tThreadPoolServerArgs.protocolFactory(tProtocolFactory)
tThreadPoolServerArgs.transportFactory(tTransportFactory)
return TThreadPoolServer(tThreadPoolServerArgs)
diff --git a/lib/kotlin/settings.gradle.kts b/lib/kotlin/settings.gradle.kts
index ccb54e7..97fab34 100644
--- a/lib/kotlin/settings.gradle.kts
+++ b/lib/kotlin/settings.gradle.kts
@@ -19,7 +19,7 @@
pluginManagement {
plugins {
kotlin("jvm") version "2.0.20"
- id("com.ncorti.ktfmt.gradle") version "0.19.0"
+ id("com.ncorti.ktfmt.gradle") version "0.20.1"
}
}
diff --git a/lib/kotlin/src/test/kotlin/org/apache/thrift/MetaDataTest.kt b/lib/kotlin/src/test/kotlin/org/apache/thrift/MetaDataTest.kt
index 16dc71e..7780aa4 100644
--- a/lib/kotlin/src/test/kotlin/org/apache/thrift/MetaDataTest.kt
+++ b/lib/kotlin/src/test/kotlin/org/apache/thrift/MetaDataTest.kt
@@ -31,11 +31,6 @@
assertEquals(3, personMetadata.size)
val idField = personMetadata[Person._Fields.ID]!!
assertEquals("id", idField.fieldName)
- assertEquals(
- mapOf(
- "max" to "100000",
- "min" to "1",
- ),
- idField.fieldAnnotations)
+ assertEquals(mapOf("max" to "100000", "min" to "1"), idField.fieldAnnotations)
}
}