This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch
dependabot/gradle/lib/kotlin/com.ncorti.ktfmt.gradle-0.20.1
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to
refs/heads/dependabot/gradle/lib/kotlin/com.ncorti.ktfmt.gradle-0.20.1 by this
push:
new 296542c42 Fix formatting
296542c42 is described below
commit 296542c42c69818fb18960764e34e434c1703cfb
Author: Christopher Tubbs <[email protected]>
AuthorDate: Wed Sep 4 13:43:54 2024 -0400
Fix formatting
---
.../kotlin/org/apache/thrift/test/TestClient.kt | 62 +++++++++++++---------
.../kotlin/org/apache/thrift/test/TestHandler.kt | 8 +--
.../kotlin/org/apache/thrift/test/TestServer.kt | 42 +++++++++------
.../test/kotlin/org/apache/thrift/MetaDataTest.kt | 7 +--
4 files changed, 68 insertions(+), 51 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 a9241da5c..5178b55af 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 @@ enum class ProtocolType(val key: String) {
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 @@ class TestClient : CliktCommand() {
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 @@ class TestClient : CliktCommand() {
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 @@ 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 &&
- 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 @@ class TestClient : CliktCommand() {
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 @@ class TestClient : CliktCommand() {
private suspend fun exceptionTest(
testClient: ThriftTestClient,
- returnCode: Int
+ returnCode: Int,
): Pair<Int, ThriftTestClient> {
var client = testClient
var code = returnCode
@@ -467,7 +473,7 @@ class TestClient : CliktCommand() {
private suspend fun multiExceptionTest(
testClient: ThriftTestClient,
- returnCode: Int
+ returnCode: Int,
): Pair<Int, ThriftTestClient> {
var client = testClient
var code = returnCode
@@ -523,7 +529,8 @@ private suspend fun ThriftTestClient.structTest(returnCode:
Int): Pair<Xtruct, I
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 @@ private suspend fun
ThriftTestClient.nestedMapTest(returnCode: Int): Int {
} 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 @@ private suspend fun ThriftTestClient.nestedStructTest(out:
Xtruct, returnCode: I
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 160097e64..425d46b6f 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 @@ class TestHandler : ThriftTest {
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 @@ class TestHandler : ThriftTest {
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 @@ class TestHandler : ThriftTest {
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 e79420b66..706083faf 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 @@ object TestServer {
}
} 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 @@ object TestServer {
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 @@ object TestServer {
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 @@ enum class ServerType(val key: String) {
Simple("simple"),
ThreadPool("thread-pool"),
NonBlocking("nonblocking"),
- ThreadedSelector("threaded-selector")
+ ThreadedSelector("threaded-selector"),
}
enum class ProtocolType(val key: String) {
@@ -151,14 +156,14 @@ enum class ProtocolType(val key: String) {
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 @@ class TestServerCommand : CliktCommand() {
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 @@ private fun getServerEngine(
protocolType: ProtocolType,
tProtocolFactory: TProtocolFactory,
tTransportFactory: TTransportFactory,
- ssl: Boolean
+ ssl: Boolean,
): TServer {
val isMulti =
protocolType == ProtocolType.Multi ||
@@ -261,7 +268,8 @@ private fun getServerEngine(
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 @@ private fun getServerEngine(
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 @@ private fun getServerEngine(
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/src/test/kotlin/org/apache/thrift/MetaDataTest.kt
b/lib/kotlin/src/test/kotlin/org/apache/thrift/MetaDataTest.kt
index 16dc71e57..7780aa410 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 @@ internal class MetaDataTest {
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)
}
}