From da9fa9c312c6d9136ec17d62e6ea1035246cc5de Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Tue, 28 Nov 2023 08:54:09 +0100 Subject: [PATCH] Use ISO 3166-2 to identify the country and the subdivisions --- .../jollyday/core/HolidayCalendar.java | 2 - .../main/resources/holidays/Holidays_at.xml | 18 +- .../main/resources/holidays/Holidays_au.xml | 30 +- .../main/resources/holidays/Holidays_ba.xml | 6 +- .../main/resources/holidays/Holidays_be.xml | 12 +- .../main/resources/holidays/Holidays_br.xml | 19 +- .../main/resources/holidays/Holidays_ca.xml | 14 + .../main/resources/holidays/Holidays_de.xml | 28 +- .../main/resources/holidays/Holidays_es.xml | 22 + .../main/resources/holidays/Holidays_fi.xml | 3 +- .../main/resources/holidays/Holidays_fr.xml | 7 + .../main/resources/holidays/Holidays_in.xml | 34 + .../main/resources/holidays/Holidays_is.xml | 3 +- .../main/resources/holidays/Holidays_it.xml | 3 +- .../main/resources/holidays/Holidays_lu.xml | 14 +- .../main/resources/holidays/Holidays_md.xml | 3 +- .../main/resources/holidays/Holidays_mx.xml | 1 + .../main/resources/holidays/Holidays_ng.xml | 3 +- .../main/resources/holidays/Holidays_ni.xml | 7 + .../main/resources/holidays/Holidays_nyse.xml | 47 +- .../main/resources/holidays/Holidays_nz.xml | 158 +- .../main/resources/holidays/Holidays_pt.xml | 3457 +++++++++-------- .../main/resources/holidays/Holidays_us.xml | 559 ++- .../jollyday/core/HolidayCalendarTest.java | 24 + jollyday-tests/pom.xml | 6 + .../jollyday/tests/CalendarHierarchyTest.java | 47 + .../jollyday/tests/Iso3166Test.java | 25 + .../jollyday/tests/country/HolidayLUTest.java | 10 + 28 files changed, 2533 insertions(+), 2029 deletions(-) create mode 100644 jollyday-core/src/test/java/de/focus_shift/jollyday/core/HolidayCalendarTest.java create mode 100644 jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarHierarchyTest.java create mode 100644 jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/Iso3166Test.java diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java index 810201224..078079d8f 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java @@ -5,7 +5,6 @@ /** * This enum provides a list of all supported holiday calendars. * - * @author Sven Diedrichsen (sven.diedrichsen@gmail.com) * @version $Id$ */ public enum HolidayCalendar { @@ -47,5 +46,4 @@ public enum HolidayCalendar { public String getId() { return id; } - } diff --git a/jollyday-core/src/main/resources/holidays/Holidays_at.xml b/jollyday-core/src/main/resources/holidays/Holidays_at.xml index ca71d3d3d..3f020b86b 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_at.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_at.xml @@ -23,56 +23,56 @@ - + - + - + - + - + - + - + - + - + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_au.xml b/jollyday-core/src/main/resources/holidays/Holidays_au.xml index 908ab4fc8..5dd1ae26e 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_au.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_au.xml @@ -43,6 +43,7 @@ + @@ -69,13 +70,14 @@ + descriptionPropertiesKey="FAMILY_COMMUNITY"/> + descriptionPropertiesKey="RECONCILIATION"> + @@ -95,9 +97,10 @@ + descriptionPropertiesKey="BANK_HOLIDAY"/> + @@ -123,6 +126,7 @@ + @@ -142,10 +146,11 @@ + descriptionPropertiesKey="QUEENS_BIRTHDAY"/> + descriptionPropertiesKey="QUEENS_BIRTHDAY"/> + @@ -155,6 +160,7 @@ + @@ -186,6 +192,7 @@ + @@ -205,17 +212,21 @@ + + + + @@ -233,10 +244,10 @@ - + + @@ -260,10 +271,9 @@ - + + descriptionPropertiesKey="WESTERN_AUSTRALIA"/> diff --git a/jollyday-core/src/main/resources/holidays/Holidays_ba.xml b/jollyday-core/src/main/resources/holidays/Holidays_ba.xml index 643f0ed30..259e88272 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_ba.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_ba.xml @@ -25,14 +25,16 @@ - + + - + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_be.xml b/jollyday-core/src/main/resources/holidays/Holidays_be.xml index a4e0ec499..4f8bef3ab 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_be.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_be.xml @@ -16,13 +16,9 @@ - - - - + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_br.xml b/jollyday-core/src/main/resources/holidays/Holidays_br.xml index dd3c2f003..628fa702d 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_br.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_br.xml @@ -19,6 +19,7 @@ + @@ -31,6 +32,7 @@ + @@ -42,8 +44,9 @@ + - + @@ -51,64 +54,76 @@ + + + + - + + + + + + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_ca.xml b/jollyday-core/src/main/resources/holidays/Holidays_ca.xml index 275c230e8..072a6bc8b 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_ca.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_ca.xml @@ -12,6 +12,7 @@ + @@ -24,6 +25,7 @@ + @@ -35,6 +37,7 @@ + @@ -47,17 +50,20 @@ + + + @@ -70,6 +76,7 @@ + @@ -82,6 +89,7 @@ + @@ -94,6 +102,7 @@ + @@ -106,11 +115,13 @@ + + @@ -124,6 +135,7 @@ + @@ -137,9 +149,11 @@ + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_de.xml b/jollyday-core/src/main/resources/holidays/Holidays_de.xml index 34fa8bb40..6335f06fb 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_de.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_de.xml @@ -39,7 +39,6 @@ - WEDNESDAY BEFORE @@ -75,36 +74,39 @@ - - WEDNESDAY - BEFORE - - - + WEDNESDAY + BEFORE + + + + + + + @@ -119,7 +121,6 @@ BEFORE - @@ -136,13 +137,11 @@ - WEDNESDAY BEFORE - @@ -150,13 +149,11 @@ - WEDNESDAY BEFORE - @@ -165,13 +162,11 @@ - WEDNESDAY BEFORE - @@ -179,7 +174,6 @@ - WEDNESDAY BEFORE @@ -205,7 +199,6 @@ - WEDNESDAY BEFORE @@ -217,7 +210,6 @@ - WEDNESDAY BEFORE @@ -229,7 +221,6 @@ - WEDNESDAY BEFORE @@ -241,7 +232,6 @@ - WEDNESDAY BEFORE diff --git a/jollyday-core/src/main/resources/holidays/Holidays_es.xml b/jollyday-core/src/main/resources/holidays/Holidays_es.xml index de2bba77e..562e43880 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_es.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_es.xml @@ -15,6 +15,7 @@ + @@ -26,6 +27,7 @@ + @@ -36,6 +38,7 @@ + @@ -44,6 +47,7 @@ + @@ -52,6 +56,7 @@ + @@ -60,6 +65,7 @@ + @@ -68,6 +74,7 @@ + @@ -75,6 +82,7 @@ + @@ -88,7 +96,9 @@ + + @@ -97,6 +107,7 @@ + @@ -106,6 +117,7 @@ + @@ -114,6 +126,7 @@ + @@ -122,6 +135,7 @@ + @@ -135,7 +149,9 @@ + + @@ -144,6 +160,7 @@ + @@ -152,6 +169,7 @@ + @@ -162,6 +180,7 @@ + @@ -171,6 +190,7 @@ + @@ -178,6 +198,7 @@ + @@ -186,6 +207,7 @@ + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_fi.xml b/jollyday-core/src/main/resources/holidays/Holidays_fi.xml index a1327af37..fb23c544a 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_fi.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_fi.xml @@ -29,7 +29,8 @@ - + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_fr.xml b/jollyday-core/src/main/resources/holidays/Holidays_fr.xml index 5cbe6cc81..0e4974814 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_fr.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_fr.xml @@ -18,38 +18,45 @@ + + + + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_in.xml b/jollyday-core/src/main/resources/holidays/Holidays_in.xml index b0280e683..fd45c7240 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_in.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_in.xml @@ -20,6 +20,7 @@ + @@ -30,6 +31,7 @@ + @@ -40,6 +42,7 @@ + @@ -52,6 +55,7 @@ + @@ -61,6 +65,7 @@ + @@ -70,6 +75,7 @@ + @@ -78,6 +84,7 @@ + @@ -85,6 +92,7 @@ + @@ -92,6 +100,7 @@ + @@ -101,6 +110,7 @@ + @@ -108,6 +118,7 @@ + @@ -123,6 +134,7 @@ + @@ -134,6 +146,7 @@ + @@ -143,6 +156,7 @@ + @@ -155,6 +169,7 @@ + @@ -166,6 +181,7 @@ + @@ -176,6 +192,7 @@ + @@ -186,6 +203,7 @@ + @@ -196,6 +214,7 @@ + @@ -205,12 +224,14 @@ + + @@ -219,6 +240,7 @@ + @@ -229,6 +251,7 @@ + @@ -243,6 +266,7 @@ + @@ -252,6 +276,7 @@ + @@ -264,6 +289,7 @@ + @@ -276,6 +302,7 @@ + @@ -288,6 +315,7 @@ + @@ -299,6 +327,7 @@ + @@ -310,6 +339,7 @@ + @@ -319,6 +349,7 @@ + @@ -328,6 +359,7 @@ + @@ -336,6 +368,7 @@ + @@ -346,6 +379,7 @@ + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_is.xml b/jollyday-core/src/main/resources/holidays/Holidays_is.xml index 2eb040720..683897e54 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_is.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_is.xml @@ -26,8 +26,7 @@ - + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_it.xml b/jollyday-core/src/main/resources/holidays/Holidays_it.xml index 420626a92..d22bd6d25 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_it.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_it.xml @@ -18,7 +18,8 @@ - + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_lu.xml b/jollyday-core/src/main/resources/holidays/Holidays_lu.xml index 6ef2c3631..3a64d388e 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_lu.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_lu.xml @@ -4,6 +4,7 @@ xmlns="https://focus_shift.de/jollyday/schema/holiday" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://focus_shift.de/jollyday/schema/holiday https://focus_shift.de/jollyday/schema/holiday/holiday.xsd"> + @@ -17,9 +18,14 @@ - - - - + + + + + + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_md.xml b/jollyday-core/src/main/resources/holidays/Holidays_md.xml index 2bb586b8a..99958be24 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_md.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_md.xml @@ -18,7 +18,8 @@ - + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_mx.xml b/jollyday-core/src/main/resources/holidays/Holidays_mx.xml index aab0457f8..0cf9e9646 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_mx.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_mx.xml @@ -35,6 +35,7 @@ + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_ng.xml b/jollyday-core/src/main/resources/holidays/Holidays_ng.xml index fe5ea2980..d7dfa5c38 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_ng.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_ng.xml @@ -20,7 +20,8 @@ - + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_ni.xml b/jollyday-core/src/main/resources/holidays/Holidays_ni.xml index 3decf6a50..350e59137 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_ni.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_ni.xml @@ -19,37 +19,44 @@ + + + + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_nyse.xml b/jollyday-core/src/main/resources/holidays/Holidays_nyse.xml index e808c6d5e..c7caaeba8 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_nyse.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_nyse.xml @@ -6,46 +6,31 @@ xsi:schemaLocation="https://focus_shift.de/jollyday/schema/holiday https://focus_shift.de/jollyday/schema/holiday/holiday.xsd"> - - + + - - + + - - - - - - - - - - - + + + + + + + + month="JANUARY" descriptionPropertiesKey="MARTIN_LUTHER_KING"/> + month="FEBRUARY" descriptionPropertiesKey="WASHINGTONS_BIRTHDAY"/> + month="MAY" descriptionPropertiesKey="MEMORIAL_DAY"/> + month="SEPTEMBER" descriptionPropertiesKey="LABOUR_DAY"/> + month="NOVEMBER" descriptionPropertiesKey="THANKSGIVING"/> diff --git a/jollyday-core/src/main/resources/holidays/Holidays_nz.xml b/jollyday-core/src/main/resources/holidays/Holidays_nz.xml index 068102892..4dc379d8e 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_nz.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_nz.xml @@ -40,67 +40,99 @@ - + - + - + - + - + - + - + - + + + + + + https://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand + https://www.mbie.govt.nz/assets/matariki-dates-2022-to-2052-matariki-advisory-group.pdf + https://www.iso.org/obp/ui/#iso:code:3166:NZ + https://en.wikipedia.org/wiki/ISO_3166-2:NZ + + - + - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + @@ -109,66 +141,84 @@ - + + - - + + + + + - - - - - - - + + - - + + + - + + - - - + + + - + + - + - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_pt.xml b/jollyday-core/src/main/resources/holidays/Holidays_pt.xml index 4836ee20f..6f77a5480 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_pt.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_pt.xml @@ -20,1570 +20,1935 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jollyday-core/src/main/resources/holidays/Holidays_us.xml b/jollyday-core/src/main/resources/holidays/Holidays_us.xml index d339d61b5..029c88684 100644 --- a/jollyday-core/src/main/resources/holidays/Holidays_us.xml +++ b/jollyday-core/src/main/resources/holidays/Holidays_us.xml @@ -14,193 +14,156 @@ - + - - - - - - + + + + + + + - - + + - + + - - + + + - - - - + + + + + - - - + + + + - - - + + + + + + - - - - + + + + + - - - - + + + + + - - - + + + + - - - - + + + + + - - - - + + + + + - - - + + + + - - - - + + + + + - - + + - - - + + + + @@ -210,55 +173,52 @@ - + + - + + - + + - + + - + + - - - - + + + + + @@ -268,25 +228,19 @@ - - - + + + + - - - + + + - + @@ -294,149 +248,125 @@ + + - - - + + + + - - - + + + + - - - + + + + - - - - + + + + + - + - - + + + - - - + + + - + + - - - + + + + - - - + + + + - + - - - + + + + - - + + + - + - - - + + + @@ -445,11 +375,11 @@ + - + @@ -458,227 +388,184 @@ + + - - - + + + + - - - - + + + + + - - - + + + + - - - + + + + - - - - + + + + + - + + - + - - + + + - - - - + + + + + - - - + + + + - - - + + + + - - - - + + + + + - - - + + + - + + - + - + - - - + + + + - - - + + + + - - - - + + + + + - - - - + + + + + - + - - + + - + + - - - + + + diff --git a/jollyday-core/src/test/java/de/focus_shift/jollyday/core/HolidayCalendarTest.java b/jollyday-core/src/test/java/de/focus_shift/jollyday/core/HolidayCalendarTest.java new file mode 100644 index 000000000..feb5a2bb8 --- /dev/null +++ b/jollyday-core/src/test/java/de/focus_shift/jollyday/core/HolidayCalendarTest.java @@ -0,0 +1,24 @@ +package de.focus_shift.jollyday.core; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Locale; +import java.util.Set; + +import static java.util.Arrays.stream; +import static org.assertj.core.api.Assertions.assertThat; + +class HolidayCalendarTest { + + private static final List noneIso3166Countries = List.of("DJ_STOXX", "LME", "NYSE", "TARGET", "XK"); + + @Test + void ensureThatAllCountryAreISO3166Conform() { + final Set isoCountries = Set.of(Locale.getISOCountries()); + + stream(HolidayCalendar.values()) + .filter(holidayCalendar -> !noneIso3166Countries.contains(holidayCalendar.getId())) + .forEach(holidayCalendar -> assertThat(holidayCalendar.getId()).isIn(isoCountries)); + } +} diff --git a/jollyday-tests/pom.xml b/jollyday-tests/pom.xml index bdce0fdc8..5fcaa7c83 100644 --- a/jollyday-tests/pom.xml +++ b/jollyday-tests/pom.xml @@ -50,6 +50,12 @@ jqwik test + + com.vitorsvieira + scala-iso_2.12 + 0.1.2 + test + diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarHierarchyTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarHierarchyTest.java new file mode 100644 index 000000000..45c563d71 --- /dev/null +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarHierarchyTest.java @@ -0,0 +1,47 @@ +package de.focus_shift.jollyday.tests; + +import com.vitorsvieira.iso.CountrySubdivision; +import com.vitorsvieira.iso.ISOCountry; +import com.vitorsvieira.iso.ISOCountrySubdivision; +import de.focus_shift.jollyday.core.HolidayCalendar; +import de.focus_shift.jollyday.core.HolidayManager; +import org.junit.jupiter.api.Test; +import scala.collection.JavaConverters; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import static de.focus_shift.jollyday.core.HolidayManager.getInstance; +import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static java.util.stream.Collectors.toList; +import static org.assertj.core.api.Assertions.assertThat; + +class CalendarHierarchyTest { + + private static final List noneIso3166Countries = List.of("DJ_STOXX", "LME", "NYSE", "TARGET", "XK", "FR", "ES", "NI"); + private static final List okSubdivisions = List.of("FI-01"); + + @Test + void ensureThatAllCountryAreISO3166Conform() { + Arrays.stream(HolidayCalendar.values()) + .filter(holidayCalendar -> !noneIso3166Countries.contains(holidayCalendar.getId())) + .forEach(holidayCalendar -> { + + final ISOCountry.EnumVal enumVal = ISOCountry.from(holidayCalendar.getId()).get(); + final Collection subdivisionVector = JavaConverters.asJavaCollection(ISOCountrySubdivision.fromCountry(enumVal)); + final List subdivisions = subdivisionVector.stream() + .map(CountrySubdivision.EnumVal::toString) + .collect(toList()); + + final HolidayManager holidayManager = getInstance(create(holidayCalendar)); + holidayManager.getCalendarHierarchy().getChildren().keySet() + .forEach(subdivision -> { + final String subdivisionWithCountry = holidayCalendar.getId() + "-" + subdivision.toUpperCase(); + if(!okSubdivisions.contains(subdivisionWithCountry)) { + assertThat(subdivisionWithCountry).isIn(subdivisions); + } + }); + }); + } +} diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/Iso3166Test.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/Iso3166Test.java new file mode 100644 index 000000000..3f6999dad --- /dev/null +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/Iso3166Test.java @@ -0,0 +1,25 @@ +package de.focus_shift.jollyday.tests; + +import de.focus_shift.jollyday.core.HolidayCalendar; +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Locale; +import java.util.Set; + +import static java.util.Arrays.stream; +import static org.assertj.core.api.Assertions.assertThat; + +class Iso3166Test { + + private static final List noneIso3166Countries = List.of("DJ_STOXX", "LME", "NYSE", "TARGET", "XK"); + + @Test + void ensureThatAllCountryAreISO3166Conform() { + final Set isoCountries = Set.of(Locale.getISOCountries()); + + stream(HolidayCalendar.values()) + .filter(holidayCalendar -> !noneIso3166Countries.contains(holidayCalendar.getId())) + .forEach(holidayCalendar -> assertThat(holidayCalendar.getId()).isIn(isoCountries)); + } +} diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayLUTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayLUTest.java index f6bdb85d3..055d1e301 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayLUTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayLUTest.java @@ -16,6 +16,7 @@ import static de.focus_shift.jollyday.core.ManagerParameters.create; import static java.time.Month.AUGUST; import static java.time.Month.DECEMBER; +import static java.time.Month.FEBRUARY; import static java.time.Month.JANUARY; import static java.time.Month.JUNE; import static java.time.Month.MAY; @@ -134,4 +135,13 @@ void ensuresThatWhitMondayIsConfigured(@ForAll @YearRange Year year) { .extracting(Holiday::getPropertiesKey) .contains("christian.WHIT_MONDAY"); } + + @Property + void ensuresThatCarnivalForCityOfLuxemburgIsConfigured(@ForAll @YearRange Year year) { + final HolidayManager holidayManager = HolidayManager.getInstance(create(LUXEMBOURG)); + final Set holidays = holidayManager.getHolidays(year.getValue(), "lu", "clu"); + assertThat(holidays) + .isNotEmpty() + .contains(new Holiday(LocalDate.of(year.getValue(), FEBRUARY, 15), "CARNIVAL", OFFICIAL_HOLIDAY)); + } }