Skip to content

Commit

Permalink
[TH2-5211] corrected after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro committed Jul 2, 2024
1 parent 2e68653 commit 9d399b1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,12 @@ data class Event(

companion object {
@JvmStatic
fun convertToEventIdProto(id: ProviderEventId): EventID {
return with(id.eventId) {
EventUtils.toEventID(startTimestamp, bookId.name, scope, this.id)
}
fun convertToEventIdProto(providerEventId: ProviderEventId): EventID = providerEventId.eventId.run {
EventUtils.toEventID(startTimestamp, bookId.name, scope, id)
}
@JvmStatic
fun convertMessageIdToProto(attachedMessageIds: Set<String>): List<MessageID> {
return attachedMessageIds.map { id ->
StoredMessageId.fromString(id).toGrpcMessageId()
}
fun convertMessageIdToProto(attachedMessageIds: Set<String>): List<MessageID> = attachedMessageIds.map { id ->
StoredMessageId.fromString(id).toGrpcMessageId()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ import io.javalin.openapi.OpenApiParam
import io.javalin.openapi.OpenApiResponse
import mu.KotlinLogging
import java.util.concurrent.ArrayBlockingQueue
import java.util.concurrent.Executor
import java.util.function.Supplier

class GetOneEvent(
private val sseResponseBuilder: SseResponseBuilder,
private val searchEventsHandler: SearchEventsHandler,
private val convExecutor: Executor,
private val dataMeasurement: DataMeasurement,
) : AbstractRequestHandler() {

Expand Down Expand Up @@ -89,7 +87,7 @@ class GetOneEvent(
val reqContext = HttpGenericResponseHandler(
queue,
sseResponseBuilder,
convExecutor,
Runnable::run,
dataMeasurement,
Event::eventId,
SseResponseBuilder::build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class HttpServer(private val context: Context) {
GetOneEvent(
sseResponseBuilder,
this.context.searchEventsHandler,
context.convExecutor,
context.requestsDataMeasurement,
),
GetEventsServlet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal class TestCustomSerializerKt {
)

val jsonBytes = event.toJSONByteArray()
println(String(jsonBytes))

assertDoesNotThrow { mapper.readTree(jsonBytes) }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Exactpro (Exactpro Systems Limited)
* Copyright 2022-2024 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,6 @@ internal class TestGetOneEvent : AbstractHttpHandlerTest<GetOneEvent>() {
return GetOneEvent(
sseResponseBuilder,
context.searchEventsHandler,
context.convExecutor,
context.requestsDataMeasurement,
)
}
Expand Down

0 comments on commit 9d399b1

Please sign in to comment.