Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generic V&V reporting #2828

Closed
wants to merge 1 commit into from
Closed
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: 6 additions & 6 deletions drools-verifier/drools-verifier-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>drools-verifier-api</artifactId>
<artifactId>drools-verifier-api</artifactId>

<name>Drools Workbench - Verifier Api</name>
<description>Drools Workbench - Verifier Api</description>
<name>Drools Workbench - Verifier Api</name>
<description>Drools Workbench - Verifier Api</description>

<properties>
<java.module.name>org.drools.verifier.api</java.module.name>
</properties>
<properties>
<java.module.name>org.drools.verifier.api</java.module.name>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,28 @@

public enum CheckType {

// Row to row relationships
CONFLICTING_ROWS,
OVERLAPPING_ROWS,
DEFICIENT_ROW,
REDUNDANT_ROWS,
SUBSUMPTANT_ROWS,
SINGLE_HIT_LOST,

// Full table check
MISSING_RANGE,

// Single row checks
IMPOSSIBLE_MATCH,
MISSING_ACTION,
MISSING_RESTRICTION,
MULTIPLE_VALUES_FOR_ONE_ACTION,
VALUE_FOR_FACT_FIELD_IS_SET_TWICE,
VALUE_FOR_ACTION_IS_SET_TWICE,
REDUNDANT_CONDITIONS_TITLE,
REDUNDANT_ROWS,
SUBSUMPTANT_ROWS,
MISSING_RANGE,
SINGLE_HIT_LOST,
EMPTY_RULE,

// Validation is not possible
ILLEGAL_VERIFIER_STATE;

public static Set<CheckType> getRowLevelCheckTypes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
public class ImpossibleMatchIssue
extends Issue {

private String fieldFactType;
private String fieldName;
private String conditionParent;
private String conflictedItem;
private String conflictingItem;
private String ruleId;
Expand All @@ -32,8 +31,7 @@ public ImpossibleMatchIssue() {
public ImpossibleMatchIssue(final Severity severity,
final CheckType checkType,
final String ruleId,
final String fieldFactType,
final String fieldName,
final String conditionParent,
final String conflictedItem,
final String conflictingItem,
final Set<Integer> rowNumbers) {
Expand All @@ -43,18 +41,17 @@ public ImpossibleMatchIssue(final Severity severity,
);

this.ruleId = ruleId;
this.fieldFactType = fieldFactType;
this.fieldName = fieldName;
this.conditionParent = conditionParent;
this.conflictedItem = conflictedItem;
this.conflictingItem = conflictingItem;
}

public void setFieldFactType(final String fieldFactType) {
this.fieldFactType = fieldFactType;
public String getConditionParent() {
return conditionParent;
}

public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
public void setConditionParent(String conditionParent) {
this.conditionParent = conditionParent;
}

public void setConflictedItem(final String conflictedItem) {
Expand All @@ -69,14 +66,6 @@ public void setRuleId(final String ruleId) {
this.ruleId = ruleId;
}

public String getFieldFactType() {
return fieldFactType;
}

public String getFieldName() {
return fieldName;
}

public String getConflictedItem() {
return conflictedItem;
}
Expand All @@ -103,10 +92,7 @@ public boolean equals(Object o) {

ImpossibleMatchIssue that = (ImpossibleMatchIssue) o;

if (fieldFactType != null ? !fieldFactType.equals(that.fieldFactType) : that.fieldFactType != null) {
return false;
}
if (fieldName != null ? !fieldName.equals(that.fieldName) : that.fieldName != null) {
if (conditionParent != null ? !conditionParent.equals(that.conditionParent) : that.conditionParent != null) {
return false;
}
if (conflictedItem != null ? !conflictedItem.equals(that.conflictedItem) : that.conflictedItem != null) {
Expand All @@ -121,8 +107,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (fieldFactType != null ? ~~fieldFactType.hashCode() : 0);
result = 31 * result + (fieldName != null ? ~~fieldName.hashCode() : 0);
result = 31 * result + (conditionParent != null ? ~~conditionParent.hashCode() : 0);
result = 31 * result + (conflictedItem != null ? ~~conflictedItem.hashCode() : 0);
result = 31 * result + (conflictingItem != null ? ~~conflictingItem.hashCode() : 0);
result = 31 * result + (ruleId != null ? ~~ruleId.hashCode() : 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.verifier.api.reporting;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import org.drools.verifier.api.reporting.model.Interval;

public class OverlappingIssue
extends Issue {

private List<Interval> intervals;
private boolean containsAnyValueField;
private Map<Integer, String> rhsValues;

public OverlappingIssue() {
}

public OverlappingIssue(final Severity severity,
final CheckType checkType,
final List<Interval> intervals,
final boolean containsAnyValueField,
final Map<Integer, String> rhsValues,
final Set<Integer> rowNumbers) {
super(severity,
checkType,
rowNumbers);
this.intervals = intervals;
this.containsAnyValueField = containsAnyValueField;
this.rhsValues = rhsValues;
}

public List<Interval> getIntervals() {
return intervals;
}

public Map<Integer, String> getRhsValues() {
return rhsValues;
}

public boolean isContainsAnyValueField() {
return containsAnyValueField;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
OverlappingIssue that = (OverlappingIssue) o;
return containsAnyValueField == that.containsAnyValueField &&
Objects.equals(intervals, that.intervals) &&
Objects.equals(rhsValues, that.rhsValues);
}

@Override
public int hashCode() {
int result = ~~super.hashCode();
result = 31 * result + (containsAnyValueField ? 1 : 0);
result = 31 * result + (intervals != null ? ~~intervals.hashCode() : 0);
result = 31 * result + (rhsValues != null ? ~~rhsValues.hashCode() : 0);
return ~~result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
public class RedundantConditionsIssue
extends Issue {

private String factType;
private String name;
private String firstItem;
private String secondItem;
Expand All @@ -30,7 +29,6 @@ public RedundantConditionsIssue() {

public RedundantConditionsIssue(final Severity severity,
final CheckType checkType,
final String factType,
final String name,
final String firstItem,
final String secondItem,
Expand All @@ -39,16 +37,11 @@ public RedundantConditionsIssue(final Severity severity,
checkType,
rowNumbers);

this.factType = factType;
this.name = name;
this.firstItem = firstItem;
this.secondItem = secondItem;
}

public void setFactType(final String factType) {
this.factType = factType;
}

public void setName(final String name) {
this.name = name;
}
Expand All @@ -61,10 +54,6 @@ public void setSecondItem(final String secondItem) {
this.secondItem = secondItem;
}

public String getFactType() {
return factType;
}

public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.verifier.api.reporting.gaps;

public class MissingRange {

private String origin;
private Object lower;
private Object upper;

public MissingRange() {

}

public MissingRange(final String origin,
final Object lower,
final Object upper) {
this.origin = origin;
this.lower = lower;
this.upper = upper;
}

public Object getLower() {
return lower;
}

public Object getUpper() {
return upper;
}

@Override
public String toString() {
return "MissingRange{" +
"fieldName='" + origin + '\'' +
", lower=" + lower +
", upper=" + upper +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.verifier.api.reporting.gaps;

import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Set;

import org.drools.verifier.api.reporting.CheckType;
import org.drools.verifier.api.reporting.Issue;
import org.drools.verifier.api.reporting.Severity;

public class MissingRangeIssue
extends Issue {

private Collection<MissingRange> uncoveredRanges;
private List<PartitionCondition> partition;

public MissingRangeIssue() {
}

public MissingRangeIssue(final Severity severity,
final CheckType checkType,
final List<PartitionCondition> partition,
final Collection<MissingRange> uncoveredRanges,
final Set<Integer> rowNumbers) {
super(severity,
checkType,
rowNumbers);
this.partition = partition;
this.uncoveredRanges = uncoveredRanges;
}

public List<PartitionCondition> getPartition() {
return partition;
}

public Collection<MissingRange> getUncoveredRanges() {
return uncoveredRanges;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
MissingRangeIssue that = (MissingRangeIssue) o;
return Objects.equals(uncoveredRanges, that.uncoveredRanges) &&
Objects.equals(partition, that.partition);
}

@Override
public int hashCode() {
int result = ~~super.hashCode();
result = 31 * result + (uncoveredRanges != null ? ~~uncoveredRanges.hashCode() : 0);
result = 31 * result + (partition != null ? ~~partition.hashCode() : 0);
return ~~result;
}
}
Loading