Skip to content

Commit

Permalink
Skipping dataset validation in case of previous validation errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mansoor-sajjad committed Sep 25, 2024
1 parent 76f8e3f commit 7ac6200
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/main/java/no/entur/antu/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ public final class Constants {
public static final String VALIDATION_CORRELATION_ID_HEADER =
"EnturValidationCorrelationId";

public static final String HAS_VALIDATION_ERRORS = "hasValidationErrors";

public static final String VALIDATION_CLIENT_MARDUK = "Marduk";
public static final String VALIDATION_CLIENT_KAKKA = "Kakka";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static no.entur.antu.Constants.DATASET_STATUS;
import static no.entur.antu.Constants.FILENAME_DELIMITER;
import static no.entur.antu.Constants.FILE_HANDLE;
import static no.entur.antu.Constants.HAS_VALIDATION_ERRORS;
import static no.entur.antu.Constants.JOB_TYPE_AGGREGATE_REPORTS;
import static no.entur.antu.Constants.JOB_TYPE_VALIDATE_DATASET;
import static no.entur.antu.Constants.NETEX_FILE_NAME;
Expand Down Expand Up @@ -131,18 +130,17 @@ public void configure() throws Exception {
PROP_STOP_WATCH +
".taken()} ms"
)
.setHeader(HAS_VALIDATION_ERRORS, simple("${body.hasError()}"))
.marshal()
.json(JsonLibrary.Jackson)
.to("direct:uploadValidationReport")
.choice()
.when(header(HAS_VALIDATION_ERRORS))
.when(simple("${body.hasError()}"))
.log(
LoggingLevel.INFO,
correlation() + "Validation errors found, skipping dataset validation"
)
.to("direct:completeValidation")
.otherwise()
.marshal()
.json(JsonLibrary.Jackson)
.to("direct:uploadValidationReport")
.setBody(header(NETEX_FILE_NAME))
.setHeader(Constants.JOB_TYPE, simple(JOB_TYPE_VALIDATE_DATASET))
.convertHeaderTo(REPORT_CREATION_DATE, String.class)
Expand Down Expand Up @@ -181,13 +179,12 @@ public void configure() throws Exception {
LoggingLevel.INFO,
correlation() + "Completed all NeTEx dataset validators"
)
.setHeader(HAS_VALIDATION_ERRORS, simple("${body.hasError()}"))
.to("direct:completeValidation")
.routeId("validate-dataset");

from("direct:completeValidation")
.choice()
.when(header(HAS_VALIDATION_ERRORS))
.when(simple("${body.hasError()}"))
.setHeader(DATASET_STATUS, constant(STATUS_VALIDATION_FAILED))
.log(LoggingLevel.INFO, correlation() + "Validation errors found")
.otherwise()
Expand Down

0 comments on commit 7ac6200

Please sign in to comment.