-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix code smells and update Drools runner to Drools 10. * Fix build warnings. * Update initialization and test case folder discovery. * Refactor properties handling. * Refactor equality comparison methods. * Extract value comparison to a separate class. * Update URL to product. * Revert areEqual method. * Fix areEqual method. * Update type registry to a newer one. * Set Drools version to SNAPSHOT until there is first Apache KIE Drools release. * Add IBM BAMOE profile. * Add IBM BAMOE 9.1.1 results. * Remove unnecessary try-catch block. * Add Java version properties. * Update Java to 17 for the Drools PR check.
- Loading branch information
Showing
11 changed files
with
3,806 additions
and
514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3,257 changes: 3,257 additions & 0 deletions
3,257
TestResults/IBMBAMOE/9.1.1-ibm-0003/tck_results.csv
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
product.comment=IBM BAMOE provides full compliance level 3 authoring and runtime execution. | ||
instructions.url=https://github.com/dmn-tck/tck/tree/master/runners/dmn-tck-runner-drools/README.md | ||
last.update=2024-10-09 | ||
product.url=https://www.ibm.com/products/business-automation-manager-open-editions | ||
vendor.name=IBM | ||
vendor.url=https://www.ibm.com | ||
product.name=IBM Business Automation Manager Open Editions | ||
product.version=9.1.1-ibm-0003 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
.../dmn-tck-runner-drools/src/test/java/org/omg/dmn/tck/runner/drools/CompareValuesUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.omg.dmn.tck.runner.drools; | ||
|
||
import org.kie.dmn.feel.util.NumberEvalHelper; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public final class CompareValuesUtil { | ||
|
||
public static final BigDecimal NUMBER_COMPARISON_PRECISION = new BigDecimal("0.00000001"); | ||
|
||
public static boolean areEqual(Object object1, Object object2) { | ||
// This includes both being null. | ||
if (object1 == object2) { | ||
return true; | ||
// If one of those is null. | ||
} else if ((object1 == null) || (object2 == null)) { | ||
return false; | ||
} else if (object1 instanceof Number && object2 instanceof Number) { | ||
BigDecimal expectedBD = NumberEvalHelper.getBigDecimalOrNull(object1); | ||
BigDecimal actualBD = NumberEvalHelper.getBigDecimalOrNull(object2); | ||
return expectedBD.subtract(actualBD).abs().compareTo(NUMBER_COMPARISON_PRECISION) < 0; | ||
} else if (object1 instanceof List && object2 instanceof List) { | ||
return areEqualLists((List<Object>) object1, (List<Object>) object2); | ||
} else if (object1 instanceof Map && object2 instanceof Map) { | ||
return areEqualMaps((Map<Object, Object>) object1, (Map<Object, Object>) object2); | ||
} else if (!object1.getClass().isAssignableFrom(object2.getClass())) { | ||
return false; | ||
} else { | ||
return object1.equals(object2); | ||
} | ||
} | ||
|
||
private static boolean areEqualLists(List<Object> list1, List<Object> list2) { | ||
if (list1.size() != list2.size()) { | ||
return false; | ||
} | ||
for (int i = 0; i < list1.size(); i++) { | ||
if (!areEqual(list1.get(i), list2.get(i))) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
private static boolean areEqualMaps(Map<Object, Object> map1, Map<Object, Object> map2) { | ||
if (map1.size() != map2.size()) { | ||
return false; | ||
} | ||
for (Map.Entry<Object, Object> entry : map1.entrySet()) { | ||
if (!areEqual(entry.getValue(), map2.get(entry.getKey()))) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
private CompareValuesUtil() { | ||
// It is not allowed to create instances of util classes. | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
runners/dmn-tck-runner-drools/src/test/java/org/omg/dmn/tck/runner/drools/DroolsContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.omg.dmn.tck.runner.drools; | ||
|
||
import org.kie.dmn.api.core.DMNModel; | ||
import org.kie.dmn.api.core.DMNRuntime; | ||
import org.omg.dmn.tck.runner.junit4.TestSuiteContext; | ||
|
||
public class DroolsContext implements TestSuiteContext { | ||
|
||
private DMNRuntime dmnRuntime; | ||
private DMNModel dmnmodel; | ||
|
||
public DroolsContext() { | ||
} | ||
|
||
public DMNModel getDMNModel() { | ||
return dmnmodel; | ||
} | ||
|
||
public void setDMNModel(final DMNModel dmnmodel) { | ||
this.dmnmodel = dmnmodel; | ||
} | ||
|
||
public DMNRuntime getDMNRuntime() { | ||
return dmnRuntime; | ||
} | ||
|
||
public void setDMNRuntime(final DMNRuntime dmnRuntime) { | ||
this.dmnRuntime = dmnRuntime; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...n-tck-runner-drools/src/test/java/org/omg/dmn/tck/runner/drools/DroolsPropertiesUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.omg.dmn.tck.runner.drools; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.util.Properties; | ||
|
||
public final class DroolsPropertiesUtil { | ||
|
||
private static final String DROOLS_PROPERTIES_PATH = File.separator + "drools.properties"; | ||
private static final String PROPERTY_DROOLS_VERSION = "drools.version"; | ||
|
||
private static String droolsVersion; | ||
|
||
|
||
private DroolsPropertiesUtil() { | ||
// It is not allowed to create instances of util classes. | ||
} | ||
|
||
public synchronized static String getDroolsVersion() { | ||
if (droolsVersion == null) { | ||
try { | ||
droolsVersion = getDroolsVersionFromProperties(); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
return droolsVersion; | ||
} | ||
|
||
private static String getDroolsVersionFromProperties() throws IOException { | ||
final Properties ps = new Properties(); | ||
ps.load(DroolsPropertiesUtil.class.getResourceAsStream(DROOLS_PROPERTIES_PATH)); | ||
final String droolsVersionFromProperties = ps.getProperty(PROPERTY_DROOLS_VERSION); | ||
return droolsVersionFromProperties != null ? droolsVersionFromProperties : ""; | ||
} | ||
} |
Oops, something went wrong.