Skip to content

Commit

Permalink
Refactor NetexValidatorsRunner (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpaturet authored Oct 21, 2024
1 parent 7e2cb60 commit ebc0692
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 50 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<entur.google.pubsub.emulator.download.skip>false</entur.google.pubsub.emulator.download.skip>
<camel.version>4.4.3</camel.version>
<entur.helpers.version>2.32</entur.helpers.version>
<netex-validator-java.version>3.0.8</netex-validator-java.version>
<netex-validator-java.version>4.0.0</netex-validator-java.version>
<commons-io.version>2.11.0</commons-io.version>
<zt-zip.version>1.17</zt-zip.version>
<redisson.version>3.37.0</redisson.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ public NetexValidatorsRunner stopPlaceDataValidatorsRunner(
netexIdUniquenessValidator
);
NetexXMLParser netexXMLParser = new NetexXMLParser();
return new NetexValidatorsRunner(
netexXMLParser,
netexSchemaValidator,
netexValidators
);
return NetexValidatorsRunner
.of()
.withNetexXMLParser(netexXMLParser)
.withNetexSchemaValidator(netexSchemaValidator)
.withXPathValidators(netexValidators)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
import no.entur.antu.validation.validator.servicelink.distance.UnexpectedDistanceInServiceLinkValidator;
import no.entur.antu.validation.validator.servicelink.stoppoints.MismatchedStopPointsValidator;
import no.entur.antu.validation.validator.xpath.EnturTimetableDataValidationTreeFactory;
import org.entur.netex.validation.validator.DatasetValidator;
import org.entur.netex.validation.validator.NetexValidatorsRunner;
import org.entur.netex.validation.validator.ValidationReportEntryFactory;
import org.entur.netex.validation.validator.XPathValidator;
import org.entur.netex.validation.validator.*;
import org.entur.netex.validation.validator.id.NetexIdUniquenessValidator;
import org.entur.netex.validation.validator.id.NetexReferenceValidator;
import org.entur.netex.validation.validator.id.ReferenceToValidEntityTypeValidator;
Expand Down Expand Up @@ -333,15 +330,16 @@ public NetexValidatorsRunner timetableDataValidatorsRunner(
serviceJourneyInterchangeInfoCollector
);

return new NetexValidatorsRunner(
netexXMLParser,
netexSchemaValidator,
xPathValidators,
jaxbValidators,
netexTimetableDatasetValidators,
commonDataCollectors,
netexDataRepository,
stopPlaceRepository
);
return NetexValidatorsRunner
.of()
.withNetexXMLParser(netexXMLParser)
.withNetexSchemaValidator(netexSchemaValidator)
.withXPathValidators(xPathValidators)
.withJaxbValidators(jaxbValidators)
.withDatasetValidators(netexTimetableDatasetValidators)
.withNetexDataCollectors(commonDataCollectors)
.withNetexDataRepository(netexDataRepository)
.withStopPlaceRepository(stopPlaceRepository)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public NetexValidatorsRunner flexMergingTimetableDataValidatorsRunner(
List<XPathValidator> netexValidators = List.of(netexIdUniquenessValidator);
// do not ignore SiteFrame
NetexXMLParser netexXMLParser = new NetexXMLParser(Set.of());
return new NetexValidatorsRunner(netexXMLParser, netexValidators);
return NetexValidatorsRunner
.of()
.withNetexXMLParser(netexXMLParser)
.withXPathValidators(netexValidators)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,15 @@ public NetexValidatorsRunner flexTimetableDataValidatorsRunner(
List<JAXBValidator> jaxbValidators = List.of(invalidFlexibleAreaValidator);
// do not ignore SiteFrame
NetexXMLParser netexXMLParser = new NetexXMLParser(Set.of());
return new NetexValidatorsRunner(
netexXMLParser,
netexSchemaValidator,
xpathValidators,
jaxbValidators,
List.of(),
List.of(),
netexDataRepository,
stopPlaceRepository
);
return NetexValidatorsRunner
.of()
.withNetexXMLParser(netexXMLParser)
.withNetexSchemaValidator(netexSchemaValidator)
.withXPathValidators(xpathValidators)
.withJaxbValidators(jaxbValidators)
.withNetexDataRepository(netexDataRepository)
.withStopPlaceRepository(stopPlaceRepository)
.build();
}

/**
Expand Down Expand Up @@ -208,15 +207,14 @@ public NetexValidatorsRunner importFlexTimetableDataValidatorsRunner(

// do not ignore SiteFrame
NetexXMLParser netexXMLParser = new NetexXMLParser(Set.of());
return new NetexValidatorsRunner(
netexXMLParser,
netexSchemaValidator,
xpathValidators,
jaxbValidators,
List.of(),
List.of(),
netexDataRepository,
stopPlaceRepository
);
return NetexValidatorsRunner
.of()
.withNetexXMLParser(netexXMLParser)
.withNetexSchemaValidator(netexSchemaValidator)
.withXPathValidators(xpathValidators)
.withJaxbValidators(jaxbValidators)
.withNetexDataRepository(netexDataRepository)
.withStopPlaceRepository(stopPlaceRepository)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
import no.entur.antu.validation.validator.id.ReferenceToNsrValidator;
import org.entur.netex.validation.configuration.DefaultValidationConfigLoader;
import org.entur.netex.validation.configuration.ValidationConfigLoader;
import org.entur.netex.validation.validator.DefaultValidationEntryFactory;
import org.entur.netex.validation.validator.NetexValidatorsRunner;
import org.entur.netex.validation.validator.ValidationReportEntryFactory;
import org.entur.netex.validation.validator.XPathValidator;
import org.entur.netex.validation.validator.*;
import org.entur.netex.validation.validator.id.BlockJourneyReferencesIgnorer;
import org.entur.netex.validation.validator.id.ExternalReferenceValidator;
import org.entur.netex.validation.validator.id.NetexIdRepository;
Expand Down Expand Up @@ -174,10 +171,11 @@ public NetexValidatorsRunner swedenTimetableDataSwedenValidatorsRunner(
NetexXMLParser netexXMLParser = new NetexXMLParser(
Set.of("navigationPaths", "equipments")
);
return new NetexValidatorsRunner(
netexXMLParser,
netexSchemaValidator,
netexValidators
);
return NetexValidatorsRunner
.of()
.withNetexXMLParser(netexXMLParser)
.withNetexSchemaValidator(netexSchemaValidator)
.withXPathValidators(netexValidators)
.build();
}
}

0 comments on commit ebc0692

Please sign in to comment.