mhenke1 commented on a change in pull request #3174: Change log level 
dynamically (updated)
URL: 
https://github.com/apache/incubator-openwhisk/pull/3174#discussion_r162018257
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/entity/test/SchemaTests.scala
 ##########
 @@ -70,6 +69,47 @@ class SchemaTests extends FlatSpec with BeforeAndAfter with 
ExecHelpers with Mat
     a[DeserializationException] should be thrownBy 
Privilege.serdes.read("???".toJson)
   }
 
+  behavior of "TransactionId"
+
+  it should "serdes a transaction id without extraLogging parameter" in {
+    val txIdWithoutParameter = TransactionId(4711)
+
+    // test serialization
+    val serializedTxIdWithoutParameter = 
TransactionId.serdes.write(txIdWithoutParameter)
+    serializedTxIdWithoutParameter match {
+      case JsArray(Vector(JsNumber(id), JsNumber(_))) =>
+        assert(id == txIdWithoutParameter.meta.id)
+      case JsArray(Vector(JsNumber(_), JsNumber(_), JsBoolean(_))) =>
+        assert(false)
+      case _ => withClue(serializedTxIdWithoutParameter) { assert(false) }
+    }
+
+    // test deserialization
+    val deserializedTxIdWithoutParameter = 
TransactionId.serdes.read(serializedTxIdWithoutParameter)
+    deserializedTxIdWithoutParameter.meta.id should 
equal(txIdWithoutParameter.meta.id)
+    deserializedTxIdWithoutParameter.meta.extraLogging should equal(false)
+  }
+
+  it should "serdes a transaction id with extraLogging parameter" in {
+    val txIdWithParameter = TransactionId(4711, true)
+
+    // test serialization
+    val serializedTxIdWithParameter = 
TransactionId.serdes.write(txIdWithParameter)
+    serializedTxIdWithParameter match {
+      case JsArray(Vector(JsNumber(_), JsNumber(_))) =>
+        assert(false)
+      case JsArray(Vector(JsNumber(id), JsNumber(_), JsBoolean(extraLogging))) 
=>
 
 Review comment:
   Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to