diff --git a/api/kogito-jobs-service-api/src/main/java/org/kie/kogito/jobs/service/api/serlialization/SerializationUtils.java b/api/kogito-jobs-service-api/src/main/java/org/kie/kogito/jobs/service/api/serlialization/SerializationUtils.java index 7cca0a4535e..d5dcdb6c49d 100644 --- a/api/kogito-jobs-service-api/src/main/java/org/kie/kogito/jobs/service/api/serlialization/SerializationUtils.java +++ b/api/kogito-jobs-service-api/src/main/java/org/kie/kogito/jobs/service/api/serlialization/SerializationUtils.java @@ -54,7 +54,8 @@ private static ObjectMapper buildObjectMapper() { ObjectMapper objectMapper = new ObjectMapper() .registerModule(new JavaTimeModule()) .registerModule(JsonFormat.getCloudEventJacksonModule()) - .disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + .disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .disable(com.fasterxml.jackson.databind.DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); registerDescriptors(objectMapper); return objectMapper; } diff --git a/api/kogito-jobs-service-api/src/test/java/org/kie/kogito/jobs/service/api/event/serialization/JobCloudEventDeserializerTest.java b/api/kogito-jobs-service-api/src/test/java/org/kie/kogito/jobs/service/api/event/serialization/JobCloudEventDeserializerTest.java index e4088fdc83d..d83677f74b9 100644 --- a/api/kogito-jobs-service-api/src/test/java/org/kie/kogito/jobs/service/api/event/serialization/JobCloudEventDeserializerTest.java +++ b/api/kogito-jobs-service-api/src/test/java/org/kie/kogito/jobs/service/api/event/serialization/JobCloudEventDeserializerTest.java @@ -150,7 +150,7 @@ private static void assertCreateJobEvent(JobCloudEvent result) { assertThat(job.getSchedule()).isInstanceOf(TimerSchedule.class); TimerSchedule schedule = (TimerSchedule) job.getSchedule(); - assertThat(schedule.getStartTime()).isEqualTo(SCHEDULE_START_TIME); + assertThat(schedule.getStartTime()).hasToString(SCHEDULE_START_TIME.toString()); assertThat(schedule.getRepeatCount()).isEqualTo(SCHEDULE_REPEAT_COUNT); assertThat(schedule.getDelay()).isEqualTo(SCHEDULE_DELAY); assertThat(schedule.getDelayUnit()).isEqualTo(SCHEDULE_DELAY_UNIT); diff --git a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java index c670e699f90..035438a8143 100644 --- a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java +++ b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java @@ -42,6 +42,7 @@ public void customize(ObjectMapper mapper) { if (!configBean.failOnEmptyBean()) { mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); } + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true).withTimeZone(TimeZone.getDefault())); mapper.registerModule(JsonFormat.getCloudEventJacksonModule()).findAndRegisterModules(); } diff --git a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java index 86896e5799e..77d853abd9d 100644 --- a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java +++ b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java @@ -47,6 +47,7 @@ public void customize(Jackson2ObjectMapperBuilder builder) { if (!configBean.failOnEmptyBean()) { builder.featuresToDisable (SerializationFeature.FAIL_ON_EMPTY_BEANS); } + builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); builder.dateFormat(new StdDateFormat().withColonInTimeZone(true).withTimeZone(TimeZone.getDefault())); builder.modulesToInstall(new JavaTimeModule()); } diff --git a/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java b/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java index dcc12089e8c..18e13872c0a 100644 --- a/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java +++ b/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -39,6 +40,7 @@ private static class DefaultObjectMapper { .setTypeFactory(TypeFactory.defaultInstance().withClassLoader(Thread.currentThread().getContextClassLoader())) .registerModule(JsonFormat.getCloudEventJacksonModule()) .registerModule(new CommonObjectModule()) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .findAndRegisterModules(); }