From 3ba2a76a4950da192c13457cc3be28ea8fed49b1 Mon Sep 17 00:00:00 2001 From: Vincent Paturet Date: Tue, 3 Feb 2026 01:21:09 +0100 Subject: [PATCH] Upgrade to NeTEx 2.0 schema - Update bindings.xjb for NeTEx 2.0 schema changes: - TariffZone_ renamed to TariffZone_Dummy - Remove obsolete HeadwayJourneyGroupGroup/Description binding - Add bindings to resolve ObjectFactory collisions for bookingArrangements - Update tests for NeTEx 2.0 API changes: - MultilingualString now uses mixed content (withContent/getContent) - Collection getters renamed with _Dummy suffix - StopPlacesInFrame returns List directly - AllVehicleModesOfTransportEnumeration -> AllPublicTransportModesEnumeration - PublicCode/PrivateCode now use structure types - Replace removed DatedCall tests with AvailabilityCondition tests - Add helper method getStringValue() for MultilingualString --- .github/workflows/deploy.yml | 10 ++-- bindings.xjb | 54 ++++++++++++----- pom.xml | 31 +++++----- .../netex/validation/NeTExValidator.java | 5 +- .../model/AbstractUnmarshalFrameTest.java | 15 ++++- .../netex/model/MarshalUnmarshalTest.java | 60 ++++++++++--------- .../rutebanken/netex/model/ToStringTest.java | 4 +- .../model/UnmarshalResourceFrameTest.java | 4 +- .../UnmarshalServiceCalendarFrameTest.java | 2 +- .../model/UnmarshalServiceFrameTest.java | 16 ++--- .../netex/model/UnmarshalSiteFrameTest.java | 14 ++--- .../model/UnmarshalTimetableFrameTest.java | 2 +- 12 files changed, 129 insertions(+), 88 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 615e2cc..93966e2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,10 +2,10 @@ name: Build and Deploy on: push: branches: - - master + - upgrade-netex-2.0 pull_request: branches: - - master + - upgrade-netex-2.0 jobs: maven-verify: runs-on: ubuntu-24.04 @@ -22,7 +22,7 @@ jobs: sudo apt-get -y install xmlstarlet - uses: actions/setup-java@v4 with: - java-version: 17 + java-version: 21 distribution: liberica - name: Cache Maven dependencies uses: actions/cache@v5 @@ -68,13 +68,13 @@ jobs: publish-snapshot: name: Publish snapshot to Maven Central - if: github.repository_owner == 'entur' && github.event_name == 'push' && github.ref == 'refs/heads/master' + if: github.repository_owner == 'entur' && github.event_name == 'push' && github.ref == 'refs/heads/upgrade-netex-2.0' needs: maven-verify uses: ./.github/workflows/maven-jreleaser-release.yml with: version: ${{ needs.maven-verify.outputs.version }} snapshot: true skip_version_update: true - java_version: 11 + java_version: 21 java_distribution: liberica secrets: inherit \ No newline at end of file diff --git a/bindings.xjb b/bindings.xjb index a6502a6..cc9dcba 100644 --- a/bindings.xjb +++ b/bindings.xjb @@ -2,7 +2,7 @@ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jxb:version="3.0" jxb:extensionBindingPrefixes="xjc"> - + @@ -14,14 +14,14 @@ -| +| + schemaLocation="./src/main/resources/xsd/2.0/netex_framework/netex_genericFramework/netex_organisation_version.xsd"> @@ -30,35 +30,28 @@ + schemaLocation="./src/main/resources/xsd/2.0/netex_part_3/part3_fares/netex_salesOfferPackage_version.xsd"> - - - - - - + schemaLocation="./src/main/resources/xsd/2.0/netex_part_3/part3_salesTransactions/netex_salesContract_version.xsd"> + schemaLocation="./src/main/resources/xsd/2.0/netex_part_3/part3_salesTransactions/netex_retailConsortium_version.xsd"> + schemaLocation="./src/main/resources/xsd/2.0/netex_framework/netex_responsibility/netex_version_support.xsd"> @@ -68,14 +61,43 @@ - + schemaLocation="./src/main/resources/xsd/2.0/netex_framework/netex_genericFramework/netex_zone_version.xsd"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index aefc203..2d89fd5 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 4.0.0 org.entur netex-java-model - 2.0.16-SNAPSHOT + 3.0.0-SNAPSHOT netex-java-model Generates Java model from NeTEx XSDs using JAXB. @@ -66,12 +66,13 @@ UTF-8 2023-11-01T10:21:59Z - 11 + 21 NeTEx - update_dsj - https://github.com/entur/${netexRepoName} - 1.16 + next + https://github.com/NeTEx-CEN/${netexRepoName} + https://github.com/entur/${netexRepoName} + 2.0 4.0.4 @@ -279,7 +280,7 @@ - ${netexGithubUrl}/archive/${netexBranch}.zip + ${cenNetexGithubUrl}/archive/${netexBranch}.zip src/main/resources/xsd/${netexVersion} NeTEx-${netexBranch}/xsd/* @@ -310,7 +311,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.15.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.15.zip src/main/resources/xsd/1.15 NeTEx-tags-v1.0.15/xsd/* @@ -326,7 +327,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.14.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.14.zip src/main/resources/xsd/1.14 NeTEx-tags-v1.0.14/xsd/* @@ -342,7 +343,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.13.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.13.zip src/main/resources/xsd/1.13 NeTEx-tags-v1.0.13/xsd/* @@ -358,7 +359,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.12.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.12.zip src/main/resources/xsd/1.12 NeTEx-tags-v1.0.12/xsd/* @@ -374,7 +375,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.11.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.11.zip src/main/resources/xsd/1.11 NeTEx-tags-v1.0.11/xsd/* @@ -390,7 +391,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.10-entur.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.10-entur.zip src/main/resources/xsd/1.10 NeTEx-tags-v1.0.10-entur/xsd/* @@ -406,7 +407,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.9.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.9.zip src/main/resources/xsd/1.09 NeTEx-tags-v1.0.9/xsd/* @@ -422,7 +423,7 @@ - ${netexGithubUrl}/archive/tags/v1.0.8.zip + ${enturNetexGithubUrl}/archive/tags/v1.0.8.zip src/main/resources/xsd/1.08 NeTEx-tags-v1.0.8/xsd/* @@ -676,7 +677,7 @@ - 11 + 21 3.9.1.2184 diff --git a/src/main/java/org/rutebanken/netex/validation/NeTExValidator.java b/src/main/java/org/rutebanken/netex/validation/NeTExValidator.java index 4b3f4a8..b95d052 100644 --- a/src/main/java/org/rutebanken/netex/validation/NeTExValidator.java +++ b/src/main/java/org/rutebanken/netex/validation/NeTExValidator.java @@ -44,7 +44,8 @@ public enum NetexVersion { v1_13 ("1.13"), v1_14 ("1.14"), v1_15 ("1.15"), - v1_16 ("1.16"); + v1_16 ("1.16"), + v2_0 ("2.0"); private final String folderName; @@ -59,7 +60,7 @@ public String toString() { } private final Schema neTExSchema; - public static final NetexVersion LATEST = NetexVersion.v1_16; + public static final NetexVersion LATEST = NetexVersion.v2_0; private static final Map VALIDATORS_PER_VERSION = new EnumMap<>(NetexVersion.class); diff --git a/src/test/java/org/rutebanken/netex/model/AbstractUnmarshalFrameTest.java b/src/test/java/org/rutebanken/netex/model/AbstractUnmarshalFrameTest.java index 485f8a5..35c0141 100644 --- a/src/test/java/org/rutebanken/netex/model/AbstractUnmarshalFrameTest.java +++ b/src/test/java/org/rutebanken/netex/model/AbstractUnmarshalFrameTest.java @@ -30,7 +30,20 @@ public static void initContext() throws JAXBException { } - + /** + * Helper method to extract string value from MultilingualString. + * In NeTEx 2.0, MultilingualString uses mixed content instead of a simple value. + */ + protected static String getStringValue(MultilingualString multilingualString) { + if (multilingualString == null || multilingualString.getContent() == null) { + return null; + } + return multilingualString.getContent().stream() + .filter(String.class::isInstance) + .map(String.class::cast) + .findFirst() + .orElse(null); + } } diff --git a/src/test/java/org/rutebanken/netex/model/MarshalUnmarshalTest.java b/src/test/java/org/rutebanken/netex/model/MarshalUnmarshalTest.java index d72c226..9f1b70e 100644 --- a/src/test/java/org/rutebanken/netex/model/MarshalUnmarshalTest.java +++ b/src/test/java/org/rutebanken/netex/model/MarshalUnmarshalTest.java @@ -27,9 +27,6 @@ import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.StringWriter; import java.nio.charset.StandardCharsets; @@ -37,7 +34,6 @@ import java.nio.file.Paths; import java.time.LocalDateTime; import java.time.LocalTime; -import java.time.temporal.ChronoField; import java.util.Arrays; import java.util.List; @@ -61,7 +57,7 @@ void publicationDeliveryWithOffsetDateTime() throws JAXBException { Marshaller marshaller = jaxbContext.createMarshaller(); PublicationDeliveryStructure publicationDelivery = new PublicationDeliveryStructure() - .withDescription(new MultilingualString().withValue("value").withLang("no").withTextIdType("")).withPublicationTimestamp(LocalDateTime.now().withNano(0)) + .withDescription(new MultilingualString().withContent("value").withLang("no").withTextIdType("")).withPublicationTimestamp(LocalDateTime.now().withNano(0)) .withParticipantRef("participantRef"); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); @@ -81,7 +77,7 @@ void publicationDeliveryWithOffsetDateTime() throws JAXBException { System.out.println(actual.getPublicationTimestamp()); assertThat(actual.getPublicationTimestamp()).isEqualTo(publicationDelivery.getPublicationTimestamp()); assertThat(actual.getDescription()).isNotNull(); - assertThat(actual.getDescription().getValue()).isEqualTo(publicationDelivery.getDescription().getValue()); + assertThat(actual.getDescription().getContent()).isEqualTo(publicationDelivery.getDescription().getContent()); assertThat(actual.getParticipantRef()).isEqualTo(publicationDelivery.getParticipantRef()); } @@ -140,7 +136,7 @@ void timetableWithVehicleModes() throws JAXBException { Marshaller marshaller = jaxbContext.createMarshaller(); TimetableFrame timetableFrame = factory.createTimetableFrame().withVersion("any").withId("TimetableFrame") - .withName(factory.createMultilingualString().withValue("TimetableFrame")).withVehicleModes(VehicleModeEnumeration.AIR); + .withName(factory.createMultilingualString().withContent("TimetableFrame")).withVehicleModes(AllPublicTransportModesEnumeration.AIR); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -157,9 +153,9 @@ void timetableWithVehicleModes() throws JAXBException { assertThat(actual.getVersion()).isNotNull().isNotEmpty().isEqualTo(timetableFrame.getVersion()); assertThat(actual.getId()).isNotNull().isNotEmpty().isEqualTo(timetableFrame.getId()); - assertThat(actual.getName().getValue()).isNotNull().isNotEmpty().isEqualTo(timetableFrame.getName().getValue()); + assertThat(actual.getName().getContent()).isNotNull().isNotEmpty().isEqualTo(timetableFrame.getName().getContent()); assertThat(actual.getVehicleModes()).isNotNull().isNotEmpty().hasSize(1); - assertThat(actual.getVehicleModes().get(0)).isNotNull().isEqualTo(VehicleModeEnumeration.AIR); + assertThat(actual.getVehicleModes().get(0)).isNotNull().isEqualTo(AllPublicTransportModesEnumeration.AIR); } @Test @@ -168,11 +164,11 @@ void dayTypeWithPropertiesOfDay() throws JAXBException { List daysOfWeek = Arrays.asList(DayOfWeekEnumeration.MONDAY, DayOfWeekEnumeration.TUESDAY, DayOfWeekEnumeration.WEDNESDAY, DayOfWeekEnumeration.THURSDAY, DayOfWeekEnumeration.FRIDAY); - PropertyOfDay propertyOfDay = factory.createPropertyOfDay().withDescription(factory.createMultilingualString().withValue("PropertyOfDay")) - .withName(factory.createMultilingualString().withValue("PropertyOfDay")).withDaysOfWeek(daysOfWeek); + PropertyOfDay propertyOfDay = factory.createPropertyOfDay().withDescription(factory.createMultilingualString().withContent("PropertyOfDay")) + .withName(factory.createMultilingualString().withContent("PropertyOfDay")).withDaysOfWeek(daysOfWeek); PropertiesOfDay_RelStructure propertiesOfDay = factory.createPropertiesOfDay_RelStructure().withPropertyOfDay(propertyOfDay); DayType dayType = factory.createDayType().withVersion("any").withId(String.format("%s:dt:weekday", "SK4488")) - .withName(factory.createMultilingualString().withValue("Ukedager (mandag til fredag)")).withProperties(propertiesOfDay); + .withName(factory.createMultilingualString().withContent("Ukedager (mandag til fredag)")).withProperties(propertiesOfDay); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -189,31 +185,35 @@ void dayTypeWithPropertiesOfDay() throws JAXBException { assertThat(actual.getVersion()).isNotNull().isNotEmpty().isEqualTo(dayType.getVersion()); assertThat(actual.getId()).isNotNull().isNotEmpty().isEqualTo(dayType.getId()); - assertThat(actual.getName().getValue()).isNotNull().isNotEmpty().isEqualTo(dayType.getName().getValue()); + assertThat(actual.getName().getContent()).isNotNull().isNotEmpty().isEqualTo(dayType.getName().getContent()); assertThat(actual.getProperties().getPropertyOfDay().get(0).getDaysOfWeek()).isNotNull().isNotEmpty().hasSize(5) .hasOnlyElementsOfType(DayOfWeekEnumeration.class).hasSameElementsAs(daysOfWeek); } @Test - void datedCallWithLocalDate() throws JAXBException { + void availabilityConditionWithLocalDateTime() throws JAXBException { Marshaller marshaller = jaxbContext.createMarshaller(); - DatedCall datedCall = new DatedCall().withArrivalDate(LocalDateTime.now().with(ChronoField.MILLI_OF_DAY, 0)); + AvailabilityCondition condition = new AvailabilityCondition() + .withFromDate(LocalDateTime.now()) + .withToDate(LocalDateTime.now().plusDays(1)) + .withId("test:condition:1") + .withVersion("1"); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - - marshaller.marshal(factory.createDatedCall(datedCall), byteArrayOutputStream); + marshaller.marshal(factory.createAvailabilityCondition(condition), byteArrayOutputStream); String xml = byteArrayOutputStream.toString(); System.out.println(xml); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - JAXBElement actual = (JAXBElement) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes())); - - assertThat(actual.getValue().getArrivalDate()).isEqualTo(datedCall.getArrivalDate()); + @SuppressWarnings("unchecked") + JAXBElement actual = (JAXBElement) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes())); + assertThat(actual.getValue().getFromDate().getHour()).isEqualTo(condition.getFromDate().getHour()); + assertThat(actual.getValue().getFromDate()).isEqualToIgnoringNanos(condition.getFromDate()); } @@ -238,24 +238,28 @@ void marshalledNamespacePrefixes() throws JAXBException { } @Test - void datedCallWithLocalDateTime() throws JAXBException { + void availabilityConditionWithCreatedLocalDateTime() throws JAXBException { Marshaller marshaller = jaxbContext.createMarshaller(); - DatedCall datedCall = new DatedCall().withChanged(LocalDateTime.now()); + AvailabilityCondition condition = new AvailabilityCondition() + .withCreated(LocalDateTime.now()) + .withId("test:condition:2") + .withVersion("1"); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - marshaller.marshal(factory.createDatedCall(datedCall), byteArrayOutputStream); + marshaller.marshal(factory.createAvailabilityCondition(condition), byteArrayOutputStream); String xml = byteArrayOutputStream.toString(); System.out.println(xml); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - JAXBElement actual = (JAXBElement) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes())); + @SuppressWarnings("unchecked") + JAXBElement actual = (JAXBElement) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes())); - assertThat(actual.getValue().getChanged().getHour()).isEqualTo(datedCall.getChanged().getHour()); - assertThat(actual.getValue().getChanged()).isEqualToIgnoringNanos(datedCall.getChanged()); + assertThat(actual.getValue().getCreated().getHour()).isEqualTo(condition.getCreated().getHour()); + assertThat(actual.getValue().getCreated()).isEqualToIgnoringNanos(condition.getCreated()); } @Test @@ -270,12 +274,12 @@ void unmarshalPublicationDeliveryAndVerifyValidBetween() throws JAXBException, I CompositeFrame compositeFrame = (CompositeFrame) actual.dataObjects.compositeFrameOrCommonFrame .get(0).getValue(); ValidityConditions_RelStructure validityConditions = compositeFrame.getValidityConditions(); - ValidBetween validBetweenWithTimezone = (ValidBetween) validityConditions.getValidityConditionRefOrValidBetweenOrValidityCondition_().get(0); + ValidBetween validBetweenWithTimezone = (ValidBetween) validityConditions.getValidityConditionRefOrValidBetweenOrValidityCondition_Dummy().get(0); assertThat(validBetweenWithTimezone.getFromDate()).isNotNull(); assertThat(validBetweenWithTimezone.getToDate()).isNotNull(); assertThat(validBetweenWithTimezone.getToDate()).hasToString("2017-01-01T11:00"); - ValidBetween validBetweenWithoutTimezone = (ValidBetween) validityConditions.getValidityConditionRefOrValidBetweenOrValidityCondition_().get(1); + ValidBetween validBetweenWithoutTimezone = (ValidBetween) validityConditions.getValidityConditionRefOrValidBetweenOrValidityCondition_Dummy().get(1); assertThat(validBetweenWithoutTimezone.getFromDate()).isNotNull(); assertThat(validBetweenWithoutTimezone.getToDate()).isNotNull(); diff --git a/src/test/java/org/rutebanken/netex/model/ToStringTest.java b/src/test/java/org/rutebanken/netex/model/ToStringTest.java index 895f567..a2e253d 100644 --- a/src/test/java/org/rutebanken/netex/model/ToStringTest.java +++ b/src/test/java/org/rutebanken/netex/model/ToStringTest.java @@ -23,8 +23,8 @@ class ToStringTest { @Test void toStringMethod() { StopPlace stopPlace = new StopPlace() - .withName(new MultilingualString().withValue("berger")) - .withDescription(new MultilingualString().withValue("description")); + .withName(new MultilingualString().withContent("berger")) + .withDescription(new MultilingualString().withContent("description")); System.out.println(stopPlace.toString()); assertThat(stopPlace.toString()).contains("berger"); assertThat(stopPlace.toString()).contains("description"); diff --git a/src/test/java/org/rutebanken/netex/model/UnmarshalResourceFrameTest.java b/src/test/java/org/rutebanken/netex/model/UnmarshalResourceFrameTest.java index 3fd6038..715cff1 100644 --- a/src/test/java/org/rutebanken/netex/model/UnmarshalResourceFrameTest.java +++ b/src/test/java/org/rutebanken/netex/model/UnmarshalResourceFrameTest.java @@ -110,8 +110,8 @@ void unmarshalResourceFrame() throws JAXBException { CompositeFrame compositeFrame = (CompositeFrame) publicationDeliveryStructure.getDataObjects().getCompositeFrameOrCommonFrame().get(0).getValue(); ResourceFrame resourceFrame = (ResourceFrame) compositeFrame.getFrames().getCommonFrame().get(0).getValue(); - Authority authority = (Authority) resourceFrame.getOrganisations().getOrganisation_().get(0).getValue(); - assertEquals("Vy", authority.getName().getValue()); + Authority authority = (Authority) resourceFrame.getOrganisations().getOrganisation_Dummy().get(0).getValue(); + assertEquals("Vy", getStringValue(authority.getName())); diff --git a/src/test/java/org/rutebanken/netex/model/UnmarshalServiceCalendarFrameTest.java b/src/test/java/org/rutebanken/netex/model/UnmarshalServiceCalendarFrameTest.java index 34da902..ac46cee 100644 --- a/src/test/java/org/rutebanken/netex/model/UnmarshalServiceCalendarFrameTest.java +++ b/src/test/java/org/rutebanken/netex/model/UnmarshalServiceCalendarFrameTest.java @@ -128,7 +128,7 @@ void unmarshalServiceCalendarFrame() throws JAXBException { ServiceCalendarFrame serviceCalendarFrame = (ServiceCalendarFrame) compositeFrame.getFrames().getCommonFrame().get(0).getValue(); - DayType dayType = (DayType) serviceCalendarFrame.getDayTypes().getDayType_().get(0).getValue(); + DayType dayType = (DayType) serviceCalendarFrame.getDayTypes().getDayType_Dummy().get(0).getValue(); assertEquals(DayOfWeekEnumeration.TUESDAY, dayType.getProperties().getPropertyOfDay().get(0).getDaysOfWeek().get(0)); OperatingDay operatingDay = serviceCalendarFrame.getOperatingDays().getOperatingDay().get(0); diff --git a/src/test/java/org/rutebanken/netex/model/UnmarshalServiceFrameTest.java b/src/test/java/org/rutebanken/netex/model/UnmarshalServiceFrameTest.java index d7ebdf8..639f954 100644 --- a/src/test/java/org/rutebanken/netex/model/UnmarshalServiceFrameTest.java +++ b/src/test/java/org/rutebanken/netex/model/UnmarshalServiceFrameTest.java @@ -146,21 +146,21 @@ void unmarshalServiceFrame() throws JAXBException { CompositeFrame compositeFrame = (CompositeFrame) publicationDeliveryStructure.getDataObjects().getCompositeFrameOrCommonFrame().get(0).getValue(); ServiceFrame serviceFrame = (ServiceFrame) compositeFrame.getFrames().getCommonFrame().get(0).getValue(); - Line line = (Line) serviceFrame.getLines().getLine_().get(0).getValue(); - assertEquals("Narvik-Riksgränsen (Sverige)", line.getName().getValue()); - assertEquals("F8", line.getPublicCode()); + Line line = (Line) serviceFrame.getLines().getLine_Dummy().get(0).getValue(); + assertEquals("Narvik-Riksgränsen (Sverige)", getStringValue(line.getName())); + assertEquals("F8", line.getPublicCode().getValue()); assertEquals("F8", line.getPrivateCode().getValue()); assertEquals("rail", line.getTransportMode().value()); - Route route = (Route) serviceFrame.getRoutes().getRoute_().get(0).getValue(); - assertEquals("Riksgränsen-Narvik Ofotbanen", route.getName().getValue()); - assertEquals("KJ-NK", route.getShortName().getValue()); + Route route = (Route) serviceFrame.getRoutes().getRoute_Dummy().get(0).getValue(); + assertEquals("Riksgränsen-Narvik Ofotbanen", getStringValue(route.getName())); + assertEquals("KJ-NK", getStringValue(route.getShortName())); PointOnRoute pointOnRoute = route.getPointsInSequence().getPointOnRoute().get(0); assertEquals("VYG:RoutePoint:KJ", pointOnRoute.getPointRef().getValue().getRef()); - JourneyPattern journeyPattern = (JourneyPattern) serviceFrame.getJourneyPatterns().getJourneyPattern_OrJourneyPatternView().get(0).getValue(); - assertEquals("KMB-NK", journeyPattern.getName().getValue()); + JourneyPattern journeyPattern = (JourneyPattern) serviceFrame.getJourneyPatterns().getJourneyPattern_Dummy().get(0).getValue(); + assertEquals("KMB-NK", getStringValue(journeyPattern.getName())); assertEquals("VYG:Route:F8-R", journeyPattern.getRouteRef().getRef()); StopPointInJourneyPattern stopPointInJourneyPattern = (StopPointInJourneyPattern) journeyPattern.getPointsInSequence().getPointInJourneyPatternOrStopPointInJourneyPatternOrTimingPointInJourneyPattern().get(0); diff --git a/src/test/java/org/rutebanken/netex/model/UnmarshalSiteFrameTest.java b/src/test/java/org/rutebanken/netex/model/UnmarshalSiteFrameTest.java index 06c9b99..6171ab6 100644 --- a/src/test/java/org/rutebanken/netex/model/UnmarshalSiteFrameTest.java +++ b/src/test/java/org/rutebanken/netex/model/UnmarshalSiteFrameTest.java @@ -157,19 +157,19 @@ void unmarshalSiteFrame() throws JAXBException { PublicationDeliveryStructure publicationDeliveryStructure = jaxbElement.getValue(); SiteFrame siteFrame = (SiteFrame) publicationDeliveryStructure.getDataObjects().getCompositeFrameOrCommonFrame().get(0).getValue(); - StopPlace stopPlace = (StopPlace) siteFrame.getStopPlaces().getStopPlace_().get(0).getValue(); - assertEquals("Krokstien", stopPlace.getName().getValue()); - assertEquals(AllVehicleModesOfTransportEnumeration.BUS, stopPlace.getTransportMode()); + StopPlace stopPlace = siteFrame.getStopPlaces().getStopPlace().get(0); + assertEquals("Krokstien", getStringValue(stopPlace.getName())); + assertEquals(AllPublicTransportModesEnumeration.BUS, stopPlace.getTransportMode()); assertEquals(StopTypeEnumeration.ONSTREET_BUS, stopPlace.getStopPlaceType()); - assertEquals("BRA:TariffZone:311", stopPlace.getTariffZones().getTariffZoneRef_().get(0).getValue().getRef()); + assertEquals("BRA:TariffZone:311", stopPlace.getTariffZones().getTariffZoneRef_Dummy().get(0).getValue().getRef()); Quay quay = (Quay) stopPlace.getQuays().getQuayRefOrQuay().get(0).getValue(); assertEquals(BigDecimal.valueOf(59.910579), quay.getCentroid().getLocation().getLatitude()); TariffZone tariffZone = (TariffZone) siteFrame.getTariffZones().getTariffZone().get(0).getValue(); - assertEquals("1", tariffZone.getName().getValue()); + assertEquals("1", getStringValue(tariffZone.getName())); GroupOfStopPlaces groupOfStopPlaces = siteFrame.getGroupsOfStopPlaces().getGroupOfStopPlaces().get(0); - assertEquals("Lillehammer", groupOfStopPlaces.getName().getValue()); + assertEquals("Lillehammer", getStringValue(groupOfStopPlaces.getName())); assertEquals("NSR:StopPlace:420", groupOfStopPlaces.getMembers().getStopPlaceRef().get(0).getValue().getRef()); } @@ -211,7 +211,7 @@ void unmarshalTopographicPlaceWithPolygon() throws JAXBException { SiteFrame siteFrame = (SiteFrame) publicationDeliveryStructure.getDataObjects().getCompositeFrameOrCommonFrame().get(0).getValue(); TopographicPlace topographicPlace = siteFrame.getTopographicPlaces().getTopographicPlace().get(0); - assertEquals("Oslo", topographicPlace.getDescriptor().getName().getValue()); + assertEquals("Oslo", getStringValue(topographicPlace.getDescriptor().getName())); assertEquals(TopographicPlaceTypeEnumeration.MUNICIPALITY, topographicPlace.getTopographicPlaceType()); assertNotNull(topographicPlace.getPolygon()); } diff --git a/src/test/java/org/rutebanken/netex/model/UnmarshalTimetableFrameTest.java b/src/test/java/org/rutebanken/netex/model/UnmarshalTimetableFrameTest.java index 9f2dcbf..25d3493 100644 --- a/src/test/java/org/rutebanken/netex/model/UnmarshalTimetableFrameTest.java +++ b/src/test/java/org/rutebanken/netex/model/UnmarshalTimetableFrameTest.java @@ -120,7 +120,7 @@ void unmarshalTimetableFrame() throws JAXBException { TimetableFrame timetableFrame = (TimetableFrame) compositeFrame.getFrames().getCommonFrame().get(0).getValue(); ServiceJourney serviceJourney = (ServiceJourney) timetableFrame.getVehicleJourneys().getVehicleJourneyOrDatedVehicleJourneyOrNormalDatedVehicleJourney().get(0); - assertEquals("96", serviceJourney.getName().getValue()); + assertEquals("96", getStringValue(serviceJourney.getName())); assertEquals("96", serviceJourney.getPrivateCode().getValue()); assertEquals("rail", serviceJourney.getTransportMode().value());