Skip to content
Snippets Groups Projects
Commit 094f1f4f authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Small fix for next verifiers

parent e1cc2588
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 24 deletions
...@@ -18,7 +18,7 @@ public abstract class AbstractVerifier implements Verifier { ...@@ -18,7 +18,7 @@ public abstract class AbstractVerifier implements Verifier {
protected VerificationType verificationType; protected VerificationType verificationType;
protected AbstractDmnVerifierConfig verifierConfig; protected AbstractDmnVerifierConfig verifierConfig;
protected VerifierResult.Builder resultBuilder; protected VerifierResult.Builder resultBuilder;
protected VerificationResultEntryFactory vref; protected VerificationResultEntryFactory vreFactory;
protected DmnObjectContainer dmnObjectContainer; protected DmnObjectContainer dmnObjectContainer;
public VerificationType getVerificationType() { public VerificationType getVerificationType() {
...@@ -41,15 +41,11 @@ public abstract class AbstractVerifier implements Verifier { ...@@ -41,15 +41,11 @@ public abstract class AbstractVerifier implements Verifier {
.verifierType() .verifierType()
.getMethod("getInstance") .getMethod("getInstance")
.invoke(null, null); .invoke(null, null);
} catch (IllegalAccessException e) { } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace(); e.printStackTrace();
} }
resultBuilder = VerifierResult.getBuilder().fromVerifier(this); resultBuilder = VerifierResult.getBuilder().fromVerifier(this);
vref = VerificationResultEntryFactory.create(resultBuilder); vreFactory = VerificationResultEntryFactory.create(resultBuilder);
} }
public final Future<VerifierResult> verify(ExecutorService executor) { public final Future<VerifierResult> verify(ExecutorService executor) {
......
...@@ -57,8 +57,8 @@ public class DateVerifier extends AbstractVerifier { ...@@ -57,8 +57,8 @@ public class DateVerifier extends AbstractVerifier {
// 1. check pattern // 1. check pattern
Matcher matcher = datePattern.matcher(dateStringValue); Matcher matcher = datePattern.matcher(dateStringValue);
if (!matcher.find()) { if (!matcher.find()) {
vref.addElement(VerificationResultEntryElement.create(dateValue)); vreFactory.addElement(VerificationResultEntryElement.create(dateValue));
vref.addToEntry( vreFactory.addToEntry(
VerificationClassification.FATAL_ERROR, VerificationClassification.FATAL_ERROR,
"Date value '%s' does not match 'date and time(\"yyyy-mm-ddTHH:MM:SS\").'", "Date value '%s' does not match 'date and time(\"yyyy-mm-ddTHH:MM:SS\").'",
dateStringValue); dateStringValue);
...@@ -68,8 +68,8 @@ public class DateVerifier extends AbstractVerifier { ...@@ -68,8 +68,8 @@ public class DateVerifier extends AbstractVerifier {
try { try {
LocalDateTime.parse(dateTime); LocalDateTime.parse(dateTime);
} catch (DateTimeParseException e) { } catch (DateTimeParseException e) {
vref.addElement(VerificationResultEntryElement.create(dateValue)); vreFactory.addElement(VerificationResultEntryElement.create(dateValue));
vref.addToEntry( vreFactory.addToEntry(
VerificationClassification.FATAL_ERROR, "Date value '%s' is no valid date.", dateTime); VerificationClassification.FATAL_ERROR, "Date value '%s' is no valid date.", dateTime);
} }
} }
......
...@@ -31,8 +31,8 @@ public class EmptyOutputVerifier extends AbstractVerifier { ...@@ -31,8 +31,8 @@ public class EmptyOutputVerifier extends AbstractVerifier {
private void checkEmptyOutputValue(VDmnOutputValue outputValue) { private void checkEmptyOutputValue(VDmnOutputValue outputValue) {
if (outputValue.getText().isEmpty()) { if (outputValue.getText().isEmpty()) {
vref.addElement(VerificationResultEntryElement.create(outputValue)); vreFactory.addElement(VerificationResultEntryElement.create(outputValue));
vref.addToEntry(VerificationClassification.WARNING, "Output value is empty.'"); vreFactory.addToEntry(VerificationClassification.WARNING, "Output value is empty.'");
} }
} }
} }
...@@ -68,9 +68,9 @@ public class EquivalentVerifier extends AbstractVerifier { ...@@ -68,9 +68,9 @@ public class EquivalentVerifier extends AbstractVerifier {
for (int i = 0; i < stringVals.size(); i++) { for (int i = 0; i < stringVals.size(); i++) {
for (int u = 0; u < stringValsInner.size(); u++) { for (int u = 0; u < stringValsInner.size(); u++) {
if (wordnetService.areNounsSynonyms(stringVals.get(i), stringValsInner.get(u))) { if (wordnetService.areNounsSynonyms(stringVals.get(i), stringValsInner.get(u))) {
vref.addElement(VerificationResultEntryElement.create(v1)); vreFactory.addElement(VerificationResultEntryElement.create(v1));
vref.addElement(VerificationResultEntryElement.create(v2)); vreFactory.addElement(VerificationResultEntryElement.create(v2));
vref.addToEntry( vreFactory.addToEntry(
VerificationClassification.WARNING, VerificationClassification.WARNING,
"String values %s and %s might be equivalent.", "String values %s and %s might be equivalent.",
stringVals.get(i), stringVals.get(i),
......
...@@ -45,10 +45,10 @@ public class IdenticalVerifier extends AbstractVerifier { ...@@ -45,10 +45,10 @@ public class IdenticalVerifier extends AbstractVerifier {
if (i == inputs.size()) { if (i == inputs.size()) {
currentRules.forEach( currentRules.forEach(
rule -> rule ->
vref.addElement( vreFactory.addElement(
VerificationResultEntryElement.create(dmnDecisionTable) VerificationResultEntryElement.create(dmnDecisionTable)
.withIdentifier(rule.getRuleId()))); .withIdentifier(rule.getRuleId())));
vref.addToEntry(VerificationClassification.WARNING, "identical"); vreFactory.addToEntry(VerificationClassification.WARNING, "identical");
} else { } else {
List<VDmnInputValue> curInVals = new ArrayList<>(); List<VDmnInputValue> curInVals = new ArrayList<>();
List<VDmnInputValue> sortInVals = List<VDmnInputValue> sortInVals =
......
...@@ -29,8 +29,8 @@ public class InputValueSyntaxVerifier extends AbstractVerifier { ...@@ -29,8 +29,8 @@ public class InputValueSyntaxVerifier extends AbstractVerifier {
// no Date, because of extra DateVerifier // no Date, because of extra DateVerifier
if (inputValue.getDmnColumn().getTypeRef() != VTypeRef.DATE if (inputValue.getDmnColumn().getTypeRef() != VTypeRef.DATE
&& inputValue.getBoundary() instanceof InvalidBoundary) { && inputValue.getBoundary() instanceof InvalidBoundary) {
vref.addElement(VerificationResultEntryElement.create(inputValue)); vreFactory.addElement(VerificationResultEntryElement.create(inputValue));
vref.addToEntry( vreFactory.addToEntry(
VerificationClassification.FATAL_ERROR, VerificationClassification.FATAL_ERROR,
"Input value is not valid: " + inputValue.getText()); "Input value is not valid: " + inputValue.getText());
System.out.println(inputValue.getText() + " IS INVALID SYNTAX"); System.out.println(inputValue.getText() + " IS INVALID SYNTAX");
......
...@@ -58,10 +58,10 @@ public class OverlappingVerifier extends AbstractVerifier { ...@@ -58,10 +58,10 @@ public class OverlappingVerifier extends AbstractVerifier {
// TODO // TODO
currentRuleIds.forEach( currentRuleIds.forEach(
rule -> rule ->
vref.addElement( vreFactory.addElement(
VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable()) VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable())
.withIdentifier(rule.getRuleId()))); .withIdentifier(rule.getRuleId())));
vref.addToEntry(VerificationClassification.WARNING, "overlapping"); vreFactory.addToEntry(VerificationClassification.WARNING, "overlapping");
} }
} else { } else {
// check current column // check current column
......
...@@ -54,10 +54,10 @@ public class SubsumptionVerifier extends AbstractVerifier { ...@@ -54,10 +54,10 @@ public class SubsumptionVerifier extends AbstractVerifier {
// TODO // TODO
currentRuleIds.forEach( currentRuleIds.forEach(
rule -> rule ->
vref.addElement( vreFactory.addElement(
VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable()) VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable())
.withIdentifier(rule.getRuleId()))); .withIdentifier(rule.getRuleId())));
vref.addToEntry(VerificationClassification.WARNING, "subsumption"); vreFactory.addToEntry(VerificationClassification.WARNING, "subsumption");
} }
} else { } else {
// get all input values from the current column, and filter with the prev. iteration // get all input values from the current column, and filter with the prev. iteration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment