com.bybutter.sisyphus.test.CallContext.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sisyphus-test Show documentation
Show all versions of sisyphus-test Show documentation
Test framework for testing gRPC apis in Sisyphus Framework
package com.bybutter.sisyphus.test
import com.bybutter.sisyphus.protobuf.Message
import io.grpc.CallOptions
import io.grpc.Metadata
import io.grpc.MethodDescriptor
import io.grpc.Status
data class CallContext(
val case: TestCase,
val step: TestStep,
var options: CallOptions,
val method: MethodDescriptor, Message<*, *>>,
val headers: Metadata,
val input: Message<*, *>,
var status: Status? = null,
var trailers: Metadata? = null,
var output: Message<*, *>? = null
) {
fun toCelContext(): Map {
return mutableMapOf().apply {
this["step"] = [email protected]
this["case"] = [email protected]
this["method"] = [email protected]
this["status"] = [email protected]?.code?.value()?.toLong() ?: 0L
this["message"] = [email protected]?.description ?: ""
this["input"] = [email protected]
this["output"] = [email protected]
this["headers"] = [email protected]()
this["trailers"] = [email protected]?.toMap()
}
}
fun toTestResult(): TestResult {
return TestResult {
this.step = [email protected]
this.case = [email protected]
this.method = [email protected]
this.status = [email protected]?.code?.value() ?: 0
this.message = [email protected]?.description ?: ""
this.input = [email protected]
this.output = [email protected]
this.headers += [email protected]()
[email protected]?.toMap()?.let {
this.trailers += it
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy