Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- update_netex_1_16_jakarta
pull_request:
branches:
- main
Expand Down Expand Up @@ -69,4 +70,13 @@ jobs:
secrets: inherit
with:
push_to_repo: true
snapshot: false
snapshot: false
publish-snapshot:
if: github.repository_owner == 'entur' && github.event_name == 'push' && github.ref == 'refs/heads/update_netex_1_16_jakarta'
needs: [maven-package]
name: Publish snapshot to maven central
uses: entur/gha-maven-central/.github/workflows/maven-publish.yml@v1
secrets: inherit
with:
push_to_repo: true
snapshot: true
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.entur</groupId>
<artifactId>netex-validator-java</artifactId>
<version>11.0.26-SNAPSHOT</version>
<version>12.0.0-SNAPSHOT</version>

<name>netex-validator-java</name>
<description>Library for validating NeTEx datasets against the Nordic NeTEx Profile.</description>
Expand Down Expand Up @@ -55,8 +55,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>17</jdk.version>

<netex-java-model.version>2.0.15.2</netex-java-model.version>
<netex-parser-java.version>3.1.73</netex-parser-java.version>
<netex-java-model.version>2.0.16-SNAPSHOT</netex-java-model.version>
<netex-parser-java.version>4.0.0-SNAPSHOT</netex-parser-java.version>
<saxon.version>12.9</saxon.version>
<geotools.version>33.0</geotools.version>
<snakeyaml.version>2.6</snakeyaml.version>
Expand Down Expand Up @@ -481,6 +481,16 @@
<name>Open Source Geospatial Foundation Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
</repository>
<repository>
<id>maven-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ private Map<String, Set<String>> getAllowedSubstitutions() {
vehicleScheduleJourneyRefSubstitutions.add("DeadRun");
substitutions.put("VehicleJourneyRef", vehicleScheduleJourneyRefSubstitutions);

Set<String> datedVehicleJourneyRefSubstitutions = new HashSet<>();
datedVehicleJourneyRefSubstitutions.add("DatedServiceJourney");
substitutions.put("DatedVehicleJourneyRef", datedVehicleJourneyRefSubstitutions);

Set<String> serviceJourneyPatternRefSubstitutions = new HashSet<>();
serviceJourneyPatternRefSubstitutions.add("ServiceJourneyPattern");
substitutions.put("JourneyPatternRef", serviceJourneyPatternRefSubstitutions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import jakarta.xml.bind.JAXBElement;
import javax.annotation.Nullable;
import org.rutebanken.netex.model.DatedServiceJourney;
import org.rutebanken.netex.model.DatedServiceJourneyRefStructure;
import org.rutebanken.netex.model.VersionOfObjectRefStructure;
import org.rutebanken.netex.model.VehicleJourneyRefStructure;

public class DatedServiceJourneyUtils {

Expand All @@ -18,12 +17,11 @@ public static String originalDatedServiceJourneyRef(
DatedServiceJourney datedServiceJourney
) {
return datedServiceJourney
.getJourneyRef()
.getReplacedJourneys()
.getDatedVehicleJourneyRefOrNormalDatedVehicleJourneyRef()
.stream()
.map(JAXBElement::getValue)
.filter(DatedServiceJourneyRefStructure.class::isInstance)
.map(DatedServiceJourneyRefStructure.class::cast)
.map(VersionOfObjectRefStructure::getRef)
.map(VehicleJourneyRefStructure::getRef)
.findFirst()
.orElse(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public ValidationTreeBuilder builder() {
)
.withRuleForLineFile(
new ValidateNotExist(
"vehicleJourneys/DatedServiceJourney/DatedServiceJourneyRef[@ref = preceding-sibling::DatedServiceJourneyRef/@ref]",
"vehicleJourneys/DatedServiceJourney/replacedJourneys/DatedVehicleJourneyRef[@ref = preceding-sibling::DatedVehicleJourneyRef/@ref]",
CODE_DATED_SERVICE_JOURNEY_5,
"DatedServiceJourney multiple references to the same DatedServiceJourney",
"Multiple references from a DatedServiceJourney to the same DatedServiceJourney",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public static NeTExValidator.NetexVersion detectNetexSchemaVersion(byte[] conten
return NeTExValidator.NetexVersion.v1_14;
case "1.15":
return NeTExValidator.NetexVersion.v1_15;
case "1.16":
return NeTExValidator.NetexVersion.v1_16;
default:
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,31 @@ void testValidReferenceType() {
);
Assertions.assertTrue(validationIssues.isEmpty());
}

@Test
void testDatedVehicleJourneyRefReferencingDatedServiceJourney() {
IdVersion idVersion = new IdVersion(
"XXX:DatedServiceJourney:1",
null,
"DatedVehicleJourneyRef",
null,
null,
0,
0
);
List<IdVersion> localRefs = List.of(idVersion);
XPathValidationContext xPathValidationContext = new XPathValidationContext(
null,
null,
TEST_CODESPACE,
null,
Set.of(),
localRefs,
validationReport.getValidationReportId()
);
List<ValidationIssue> validationIssues = referenceToValidEntityTypeValidator.validate(
xPathValidationContext
);
Assertions.assertTrue(validationIssues.isEmpty());
}
}
Binary file modified src/test/resources/test-multiple-references-to-same-dsj.zip
Binary file not shown.