Skip to content

Commit

Permalink
Use ISO 3166-2 to identify the country and the subdivisions
Browse files Browse the repository at this point in the history
  • Loading branch information
derTobsch committed Nov 28, 2023
1 parent 0b6a495 commit 5d618d7
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 108 deletions.
10 changes: 5 additions & 5 deletions jollyday-core/src/main/resources/holidays/Holidays_es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="m" description="Madrid">
<SubConfigurations hierarchy="md" description="Madrid">
<Holidays>
<Fixed month="MARCH" day="19" descriptionPropertiesKey="ST_JOSEPH"/>
<Fixed month="MAY" day="2" descriptionPropertiesKey="REGIONAL"/>
Expand All @@ -152,7 +152,7 @@

</SubConfigurations>

<SubConfigurations hierarchy="mu" description="Murcia">
<SubConfigurations hierarchy="mc" description="Murcia">
<Holidays>
<Fixed month="MARCH" day="19" descriptionPropertiesKey="ST_JOSEPH"/>
<Fixed month="JUNE" day="9" descriptionPropertiesKey="REGIONAL"/>
Expand All @@ -161,7 +161,7 @@
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="na" description="Navarre">
<SubConfigurations hierarchy="nc" description="Navarra">
<Holidays>
<Fixed month="MARCH" day="19" descriptionPropertiesKey="ST_JOSEPH"/>
<Fixed month="AUGUST" day="15" descriptionPropertiesKey="ASSUMPTION_DAY"/>
Expand All @@ -170,7 +170,7 @@
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="o" description="Asturias">
<SubConfigurations hierarchy="as" description="Asturias">
<Holidays>
<Fixed month="SEPTEMBER" day="8" descriptionPropertiesKey="REGIONAL"/>
<Fixed month="AUGUST" day="15" descriptionPropertiesKey="ASSUMPTION_DAY">
Expand All @@ -191,7 +191,7 @@
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="s" description="Cantabria">
<SubConfigurations hierarchy="cb" description="Cantabria">
<Holidays>
<Fixed month="AUGUST" day="15" descriptionPropertiesKey="ASSUMPTION_DAY"/>
<Fixed month="SEPTEMBER" day="15" descriptionPropertiesKey="APARECIDA"/>
Expand Down
52 changes: 28 additions & 24 deletions jollyday-core/src/main/resources/holidays/Holidays_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,51 @@
<ChristianHoliday type="WHIT_MONDAY" validFrom="2008" descriptionPropertiesKey="christian.WHIT_MONDAY"/>
</Holidays>

<SubConfigurations hierarchy="ma" description="Martinique">
<Holidays>
<Fixed month="MAY" day="22"/>
</Holidays>
</SubConfigurations>
<SubConfigurations hierarchy="GES" description="Grand Est">
<Holidays/>

<SubConfigurations hierarchy="gu" description="Guadeloupe">
<Holidays>
<Fixed month="MAY" day="27"/>
</Holidays>
</SubConfigurations>
<SubConfigurations hierarchy="57" description="Moselle">
<Holidays>
<Fixed month="DECEMBER" day="26"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="gy" description="Guyane">
<Holidays>
<Fixed month="JUNE" day="10"/>
</Holidays>
<SubConfigurations hierarchy="67" description="Bas-Rhin">
<Holidays>
<Fixed month="DECEMBER" day="26"/>
<ChristianHoliday type="GOOD_FRIDAY" descriptionPropertiesKey="christian.GOOD_FRIDAY"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="68" description="Haut-Rhin">
<Holidays>
<Fixed month="DECEMBER" day="26"/>
<ChristianHoliday type="GOOD_FRIDAY" descriptionPropertiesKey="christian.GOOD_FRIDAY"/>
</Holidays>
</SubConfigurations>
</SubConfigurations>

