From 39db8b2961bdf9b3ec672629912b32f212e3d9bc Mon Sep 17 00:00:00 2001 From: abhupadh Date: Wed, 5 Mar 2025 18:52:01 -0800 Subject: [PATCH 1/6] upgrading to java17, cloudevents latest version --- .../ZonedDateTimeDeserializer.java | 24 +++++++++++++++++++ .../cloudevents/ZonedDateTimeSerializer.java | 20 ++++++++++++++++ .../java/com/adobe/aio/util/JacksonUtil.java | 4 ++-- pom.xml | 14 +++++------ 4 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java create mode 100644 core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java diff --git a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java new file mode 100644 index 00000000..354cc136 --- /dev/null +++ b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java @@ -0,0 +1,24 @@ +package com.adobe.aio.cloudevents; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import java.io.IOException; +import java.time.DateTimeException; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +public class ZonedDateTimeDeserializer extends JsonDeserializer { + + @Override + public ZonedDateTime deserialize( + JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException, JacksonException { + try { + return ZonedDateTime.parse(jsonParser.getText(), DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } catch (DateTimeException e) { + throw new IllegalArgumentException("could not parse"); + } + } +} diff --git a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java new file mode 100644 index 00000000..2c89d9d3 --- /dev/null +++ b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java @@ -0,0 +1,20 @@ +package com.adobe.aio.cloudevents; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +public class ZonedDateTimeSerializer extends JsonSerializer { + + @Override + public void serialize( + ZonedDateTime zonedDateTime, + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) + throws IOException { + jsonGenerator.writeString(zonedDateTime.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); + } +} \ No newline at end of file diff --git a/core/src/main/java/com/adobe/aio/util/JacksonUtil.java b/core/src/main/java/com/adobe/aio/util/JacksonUtil.java index 9febae2b..42ad80a8 100644 --- a/core/src/main/java/com/adobe/aio/util/JacksonUtil.java +++ b/core/src/main/java/com/adobe/aio/util/JacksonUtil.java @@ -11,6 +11,8 @@ */ package com.adobe.aio.util; +import com.adobe.aio.cloudevents.ZonedDateTimeDeserializer; +import com.adobe.aio.cloudevents.ZonedDateTimeSerializer; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -20,8 +22,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.node.TextNode; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import io.cloudevents.json.ZonedDateTimeDeserializer; -import io.cloudevents.json.ZonedDateTimeSerializer; import io.openapitools.jackson.dataformat.hal.JacksonHALModule; import java.time.ZonedDateTime; import org.apache.commons.lang3.StringUtils; diff --git a/pom.xml b/pom.xml index bb66a5b8..103403f7 100644 --- a/pom.xml +++ b/pom.xml @@ -96,15 +96,15 @@ 0.8.10 - 1.10.0 + 1.13.0 3.13.0 5.10.0 - 5.4.0 - 1.7.6 - 2.13.4 + 5.11.0 + 2.0.12 + 2.17.2 0.11.5 - 1.2.0 + 4.0.1 @@ -259,8 +259,8 @@ [3.3.9,) - Maven must be executed with a Java 8 JRE or higher. - 1.8.0 + Maven must be executed with a Java 17 JRE or higher. + 1.17.0 From 572e199696af214438bfbe748bd4bf690935e432 Mon Sep 17 00:00:00 2001 From: abhupadh Date: Wed, 5 Mar 2025 18:53:21 -0800 Subject: [PATCH 2/6] adding license header --- .../aio/cloudevents/ZonedDateTimeDeserializer.java | 11 +++++++++++ .../aio/cloudevents/ZonedDateTimeSerializer.java | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java index 354cc136..da67c877 100644 --- a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java +++ b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java @@ -1,3 +1,14 @@ +/* + * Copyright 2023 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ package com.adobe.aio.cloudevents; import com.fasterxml.jackson.core.JacksonException; diff --git a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java index 2c89d9d3..a1de59e5 100644 --- a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java +++ b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeSerializer.java @@ -1,3 +1,14 @@ +/* + * Copyright 2023 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ package com.adobe.aio.cloudevents; import com.fasterxml.jackson.core.JsonGenerator; From e84f396b56539caf5a73dc8215845abea70801d3 Mon Sep 17 00:00:00 2001 From: abhupadh Date: Thu, 6 Mar 2025 13:27:42 -0800 Subject: [PATCH 3/6] upgrading aio-lib-java version to 3.0.0 as major release for java17 upgrade --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 103403f7..63e6d20a 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT pom From 38a4d18e8e17d1d4244bed9aacb2a2ee31183f30 Mon Sep 17 00:00:00 2001 From: abhupadh Date: Thu, 6 Mar 2025 17:14:45 -0800 Subject: [PATCH 4/6] minor refactoring --- .../webhook/feign/FeignPubKeyServiceTest.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/events_webhook/src/test/java/com/adobe/aio/event/webhook/feign/FeignPubKeyServiceTest.java b/events_webhook/src/test/java/com/adobe/aio/event/webhook/feign/FeignPubKeyServiceTest.java index 8152da24..94045020 100644 --- a/events_webhook/src/test/java/com/adobe/aio/event/webhook/feign/FeignPubKeyServiceTest.java +++ b/events_webhook/src/test/java/com/adobe/aio/event/webhook/feign/FeignPubKeyServiceTest.java @@ -1,23 +1,20 @@ package com.adobe.aio.event.webhook.feign; -import java.io.File; -import java.security.KeyFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PublicKey; - -import javax.crypto.KeyGenerator; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockserver.client.MockServerClient; import org.mockserver.junit.jupiter.MockServerExtension; import shaded_package.org.apache.commons.codec.binary.Base64; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockserver.model.HttpRequest.*; -import static org.mockserver.model.HttpResponse.*; - @ExtendWith(MockServerExtension.class) public class FeignPubKeyServiceTest { From 52c8f901b7eb12dd2d5c78ee1741f5d55775c8e0 Mon Sep 17 00:00:00 2001 From: abhupadh Date: Thu, 6 Mar 2025 17:16:29 -0800 Subject: [PATCH 5/6] review comment --- .../com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java index da67c877..b7cfbea8 100644 --- a/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java +++ b/core/src/main/java/com/adobe/aio/cloudevents/ZonedDateTimeDeserializer.java @@ -29,7 +29,7 @@ public ZonedDateTime deserialize( try { return ZonedDateTime.parse(jsonParser.getText(), DateTimeFormatter.ISO_OFFSET_DATE_TIME); } catch (DateTimeException e) { - throw new IllegalArgumentException("could not parse"); + throw new IllegalArgumentException("could not parse", e); } } } From 4478d8cb1938e25e7bac59e93be762d08e54fc3e Mon Sep 17 00:00:00 2001 From: abhupadh Date: Thu, 13 Mar 2025 12:41:37 -0700 Subject: [PATCH 6/6] using correct snapshot version for aio-lib-java in all child modules --- aem/aio_aem_events/pom.xml | 2 +- aem/core_aem/pom.xml | 2 +- aem/events_ingress_aem/pom.xml | 2 +- aem/events_mgmt_aem/pom.xml | 2 +- aem/events_osgi_mapping/pom.xml | 2 +- aem/lib_osgi/pom.xml | 2 +- aem/pom.xml | 2 +- core/pom.xml | 2 +- events_ingress/pom.xml | 2 +- events_journal/pom.xml | 2 +- events_mgmt/pom.xml | 2 +- events_test/pom.xml | 2 +- events_webhook/pom.xml | 2 +- events_xdm/pom.xml | 2 +- ims/pom.xml | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/aem/aio_aem_events/pom.xml b/aem/aio_aem_events/pom.xml index b046b7f5..91cfc76d 100644 --- a/aem/aio_aem_events/pom.xml +++ b/aem/aio_aem_events/pom.xml @@ -22,7 +22,7 @@ com.adobe.aio.aem aio-aem ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT aio-aem-events diff --git a/aem/core_aem/pom.xml b/aem/core_aem/pom.xml index 4a51701c..69836cdb 100644 --- a/aem/core_aem/pom.xml +++ b/aem/core_aem/pom.xml @@ -19,7 +19,7 @@ com.adobe.aio.aem aio-aem ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT aio-aem-core diff --git a/aem/events_ingress_aem/pom.xml b/aem/events_ingress_aem/pom.xml index e1349650..25ca9e8f 100644 --- a/aem/events_ingress_aem/pom.xml +++ b/aem/events_ingress_aem/pom.xml @@ -19,7 +19,7 @@ com.adobe.aio.aem aio-aem ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT aio-aem-events-publish diff --git a/aem/events_mgmt_aem/pom.xml b/aem/events_mgmt_aem/pom.xml index 503412a6..01aa2644 100644 --- a/aem/events_mgmt_aem/pom.xml +++ b/aem/events_mgmt_aem/pom.xml @@ -19,7 +19,7 @@ com.adobe.aio.aem aio-aem ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT aio-aem-events-mgmt diff --git a/aem/events_osgi_mapping/pom.xml b/aem/events_osgi_mapping/pom.xml index 90142d56..3392ee01 100644 --- a/aem/events_osgi_mapping/pom.xml +++ b/aem/events_osgi_mapping/pom.xml @@ -19,7 +19,7 @@ com.adobe.aio.aem aio-aem ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT aio-aem-events-osgi-mapping diff --git a/aem/lib_osgi/pom.xml b/aem/lib_osgi/pom.xml index 2d248934..b4f3d4fa 100644 --- a/aem/lib_osgi/pom.xml +++ b/aem/lib_osgi/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio.aem aio-aem ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT aio-lib-osgi diff --git a/aem/pom.xml b/aem/pom.xml index d9adfac8..3cc7a04d 100644 --- a/aem/pom.xml +++ b/aem/pom.xml @@ -19,7 +19,7 @@ com.adobe.aio aio-lib-java ../pom.xml - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT com.adobe.aio.aem diff --git a/core/pom.xml b/core/pom.xml index c95417b8..6df8405d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/events_ingress/pom.xml b/events_ingress/pom.xml index 201b042d..3649aacc 100644 --- a/events_ingress/pom.xml +++ b/events_ingress/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/events_journal/pom.xml b/events_journal/pom.xml index 99014af0..78dbb9d3 100644 --- a/events_journal/pom.xml +++ b/events_journal/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/events_mgmt/pom.xml b/events_mgmt/pom.xml index 080cd338..22d9c1d5 100644 --- a/events_mgmt/pom.xml +++ b/events_mgmt/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/events_test/pom.xml b/events_test/pom.xml index 0939c283..f01bd949 100644 --- a/events_test/pom.xml +++ b/events_test/pom.xml @@ -16,7 +16,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/events_webhook/pom.xml b/events_webhook/pom.xml index 4ca46b6b..cc1dfd15 100644 --- a/events_webhook/pom.xml +++ b/events_webhook/pom.xml @@ -16,7 +16,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/events_xdm/pom.xml b/events_xdm/pom.xml index 8ef32de0..61f03504 100644 --- a/events_xdm/pom.xml +++ b/events_xdm/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/ims/pom.xml b/ims/pom.xml index 5da83d0d..758275da 100644 --- a/ims/pom.xml +++ b/ims/pom.xml @@ -17,7 +17,7 @@ com.adobe.aio aio-lib-java - 2.0.1-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml 4.0.0