Skip to content

Commit

Permalink
Add IBM BAMOE 9.1.1 results. (#677)
Browse files Browse the repository at this point in the history
* 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
baldimir authored Oct 9, 2024
1 parent 2a5d18d commit 3773cdf
Show file tree
Hide file tree
Showing 11 changed files with 3,806 additions and 514 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/optional_drools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Maven packages
uses: actions/cache@v2
with:
Expand Down
3,257 changes: 3,257 additions & 0 deletions TestResults/IBMBAMOE/9.1.1-ibm-0003/tck_results.csv

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions TestResults/IBMBAMOE/9.1.1-ibm-0003/tck_results.properties
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
10 changes: 5 additions & 5 deletions runners/dmn-tck-runner-drools/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DMN TCK Drools runner
# DMN TCK Apache KIE Drools runner

This is a Drools runner implementation for the DMN TCK suite of tests, to automate the TCK DMN tests execution for the [Drools](https://drools.org) engine.
This is an Apache KIE Drools runner implementation for the DMN TCK suite of tests, to automate the TCK DMN tests execution for the [Drools](https://drools.org) engine.

## How to build and execute this runner

Expand All @@ -18,10 +18,10 @@ $ mvn clean install -Pdrools

For the full list of running options, please reference the [general DMN TCK runners manual](https://github.com/dmn-tck/tck/tree/master/runners#how-to-buildexecute-test-for-a-vendors-engine).

## Details on the DMN TCK Drools runner
## Details on the DMN TCK Apache KIE Drools runner

This runner configuration is meant to run normally out-of-the-box.

This DMN TCK Drools runner reference a published Drools version as governed in this `pom.xml`.
This DMN TCK Apache KIE Drools runner reference a published Drools version as governed in its `pom.xml`.

The runner leverages the general DMN TCK jUnit runners architecture, to automate the execution of the TCK DMN tests on the referenced Drools version of the [Drools](https://drools.org) engine.
The runner leverages the general DMN TCK jUnit runners architecture, to automate the execution of the TCK DMN tests on the referenced version of the [Drools](https://drools.org) engine.
90 changes: 40 additions & 50 deletions runners/dmn-tck-runner-drools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
<version>1.0.0-SNAPSHOT</version>
<name>DMN :: TCK :: jUnit Runner :: Drools</name>
<properties>
<drools.version>8.40.0.Final</drools.version>
<drools.version>10.0.999-SNAPSHOT</drools.version>

<slf4j.version>2.0.16</slf4j.version>
<logback.version>1.5.8</logback.version>
<junit.version>4.13.2</junit.version>

<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://origin-repository.jboss.org/nexus/content/groups/public/</url>
<id>apache-public-repository-group</id>
<name>Apache Public Repository Group</name>
<url>https://repository.apache.org/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
Expand All @@ -27,30 +36,30 @@
<dependency>
<groupId>org.omg.dmn</groupId>
<artifactId>tck-marshaller</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.omg.dmn</groupId>
<artifactId>tck-runner</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<!-- log dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>${junit.version}</version>
</dependency>
<!-- Drools dependencies -->
<dependency>
Expand All @@ -64,65 +73,46 @@
<version>${drools.version}</version>
</dependency>
</dependencies>

<!-- Section for downstream Drools vendors to add custom profiles for Drools runner. Default runner configuration is for open source community Drools. -->
<profiles>
<profile>
<id>ibmbamoe</id>
<activation>
<file>
<exists>enable-ibmbamoe.flag</exists>
</file>
</activation>
<properties>
<drools.version>9.1.1-ibm-0003</drools.version>
</properties>
</profile>
</profiles>

<build>
<resources>
<resource>
<directory>src/main/filtered-resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
<systemPropertyVariables>
<org.kie.dmn.runtime.typecheck>true</org.kie.dmn.runtime.typecheck>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<org.kie.dmn.runtime.typecheck>true</org.kie.dmn.runtime.typecheck>
</systemPropertyVariables>
<propertiesEncoding>UTF-8</propertiesEncoding>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>add-jdk9plus-dependencies</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
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.
}
}
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;
}
}
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 : "";
}
}
Loading

0 comments on commit 3773cdf

Please sign in to comment.