uranusjr commented on code in PR #76269:
URL: https://github.com/apache/airflow/pull/76269#discussion_r4734932292
##########
java-sdk/sdk/src/test/kotlin/org/apache/airflow/sdk/execution/CommTest.kt:
##########
@@ -40,6 +40,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Timeout
import org.msgpack.core.MessagePack
import org.msgpack.core.buffer.ArrayBufferInput
+import org.msgpack.value.Value
+import org.msgpack.value.ValueFactory
Review Comment:
```suggestion
import org.msgpack.value.ValueFactory.{newBoolean, newInteger, newString}
```
This would remove the repeated `ValueFactory.` prefix in code. Style choice,
but critical.
##########
java-sdk/sdk/src/test/kotlin/org/apache/airflow/sdk/execution/CommTest.kt:
##########
@@ -112,53 +114,31 @@ class CommsTest {
Assertions.assertEquals(expected, actual)
}
+ private fun bodyFrame(
+ type: String,
+ vararg fields: Pair<String, Value>,
+ ): (Int) -> ByteArray =
+ { id ->
+ val body =
+ ValueFactory.newMap(
+ mapOf("type" to ValueFactory.newString(type), *fields).mapKeys {
(key, _) -> ValueFactory.newString(key) },
Review Comment:
This builds a `String`-keyed map and then re-keys it.
`ValueFactory.newMapBuilder()` with `put(...)` for `type` avoids the
intermediate map, and doesn't silently let a `"type"` field override `type`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]