This is an automated email from the ASF dual-hosted git repository.
jiriondrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/camel-main by this push:
new 2432393552 Better fix of dataformat
2432393552 is described below
commit 2432393552e4ac37de7506aac1b05e076beb113f
Author: JiriOndrusek <[email protected]>
AuthorDate: Fri Jun 21 12:02:55 2024 +0200
Better fix of dataformat
---
.../camel/quarkus/component/dataformat/it/ICalUtils.java | 10 ++--------
.../camel/quarkus/component/dataformat/it/DataformatTest.java | 2 ++
integration-tests/dataformat/src/test/resources/test.ics | 4 ++--
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git
a/integration-tests/dataformat/src/main/java/org/apache/camel/quarkus/component/dataformat/it/ICalUtils.java
b/integration-tests/dataformat/src/main/java/org/apache/camel/quarkus/component/dataformat/it/ICalUtils.java
index 30ead3641b..b5d04fd036 100644
---
a/integration-tests/dataformat/src/main/java/org/apache/camel/quarkus/component/dataformat/it/ICalUtils.java
+++
b/integration-tests/dataformat/src/main/java/org/apache/camel/quarkus/component/dataformat/it/ICalUtils.java
@@ -17,12 +17,10 @@
package org.apache.camel.quarkus.component.dataformat.it;
import java.net.URI;
-import java.time.DateTimeException;
import java.time.Instant;
import java.time.ZonedDateTime;
import net.fortuna.ical4j.model.Calendar;
-import net.fortuna.ical4j.model.DateTime;
import net.fortuna.ical4j.model.TimeZoneRegistry;
import net.fortuna.ical4j.model.TimeZoneRegistryFactory;
import net.fortuna.ical4j.model.component.VEvent;
@@ -49,8 +47,8 @@ public class ICalUtils {
// Create the event
VEvent meeting = new VEvent();
meeting.replace(new DtStamp(Instant.ofEpochMilli(0)));
- meeting.add(new DtStart(toDateTime(start, registry).toInstant()));
- meeting.add(new DtEnd(toDateTime(end, registry).toInstant()));
+ meeting.add(new DtStart(start));
+ meeting.add(new DtEnd(end));
meeting.add(new Summary(summary));
// add timezone info..
@@ -76,8 +74,4 @@ public class ICalUtils {
return icsCalendar;
}
- static DateTime toDateTime(ZonedDateTime zonedDateTime, TimeZoneRegistry
registry) {
- return new DateTime(zonedDateTime.toInstant().toEpochMilli());
- }
-
}
diff --git
a/integration-tests/dataformat/src/test/java/org/apache/camel/quarkus/component/dataformat/it/DataformatTest.java
b/integration-tests/dataformat/src/test/java/org/apache/camel/quarkus/component/dataformat/it/DataformatTest.java
index 5556571bfa..f2cf856cba 100644
---
a/integration-tests/dataformat/src/test/java/org/apache/camel/quarkus/component/dataformat/it/DataformatTest.java
+++
b/integration-tests/dataformat/src/test/java/org/apache/camel/quarkus/component/dataformat/it/DataformatTest.java
@@ -68,7 +68,9 @@ class DataformatTest {
final String icsTemplate =
IOUtils.toString(getClass().getResourceAsStream("/test.ics"),
StandardCharsets.UTF_8);
final String icalString = String.format(
icsTemplate,
+ ZoneId.systemDefault().getId(),
toFormatedLocalDateTime(START),
+ ZoneId.systemDefault().getId(),
toFormatedLocalDateTime(END),
START.getZone().getId());
diff --git a/integration-tests/dataformat/src/test/resources/test.ics
b/integration-tests/dataformat/src/test/resources/test.ics
index c730b9af11..8da810106e 100644
--- a/integration-tests/dataformat/src/test/resources/test.ics
+++ b/integration-tests/dataformat/src/test/resources/test.ics
@@ -4,8 +4,8 @@ PRODID:-//Events Calendar//iCal4j 1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:19700101T000000Z
-DTSTART:%s
-DTEND:%s
+DTSTART;TZID=%s:%s
+DTEND;TZID=%s:%s
SUMMARY:Progress Meeting
TZID:%s
UID:00000000