<SubConfigurations hierarchy="lr" description="La Reunion">
<SubConfigurations hierarchy="971" description="Guadeloupe">
<Holidays>
<Fixed month="DECEMBER" day="20"/>
<Fixed month="MAY" day="27"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="br" description="Bas-Rhin">
<SubConfigurations hierarchy="972" description="Martinique">
<Holidays>
<Fixed month="DECEMBER" day="26"/>
<ChristianHoliday type="GOOD_FRIDAY" descriptionPropertiesKey="christian.GOOD_FRIDAY"/>
<Fixed month="MAY" day="22"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="hr" description="Haut-Rhin">
<SubConfigurations hierarchy="973" description="Guyane">
<Holidays>
<Fixed month="DECEMBER" day="26"/>
<ChristianHoliday type="GOOD_FRIDAY" descriptionPropertiesKey="christian.GOOD_FRIDAY"/>
<Fixed month="JUNE" day="10"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="mo" description="Moselle">
<SubConfigurations hierarchy="974" description="La Reunion">
<Holidays>
<Fixed month="DECEMBER" day="26"/>
<Fixed month="DECEMBER" day="20"/>
</Holidays>
</SubConfigurations>
</Configuration>
64 changes: 40 additions & 24 deletions jollyday-core/src/main/resources/holidays/Holidays_ni.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,62 @@
<ChristianHoliday type="MAUNDY_THURSDAY" descriptionPropertiesKey="christian.MAUNDY_THURSDAY"/>
</Holidays>

<SubConfigurations hierarchy="bo" description="Boaco">
<SubConfigurations hierarchy="BO" description="Boaco">
<Holidays>
<Fixed month="JULY" day="25" descriptionPropertiesKey="SANTIAGO"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="so" description="Somoto">
<Holidays>
<Fixed month="JULY" day="25" descriptionPropertiesKey="SANTIAGO"/>
</Holidays>
<SubConfigurations hierarchy="GR" description="Granada">
<Holidays/>

<SubConfigurations hierarchy="na" description="Nandaime">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
</SubConfigurations>
</SubConfigurations>

<SubConfigurations hierarchy="mn" description="Managua">
<SubConfigurations hierarchy="MD" description="Madriz">
<Holidays/>

<SubConfigurations hierarchy="so" description="Somoto">
<Holidays>
<Fixed month="JULY" day="25" descriptionPropertiesKey="SANTIAGO"/>
</Holidays>
</SubConfigurations>
</SubConfigurations>

<SubConfigurations hierarchy="MN" description="Managua">
<Holidays>
<Fixed month="JULY" day="25" descriptionPropertiesKey="SANTIAGO"/>
<Fixed month="AUGUST" day="1" descriptionPropertiesKey="SANTO_DOMINGO"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="na" description="Nandaime">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
</SubConfigurations>
<SubConfigurations hierarchy="MS" description="Masaya">
<Holidays/>

<SubConfigurations hierarchy="ni" description="Niquinohomo">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
<SubConfigurations hierarchy="ni" description="Niquinohomo">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
</SubConfigurations>
</SubConfigurations>

<SubConfigurations hierarchy="mo" description="Moyogalpa">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
</SubConfigurations>
<SubConfigurations hierarchy="RI" description="Rivas">
<Holidays/>

<SubConfigurations hierarchy="om" description="Ometepe">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
<SubConfigurations hierarchy="mo" description="Moyogalpa">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
</SubConfigurations>

<SubConfigurations hierarchy="om" description="Ometepe">
<Holidays>
<Fixed month="JULY" day="26" descriptionPropertiesKey="SANTA_ANA"/>
</Holidays>
</SubConfigurations>
</SubConfigurations>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void ensuresThatWhitMondayIsNoPublicHolidayInItalyIsConfigured(@ForAll @YearRang
@Property
void ensuresThatWhitMondayInBZIsConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(ITALY));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue(), "bz");
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue(), "32");
assertThat(holidays)
.isNotEmpty()
.extracting(Holiday::getPropertiesKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void ensuresThatChristmasIsConfigured(@ForAll @YearRange Year year) {
@Property
void ensuresThatBaltiDayIsConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(MOLDOVA));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue(), "bti");
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue(), "ba");
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), MAY, 22), "REGIONAL", OFFICIAL_HOLIDAY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.time.LocalDate;
import java.util.Set;

import static de.focus_shift.jollyday.core.HolidayCalendar.NEW_ZEALAND;
import static de.focus_shift.jollyday.core.ManagerParameters.*;
import static org.assertj.core.api.Assertions.assertThat;

class HolidayNZTest extends AbstractCountryTestBase {
Expand All @@ -19,8 +21,7 @@ class HolidayNZTest extends AbstractCountryTestBase {
private static final int YEAR = 2018;

private final CalendarUtil calendarUtil = new CalendarUtil();
private final HolidayManager holidayManager = HolidayManager
.getInstance(ManagerParameters.create(HolidayCalendar.NEW_ZEALAND));
private final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND));

@Test
void testManagerNZStructure() {
Expand Down
Loading

0 comments on commit 5d618d7

Please sign in to comment.