Skip to content

Commit

Permalink
fix(kotlin): create kotlinModule using Builder instead constructor (s…
Browse files Browse the repository at this point in the history
…pinnaker#4219) (spinnaker#4220)

(cherry picked from commit d24ce6d)

Co-authored-by: Edgar Garcia <63310723+edgarulg@users.noreply.github.com>
  • Loading branch information
mergify[bot] and edgarulg authored Feb 14, 2022
1 parent 82a7dc3 commit dc68a7a
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class RedisQueueConfiguration {
@ConditionalOnMissingBean
fun redisQueueObjectMapper(properties: Optional<ObjectMapperSubtypeProperties>): ObjectMapper =
ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)

SpringObjectMapperConfigurer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RedisClusterDeadMessageHandler(

private val dlqKey = "{$deadLetterQueueName}.messages"

private val mapper = ObjectMapper().registerModule(KotlinModule())
private val mapper = ObjectMapper().registerModule(KotlinModule.Builder().build())

override fun invoke(queue: Queue, message: Message) {
jedisCluster.use { cluster ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RedisDeadMessageHandler(

private val dlqKey = "$deadLetterQueueName.messages"

private val mapper = ObjectMapper().registerModule(KotlinModule())
private val mapper = ObjectMapper().registerModule(KotlinModule.Builder().build())

override fun invoke(queue: Queue, message: Message) {
pool.resource.use { redis ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private fun createQueue(clock: Clock,
}
),
mapper = ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)

registerSubtypes(TestMessage::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private fun createQueue(clock: Clock,
clock = clock,
lockTtlSeconds = 2,
mapper = ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)

registerSubtypes(TestMessage::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static ObjectMapper newInstance() {
instance.registerModule(new Jdk8Module());
instance.registerModule(new GuavaModule());
instance.registerModule(new JavaTimeModule());
instance.registerModule(new KotlinModule());
instance.registerModule(new KotlinModule.Builder().build());
instance.disable(READ_DATE_TIMESTAMPS_AS_NANOSECONDS);
instance.disable(WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS);
instance.disable(FAIL_ON_UNKNOWN_PROPERTIES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ class KeelConfiguration {

@Bean fun keelObjectMapper() =
OrcaObjectMapper.newInstance()
.registerModule(KotlinModule())
.registerModule(KotlinModule.Builder().build())
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ObjectMapper pipelineTemplateObjectMapper() {
return new ObjectMapper()
.enable(SerializationFeature.INDENT_OUTPUT)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.registerModule(new KotlinModule());
.registerModule(new KotlinModule.Builder().build());
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TemplatedPipelineRequestSpec extends Specification {
def objectMapper = new ObjectMapper()
.enable(SerializationFeature.INDENT_OUTPUT)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.registerModule(new KotlinModule())
.registerModule(new KotlinModule.Builder().build())

@Unroll
def 'should deserialize config'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RedisOrcaQueueConfiguration : RedisQueueConfiguration() {
taskResolver: TaskResolver
) {
mapper.apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerModule(
SimpleModule()
.addDeserializer(ExecutionType::class.java, ExecutionTypeDeserializer())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal object RedisPendingExecutionServiceTest : SubjectSpek<RedisPendingExecu

val redis = EmbeddedRedis.embed()
val mapper = ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerSubtypes(StartExecution::class.java, RestartStage::class.java)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SqlOrcaQueueConfiguration : SqlQueueConfiguration() {
taskResolver: TaskResolver
) {
mapper.apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerModule(
SimpleModule()
.addDeserializer(ExecutionType::class.java, ExecutionTypeDeserializer())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SqlTestConfig {
taskResolver: TaskResolver
) {
mapper.apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerModule(
SimpleModule()
.addDeserializer(ExecutionType::class.java, ExecutionTypeDeserializer())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal object SqlPendingExecutionServiceTest : SubjectSpek<SqlPendingExecution
val maxDepth = 4

val mapper = ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerSubtypes(StartExecution::class.java, RestartStage::class.java)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object TaskTypeDeserializerTest : Spek({
val taskResolver = TaskResolver(TasksProvider(listOf(DummyTask())), false)

val objectMapper = ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerModule(
SimpleModule()
.addDeserializer(Class::class.java, TaskTypeDeserializer(taskResolver))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal object DualPendingExecutionServiceTest : SubjectSpek<DualPendingExecuti
val primaryRedis = EmbeddedRedis.embed()
val previousRedis = EmbeddedRedis.embed()
val mapper = ObjectMapper().apply {
registerModule(KotlinModule())
registerModule(KotlinModule.Builder().build())
registerSubtypes(StartExecution::class.java, RestartStage::class.java)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import static java.time.temporal.ChronoUnit.DAYS
abstract class OldPipelineCleanupPollingNotificationAgentSpec extends Specification {
@Shared
ObjectMapper mapper = OrcaObjectMapper.newInstance().with {
registerModule(new KotlinModule())
registerModule(new KotlinModule.Builder().build())
it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import static java.time.temporal.ChronoUnit.DAYS
abstract class TopApplicationExecutionCleanupPollingNotificationAgentSpec extends Specification {
@Shared
ObjectMapper mapper = OrcaObjectMapper.newInstance().with {
registerModule(new KotlinModule())
registerModule(new KotlinModule.Builder().build())
it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract class SqlPipelineExecutionRepositorySpec extends PipelineExecutionRepos

@Shared
ObjectMapper mapper = OrcaObjectMapper.newInstance().with {
registerModule(new KotlinModule())
registerModule(new KotlinModule.Builder().build())
it
}

Expand Down

0 comments on commit dc68a7a

Please sign in to comment.