Skip to content

Commit

Permalink
feat: support objectmapper customization
Browse files Browse the repository at this point in the history
  • Loading branch information
manosbatsis committed Dec 28, 2023
1 parent ca598bf commit 83ecc79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.manosbatsis.corda5.testutils.integration.junit5

import com.fasterxml.jackson.databind.ObjectMapper
import com.github.manosbatsis.corda5.testutils.rest.client.loggerFor
import java.io.File

Expand Down Expand Up @@ -39,8 +40,9 @@ data class Corda5NodesConfig(
val baseUrl: String = "https://localhost:8888/api/v1/",
val httpMaxWaitSeconds: Int = 60,
val debug: Boolean = false,
val projectDir: File = Corda5NodesConfig.gradleRootDir,
val combinedWorkerMode: CombinedWorkerMode = CombinedWorkerMode.SHARED
val projectDir: File = gradleRootDir,
val combinedWorkerMode: CombinedWorkerMode = CombinedWorkerMode.SHARED,
val objectMapperConfigurer: ((ObjectMapper) -> Unit)? = null
) {
companion object {
private val logger = loggerFor(Corda5NodesConfig::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ class NodeHandlesHelper(

companion object {
private val logger = loggerFor(NodeHandlesHelper::class.java)
private val objectMapper = ObjectMapper().registerModules(JavaTimeModule(), kotlinModule(), Corda5Module())

var nodeHandlesCache: NodeHandles? = null
}

private val objectMapper by lazy {
ObjectMapper().registerModules(JavaTimeModule(), kotlinModule(), Corda5Module())
.also {
if (config.objectMapperConfigurer != null) config.objectMapperConfigurer.invoke(it)
}
}

val nodeHandles: NodeHandles
get() {
when (config.combinedWorkerMode) {
Expand Down

0 comments on commit 83ecc79

Please sign in to comment.