Skip to content

Replace ICU-based date/time comparison in TDML Runner with XMLGregorianCalendar#1677

Open
gdesrosiers1805 wants to merge 1 commit into
apache:mainfrom
gdesrosiers1805:bugfix/daffodil-3077
Open

Replace ICU-based date/time comparison in TDML Runner with XMLGregorianCalendar#1677
gdesrosiers1805 wants to merge 1 commit into
apache:mainfrom
gdesrosiers1805:bugfix/daffodil-3077

Conversation

@gdesrosiers1805
Copy link
Copy Markdown
Contributor

The TDML date/time comparison previously used the DFDLDate/Time/DateTimeConversion classes, which create ICU objects. This broke cross-testing against the IBM DFDL cross tester, which depends on an older ICU version (e.g. it lacks Calendar.clone()).

Compare xs:date/time/dateTime values by parsing into XMLGregorianCalendar and using its XSD order relation (compare()), keeping ICU off the comparison path entirely.

XMLGregorianCalendar implements XSD 1.0, which does not permit year zero, so it rejects values like "0000-01-01". Two tests whose data uses year zero (yearfromdate_03 and yearfromdatetime_03) are temporarily ignored as a result. These expose a pre-existing Daffodil bug: Daffodil produces year-zero values that are invalid under XSD 1.0, which needs to be addressed separately. The tests should be re-enabled (or converted to negative tests) once that is resolved.

DAFFODIL-3077

Copy link
Copy Markdown
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, just a number of really minor comments

Comment thread daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala Outdated
Comment thread daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala Outdated
@Test def yearfromdatetime_01 = test
@Test def yearfromdatetime_02 = test
@Test def yearfromdatetime_03 = test
@Ignore("year zero is invalid per XSD 1.0") @Test def yearfromdatetime_03 = test
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding an ignore message, our convention has been to create an issue and add a comment, e.g.

// DAFFODIL-XYZ
@Ignore @Test def yearfromdatetime_03 = test

We may want to consider a convention where the message is the bug number, i.e. @Ignore("DAFFODIL-XYZ"), but I would suggest we make that change wholesale at once if we do want to do it. Probably not worth the effort for now though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually confused as to why we were ignoreng the tests with no context, can we add the Daffodil bug comment above so poeple know?

Comment thread daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala Outdated
…anCalendar

The TDML date/time comparison previously used the DFDLDate/Time/DateTimeConversion
classes, which create ICU objects. This broke cross-testing against the IBM DFDL
cross tester, which depends on an older ICU version (e.g. it lacks Calendar.clone()).

Compare xs:date/time/dateTime values by parsing into XMLGregorianCalendar and using
its XSD order relation (compare()), keeping ICU off the comparison path entirely.

XMLGregorianCalendar implements XSD 1.0, which does not permit year zero, so it
rejects values like "0000-01-01". Two tests whose data uses year zero
(yearfromdate_03 and yearfromdatetime_03) are temporarily ignored as a result.
These expose a pre-existing Daffodil bug: Daffodil produces year-zero values that
are invalid under XSD 1.0, which needs to be addressed separately. The tests should
be re-enabled (or converted to negative tests) once that is resolved.

DAFFODIL-3077
Copy link
Copy Markdown
Contributor

@olabusayoT olabusayoT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Looks good, but couple comments about the contexless ignore

@Test def yearfromdatetime_01 = test
@Test def yearfromdatetime_02 = test
@Test def yearfromdatetime_03 = test
@Ignore @Test def yearfromdatetime_03 = test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to this ignore explaining why we are ignoring these tests

@Test def yearfromdatetime_01 = test
@Test def yearfromdatetime_02 = test
@Test def yearfromdatetime_03 = test
@Ignore("year zero is invalid per XSD 1.0") @Test def yearfromdatetime_03 = test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually confused as to why we were ignoreng the tests with no context, can we add the Daffodil bug comment above so poeple know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants