Draft
Conversation
added 4 commits
May 5, 2022 05:20
added 12 commits
May 5, 2022 11:38
… right after receiving request
cordwelt
suggested changes
May 24, 2022
src/main/kotlin/com/exactpro/th2/http/server/util/EventUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/http/server/util/MessageUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/http/server/util/MessageUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/http/server/util/ResponseBuilder.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/http/server/options/ServerOptions.kt
Outdated
Show resolved
Hide resolved
cordwelt
suggested changes
May 27, 2022
| cleaner.schedule(checkSockets, socketDelayCheck * 1000, socketDelayCheck * 1000) | ||
| } | ||
|
|
||
| fun removeSocket(key: String) = dialogues.remove(key).apply { LOGGER.debug("Inactive socket [$key] was removed from store") } |
| private fun handle(client: Socket, parentEventId: String) { | ||
| if (!client.isConnected || client.isClosed || client.isInputShutdown) { | ||
| options.onError("Cannot handle socket [closed]: $socket", parentEventId, IllegalStateException()) | ||
| options.onError("Cannot handle socket [closed]: $socket", exception = null, parentEventId) |
Contributor
There was a problem hiding this comment.
exception = null
Maybe make exception argument optional too?
| val mapper = JsonMapper.builder() | ||
| .addModule(KotlinModule(nullIsSameAsDefault = true)) | ||
| .build() | ||
| val mapper = ObjectMapper(YAMLFactory()).apply { |
Contributor
There was a problem hiding this comment.
YAMLFactory()
custom config is loaded from JSON file
| }, rootEventId).id | ||
| init(StateManagerContext(server, stateManagerEvent, eventStore)) | ||
| val stateManagerEvent = eventStore( | ||
| Event.start().endTimestamp().name("State manager"), |
Contributor
There was a problem hiding this comment.
.endTimestamp()
Looks like its optional and will be automatically set during conversion to proto-event
Comment on lines
205
to
207
| sendAll(MessageGroupBatch.newBuilder().addGroups(MessageGroup.newBuilder().apply { | ||
| this += message | ||
| }).build(), *attribute) |
Contributor
There was a problem hiding this comment.
Suggested change
| sendAll(MessageGroupBatch.newBuilder().addGroups(MessageGroup.newBuilder().apply { | |
| this += message | |
| }).build(), *attribute) | |
| sendAll(MessageGroupBatch.newBuilder().apply { addGroupsBuilder() += message }.build(), *attribute) |
| @@ -0,0 +1,3 @@ | |||
| package com.exactpro.th2.http.server.api | |||
|
|
|||
| interface IStateManagerSettings {} No newline at end of file | |||
Contributor
There was a problem hiding this comment.
Suggested change
| interface IStateManagerSettings {} | |
| interface IStateManagerSettings |
| val kmf: KeyManagerFactory = KeyManagerFactory.getInstance(settings.keyManagerAlgorithm) | ||
| val ks: KeyStore = KeyStore.getInstance(settings.keystoreType) | ||
| when { | ||
| settings.keystorePath.isEmpty() -> this::class.java.classLoader.getResourceAsStream("defaultkeystore").use { ks.load(it, passphrase) } |
Contributor
There was a problem hiding this comment.
Suggested change
| settings.keystorePath.isEmpty() -> this::class.java.classLoader.getResourceAsStream("defaultkeystore").use { ks.load(it, passphrase) } | |
| settings.keystorePath.isEmpty() -> this::class.java.getResourceAsStream("defaultkeystore").use { ks.load(it, passphrase) } |
| while (error != null) { | ||
| bodyData(EventUtils.createMessageBean(error.message)) | ||
| error = error.cause | ||
| exception?.let { |
| } No newline at end of file | ||
| } | ||
|
|
||
| fun MessageGroup.getParentEventId() = messagesList.mapNotNull { |
Contributor
There was a problem hiding this comment.
Suggested change
| fun MessageGroup.getParentEventId() = messagesList.mapNotNull { | |
| fun MessageGroup.getParentEventId() = messagesList.mapNotNullTo(HashSet()) { |
Comment on lines
+75
to
+79
| eventId = when { | ||
| head.hasParentEventId() -> head.parentEventId | ||
| body.hasParentEventId() -> body.parentEventId | ||
| else -> EventID.getDefaultInstance() | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| eventId = when { | |
| head.hasParentEventId() -> head.parentEventId | |
| body.hasParentEventId() -> body.parentEventId | |
| else -> EventID.getDefaultInstance() | |
| } | |
| eventId = if (head.hasParentEventId()) head.parentEventId else body.parentEventId |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needed stable api to have a possibility to validate request or send response after
Trying to clean server class to be useable separeted from common logic
Updated package path and copyright
Trying to use th2-client as multi-thread test http client