mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Merge branch 'branch-1.2.x'
# Conflicts: # CHANGELOG.md # src/main/java/de/kosit/validationtool/impl/model/BaseScenario.java # src/test/java/de/kosit/validationtool/impl/DefaultCheckTest.java
This commit is contained in:
commit
e0bd3ec8ab
6 changed files with 35 additions and 4 deletions
|
|
@ -164,6 +164,7 @@ public class ScenarioRepository {
|
|||
|
||||
private ScenarioType createFallback() {
|
||||
final ScenarioType t = new ScenarioType();
|
||||
t.setFallback(true);
|
||||
t.setName("Fallback-Scenario");
|
||||
t.setMatch("count(/)<0");
|
||||
final CreateReportType reportType = new CreateReportType();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ public abstract class BaseScenario {
|
|||
private ResourceType resourceType;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean fallback;
|
||||
|
||||
private XPathExecutable matchExecutable;
|
||||
|
||||
private XPathExecutable acceptExecutable;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
package de.kosit.validationtool.impl.tasks;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import de.kosit.validationtool.impl.ScenarioRepository;
|
||||
import de.kosit.validationtool.impl.model.Result;
|
||||
|
|
@ -35,6 +36,7 @@ import net.sf.saxon.s9api.XdmNode;
|
|||
* @author Andreas Penski
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ScenarioSelectionAction implements CheckAction {
|
||||
|
||||
private final ScenarioRepository repository;
|
||||
|
|
@ -47,16 +49,21 @@ public class ScenarioSelectionAction implements CheckAction {
|
|||
if (results.getParserResult().isValid()) {
|
||||
scenarioTypeResult = determineScenario(results.getParserResult().getObject());
|
||||
} else {
|
||||
scenarioTypeResult = new Result<>(repository.getFallbackScenario());
|
||||
scenarioTypeResult = new Result<>(this.repository.getFallbackScenario());
|
||||
}
|
||||
results.setScenarioSelectionResult(scenarioTypeResult);
|
||||
report.setScenario(scenarioTypeResult.getObject());
|
||||
if (!scenarioTypeResult.getObject().isFallback()) {
|
||||
report.setScenario(scenarioTypeResult.getObject());
|
||||
log.info("Schenario {} identified for {}", scenarioTypeResult.getObject().getName(), results.getInput().getName());
|
||||
} else {
|
||||
log.error("No valid schenario configuration found for {}", results.getInput().getName());
|
||||
}
|
||||
}
|
||||
|
||||
private Result<ScenarioType, String> determineScenario(final XdmNode document) {
|
||||
final Result<ScenarioType, String> result = this.repository.selectScenario(document);
|
||||
if (result.isInvalid()) {
|
||||
return new Result<>(repository.getFallbackScenario());
|
||||
return new Result<>(this.repository.getFallbackScenario());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue